unwanted linux kernel image added to /boot directory
Hello,
There seems to be a problem when a kernel module is added to an initramfs image.
As soon as I add a recipe which installs an external kernel module into an initramfs image it automatically installs the linux kernel image in a /boot directory.
This is really bad as it increases the size of the initramfs image.
/boot/Image should not be installed in the image when an external kernel module is added to an image.
Can someone suggest a fix to this issue?
Thanks,
Scott
Quoted 5 lines · Scott Branden via lists.openembedded.org
Hello,
There seems to be a problem when a kernel module is added to an initramfs image.
Quoted 8 lines
As soon as I add a recipe which installs an external kernel module into an initramfs image it automatically installs the linux kernel image in a /boot directory.
This is really bad as it increases the size of the initramfs image.
/boot/Imageshould not be installed in the image when an external kernel module is added to an image.Can someone suggest a fix to this issue?
try
IMAGE_INSTALL_remove = "kernel-image-${KERNEL_IMAGETYPE}"
or set
KERNEL_IMAGE = ""
Quoted 5 lines
Thanks,
Scott
Quoted 18 lines · Khem Raj
Quoted 15 lines · Scott Branden via lists.openembedded.org
Hello,
There seems to be a problem when a kernel module is added to an initramfs image.
As soon as I add a recipe which installs an external kernel module into an initramfs image it automatically installs the linux kernel image in a /boot directory.
This is really bad as it increases the size of the initramfs image.
/boot/Imageshould not be installed in the image when an external kernel module is added to an image.
Quoted 6 lines
Quoted 2 lines
Can someone suggest a fix to this issue?
try
IMAGE_INSTALL_remove= "kernel-image-${KERNEL_IMAGETYPE}"
Kernel image won't be in IMAGE_INSTALL list, but rather in rdeps chain.
Quoted 3 lines
or set
KERNEL_IMAGE= ""
No such variable.
Signature · 4 lines
Regards, Denys Dmytriyenko <[email protected]> PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964 Fingerprint: 25FC E4A5 8A72 2F69 1186 6D76 4209 0272 9A92 C964
Quoted 9 lines · Scott Branden via lists.openembedded.org
Hello,
There seems to be a problem when a kernel module is added to an initramfs image.
As soon as I add a recipe which installs an external kernel module into an initramfs image it automatically installs the linux kernel image in a /boot directory.
Quoted 6 lines
This is really bad as it increases the size of the initramfs image.
/boot/Imageshould not be installed in the image when an external kernel module is added to an image.Can someone suggest a fix to this issue?
There is an ages-old control knob for that, read here:
https://git.openembedded.org/openembedded-core/tree/meta/classes/kernel.bbclass#n623
In your machine or distro config, you can set this as:
RDEPENDS_${KERNEL_PACKAGE_NAME}-base = ""
But that will affect all your images for a given machine. If you need to only do it selectively for your initramfs image, but keep the standard behavior for other images, you can do something like this in corresponding recipe:
ROOTFS_POSTPROCESS_COMMAND += "empty_boot_dir; "
empty_boot_dir () {
rm -rf ${IMAGE_ROOTFS}/boot/*
}Signature · 4 lines
Regards, Denys Dmytriyenko <[email protected]> PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964 Fingerprint: 25FC E4A5 8A72 2F69 1186 6D76 4209 0272 9A92 C964
A message that is not in the archive (sent off-list or not yet received): [email protected]
This went off the list - hope you don't mind to put it back...
Quoted 6 lines · Scott Branden
Hi Denys,
Thanks for the excellent suggestions - they work.
But, these seem really obscure. I think the kernel.bbclass shouldn't automatically be installing/boot/linuxto begin with. It could be done based on an image feature selection?
kernel.bbclass does not populate the rootfs, it populates the corresponding package. Any rootfs/initramfs is then built by installing necessary packages into it. Whether to install a package or not is determined by IMAGE_INSTALL and dependencies between the packages.
Quoted 4 lines
In addition, there seems to be an additional logic error in the present image creation. If I do not install an external kernel module in the image then
/boot/linuxis not installed either. Simply adding an external kernel module to an image shouldn't pull in/boot/linuxinto the image?
It is not an error, but a well-defined behavior. In the link below there's a comment about the default dependencies and how to alter them.
Basically, every kernel-module-* RDEPENDS on kernel-base, which normally RDEPENDS on kernel-image. So, when you insall a module into your rootfs, it follows the dependency chain properly. Hence all the suggestions you received to simply disconnect kernel-image from kernel-base.
That normally works for most cases, unless you need a mixed behavior that I mentioned. Hence, ROOTFS_POSTPROCESS_COMMAND trick.
Quoted 32 lines · Denys Dmytriyenko
Quoted 31 lines · Scott Branden via lists.openembedded.org
Quoted 9 lines
Hello,
There seems to be a problem when a kernel module is added to an initramfs image.
As soon as I add a recipe which installs an external kernel module into an initramfs image it automatically installs the linux kernel image in a /boot directory.
Quoted 6 lines
This is really bad as it increases the size of the initramfs image.
/boot/Imageshould not be installed in the image when an external kernel module is added to an image.Can someone suggest a fix to this issue?
There is an ages-old control knob for that, read here:
https://git.openembedded.org/openembedded-core/tree/meta/classes/kernel.bbclass#n623In your machine or distro config, you can set this as:
RDEPENDS_${KERNEL_PACKAGE_NAME}-base = ""But that will affect all your images for a given machine. If you need to only do it selectively for your initramfs image, but keep the standard behavior for other images, you can do something like this in corresponding recipe:
ROOTFS_POSTPROCESS_COMMAND+= "empty_boot_dir; "empty_boot_dir () { rm -rf ${IMAGE_ROOTFS}/boot/* }
Signature · 4 lines
Regards, Denys Dmytriyenko <[email protected]> PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964 Fingerprint: 25FC E4A5 8A72 2F69 1186 6D76 4209 0272 9A92 C964
Quoted 1 line · Denys Dmytriyenko
This went off the list - hope you don't mind to put it back...
And, I ended up sending it to the wrong list... Sorry.
Quoted 63 lines · Scott Branden
Quoted 6 lines
Hi Denys,
Thanks for the excellent suggestions - they work.
But, these seem really obscure. I think the kernel.bbclass shouldn't automatically be installing/boot/linuxto begin with. It could be done based on an image feature selection?kernel.bbclass does not populate the rootfs, it populates the corresponding package. Any rootfs/initramfs is then built by installing necessary packages into it. Whether to install a package or not is determined by
IMAGE_INSTALLand dependencies between the packages.Quoted 4 lines
In addition, there seems to be an additional logic error in the present image creation. If I do not install an external kernel module in the image then
/boot/linuxis not installed either. Simply adding an external kernel module to an image shouldn't pull in/boot/linuxinto the image?It is not an error, but a well-defined behavior. In the link below there's a comment about the default dependencies and how to alter them.
Basically, every kernel-module-* RDEPENDS on kernel-base, which normally RDEPENDS on kernel-image. So, when you insall a module into your rootfs, it follows the dependency chain properly. Hence all the suggestions you received to simply disconnect kernel-image from kernel-base.
That normally works for most cases, unless you need a mixed behavior that I mentioned. Hence,
ROOTFS_POSTPROCESS_COMMANDtrick.Quoted 32 lines · Denys Dmytriyenko
Quoted 31 lines · Scott Branden via lists.openembedded.org
Quoted 9 lines
Hello,
There seems to be a problem when a kernel module is added to an initramfs image.
As soon as I add a recipe which installs an external kernel module into an initramfs image it automatically installs the linux kernel image in a /boot directory.
Quoted 6 lines
This is really bad as it increases the size of the initramfs image.
/boot/Imageshould not be installed in the image when an external kernel module is added to an image.Can someone suggest a fix to this issue?
There is an ages-old control knob for that, read here:
https://git.openembedded.org/openembedded-core/tree/meta/classes/kernel.bbclass#n623In your machine or distro config, you can set this as:
RDEPENDS_${KERNEL_PACKAGE_NAME}-base = ""But that will affect all your images for a given machine. If you need to only do it selectively for your initramfs image, but keep the standard behavior for other images, you can do something like this in corresponding recipe:
ROOTFS_POSTPROCESS_COMMAND+= "empty_boot_dir; "empty_boot_dir () { rm -rf ${IMAGE_ROOTFS}/boot/* }
Signature · 4 lines
Regards, Denys Dmytriyenko <[email protected]> PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964 Fingerprint: 25FC E4A5 8A72 2F69 1186 6D76 4209 0272 9A92 C964