I confess it still slightly confuses me that it even thinks to recreate a file that was installed via the package -- because my configuration does have /boot/amd-uc.img as a packaged file and my AMD laptop needs it. Still, using savedconfig and stripping the amd ucode files from /lib/firmware should now mean that this runs like:
The point of the change is twofold:
- /boot/amd-ucode.img is only useful for GRUB. Users of systemd-boot or (UKI) efistub booting should also get microcode updates, we can only determine which booting method we are using in installkernel.
- Whether we want an amd-ucode.img depends on whether we are using an initrd_generator that bundles the microcode (dracut) or not (ugrd), we can only determine this via installkernel.
Note also that the ebuild will NOT install a microcode image if the dist-kernel flag is enabled, because users of dist-kernels are forced to use /sbin/installkernel while users of custom kernels may or may not choose to do so (so we keep the ebuild code as "backwards compatibility" for users that do not use installkernel).
Do you have enabled the use-flag "dracut" for the package "installkernel" ?
AFAIK installkernel emerged without any of its used use-flag will behave like we expect a "make install" for a "naked" kernel (I mean without initramfs; and Intel microcode inside the kernel image)
Not necessarily true, other packages can and do install hooks.
As far as I'm concerned, I'm using
Code:
sys-kernel/linux-firmware -initramfs
in package.use to get rid of /boot/amd-ucode.img.
Indeed, this is the correct solution. The initramfs flag controls whether a microcode initramfs is built (irrespective of if the ebuild is installing it or /sbin/installkernel)
I'm just curious why "installkernel" is so sloppy. I have fixed it myself, on my own machine. But I wonder if something should be done to improve "installkernel".
It's not sloppy, it is intentional. Users should be able to create a /boot partition, ESP or UKI that can boot on both Intel and AMD machines. Configuration is done via sys-kernel/linux-firmware[+/-initramfs] and sys-microcode/intel-microcode[+/-initramfs] the default is enabled since not having the microcode when you do need it is a security risk, while the other way around (having the microcode double, built-in, via /boot, or built into an UKI) is harmless. So we intentionally do not check the CPU vendor at runtime.