Package: initramfs-tools-core
Version: 0.130
Severity: normal
Tags: patch

Dear Maintainer,

Linux 3.18.0 comes with native support for xz compressed modules.
kmod/25-1 adds support for xz compressed modules. Compression allows me
to build custom kernels with much smaller FS impact, so I've been trying
it out.

I built and installed kernel from source (4.14.21, 4.15.5) with XZ
module compression.

$ make menuconfig
     # Enable CONFIG_MODULE_COMPRESS
     # Enable CONFIG_MODULE_COMPRESS_XZ
$ make
$ make modules_install
$ make install

However, after rebooting throug grub the kernel loads the initramfs, but
initramfs fails to find the root filesystem. Examining contents of
the generated /boot/initrd.img*, compared to an uncompressed build, many
modules and /lib/firmware/* are absent.

I was able to generate working initrd.img* files with the following
patch:

==========>8==========
--- /usr/share/initramfs-tools/hook-functions~  2018-02-23 10:57:27.622691989 
-0500
+++ /usr/share/initramfs-tools/hook-functions   2018-02-23 11:57:55.792649031 
-0500
@@ -212,12 +212,15 @@
                fi
        fi
        while [ $# -ge 1 ]; do
-               exclude="${exclude:-} -name $1 -prune -o "
+               exclude="${exclude:-} -name $1 -prune -o -name $1.xz -prune -o "
                shift
        done
        for kmod in $(find "${MODULESDIR}/${dir}" ${exclude:-} -name '*.ko' 
-printf '%f\n'); do
                modules="$modules ${kmod%.ko}"
        done
+       for kmod in $(find "${MODULESDIR}/${dir}" ${exclude:-} -name '*.ko.xz' 
-printf '%f\n'); do
+               modules="$modules ${kmod%.ko.xz}"
+       done
        manual_add_modules $modules
 }

@@ -313,6 +316,9 @@
                        */$pattern.ko)
                                manual_add_modules $(basename $module .ko)
                                ;;
+                       */$pattern.ko.xz)
+                               manual_add_modules $(basename $module .ko.xz)
+                               ;;
                        esac
                done < $builtin
        fi

==========>8==========
There may be more elegant solutions.

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: i386 (x86_64)

Kernel: Linux 4.14.0-3-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968), LANGUAGE=C 
(charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages initramfs-tools-core depends on:
ii  cpio         2.12+dfsg-6
ii  klibc-utils  2.0.4-11
ii  kmod         25-1
ii  udev         237-3

Versions of packages initramfs-tools-core recommends:
ii  busybox  1:1.27.2-2

Versions of packages initramfs-tools-core suggests:
ii  bash-completion  1:2.1-4.3

-- Configuration Files:
/etc/initramfs-tools/initramfs.conf unchanged [not included]
(BUSYBOX=y)

-- no debconf information

Reply via email to