AndrewAmmerlaan wrote:This has now been resolved
What causes the img file to be built when running "make install" in /usr/src/linux?
I have two quite similar systems. On system A I did emerge @world with the default +dracut at first. I then installed dracut, booted and it crashed probably due to missing entries in /etc/dracut.conf. I then unmerged dracut, ran a world update with --newuse where -dracut was added to installkernel. Then re-building the kernel by make distclean, copy back my saved .config and make. When I install the kernel, even with CONFIG_BLK_DEV_INITRD disabled "make install" will create an img file:
Code: Select all
sys_a /usr/src/linux # find /etc -type f -print0 |xargs -0 grep -i dracut
/etc/portage/package.use/06_installkernel:sys-kernel/installkernel -dracut
sys_a /usr/src/linux # emerge -pv dracut installkernel
These are the packages that would be merged, in order:
Calculating dependencies... done!
Dependency resolution took 3.93 s (backtrack: 0/20).
[ebuild R ] sys-kernel/installkernel-18-r1::gentoo USE="-dracut -grub -systemd -uki -ukify" 0 KiB
[ebuild N ] sys-kernel/dracut-060_pre20240104::gentoo USE="(-selinux) (-test)" 489 KiB
Total: 2 packages (1 new, 1 reinstall), Size of downloads: 489 KiB
* IMPORTANT: 18 news items need reading for repository 'gentoo'.
* Use eselect news read to view new items.
I then do
Code: Select all
make distclean
cp ~/dot.config .config
make -j$(nproc)
make modules
make modules_install
And when I install the kernel it will crete an initramfs img file:
Code: Select all
sys_a /usr/src/linux # make install
INSTALL /boot
sys_a /usr/src/linux # ls -lt /boot/|head -5
total 148976
-rw-r--r-- 1 root root 142987 Jan 28 16:01 config-6.6.13-gentoo
-rw-r--r-- 1 root root 8663480 Jan 28 16:01 System.map
-rw-r--r-- 1 root root 8663480 Jan 28 16:01 System.map-6.6.13-gentoo
-rw-r--r-- 1 root root 7866735 Jan 28 16:01 initramfs-6.6.13-gentoo.img
sys_a /usr/src/linux # grub-mkconfig -o /boot/grub/grub.cfg 2>&1 | grep 6.6
Found linux image: /boot/vmlinuz-6.6.13-gentoo
Found initrd image: /boot/initramfs-6.6.13-gentoo.img
Found linux image: /boot/vmlinuz-6.6.13-gentoo.old
Found initrd image: /boot/initramfs-6.6.13-gentoo.img.old
I can remove the img files prior to grub-mkconfig in order to make sys_a to boot, but leaving it will cause my system not to boot.
On system B I was aware of the dracut problem so I added -dracut to installkernel before the world update. When I build the kernel "make install" will not include an img file, even if CONFIG_BLK_DEV_INITRD is set. Here's the same set commands as I ran on sys_a:
Code: Select all
sys_b /usr/src/linux # find /etc -type f -print0 |xargs -0 grep -i dracut
/etc/portage/package.use/06-installkernel:sys-kernel/installkernel -grub -dracut
sys_b /usr/src/linux # emerge -pv dracut installkernel
These are the packages that would be merged, in order:
Calculating dependencies... done!
Dependency resolution took 2.20 s (backtrack: 0/20).
[ebuild R ] sys-kernel/installkernel-18-r1::gentoo USE="-dracut -grub -systemd -uki -ukify" 0 KiB
[ebuild N ] sys-kernel/dracut-060_pre20240104::gentoo USE="(-selinux) (-test)" 489 KiB
Total: 2 packages (1 new, 1 reinstall), Size of downloads: 489 KiB
* IMPORTANT: 17 news items need reading for repository 'gentoo'.
* Use eselect news read to view new items.
Code: Select all
make distclean
cp ~/dot.config .config
make -j$(nproc)
make modules
make modules_install
Code: Select all
sys_b /usr/src/linux # make install
INSTALL /boot
sys_b /usr/src/linux # ls -lt /boot/|head -5
total 270924
-rw-r--r-- 1 root root 142700 Jan 28 16:03 config-6.6.13-gentoo
-rw-r--r-- 1 root root 7401737 Jan 28 16:03 System.map-6.6.13-gentoo
-rw-r--r-- 1 root root 12303520 Jan 28 16:03 vmlinuz-6.6.13-gentoo
drwxr-xr-x 6 root root 4096 Jan 28 15:09 grub
sys_b /usr/src/linux # grub-mkconfig -o /boot/grub/grub.cfg 2>&1 | grep 6.6
Found linux image: /boot/vmlinuz-6.6.13-gentoo
Found linux image: /boot/vmlinuz-6.6.13-gentoo.old
What causes the img file to be copied into /boot and be used by grub?
I even copied the .config from sys_a to sys_b and built and installed it with no img created on sys_b so it appears to be due some state in the system and not in the kernel .config file.
BTW: I understand that -dracut is now the default in installkernel so I no longer need to add the -dracut USE flag, but I don't know exactly what causes sys_a to create the img file and if it's related to some stale state caused by the earlier +dracut install.