With commit fa9201b2 ("fadump: isolate fadump initramfs image within
the default one"), initramfs image gets to hold two images, one for
production kernel boot purpose and the other for capture kernel boot.
Most files are common among the two images. Retain file modification
time to replace duplicate files with hardlinks and save space. Also,
avoid unnecessarily compressing fadump image that is decompressed
immediately anyway.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
mkfadumprd | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/mkfadumprd b/mkfadumprd
index 86dfcee..be29c5c 100644
--- a/mkfadumprd
+++ b/mkfadumprd
@@ -35,17 +35,19 @@ TARGET_INITRD="$1" && shift
FADUMP_INITRD="$MKFADUMPRD_TMPDIR/fadump.img"
### First build an initramfs with dump capture capability
-# this file tells the initrd is fadump enabled
+# Don't compress the capture image as uncompressed image is needed immediately.
+# Also, early microcode would not be needed here.
+# This file tells the initramfs is fadump enabled
touch "$MKFADUMPRD_TMPDIR/fadump.initramfs"
ddebug "rebuild fadump initrd: $FADUMP_INITRD $DEFAULT_INITRD
$KDUMP_KERNELVER"
-if ! $MKDUMPRD "$FADUMP_INITRD" -i
"$MKFADUMPRD_TMPDIR/fadump.initramfs" /etc/fadump.initramfs; then
+if ! $MKDUMPRD "$FADUMP_INITRD" -i
"$MKFADUMPRD_TMPDIR/fadump.initramfs" /etc/fadump.initramfs --no-compress
--no-early-microcode; then
perror_exit "mkfadumprd: failed to build image with dump capture support"
fi
-### Unpack the initramfs having dump capture capability
+### Unpack the initramfs having dump capture capability retaining previous file
modification time.
+# This helps in saving space by hardlinking identical files.
mkdir -p "$MKFADUMPRD_TMPDIR/fadumproot"
-if ! (pushd "$MKFADUMPRD_TMPDIR/fadumproot" > /dev/null && lsinitrd
--unpack "$FADUMP_INITRD" &&
- popd > /dev/null); then
+if ! (cpio -id --preserve-modification-time --quiet -D
"$MKFADUMPRD_TMPDIR/fadumproot" < "$FADUMP_INITRD"); then
derror "mkfadumprd: failed to unpack '$MKFADUMPRD_TMPDIR'"
exit 1
fi
--
2.37.3