From fe2d240656e271e23d4b5bb134218e303b570f69 Mon Sep 17 00:00:00 2001 From: Sertonix Date: Mon, 5 Aug 2024 22:05:51 +0000 Subject: [PATCH] netboot/mk-s390image: Fix size when argument is a symlink MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `du -b` by default returns the size of a symlink when it is passed a symlink. Adding the `-L` option allows passing symlinks to mk-s390image without resulting in unbootable image. Signed-off-by: Sertonix Reviewed-by: Steffen Eiden Fixes: https://github.com/ibm-s390-linux/s390-tools/pull/176 Signed-off-by: Steffen Eiden Signed-off-by: Jan Höppner --- netboot/mk-s390image | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/netboot/mk-s390image b/netboot/mk-s390image index 341221da..ba57ed1e 100755 --- a/netboot/mk-s390image +++ b/netboot/mk-s390image @@ -119,9 +119,9 @@ dobuild() # append ramdisk if specified if [ "$ramdisk" != "" ] then - ramdisk_size=$(du -b $ramdisk | cut -f1) - kernel_size=$(du -b $kernel | cut -f1) - ramdisk_offset=$(du -b $image | cut -f1) + ramdisk_size=$(du -b -L $ramdisk | cut -f1) + kernel_size=$(du -b -L $kernel | cut -f1) + ramdisk_offset=$(du -b -L $image | cut -f1) cat $ramdisk >> $image binval=$(mktemp) dec2be64 $ramdisk_offset > $binval @@ -135,7 +135,7 @@ dobuild() # set cmdline if [ "$parmfile" != "" ] then - parmfile_size=$(du -b $parmfile | cut -f1) + parmfile_size=$(du -b -L $parmfile | cut -f1) if [ $parmfile_size -le $MAX_PARMFILE_SIZE ] then # Clear any previous parameters