Skip to content

Commit 6de9372

Browse files
committed
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 <jlecuirot@microsoft.com>
1 parent 2874a98 commit 6de9372

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/coreos-kernel-6.12.54.ebuild

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,16 @@ src_compile() {
108108
ln -s usr/lib64 lib || die
109109
ln -s usr/lib64 lib64 || die
110110
ln -s lib64 usr/lib || die
111-
mkdir -p lib/modules/"${KV_FULL}"/ || die
112111
# Instead from ESYSROOT we can also copy kernel modules from the dracut pre-selection
113-
cp "${S}"/build/bootengine/usr/lib/modules/"${KV_FULL}"/modules.* lib/modules/"${KV_FULL}"/ || die
114112
mkdir -p lib/modprobe.d/ || die
115113
cp "${S}"/build/bootengine/lib/modprobe.d/* lib/modprobe.d/ || die
116114
# Only include modules related to mounting /usr and for interacting with the emergency console
117115
pushd "${S}/build/bootengine/usr/lib/modules/${KV_FULL}" || die
118116
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
119117
popd || die
118+
# Double compression only makes the image bigger and slower
119+
find . -name "*.ko.xz" -exec unxz {} + || die
120+
depmod -a -b . "${KV_FULL}" || die
120121
echo '$MODALIAS=.* 0:0 660 @/sbin/modprobe "$MODALIAS"' > ./etc/mdev.conf || die
121122
# We can't use busybox's modprobe because it doesn't support the globs in module.alias, breaking module loading
122123
DRACUT_NO_XATTR=1 "${BROOT}"/usr/lib/dracut/dracut-install --destrootdir . --sysrootdir "${ESYSROOT}" --ldd /bin/veritysetup /bin/dmsetup /bin/busybox /sbin/modprobe || die

0 commit comments

Comments
 (0)