mikeeq / mbp-fedora-kernel

65 stars 12 forks source link

Remove need for update script. #53

Closed sharpenedblade closed 2 years ago

sharpenedblade commented 2 years ago

If you add some post install hooks to the rpm, and build the modules with the kernel, then the update scripts are unnecessary.

sharpenedblade commented 2 years ago
Name: linux-t2
Version: 5.18
Release: 1%{?dist}
Summary: System configuration for linux on t2 macs.

License: MIT
URL: https://t2linux.org
Source0: https://wiki.t2linux.org/tools/rmmod_tb.sh

%description
Configuration files for linux on t2 macs. The linux-t2 kernel is necessary for this to work, and this must be installed to boot. Everything works except for TouchId, eGPU, and audio switching.

%prep
cp %{_sourcedir}/* %{_builddir}

%build
echo -e 'hid-apple\nbcm5974\nsnd-seq\napple_bce' > apple_bce.conf

echo -e 'add_drivers+=" hid_apple snd-seq apple_bce "\nforce_drivers+=" hid_apple snd-seq apple_bce "' > apple_bce_install.conf

%install
mkdir -p %{buildroot}/etc/dracut.conf.d/
mv apple_bce_install.conf %{buildroot}/etc/dracut.conf.d/apple_bce_install.conf

mkdir -p %{buildroot}/etc/modules-load.d/
mv apple_bce.conf %{buildroot}/etc/modules-load.d/apple_bce.conf

mkdir -p %{buildroot}/lib/systemd/system-sleep
mv %{_builddir}/rmmod_tb.sh %{buildroot}/lib/systemd/system-sleep/rmmod_tb.sh
chmod +x %{buildroot}/lib/systemd/system-sleep/rmmod_tb.sh

%post
grubby --remove-args="efi=noruntime pcie_ports=compat" --update-kernel=ALL
grubby --args="efi=noruntime pcie_ports=compat" --update-kernel=ALL
sed -i '/^GRUB_ENABLE_BLSCFG=true/c\GRUB_ENABLE_BLSCFG=false' /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg

%files
/etc/modules-load.d/apple_bce.conf
/lib/systemd/system-sleep/rmmod_tb.sh
/etc/dracut.conf.d/apple_bce_install.conf

This package removes the need for an install script. Whenever the suspend script, or grub config needs to change, just update this package, even if the kernel version is the same. To prevent the mainline kernel from being installed, this repo should have cost = 998 and priority = 98 in its *.repo file.

sharpenedblade commented 2 years ago

You can enable BLS in grub, it works using this script, you have to use grubby to change kernel args, not edit the grub config file.

mikeeq commented 2 years ago

Will be done in https://github.com/mikeeq/mbp-fedora-kernel/pull/66

mikeeq commented 2 years ago

Done! Thanks for a suggestion!