commit: a79ecbd06cf71b3ac5abd2675601a0d750a9908c Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> AuthorDate: Tue Aug 18 03:31:59 2015 +0000 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> CommitDate: Tue Aug 18 03:34:57 2015 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=a79ecbd0
Support compressed modules: both XZ & GZIP. Newer kernels support compressed modules directly. It's not ideal for genkernel, since it would be double-compressed, but since genkernel takes the modules the module destination directory after modules_install, it's the quickest way to a working system again (because the non-compressed modules aren't installed). Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> gen_compile.sh | 6 ++++-- gen_initramfs.sh | 9 +++++---- gen_moddeps.sh | 4 ++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gen_compile.sh b/gen_compile.sh index 04ed8d6..97bd36e 100755 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -683,11 +683,13 @@ compile_iscsi() { # if kernel modules exist, copy them to initramfs, otherwise it will be compiled into the kernel mkdir -p "${TEMP}/initramfs-iscsi-temp/lib/modules/${KV}/kernel/drivers/scsi/" + KEXT=$(modules_kext) for modname in iscsi_tcp libiscsi scsi_transport_iscsi do - if [ -e "${CMD_KERNEL_DIR}/drivers/scsi/${modname}.ko" ] + module=${CMD_KERNEL_DIR}/drivers/scsi/${modname}${KEXT} + if [ -e "${module}" ] then - cp ${CMD_KERNEL_DIR}/drivers/scsi/${modname}.ko "${TEMP}/initramfs-iscsi-temp/lib/modules/${KV}/kernel/drivers/scsi/" + cp $module "${TEMP}/initramfs-iscsi-temp/lib/modules/${KV}/kernel/drivers/scsi/" fi done diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 4ec5fea..e7f72df 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -293,11 +293,12 @@ append_dmraid(){ /bin/tar -jxpf "${DMRAID_BINCACHE}" -C "${TEMP}/initramfs-dmraid-temp" || gen_die "Could not extract dmraid binary cache!"; cd "${TEMP}/initramfs-dmraid-temp/" - RAID456=`find . -type f -name raid456.ko` + module_ext=$(modules_kext) + RAID456=`find . -type f -name raid456${module_ext}` if [ -n "${RAID456}" ] then - cd "${RAID456/raid456.ko/}" - ln -sf raid456.kp raid45.ko + cd "${RAID456/raid456${module_ext}/}" + ln -sf raid456.kp $(basename ${RAID456}) cd "${TEMP}/initramfs-dmraid-temp/" fi log_future_cpio_content @@ -614,7 +615,7 @@ print_list() append_modules() { local group local group_modules - local MOD_EXT=".ko" + local MOD_EXT="$(modules_kext)" print_info 2 "initramfs: >> Searching for modules..." if [ "${INSTALL_MOD_PATH}" != '' ] diff --git a/gen_moddeps.sh b/gen_moddeps.sh index 0867b56..415e095 100755 --- a/gen_moddeps.sh +++ b/gen_moddeps.sh @@ -4,6 +4,10 @@ modules_kext() { KEXT=".ko" + if grep -sq '^CONFIG_MODULE_COMPRESS=y' "${KERNEL_DIR}"/.config; then + grep -sq '^CONFIG_MODULE_COMPRESS_XZ=y' "${KERNEL_DIR}"/.config && KEXT='.ko.xz' + grep -sq '^CONFIG_MODULE_COMPRESS_GZIP=y' "${KERNEL_DIR}"/.config && KEXT='.ko.gz' + fi echo ${KEXT} }