Custom kernel version is not detected
Hello,
I started recently maintaining the Xanmod kernel in AUR (built from the binary sources). My system is Manjaro. The original package maintainer needs the binaries in /boot to have a fixed name (their boot manager is not Grub, but syslinux) and each filename modification means that the syslinux configuration needs to be manually modified.
This means that we have currently the following binaries in /boot for our kernel:
initramfs-linux-xanmod-linux-bin-x64v2-fallback.img
initramfs-linux-xanmod-linux-bin-x64v2.img
initramfs-linux-xanmod-linux-bin-x64v2.kver
vmlinuz-linux-xanmod-linux-bin-x64v2
The content of initramfs-linux-xanmod-linux-bin-x64v2.kver is 6.2.9-x64v2-xanmod1 which corresponds to
- kernel major version
- kernel minor version
- kernel release version
- the architecture name
- flavor label and package release version
The trouble is that the current grub scripts are not picking the kernel name; from what I understand first the .img file, then then vmlinuz file names are parsed, and then the content of .kver file is retrieved in order to store the value in the macros used by grub scripts when generating the submenu. So far this logic does not work with our kernel; we end up with menuentry 'Manjaro Linux (Kernel: x64v2)' and menuentry 'Manjaro Linux (Kernel: x64v2 - fallback initramfs)' in grub.cfg , which is, obviously, not enough to correctly identify the version of the kernel.
At the latest update of grub a few minutes ago (2.0.6.r456.g65bc45963-3) I saw the following output:
Creating temporary files...
Reloading device manager configuration...
Arming ConditionNeedsUpdate...
Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux61.preset: 'default'
-> -k /boot/vmlinuz-6.1-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-6.1-x86_64.img
==> Starting build: '6.1.22-1-MANJARO'
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [autodetect]
-> Running build hook: [modconf]
-> Running build hook: [kms]
-> Running build hook: [keyboard]
-> Running build hook: [keymap]
-> Running build hook: [consolefont]
-> Running build hook: [block]
-> Running build hook: [filesystems]
-> Running build hook: [usr]
-> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: '/boot/initramfs-6.1-x86_64.img'
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux61.preset: 'fallback'
-> -k /boot/vmlinuz-6.1-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-6.1-x86_64-fallback.img -S autodetect
==> Starting build: '6.1.22-1-MANJARO'
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [modconf]
-> Running build hook: [kms]
==> WARNING: Possibly missing firmware for module: 'ast'
-> Running build hook: [keyboard]
-> Running build hook: [keymap]
-> Running build hook: [consolefont]
-> Running build hook: [block]
-> Running build hook: [filesystems]
-> Running build hook: [usr]
-> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: '/boot/initramfs-6.1-x86_64-fallback.img'
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux62.preset: 'default'
-> -k /boot/vmlinuz-6.2-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-6.2-x86_64.img
==> Starting build: '6.2.9-1-MANJARO'
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [autodetect]
-> Running build hook: [modconf]
-> Running build hook: [kms]
-> Running build hook: [keyboard]
-> Running build hook: [keymap]
-> Running build hook: [consolefont]
-> Running build hook: [block]
-> Running build hook: [filesystems]
-> Running build hook: [usr]
-> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: '/boot/initramfs-6.2-x86_64.img'
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux62.preset: 'fallback'
-> -k /boot/vmlinuz-6.2-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-6.2-x86_64-fallback.img -S autodetect
==> Starting build: '6.2.9-1-MANJARO'
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [modconf]
-> Running build hook: [kms]
==> WARNING: Possibly missing firmware for module: 'ast'
-> Running build hook: [keyboard]
-> Running build hook: [keymap]
-> Running build hook: [consolefont]
-> Running build hook: [block]
-> Running build hook: [filesystems]
-> Running build hook: [usr]
-> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: '/boot/initramfs-6.2-x86_64-fallback.img'
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux-xanmod-linux-bin-x64v2.preset: 'default'
-> -k /boot/vmlinuz-linux-xanmod-linux-bin-x64v2 -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-xanmod-linux-bin-x64v2.img
==> Starting build: '6.2.9-x64v2-xanmod1'
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [autodetect]
-> Running build hook: [modconf]
-> Running build hook: [kms]
-> Running build hook: [keyboard]
-> Running build hook: [keymap]
-> Running build hook: [consolefont]
-> Running build hook: [block]
-> Running build hook: [filesystems]
-> Running build hook: [usr]
-> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: '/boot/initramfs-linux-xanmod-linux-bin-x64v2.img'
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux-xanmod-linux-bin-x64v2.preset: 'fallback'
-> -k /boot/vmlinuz-linux-xanmod-linux-bin-x64v2 -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-xanmod-linux-bin-x64v2-fallback.img -S autodetect
==> Starting build: '6.2.9-x64v2-xanmod1'
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [modconf]
-> Running build hook: [kms]
==> WARNING: Possibly missing firmware for module: 'ast'
-> Running build hook: [keyboard]
-> Running build hook: [keymap]
-> Running build hook: [consolefont]
-> Running build hook: [block]
-> Running build hook: [filesystems]
-> Running build hook: [usr]
-> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: '/boot/initramfs-linux-xanmod-linux-bin-x64v2-fallback.img'
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux-xanmod-lts-linux-bin-x64v2.preset: 'default'
/usr/lib/initcpio/functions: line 270: printf: `P': invalid format character
-> -k /boot/vmlinuz-==> ERROR: specified kernel image does not exist: '/boot/vmlinuz-%PKGBASE%'
==> Building image from preset: /etc/mkinitcpio.d/linux-xanmod-lts-linux-bin-x64v2.preset: 'fallback'
/usr/lib/initcpio/functions: line 270: printf: `P': invalid format character
-> -k /boot/vmlinuz-==> ERROR: specified kernel image does not exist: '/boot/vmlinuz-%PKGBASE%'
Error: command failed to execute correctly
Refreshing PackageKit...
Reloading system bus configuration...
Is there something I could do when building the kernel so that the names of the binaries remain as listed and yet the correct kernel name can be detected and written in the grub.cfg file ? Thank you in advance for your help !
P.S. I attached also the PKGBUILD file.