|
|
ab92d3 |
From 39d06b934fd4bec88b0945b5277407d7b5510c22 Mon Sep 17 00:00:00 2001
|
|
|
ab92d3 |
From: Kairui Song <kasong@redhat.com>
|
|
|
ab92d3 |
Date: Mon, 15 Feb 2021 22:58:20 +0800
|
|
|
ab92d3 |
Subject: [PATCH] feat(squash): install and depmod modules seperately
|
|
|
ab92d3 |
|
|
|
ab92d3 |
Separately install the modules required for squash image setup.
|
|
|
ab92d3 |
These modules can be deleted after squash image setup to save
|
|
|
ab92d3 |
memory.
|
|
|
ab92d3 |
|
|
|
ab92d3 |
Signed-off-by: Kairui Song <kasong@redhat.com>
|
|
|
ab92d3 |
(cherry picked from commit 5a18b24a8b9c20c98f711963ce5407ceb2f3d57b)
|
|
|
ab92d3 |
|
|
|
ab92d3 |
Cherry-picked from: 5a18b24a8b9c20c98f711963ce5407ceb2f3d57b
|
|
|
ab92d3 |
Resolves: #1959336
|
|
|
ab92d3 |
---
|
|
|
ab92d3 |
modules.d/99squash/init-squash.sh | 3 +++
|
|
|
ab92d3 |
modules.d/99squash/module-setup.sh | 12 +++++-------
|
|
|
ab92d3 |
2 files changed, 8 insertions(+), 7 deletions(-)
|
|
|
ab92d3 |
|
|
|
ab92d3 |
diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh
|
|
|
ab92d3 |
index 449585f0..ecb6cc58 100755
|
|
|
ab92d3 |
--- a/modules.d/99squash/init-squash.sh
|
|
|
ab92d3 |
+++ b/modules.d/99squash/init-squash.sh
|
|
|
ab92d3 |
@@ -34,6 +34,9 @@ if [ $? != 0 ]; then
|
|
|
ab92d3 |
echo "Unable to setup overlay module"
|
|
|
ab92d3 |
fi
|
|
|
ab92d3 |
|
|
|
ab92d3 |
+# These modules are no longer needed, delete to save memory
|
|
|
ab92d3 |
+rm -rf /usr/lib/modules/
|
|
|
ab92d3 |
+
|
|
|
ab92d3 |
[ ! -d "$SQUASH_MNT" ] && \
|
|
|
ab92d3 |
mkdir -m 0755 -p $SQUASH_MNT
|
|
|
ab92d3 |
|
|
|
ab92d3 |
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
|
|
|
ab92d3 |
index c0eb4acd..ad619176 100644
|
|
|
ab92d3 |
--- a/modules.d/99squash/module-setup.sh
|
|
|
ab92d3 |
+++ b/modules.d/99squash/module-setup.sh
|
|
|
ab92d3 |
@@ -18,10 +18,6 @@ depends() {
|
|
|
ab92d3 |
return 0
|
|
|
ab92d3 |
}
|
|
|
ab92d3 |
|
|
|
ab92d3 |
-installkernel() {
|
|
|
ab92d3 |
- hostonly="" instmods -c squashfs loop overlay
|
|
|
ab92d3 |
-}
|
|
|
ab92d3 |
-
|
|
|
ab92d3 |
installpost() {
|
|
|
ab92d3 |
local squash_candidate=( "usr" "etc" )
|
|
|
ab92d3 |
|
|
|
ab92d3 |
@@ -36,7 +32,6 @@ installpost() {
|
|
|
ab92d3 |
# - Files need to be accessible without mounting the squash image
|
|
|
ab92d3 |
# - Initramfs marker
|
|
|
ab92d3 |
for file in \
|
|
|
ab92d3 |
- "$squash_dir"/usr/lib/modules/*/modules.* \
|
|
|
ab92d3 |
"$squash_dir"/usr/lib/dracut/* \
|
|
|
ab92d3 |
"$squash_dir"/etc/initrd-release
|
|
|
ab92d3 |
do
|
|
|
ab92d3 |
@@ -46,8 +41,7 @@ installpost() {
|
|
|
ab92d3 |
done
|
|
|
ab92d3 |
|
|
|
ab92d3 |
# Install required files for the squash image setup script.
|
|
|
ab92d3 |
- hostonly="" instmods "loop" "squashfs" "overlay"
|
|
|
ab92d3 |
- inst_multiple modprobe mount mkdir ln echo
|
|
|
ab92d3 |
+ inst_multiple modprobe mount mkdir ln echo rm
|
|
|
ab92d3 |
|
|
|
ab92d3 |
mv "$initdir"/init "$initdir"/init.orig
|
|
|
ab92d3 |
inst "$moddir"/init-squash.sh /init
|
|
|
ab92d3 |
@@ -63,6 +57,10 @@ installpost() {
|
|
|
ab92d3 |
find "$initdir/$folder/" -not -type d \
|
|
|
ab92d3 |
-exec bash -c 'mv -f "$squash_dir${1#$initdir}" "$1"' -- "{}" \;
|
|
|
ab92d3 |
done
|
|
|
ab92d3 |
+
|
|
|
ab92d3 |
+ # Install required modules for the squash image init script.
|
|
|
ab92d3 |
+ hostonly="" instmods "loop" "squashfs" "overlay"
|
|
|
ab92d3 |
+ dracut_kernel_post
|
|
|
ab92d3 |
}
|
|
|
ab92d3 |
|
|
|
ab92d3 |
install() {
|
|
|
ab92d3 |
|