Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 922443

Summary: sys-kernel/raspberrypi-image-6.1.21_p20230405 genkernel creates broken initramfs images
Product: Gentoo Linux Reporter: Jason Cooper <jason+gentoobugs>
Component: Current packagesAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: UNCONFIRMED ---    
Severity: normal CC: jason+gentoobugs
Priority: Normal    
Version: unspecified   
Hardware: ARM64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jason Cooper 2024-01-18 19:19:16 UTC
while attempting to build an encrypted SD Card image for my rpi4B, I encountered some problems with the default kernel (raspberry pi-image)

1) It doesn't seem to include a kernel config anywhere I could find.  This prevents genkernel from detecting the correct KEXT (.ko.xz, not .ko), resulting in no modules being found or included in the initramfs.

2) EXTRAVERSION is not equal to the directory name under which to find the kernel modules, in my case with rpi4B, /lib/modules/6.1.21-v8+.

In order to getting a working initramfs that could successfully ask me for the password and decrypt the partition (LVM2 inside), I needed to do the following:

1) Install sys-kernel/raspberrypi-sources
2) HACK: Force genkernel to use KEXT='.ko.xz' (no kernel config found)
3) HACK: cd /usr/src; ln -s linux-6.1.21_p20230405-raspberrypi linux-6.1.21-v8+
4) HACK: Set EXTRAVERSION="-v8+" in /usr/src/linux-6.1.21-v8+/Makefile

#3 and #4 fix the modules included in the initramfs not being found due to being in the wrong directory.  '/lib/modules/6.1.21_p20230405-raspberrypi' vice '/lib/modules/6.1.21-v8+' which is what the prebuilt kernel is configured as.

After this, I have a booting system :)

I'm not really sure how to fix this easily.  I suspect there needs to be different ebuilds for the different raspberrypi-image archs, then the corresponding sources could more easily have the correct info.