From 6de93722c2f8bfb98c0640dd44b4aafa98299e77 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Tue, 28 Oct 2025 14:38:25 +0000 Subject: [PATCH] sys-kernel/coreos-kernel: Decompress the minimal initrd kernel modules The initrd itself is already compressed with xz, so compressing the modules within with xz as well just makes the image bigger and slower. Not compressing all the kernel modules in the first place is not such a clear win because it is zlib and zstd compression that is applied elsewhere. Signed-off-by: James Le Cuirot --- .../sys-kernel/coreos-kernel/coreos-kernel-6.12.54.ebuild | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/coreos-kernel-6.12.54.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/coreos-kernel-6.12.54.ebuild index 77094b324d..e94a073bce 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/coreos-kernel-6.12.54.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/coreos-kernel-6.12.54.ebuild @@ -108,15 +108,16 @@ src_compile() { ln -s usr/lib64 lib || die ln -s usr/lib64 lib64 || die ln -s lib64 usr/lib || die - mkdir -p lib/modules/"${KV_FULL}"/ || die # Instead from ESYSROOT we can also copy kernel modules from the dracut pre-selection - cp "${S}"/build/bootengine/usr/lib/modules/"${KV_FULL}"/modules.* lib/modules/"${KV_FULL}"/ || die mkdir -p lib/modprobe.d/ || die cp "${S}"/build/bootengine/lib/modprobe.d/* lib/modprobe.d/ || die # Only include modules related to mounting /usr and for interacting with the emergency console pushd "${S}/build/bootengine/usr/lib/modules/${KV_FULL}" || die find kernel/drivers/{ata,block,hid,hv,input/serio,mmc,nvme,pci,scsi,usb} kernel/fs/{btrfs,overlayfs,squashfs} kernel/security/keys -name "*.ko.*" -printf "%f\0" | DRACUT_NO_XATTR=1 xargs --null "${BROOT}"/usr/lib/dracut/dracut-install --destrootdir "${S}"/build/minimal --kerneldir . --sysrootdir "${S}"/build/bootengine/ --firmwaredirs "${S}"/build/bootengine/usr/lib/firmware --module dm-verity dm-mod virtio_console || die popd || die + # Double compression only makes the image bigger and slower + find . -name "*.ko.xz" -exec unxz {} + || die + depmod -a -b . "${KV_FULL}" || die echo '$MODALIAS=.* 0:0 660 @/sbin/modprobe "$MODALIAS"' > ./etc/mdev.conf || die # We can't use busybox's modprobe because it doesn't support the globs in module.alias, breaking module loading DRACUT_NO_XATTR=1 "${BROOT}"/usr/lib/dracut/dracut-install --destrootdir . --sysrootdir "${ESYSROOT}" --ldd /bin/veritysetup /bin/dmsetup /bin/busybox /sbin/modprobe || die