wok-next rev 19027

syslinux/iso2exe: update partition size
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Apr 03 10:27:26 2016 +0200 (2016-04-03)
parents 7d5aee943f85
children bb2e9d803029
files syslinux/stuff/iso2exe/iso2exe.c syslinux/stuff/iso2exe/iso2exe.sh
line diff
     1.1 --- a/syslinux/stuff/iso2exe/iso2exe.c	Sun Apr 03 03:59:59 2016 +0300
     1.2 +++ b/syslinux/stuff/iso2exe/iso2exe.c	Sun Apr 03 10:27:26 2016 +0200
     1.3 @@ -453,6 +453,13 @@
     1.4  			}
     1.5  			write(fd, string, 32);
     1.6  		}
     1.7 +
     1.8 +		/* Update partition size */
     1.9 +		n = 1+((n - 1) >> 20);
    1.10 +		BYTE(bootiso + partition + 7) = 
    1.11 +		BYTE(bootiso + isohybrid + partition + 7) = n -1;
    1.12 +		LONG(bootiso + partition + 12) =
    1.13 +		LONG(bootiso + isohybrid + partition + 12) = n * 2048;
    1.14  	}
    1.15  
    1.16  	/* Install iso2exe boot sector */
     2.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Sun Apr 03 03:59:59 2016 +0300
     2.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Sun Apr 03 10:27:26 2016 +0200
     2.3 @@ -473,15 +473,6 @@
     2.4  			md5sum | cut -c-32 | sed 's/\(..\)/\\x\1/g')" | \
     2.5  			ddq bs=16 seek=2047 conv=notrunc of=$1
     2.6  	fi
     2.7 -	echo -n "Adding boot checksum..."
     2.8 -	if [ $(stat -c %s $1) -gt 32768 ]; then
     2.9 -		n=$(($(get 2 $1) - 1 + ($(get 4 $1) - 1)*512))
    2.10 -		n=$(($(od -v -N $n -t u2 -w2 -An $1 | \
    2.11 -		       awk '{ i+= $0 } END { print (i % 65536) }') \
    2.12 -		     + $(get $(($n+1)) $1 1)))
    2.13 -		store 18 $(( (-$n -1) % 65536 )) $1
    2.14 -	fi
    2.15 -	echo " done."
    2.16  	if [ "$append$initrd" ]; then
    2.17  		echo -n "Adding custom config... "
    2.18  		DATA=/tmp/$(basename $0)$$
    2.19 @@ -492,14 +483,33 @@
    2.20  			cat $initrd >> $DATA
    2.21  		echo "#!boot $(md5sum $DATA | sed 's/ .*//')" | cat - $DATA | \
    2.22  		ddq bs=2k seek=$(custom_config_sector $1) of=$1 conv=notrunc
    2.23 -		if [ $(stat -c %s $1) -gt $isosz ]; then
    2.24 -			echo "$(($(stat -c %s $1) - $isosz)) extra bytes."
    2.25 +		newsz=$(stat -c %s $1)
    2.26 +		for i in 1 2 3 4 ; do
    2.27 +			[ $(get $((0x1BE+16*i)) $1 4) -eq $((0x00010080)) ] || continue
    2.28 +			mb=$(((($newsz -1)/1024/1024)+1))
    2.29 +			h=$((512*$(get 417 "$1" 1)))
    2.30 +			store $(($mb-1)) $((0x1C5+16*i)) $1 8
    2.31 +			store $(($mb-1)) $(($h+0x1C5+16*i)) $1 8
    2.32 +			store $(($mb*2048)) $((0x1D2+16*i)) $1 32
    2.33 +			store $(($mb*2048)) $(($h+0x1D2+16*i)) $1 32
    2.34 +		done
    2.35 +		if [ $newsz -gt $isosz ]; then
    2.36 +			echo "$(($newsz - $isosz)) extra bytes."
    2.37  		else
    2.38  			echo "$(($isosz - 32768 - 2048*$(get 32848 $1 4) 
    2.39  				 - $(stat -c %s $DATA) - 24)) bytes free."
    2.40  		fi
    2.41  		rm -f $DATA > /dev/null
    2.42  	fi
    2.43 +	echo -n "Adding boot checksum..."
    2.44 +	if [ $(stat -c %s $1) -gt 32768 ]; then
    2.45 +		n=$(($(get 2 $1) - 1 + ($(get 4 $1) - 1)*512))
    2.46 +		n=$(($(od -v -N $n -t u2 -w2 -An $1 | \
    2.47 +		       awk '{ i+= $0 } END { print (i % 65536) }') \
    2.48 +		     + $(get $(($n+1)) $1 1)))
    2.49 +		store 18 $(( (-$n -1) % 65536 )) $1
    2.50 +	fi
    2.51 +	echo " done."
    2.52  }
    2.53  
    2.54  main "$@" <<EOT