8 Star 0 Fork 16

src-anolis-os/dracut

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0171.patch 2.45 KB
一键复制 编辑 原始数据 按行查看 历史
From 39d06b934fd4bec88b0945b5277407d7b5510c22 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 15 Feb 2021 22:58:20 +0800
Subject: [PATCH] feat(squash): install and depmod modules seperately
Separately install the modules required for squash image setup.
These modules can be deleted after squash image setup to save
memory.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 5a18b24a8b9c20c98f711963ce5407ceb2f3d57b)
Cherry-picked from: 5a18b24a8b9c20c98f711963ce5407ceb2f3d57b
Resolves: #1959336
---
modules.d/99squash/init-squash.sh | 3 +++
modules.d/99squash/module-setup.sh | 12 +++++-------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh
index 449585f0..ecb6cc58 100755
--- a/modules.d/99squash/init-squash.sh
+++ b/modules.d/99squash/init-squash.sh
@@ -34,6 +34,9 @@ if [ $? != 0 ]; then
echo "Unable to setup overlay module"
fi
+# These modules are no longer needed, delete to save memory
+rm -rf /usr/lib/modules/
+
[ ! -d "$SQUASH_MNT" ] && \
mkdir -m 0755 -p $SQUASH_MNT
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index c0eb4acd..ad619176 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -18,10 +18,6 @@ depends() {
return 0
}
-installkernel() {
- hostonly="" instmods -c squashfs loop overlay
-}
-
installpost() {
local squash_candidate=( "usr" "etc" )
@@ -36,7 +32,6 @@ installpost() {
# - Files need to be accessible without mounting the squash image
# - Initramfs marker
for file in \
- "$squash_dir"/usr/lib/modules/*/modules.* \
"$squash_dir"/usr/lib/dracut/* \
"$squash_dir"/etc/initrd-release
do
@@ -46,8 +41,7 @@ installpost() {
done
# Install required files for the squash image setup script.
- hostonly="" instmods "loop" "squashfs" "overlay"
- inst_multiple modprobe mount mkdir ln echo
+ inst_multiple modprobe mount mkdir ln echo rm
mv "$initdir"/init "$initdir"/init.orig
inst "$moddir"/init-squash.sh /init
@@ -63,6 +57,10 @@ installpost() {
find "$initdir/$folder/" -not -type d \
-exec bash -c 'mv -f "$squash_dir${1#$initdir}" "$1"' -- "{}" \;
done
+
+ # Install required modules for the squash image init script.
+ hostonly="" instmods "loop" "squashfs" "overlay"
+ dracut_kernel_post
}
install() {
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-os/dracut.git
git@gitee.com:src-anolis-os/dracut.git
src-anolis-os
dracut
dracut
a8

搜索帮助