From c2bcd10c53a47df5ec42116bc55bbc6ccfdd8528 Mon Sep 17 00:00:00 2001 From: Pig Monkey Date: Thu, 6 Sep 2018 20:06:40 -0700 Subject: [PATCH] support kernel parameters Note that this is only supported for grub. That is the only bootloader I use. Patches for other bootloaders will be accepted. The default params: * quiet the boot process * cause all virtual terminals to blank (ie, screen power off) after 60 seconds * enable panel self refresh v2 Blanking the screen is useful with physlock. Physlock does not run in X, so DPMS settings have no effect on it. PSR can potentially improve battery life on some machines, but cause screen flicker on others. I have happily been using v2 on a ThinkPad X260 for 6 months, but users should experiment between 1/2/3/4 to find the best setting for their machine, or disable it entirely with 0. See: * https://hansdegoede.livejournal.com/18653.html * https://patchwork.kernel.org/patch/8182841/ --- group_vars/all | 2 ++ roles/base/tasks/main.yml | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/group_vars/all b/group_vars/all index 200b2a6..780bfc0 100644 --- a/group_vars/all +++ b/group_vars/all @@ -283,3 +283,5 @@ aur_fonts: syncthing: run_on: trusted + +kernel_parameters: "quiet consoleblank=60 i915.enable_psr=2" diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 69da68b..d93c97c 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -9,6 +9,17 @@ hostname: name={{ hostname }} when: hostname is defined +- name: Set kernel parameters + lineinfile: "dest=/etc/default/grub + regexp=^GRUB_CMDLINE_LINUX_DEFAULT + state=present + line='GRUB_CMDLINE_LINUX_DEFAULT=\"{{ kernel_parameters }}\"'" + when: kernel_parameters is defined and bootloader == 'grub' + notify: + - rebuild grub + tags: + - kernelparams + - include: shell.yml - include: user.yml - include: sudo.yml