tazlito rev 478

uefi support aventually... (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jan 20 11:22:45 2018 +0100 (2018-01-20)
parents 7959015b775d
children 0eed66d92e2a
files tazlito
line diff
     1.1 --- a/tazlito	Fri Jan 19 21:17:10 2018 +0100
     1.2 +++ b/tazlito	Sat Jan 20 11:22:45 2018 +0100
     1.3 @@ -259,6 +259,17 @@
     1.4  }
     1.5  
     1.6  
     1.7 +# Force the size in the 2nd eltorito boot file (/boot/isolinux/efi.img)
     1.8 +
     1.9 +fix_efi_boot_img_size() {
    1.10 +	i=$(stat -m $2/boot/isolinux/boot.cat | sed q)
    1.11 +	set -- $1 $((102+2048*$i)) $3
    1.12 +	for i in $(seq 0 8 24); do
    1.13 +		printf '\\\\x%02X' $((($3 >> $i) & 255))
    1.14 +	done | xargs echo -en | dd bs=1 conv=notrunc of=$1 seek=$2 2>/dev/null
    1.15 +}
    1.16 +
    1.17 +
    1.18  # Force the size for the /boot/isolinux/efi.img file
    1.19  
    1.20  fix_efi_img_size() {
    1.21 @@ -430,6 +441,7 @@
    1.22  	cat /tmp/fatbr$$ /tmp/fatbin-*-$$ /tmp/fatbin-*-$$ /tmp/fatdir$$ | \
    1.23  	dd of=$1 conv=notrunc bs=2k seek=$n 2>/dev/null
    1.24  	fix_efi_img_size $(($s*512)) $1
    1.25 +	fix_efi_boot_img_size $1 $2 $s
    1.26  	rm -f /tmp/fat*$$
    1.27  }
    1.28  
    1.29 @@ -455,7 +467,7 @@
    1.30  		fi
    1.31  		shift
    1.32  	done; } | awk '{ n+=int(($1+2047)/2048) } END { print n }')
    1.33 -	[ $clusters -eq 0 ] && return
    1.34 +	[ ${clusters:-0} -eq 0 ] && return
    1.35  	local dclust=$( (cd $basedir; find efi -type d 2>/dev/null) | awk '
    1.36  		BEGIN {
    1.37  			FS="/"
    1.38 @@ -477,7 +489,8 @@
    1.39  		#     reserved   +    fat*2      +      root dir  +   dirs
    1.40  		count=$(((1 + (($clusters+255)/256)*2+3)/4 +  1  + $dclust ))
    1.41  	fi
    1.42 -	dd if=/dev/zero bs=2k of=$basedir/boot/isolinux/efi.img count=$count
    1.43 +	dd if=/dev/zero bs=2k of=$basedir/boot/isolinux/efi.img \
    1.44 +		count=$count 2> /dev/null
    1.45  }
    1.46  
    1.47