Biosias / uefi-mkconfig

grub-mkconfig inspired script for automatically managing uefi entries for booting linux kernel directly without bootloader
Apache License 2.0
7 stars 3 forks source link

microcode handling #3

Closed AndrewAmmerlaan closed 3 months ago

AndrewAmmerlaan commented 3 months ago

Dracut by default includes CPU microcode in the initramfs image. However for kernels without an initramfs, or with an initramfs not generated with dracut. We need to update the CPU mircrocode in some other way.

sys-kernel/linux-firmware[initramfs,-dist-kernel] and sys-firmware/intel-microcode[initramfs,-dist-kernel] currently install /boot/amd-uc.img and /boot/intel-uc.img. This already works with GRUB, and the next version of installkernel will also be capable of passing this on so it can be used in systemd-boot, UKIs, and efistub.

These images will be ESP/EFI/Gentoo/amd-uc.img and ESP/EFI/Gentoo/intel-uc.img (i.e. in the same directory as the kernel image). If these images are present, then we should specify them in the efi entry with additional initrd=... arguments. Note that these early microcode images should be specified before any regular initramfs we find.

Biosias commented 3 months ago

Hello. thank you for heads up! Will take a look at this.

Biosias commented 3 months ago

Pushed https://github.com/Biosias/uefi-mkconfig/commit/53ee0757c233640b6f0ed7dddaea9f2053f61116

AndrewAmmerlaan commented 3 months ago

Thanks, one small remark from my side, I think the elif should be an if, because it is not uncommon to have both microcode packages installed (especially on intel systems). If it magically prefers one over the other we might end up accidentally omitting the microcode we actually want.

Biosias commented 3 months ago

Indeed, now if there are both installed, it will prefer amd by default.

I did it this way because I'm not sure if loading both will not cause conflicts. Hence if both are installed and only intel one is needed. amd one can be ignore via the inbuilt mechanism.

However if loading both doesn't cause conflicts I'll change it to two ifs.

AndrewAmmerlaan commented 3 months ago

Loading both should be fine. AFAIK you can have as many initrd= as you want on the cmdline.

Biosias commented 3 months ago

In that case, I'll change it.

AndrewAmmerlaan commented 3 months ago

Great, Thanks!