|
|
6edea0 |
From cbebaacfd05c55fddd11b3090983a2be1d2b48d3 Mon Sep 17 00:00:00 2001
|
|
|
6edea0 |
From: Kairui Song <kasong@redhat.com>
|
|
|
6edea0 |
Date: Wed, 17 Jul 2019 17:10:36 +0800
|
|
|
6edea0 |
Subject: [PATCH] dracut.sh: Adjust squash and strip order
|
|
|
6edea0 |
|
|
|
6edea0 |
Previously with squash module, some binaries will be reinstalled, but
|
|
|
6edea0 |
stripping happens before that so new installed binaries is not stripped.
|
|
|
6edea0 |
So adjust the squash and strip order, ensure new installed binaries are
|
|
|
6edea0 |
stripped just the same way with the old binaries.
|
|
|
6edea0 |
|
|
|
6edea0 |
Also split squash into two stage to make the split easier, move the
|
|
|
6edea0 |
squash temp dir into initdir so stripping will cover that too,
|
|
|
6edea0 |
and print more usefule message.
|
|
|
6edea0 |
|
|
|
6edea0 |
Signed-off-by: Kairui Song <kasong@redhat.com>
|
|
|
6edea0 |
(cherry picked from commit 6a74c03b4a8472fb090015b32e652edfeadb5a10)
|
|
|
6edea0 |
|
|
|
6edea0 |
Resolves: #1776659
|
|
|
6edea0 |
---
|
|
|
6edea0 |
dracut.sh | 43 +++++++++++++++++++++++++------------------
|
|
|
6edea0 |
1 file changed, 25 insertions(+), 18 deletions(-)
|
|
|
6edea0 |
|
|
|
6edea0 |
diff --git a/dracut.sh b/dracut.sh
|
|
|
6edea0 |
index 223261d6..310646e3 100755
|
|
|
6edea0 |
--- a/dracut.sh
|
|
|
6edea0 |
+++ b/dracut.sh
|
|
|
6edea0 |
@@ -1659,21 +1659,6 @@ for d in $(ldconfig_paths); do
|
|
|
6edea0 |
rmdir -p --ignore-fail-on-non-empty "$initdir/$d" >/dev/null 2>&1
|
|
|
6edea0 |
done
|
|
|
6edea0 |
|
|
|
6edea0 |
-if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
|
|
6edea0 |
- dinfo "*** Stripping files ***"
|
|
|
6edea0 |
- find "$initdir" -type f \
|
|
|
6edea0 |
- -executable -not -path '*/lib/modules/*.ko' -print0 \
|
|
|
6edea0 |
- | xargs -r -0 $strip_cmd -g -p 2>/dev/null
|
|
|
6edea0 |
-
|
|
|
6edea0 |
- # strip kernel modules, but do not touch signed modules
|
|
|
6edea0 |
- find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
|
|
6edea0 |
- | while read -r -d $'\0' f || [ -n "$f" ]; do
|
|
|
6edea0 |
- SIG=$(tail -c 28 "$f" | tr -d '\000')
|
|
|
6edea0 |
- [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
|
|
|
6edea0 |
- done | xargs -r -0 $strip_cmd -g -p
|
|
|
6edea0 |
-
|
|
|
6edea0 |
- dinfo "*** Stripping files done ***"
|
|
|
6edea0 |
-fi
|
|
|
6edea0 |
if [[ $early_microcode = yes ]]; then
|
|
|
6edea0 |
dinfo "*** Generating early-microcode cpio image ***"
|
|
|
6edea0 |
ucode_dir=(amd-ucode intel-ucode)
|
|
|
6edea0 |
@@ -1745,9 +1730,8 @@ if [[ $hostonly_cmdline == "yes" ]] ; then
|
|
|
6edea0 |
fi
|
|
|
6edea0 |
fi
|
|
|
6edea0 |
|
|
|
6edea0 |
-dinfo "*** Creating image file '$outfile' ***"
|
|
|
6edea0 |
-
|
|
|
6edea0 |
if dracut_module_included "squash"; then
|
|
|
6edea0 |
+ dinfo "*** Install squash loader ***"
|
|
|
6edea0 |
if ! check_kernel_config CONFIG_SQUASHFS; then
|
|
|
6edea0 |
dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work"
|
|
|
6edea0 |
exit 1
|
|
|
6edea0 |
@@ -1761,7 +1745,7 @@ if dracut_module_included "squash"; then
|
|
|
6edea0 |
exit 1
|
|
|
6edea0 |
fi
|
|
|
6edea0 |
|
|
|
6edea0 |
- readonly squash_dir="${DRACUT_TMPDIR}/squashfs"
|
|
|
6edea0 |
+ readonly squash_dir="$initdir/squash/root"
|
|
|
6edea0 |
readonly squash_img=$initdir/squash/root.img
|
|
|
6edea0 |
|
|
|
6edea0 |
# Currently only move "usr" "etc" to squashdir
|
|
|
6edea0 |
@@ -1854,15 +1838,38 @@ if dracut_module_included "squash"; then
|
|
|
6edea0 |
fi
|
|
|
6edea0 |
done
|
|
|
6edea0 |
done
|
|
|
6edea0 |
+fi
|
|
|
6edea0 |
|
|
|
6edea0 |
+if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
|
|
6edea0 |
+ dinfo "*** Stripping files ***"
|
|
|
6edea0 |
+ find "$initdir" -type f \
|
|
|
6edea0 |
+ -executable -not -path '*/lib/modules/*.ko' -print0 \
|
|
|
6edea0 |
+ | xargs -r -0 $strip_cmd -g -p 2>/dev/null
|
|
|
6edea0 |
+
|
|
|
6edea0 |
+ # strip kernel modules, but do not touch signed modules
|
|
|
6edea0 |
+ find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
|
|
6edea0 |
+ | while read -r -d $'\0' f || [ -n "$f" ]; do
|
|
|
6edea0 |
+ SIG=$(tail -c 28 "$f" | tr -d '\000')
|
|
|
6edea0 |
+ [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
|
|
|
6edea0 |
+ done | xargs -r -0 $strip_cmd -g -p
|
|
|
6edea0 |
+ dinfo "*** Stripping files done ***"
|
|
|
6edea0 |
+fi
|
|
|
6edea0 |
+
|
|
|
6edea0 |
+if dracut_module_included "squash"; then
|
|
|
6edea0 |
+ dinfo "*** Squashing the files inside the initramfs ***"
|
|
|
6edea0 |
mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null
|
|
|
6edea0 |
|
|
|
6edea0 |
if [[ $? != 0 ]]; then
|
|
|
6edea0 |
dfatal "dracut: Failed making squash image"
|
|
|
6edea0 |
exit 1
|
|
|
6edea0 |
fi
|
|
|
6edea0 |
+
|
|
|
6edea0 |
+ rm -rf $squash_dir
|
|
|
6edea0 |
+ dinfo "*** Squashing the files inside the initramfs done ***"
|
|
|
6edea0 |
fi
|
|
|
6edea0 |
|
|
|
6edea0 |
+dinfo "*** Creating image file '$outfile' ***"
|
|
|
6edea0 |
+
|
|
|
6edea0 |
if [[ $uefi = yes ]]; then
|
|
|
6edea0 |
readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
|
|
|
6edea0 |
mkdir "$uefi_outdir"
|
|
|
6edea0 |
|