wok rev 20332

syslinux:isohybrid.sh/iso2exe.sh rework GPT partition
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed May 30 11:10:35 2018 +0200 (2018-05-30)
parents 1120b81aab32
children 99a7a1e955d4
files syslinux/stuff/iso2exe/iso2exe.sh syslinux/stuff/tools/isohybrid.sh
line diff
     1.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Tue May 29 10:57:28 2018 +0200
     1.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Wed May 30 11:10:35 2018 +0200
     1.3 @@ -116,10 +116,10 @@
     1.4  		ddq if=/tmp/exe$$ bs=1 count=3 skip=$((0x7C00)) of=$1 seek=$i conv=notrunc
     1.5  	fi
     1.6  	rm -f /tmp/exe$$ /tmp/coff$$
     1.7 -	if [ -z "$RECURSIVE_PARTITION" -a $(get 470 $1 4) -eq 0 ]; then
     1.8 -		store 464 $((1+$i/512)) $1 8
     1.9 -		store 470 $(($i/512)) $1 8
    1.10 -		store 474 $(($(get 474 $1 4) - $i/512)) $1 32
    1.11 +	if [ -z "$RECURSIVE_PARTITION" -a $(get 454 $1 4) -eq 0 ]; then
    1.12 +		store 448 $((1+$i/512)) $1 8
    1.13 +		store 454 $(($i/512)) $1 8
    1.14 +		store 458 $(($(get 458 $1 4) - $i/512)) $1 32
    1.15  	fi
    1.16  }
    1.17  
    1.18 @@ -204,19 +204,19 @@
    1.19  			printf " $i:%08X  %08X  %02X\n" $OFFSET $SIZE \
    1.20  				$(get $((446+4+16*i)) "$1" 1)
    1.21  		done
    1.22 -		if [ $(get 466 "$1") -eq 65263 ]; then
    1.23 +		if [ $(get 450 "$1") -eq 65262 ]; then
    1.24  			echo "EFI partitions :"
    1.25 -			n=$(get 584 "$1" 1)
    1.26 +			n=$(get 592 "$1")
    1.27  			s=$(get 596 "$1")
    1.28 -			o=$((($(get 552 "$1" 1)*512)-($(get 592 "$1")*$s)))
    1.29 +			o=$(($(get 584 "$1")*512))
    1.30  			i=0
    1.31 -			while [ $n -gt $i ]; do
    1.32 +			while [ $i -lt $n ]; do
    1.33  				f=$(get $(($o+0x20)) "$1" 4)
    1.34  				l=$(($(get $(($o+0x28)) "$1" 4)-$f))
    1.35  				[ $l -eq 0 ] && break
    1.36  				printf " $i:%08X  %08X  %s\n" $f $(($l+1)) \
    1.37 -				"$(od -An -N 36 -w -j $(($o+0x38)) -t a "$1" \
    1.38 -				 | sed 's/\( nul\)*//g;s/   //g;s/ sp//')"
    1.39 +				"$(od -An -N 72 -w72 -j $(($o+0x38)) -t a "$1" \
    1.40 +				 | sed 's/ nul//g;s/   //g;s/ sp//g')"
    1.41  				o=$(($o+$s))
    1.42  				i=$(($i+1))
    1.43  			done
    1.44 @@ -552,7 +552,7 @@
    1.45  	0)	[ -x /usr/bin/isohybrid ] && isohybrid -entry 2 $1;;
    1.46  	esac
    1.47  
    1.48 -	gpt= ; [ $(get 466 $1) -eq 65263 ] && gpt=1
    1.49 +	gpt= ; [ $(get 450 $1) -eq 65262 ] && gpt=1
    1.50  	mac= ; [ $(get 2048 $1) -eq 19792 ] && mac=1
    1.51  	echo "Read hybrid & tazlito data..."
    1.52  	if [ -n "$gpt" ]; then
     2.1 --- a/syslinux/stuff/tools/isohybrid.sh	Tue May 29 10:57:28 2018 +0200
     2.2 +++ b/syslinux/stuff/tools/isohybrid.sh	Wed May 30 11:10:35 2018 +0200
     2.3 @@ -196,20 +196,20 @@
     2.4  	sectorcount=$(($cylinders * $heads * $sectors))
     2.5  	store32 $(($e + 12)) $sectorcount
     2.6  	if [ -n "$efi_ofs" ]; then
     2.7 +		lastlba=$(($sectorcount -1))
     2.8  		[ $(read16 0 1024) -eq 35615 -a $(read16 11 0) -ne 35615 ] &&
     2.9  		ddq bs=512 conv=notrunc skip=2 seek=44 count=20 if=$iso of=$iso
    2.10  		store32 $((446)) $((0x10000))
    2.11  		store32 $((446+4)) $((0xFFFFFEEE))
    2.12 -		store32 $((446+8)) $efi_ofs
    2.13 -		store32 $((446+12)) $efi_len
    2.14 +		store32 $((446+8)) 1
    2.15 +		store32 $((446+12)) $lastlba
    2.16  		uudecode <<EOT | unlzma | ddq bs=512 seek=1 of=$iso conv=notrunc
    2.17  begin-base64 644 -
    2.18 -XQAAgAD//////////wAikYVN1N2VY3JXMnUMJn1RCdQOHN33EegtIBhrUQ7P
    2.19 -3PVRrH5+fynx2ZfhIpUTKFVouVH5CEgkcBOQqiTCVX7AsRmUkli6MUo+x+TC
    2.20 -9ftViSMiaEWDb8bI73GU3XCMZsZaT5nFwi6NqzhBI9sfRJz5i6cK7kSsPjxN
    2.21 -bK6ivatF20do2T7S8NSju5FOCCwMuMHuIcU+Ic8JzCvfjdjkHSkUjA6wIcQi
    2.22 -48FNYYyKv58kxngpmoy32Xc7rZ4cKAXJl3LmsFkYdw7QuZ7Rqv5sP3Z8St8D
    2.23 -krjcZVJf//Pj90o=
    2.24 +XQAAgAD//////////wAikYVN1N2VY3JXMnUMJn1TblyFehfeJH+D4/XPYFjO
    2.25 +OzQluqM2w0L9b1dJMfZHJbnNnBFhYprW0PWPY1UOgQJkhF/W2Z0lXvaSrZ7t
    2.26 +yEtpmE3Go6qt6FetOfWNMJZhtBdE0TjxFZCvh5z8hy/kRQb1XOkLxeb5VHT3
    2.27 +H4JI5S76wY0TueXYsBOJwlwW9fZ8IXP72cDO3JArS4ZhUGxbOOF2oDuf/hFM
    2.28 +zQ==
    2.29  ====
    2.30  EOT
    2.31  		lastlba=$(($sectorcount -1))
    2.32 @@ -220,15 +220,13 @@
    2.33  		store32 $((0x230)) $(($lastlba-$usablelba+1))
    2.34  		store32 $((0x420)) $efi_ofs
    2.35  		store32 $((0x428)) $(($efi_ofs+$efi_len-1))
    2.36 -		store32 $((0x4A8)) $(($lastlba-0x800))
    2.37 -		store32 $((0x4B0)) 5
    2.38  		store32sw $((0x1008)) $(($efi_ofs/4))
    2.39  		store32sw $((0x1054)) $(($efi_len/4))
    2.40  		for i in 238 410 490 ; do
    2.41  			ddq if=/dev/urandom count=16 bs=1 conv=notrunc \
    2.42  			    of=$iso seek=$((0x$i))
    2.43  		done
    2.44 -		store32 $((0x258)) $(crc32 0x400 0x4000)
    2.45 +		store32 $((0x258)) $(crc32 0x400 $((128*$(read32 0 $((0x250))))))
    2.46  		store32 $((0x210)) $(crc32 0x200 $(read32 0 $((0x20C))))
    2.47  	fi
    2.48  }
    2.49 @@ -246,7 +244,7 @@
    2.50  	abort "invalid boot catalog."
    2.51  efi_ofs=
    2.52  if [ $(read8 $cat 65) -eq 239 ]; then
    2.53 -	[ -n "$entry" ] && echo "$iso: efi boot ignore --entry $entry"
    2.54 +	[ ${entry:-2} != 2 ] && echo "$iso: efi boot ignore --entry $entry"
    2.55  	entry=2
    2.56  	partype=0
    2.57  	efi_ofs=$((4*$(read32 $cat 104)))