From 19a40535c6e271658c2b4de0d745158aaaba2f1a Mon Sep 17 00:00:00 2001 From: Arie Peterson Date: Wed, 26 Jun 2019 15:34:07 +0200 Subject: [PATCH 1/2] Load kernel modules to tmpfs mount --- crypt-initrd-extra-files/init | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crypt-initrd-extra-files/init b/crypt-initrd-extra-files/init index c696d60..f0b0362 100755 --- a/crypt-initrd-extra-files/init +++ b/crypt-initrd-extra-files/init @@ -337,6 +337,10 @@ unset fsckfix mount -n -o move /sys ${rootmnt}/sys mount -n -o move /proc ${rootmnt}/proc +mount -t tmpfs -o size=100M,mode=0700 modules ${rootmnt}/lib/modules/ +cd ${rootmnt}/lib/modules/ +tar xfz /modules.tgz + # Chain to real filesystem if [ -z "$drop_caps" ] && command -v switch_root >/dev/null 2>&1; then exec switch_root ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console -- GitLab From 95c11400bfe9117d078080a8d06fcd76aa6a6a11 Mon Sep 17 00:00:00 2001 From: Arie Peterson Date: Fri, 28 Jun 2019 11:19:34 +0200 Subject: [PATCH 2/2] Create tmpfs mount only if modules tarball is present --- crypt-initrd-extra-files/init | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crypt-initrd-extra-files/init b/crypt-initrd-extra-files/init index f0b0362..a71e8ba 100755 --- a/crypt-initrd-extra-files/init +++ b/crypt-initrd-extra-files/init @@ -337,9 +337,11 @@ unset fsckfix mount -n -o move /sys ${rootmnt}/sys mount -n -o move /proc ${rootmnt}/proc -mount -t tmpfs -o size=100M,mode=0700 modules ${rootmnt}/lib/modules/ -cd ${rootmnt}/lib/modules/ -tar xfz /modules.tgz +if [ -e /modules.tgz ]; then + mount -t tmpfs -o size=100M,mode=0700 modules ${rootmnt}/lib/modules/ + cd ${rootmnt}/lib/modules/ + tar xfz /modules.tgz +fi # Chain to real filesystem if [ -z "$drop_caps" ] && command -v switch_root >/dev/null 2>&1; then -- GitLab