wok diff syslinux/stuff/iso2exe/iso2exe.sh @ rev 14257

syslinux/iso2exe: check kernel version, add floppy bootstrap stub
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Mar 28 11:51:42 2013 +0100 (2013-03-28)
parents a26ba54f3ea7
children 5ed4d6b2d690
line diff
     1.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Mon Mar 04 09:52:12 2013 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Thu Mar 28 11:51:42 2013 +0100
     1.3 @@ -59,16 +59,27 @@
     1.4  			LOC=$(($LOC+40))
     1.5  		done
     1.6  		ddq if=/tmp/exe$$ of=$1 bs=1 skip=128 seek=$OFS conv=notrunc
     1.7 +		store 60 $OFS $1
     1.8  	fi
     1.9  	rm -f /tmp/exe$$ 
    1.10 -	store 60 $OFS $1
    1.11 +}
    1.12 +
    1.13 +add_fdbootstrap()
    1.14 +{
    1.15 +	SIZE=$($0 --get bootfd.bin 2> /dev/null | tee /tmp/exe$$ | wc -c)
    1.16 +	if [ $SIZE -ne 0 ]; then
    1.17 +		OFS=$(( $OFS - $SIZE ))
    1.18 +		printf "Adding floppy bootstrap file at %04X...\n" $OFS
    1.19 +		$0 --get bootfd.bin | ddq of=$1 bs=1 seek=$OFS conv=notrunc
    1.20 +		store 28 $(($SIZE/512)) $1 8
    1.21 +	fi
    1.22  }
    1.23  case "$1" in
    1.24  --build)
    1.25  	shift
    1.26  	[ $(tar cf - $@ | wc -c) -gt $((32 * 1024)) ] &&
    1.27 -		echo "The file set $@ is too large (31K max) :" &&
    1.28 -		ls -l $@ && exit 1
    1.29 +		echo "WARNING: The file set $@ is too large (31K max) :" &&
    1.30 +		ls -l $@
    1.31  	cat >> $0 <<EOM
    1.32  $(tar cf - $@ | lzma e -si -so | uuencode -m -)
    1.33  EOT
    1.34 @@ -86,12 +97,14 @@
    1.35  	add_rootfs $DATA > /dev/null
    1.36  	add_doscom $DATA > /dev/null
    1.37  	add_win32exe $DATA > /dev/null
    1.38 +	add_fdbootstrap $DATA > /dev/null
    1.39 +	name=${3:-bootiso}
    1.40  	cat <<EOT
    1.41  
    1.42 -#define BOOTISOSZ $((0x8400 - $OFS))
    1.43 +#define $(echo $name | tr '[a-z]' '[A-Z]')SZ $((0x8400 - $OFS))
    1.44  
    1.45  #ifdef WIN32
    1.46 -static char bootiso[] = {
    1.47 +static char $name[] = {
    1.48  $(hexdump -v -n 1024 -e '"    " 16/1 "0x%02X, "' -e '"  // %04.4_ax |" 16/1 "%_p" "| \n"' $DATA | sed 's/ 0x  ,/      /g')
    1.49  $(hexdump -v -s $OFS -e '"    " 16/1 "0x%02X, "' -e '"  // %04.4_ax |" 16/1 "%_p" "| \n"' $DATA | sed 's/ 0x  ,/      /g')
    1.50  };
    1.51 @@ -119,6 +132,7 @@
    1.52  
    1.53  main()
    1.54  {
    1.55 +	[ $(id -u) -ne 0 ] && exec su -c "$0 $@" < /dev/tty
    1.56  	case "$1" in
    1.57  	--get)	shift
    1.58  		uudecode | unlzma | tar xOf - $@
    1.59 @@ -142,6 +156,7 @@
    1.60  	add_rootfs $1
    1.61  	add_doscom $1
    1.62  	add_win32exe $1
    1.63 +	add_fdbootstrap $1
    1.64  	store 26 ${RANDOM:-0} $1
    1.65  	i=66
    1.66  	n=0