How to build initramfs with modules but without bzImage
I am building 2 images. One has my rootfs, the other builds a kernel with builtin initramfs.
To build the initramfs I did the following:
In the .../conf directory, I create a file named initramfs.conf and add the following:
INITRAMFS_IMAGE = "core-image-minimal-initramfs"INITRAMFS_IMAGE_BUNDLE = "1"
IMAGE_FSTYPES = "cpio.gz"
Then to build the initramfs based on the core-image-base recipe, I execute the following bitbake command:
bitbake -R conf/initramfs.conf core-image-minimal-initramfs
When it completes, there is a kernel + initramfs file in the .../tmp/ deploy/images/..../ directory.
This image boots to the init script, but then hangs as the mmc drivers have not been included.
Now I create a core-image-minimal-initramfs.bbappend file and PACKAGE_INSTALL the modules I need (also tried kernel-modules).
Unfortunately this also installs the kernel bzImage in the /boot directory, that appears to be a dependancy. This adds another 6MB to my initramfs, which is now to load.
I expect it should be possible to add the modules without adding the kernel, but haven't been able to find a way to do that. Or it should be possible to remove the contents of /boot after do_rootfs.
But I have no clue how to do that.
Or am I just generating the initramfs in the wrong way?
Ferry
Op Mon, 22 May 2017 00:05:41 +0200, schreef Ferry Toth:
Quoted 30 lines
I am building 2 images. One has my rootfs, the other builds a kernel with builtin initramfs.
To build the initramfs I did the following:
In the .../conf directory, I create a file named initramfs.conf and add the following:
INITRAMFS_IMAGE= "core-image-minimal-initramfs"INITRAMFS_IMAGE_BUNDLE= "1"
IMAGE_FSTYPES= "cpio.gz"Then to build the initramfs based on the core-image-base recipe, I execute the following bitbake command:
bitbake -R
conf/initramfs.confcore-image-minimal-initramfsWhen it completes, there is a kernel + initramfs file in the .../tmp/ deploy/images/..../ directory.
This image boots to the init script, but then hangs as the mmc drivers have not been included.
Now I create a core-image-minimal-initramfs.bbappend file and
PACKAGE_INSTALLthe modules I need (also tried kernel-modules).Unfortunately this also installs the kernel bzImage in the /boot directory, that appears to be a dependancy. This adds another 6MB to my initramfs, which is now to load.
Quoted 7 lines
I expect it should be possible to add the modules without adding the kernel, but haven't been able to find a way to do that. Or it should be possible to remove the contents of /boot after
do_rootfs.But I have no clue how to do that.
Or am I just generating the initramfs in the wrong way?
Thanks people especially paulg and khem on irc,
I added to my core-image-minimal-initramfs.bbappend:
ROOTFS_POSTPROCESS_COMMAND += "clobber_unused"
clobber_unused () {
rm ${IMAGE_ROOTFS}/boot/*
}This shrink my initramfs just enough to boot. Of course I can remove more files if needed, by adding dir's to the clobber function.