machine_setup/ansible/roles/framework_laptop/tasks/linux.yaml
2024-10-21 18:10:39 -04:00

100 lines
3.7 KiB
YAML

# This will prevent pools from being imported, but since my laptop has a single pool with a single disk which is mounted during boot, disabling this service saves me 10 seconds at boot. Reference: https://github.com/openzfs/zfs/issues/10891
- name: Disable services
systemd:
enabled: no
masked: true
name: "{{ item }}"
daemon_reload: yes
loop:
- systemd-udev-settle.service
- name: Install tmpfiles.d configuration
when: hwpstate is defined and hwpstate and cores is defined
copy:
src: "files/{{ item }}_tmpfiles.conf"
dest: "/etc/tmpfiles.d/{{ item }}.conf"
mode: 0644
owner: root
group: wheel
loop:
- screen_brightness
- name: Install module config
copy:
src: "files/{{ item }}_modprobe.conf"
dest: "/etc/modprobe.d/{{ item }}.conf"
mode: 0644
owner: root
group: wheel
loop:
- iwlwifi
- snd_hda_intel
- disable_sp5100_watchdog
- wifi_us
- name: Configure kernel command line
zfs:
name: "zroot/linux"
state: present
extra_zfs_properties:
# amdgpu.abmlevel=3 :: Automatically reduce screen brightness but tweak colors to compensate for power reduction.
# pcie_aspm=force pcie_aspm.policy=powersupersave :: Enable PCIe active state power management for power reduction.
# nowatchdog :: Disable watchdog for power savings (related to disable_sp5100_watchdog above).
# amd_pstate=passive :: Fully automated hardware pstate control.
# amd_pstate=active :: Same as passive except we can set the energy performance preference (EPP) to suggest how much we prefer performance or energy efficiency.
# amd_pstate=guided :: Same as passive except we can set upper and lower frequency bounds.
# amdgpu.dcdebugmask=0x10 :: Allegedly disables Panel Replay from https://community.frame.work/t/tracking-freezing-arch-linux-amd/39495/32
"org.zfsbootmenu:commandline": "rw quiet amdgpu.abmlevel=3 pcie_aspm=force pcie_aspm.policy=powersupersave nowatchdog amdgpu.dcdebugmask=0x10"
- name: Install Configuration
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0600
owner: root
group: wheel
loop:
- src: gpe10-boot.service
dest: /etc/systemd/system/gpe10-boot.service
- src: gpe10-sleep.service
dest: /etc/systemd/system/gpe10-sleep.service
- name: Enable services
systemd:
enabled: yes
name: "{{ item }}"
daemon_reload: yes
loop:
- gpe10-boot.service
- gpe10-sleep.service
# install swtpm
# install edk2-ovmf for /usr/share/ovmf/OVMF.fd
# install qemu-system-x86
# doas qemu-system-x86_64 -cdrom /vm/.iso/Win11_23H2_English_x64v2.iso -cpu Skylake-Client-v3 -enable-kvm -m 8192 —device chardev,socket,id=chrtpm,path=/tmp/emulated_tpm/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0 -smp 2 -device intel-hda -device hda-duplex -usb -nic user,ipv6=off,model=rtl8139,mac=84:1b:77:c9:03:a6 -bios /usr/share/edk2/x64/OVMF.fd -drive file=/dev/zvol/zroot/freebsd/current/vm/windows/disk0,format=raw,media=disk,if=none,id=nvm -device nvme,drive=nvm,serial=foo,opt_io_size=4096,min_io_size=4096,logical_block_size=4096,physical_block_size=4096
# doas mkdir /tmp/emulated_tpm
# doas swtpm socket --tpmstate dir=/tmp/emulated_tpm --ctrl type=unixio,path=/tmp/emulated_tpm/swtpm-sock --log level=20 --tpm2
- name: Build aur packages
register: buildaur
become_user: "{{ build_user.name }}"
command: "aurutils-sync --no-view {{ item }}"
args:
creates: "/var/cache/pacman/custom/{{ item }}-*.pkg.tar.*"
loop:
- fw-ectool-git
- name: Update cache
when: buildaur.changed
pacman:
name: []
state: present
update_cache: true
- name: Install packages
package:
name:
- fw-ectool-git
state: present