I wanted to build an aarch64 kernel for the raspberry pi4. I ran into a problem when i wanted to boot the kernel. I could not get Grub2 to put the resulting kernel in the grub menu. Hopefully someone can give an advise of what i did wrong.
The steps i did:
First i cross compiled the kernel in a rpm (easy to install and remove):
make -j12 ARCH=arm64 CROSS_COMPILE=aarch64-suse-linux- rpm-pkg
This rpm ‘kernel-6.1.20_py01-1.aarch64.rpm’ found in ~/rpmbuild/RPMS/aarch64/ was installed on the raspberry pi4.
On the raspberry pi the initrd was made with:
# dracut --kver 6.1.20-py01
dracut: *** Creating image file '/boot/initrd-6.1.20-py01' ***
dracut: *** Creating initramfs image file '/boot/initrd-6.1.20-py01' done ***
Then i wanted to updated the grub menu. I used:
# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/Image-6.1.8-1-default
Found initrd image: /boot/initrd-6.1.8-1-default
To my surprise no initrd-6.1.20-py01 was found by Grub!
I found that the problem was a missing “Image-*” file. In /etc/grub.d/10_linux is a line:
xaarch64) klist="/boot/Image-* /Image-* /boot/kernel-*" ;;
With the aarch64 only the names "Image- or kernel-* are accepted. With x86_64 the “initrd-” name is fine.
This is why the kernel i build was not found. Below what was installed in the /boot/:
# la /boot/*6.1*
lrwxrwxrwx 1 root root 40 Feb 10 18:22 /boot/Image-6.1.8-1-default -> ../usr/lib/modules/6.1.8-1-default/Image
-rw-r--r-- 1 root root 5102347 Mar 18 18:31 /boot/System.map-6.1.20-py01
lrwxrwxrwx 1 root root 45 Feb 10 18:22 /boot/System.map-6.1.8-1-default -> ../usr/lib/modules/6.1.8-1-default/System.map
-rw-r--r-- 1 root root 186049 Mar 18 18:31 /boot/config-6.1.20-py01
lrwxrwxrwx 1 root root 41 Feb 10 18:22 /boot/config-6.1.8-1-default -> ../usr/lib/modules/6.1.8-1-default/config
-rw------- 1 root root 13215578 Mar 18 18:45 /boot/initrd-6.1.20-py01
-rw------- 1 root root 18773434 Feb 18 17:10 /boot/initrd-6.1.8-1-default
lrwxrwxrwx 1 root root 46 Feb 10 18:22 /boot/sysctl.conf-6.1.8-1-default -> ../usr/lib/modules/6.1.8-1-default/sysctl.conf
-rw-r--r-- 1 root root 10765025 Mar 18 18:31 /boot/vmlinuz-6.1.20-py01
I have build a vmlinuz-6.1.20-py01. This must be a “Image-* kernel-*” file.
Making a link to the vmlinuz-6.1.20-py01 with the name “Image-6.1.20-py01” helped:
# ln /boot/vmlinuz-6.1.20-py01 /boot/Image-6.1.20-py01
# grub2-mkconfig -o /boot/grub2/grub.cfg-new-2
Generating grub configuration file ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/Image-6.1.20-py01
Found initrd image: /boot/initrd-6.1.20-py01
Found linux image: /boot/Image-6.1.8-1-default
Found initrd image: /boot/initrd-6.1.8-1-default
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Now it is fine, but what did i wrong here?
How do i compile the kernel to a "Image-* kernel-* " file using the rpm output?
Why is Grub2 so picky about the name of the kernel. Why does it not accept the vmlinuz-* on the aarch64?
Hopefully someone can help.
Thanks!