wok rev 20869

syslinux/iso2exe: add cdrom icon
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 23 13:25:31 2019 +0100 (16 months ago)
parents ad3df832c790
children dbb60b913b41
files syslinux/stuff/iso2exe/bootiso.S syslinux/stuff/iso2exe/iso2exe.sh syslinux/stuff/iso2exe/win32.rc
line diff
     1.1 --- a/syslinux/stuff/iso2exe/bootiso.S	Sat Feb 23 11:05:52 2019 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/bootiso.S	Sat Feb 23 13:25:31 2019 +0100
     1.3 @@ -178,7 +178,7 @@
     1.4  	ret
     1.5  	.org	0x7E00
     1.6  
     1.7 -	.org	0x7F81
     1.8 +	.org	0x7F78
     1.9  ////////////////////////////// DOS EXE code ///////////////////////////////////
    1.10  
    1.11  exestart:
    1.12 @@ -200,7 +200,7 @@
    1.13  abort:
    1.14  goputs:
    1.15  	mov	$EXEADRS(puts), %si
    1.16 -	jmp	%si
    1.17 +	jmp	*%si
    1.18  
    1.19  tst386:
    1.20  	pushw	%sp
    1.21 @@ -226,9 +226,10 @@
    1.22  	movw	comstart-end_header(%di), %si		// .com address
    1.23  	pushw	%di
    1.24  	movb	$0x7C/2, %ch		// 31K-31.5K, > com length
    1.25 -	rep
    1.26 -	movsw
    1.27 -	ret
    1.28 +	movb	$0x80, %bh
    1.29 +	movw	$0xA5F3, (%bx)		// rep movsw
    1.30 +	movb	$0xC3, 2(%bx)		// ret
    1.31 +	jmp	*%bx
    1.32  
    1.33  vm86modemsg:
    1.34  // --------------- Must be in 7F40 7FFF range ------------------------
     2.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Sat Feb 23 11:05:52 2019 +0100
     2.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Sat Feb 23 13:25:31 2019 +0100
     2.3 @@ -5,6 +5,11 @@
     2.4  	dd $@ 2> /dev/null
     2.5  }
     2.6  
     2.7 +ddn()
     2.8 +{
     2.9 +	ddq $@ conv=notrunc
    2.10 +}
    2.11 +
    2.12  store()
    2.13  {
    2.14  	local i
    2.15 @@ -12,7 +17,7 @@
    2.16  	n=$2; for i in $(seq 8 8 ${4:-16}); do
    2.17  		printf '\\\\x%02X' $(($n & 255))
    2.18  		n=$(($n >> 8))
    2.19 -	done | xargs echo -en | ddq bs=1 conv=notrunc of=$3 seek=$(($1))
    2.20 +	done | xargs echo -en | ddn bs=1 of=$3 seek=$(($1))
    2.21  }
    2.22  
    2.23  get()
    2.24 @@ -40,28 +45,18 @@
    2.25  	$0 --get rootfs.gz > $TMP/rootfs.gz
    2.26  	SIZE=$(wc -c < $TMP/rootfs.gz)
    2.27  	store 24 $SIZE $1
    2.28 -	OFS=$(( $OFS - $SIZE ))
    2.29 +	OFS=$(( 0x7FF0 - $SIZE ))
    2.30  	printf "Adding rootfs.gz file at %04X (%d bytes) ...\n" $OFS $SIZE
    2.31 -	cat $TMP/rootfs.gz | ddq of=$1 bs=1 seek=$OFS conv=notrunc
    2.32 +	cat $TMP/rootfs.gz | ddn of=$1 bs=1 seek=$OFS
    2.33  	rm -rf $TMP
    2.34  }
    2.35  
    2.36 -add_dosexe()
    2.37 -{
    2.38 -	TMP=/tmp/bootiso$$
    2.39 -	$0 --get bootiso.bin > $TMP 2> /dev/null
    2.40 -	OFS=$(($(get 20 $TMP) - 0xC0))
    2.41 -	printf "Adding DOS/EXE stub at %04X (%d bytes) ...\n" $OFS $((0x7FF0 - $OFS))
    2.42 -	ddq if=$TMP bs=1 skip=$OFS of=$1 seek=$OFS conv=notrunc
    2.43 -	rm -f $TMP
    2.44 -}
    2.45 -
    2.46  add_doscom()
    2.47  {
    2.48  	SIZE=$($0 --get boot.com | wc -c)
    2.49  	OFS=$(( $OFS - $SIZE ))
    2.50  	printf "Adding DOS boot file at %04X (%d bytes) ...\n" $OFS $SIZE
    2.51 -	$0 --get boot.com | ddq of=$1 bs=1 seek=$OFS conv=notrunc
    2.52 +	$0 --get boot.com | ddn of=$1 bs=1 seek=$OFS
    2.53  	store 64 $(($OFS+0xC0)) $1
    2.54  }
    2.55  
    2.56 @@ -72,7 +67,7 @@
    2.57  	zcat $2 | compress /tmp/rezipped$$.gz
    2.58  	n=$(stat -c %s /tmp/rezipped$$.gz)
    2.59  	printf "Moving tazlito data record at %04X ($n bytes) ...\n" $OFS
    2.60 -	ddq if=/tmp/rezipped$$.gz bs=1 of=$1 seek=$OFS conv=notrunc
    2.61 +	ddn if=/tmp/rezipped$$.gz bs=1 of=$1 seek=$OFS
    2.62  	HOLE=$(($HOLE+$n))
    2.63  	rm -f /tmp/rezipped$$.gz
    2.64  	if [ -n "$gpt" ]; then
    2.65 @@ -94,22 +89,28 @@
    2.66  	done
    2.67  	cut=$((0x98+$(get 0x94 /tmp/exe$$)))	### end of header
    2.68  	store $((0x94)) $(($n + $cut - 0x98)) /tmp/exe$$
    2.69 -	ddq if=/tmp/exe$$ of=$1 conv=notrunc bs=1 count=$cut
    2.70 -	ddq if=/tmp/exe$$ of=$1 conv=notrunc bs=1 skip=$cut seek=$(($n+$cut))
    2.71 +	ddn if=/tmp/exe$$ of=$1 bs=1 count=$cut
    2.72 +	ddn if=/tmp/exe$$ of=$1 bs=1 skip=$cut seek=$(($n+$cut))
    2.73  	printf "Adding bootiso head at %04X...\n" 0
    2.74  	$0 --get bootiso.bin 2> /dev/null > /tmp/exe$$
    2.75 -	ddq if=/tmp/exe$$ of=$1 bs=128 count=1 conv=notrunc	### DOS stub
    2.76 -	ddq if=/tmp/exe$$ of=$1 bs=1 count=24 seek=$((0x1A0)) skip=$((0x1A0)) conv=notrunc
    2.77 -	ddq if=$2 bs=1 skip=$((0x1B8)) seek=$((0x1B8)) count=72 of=$1 conv=notrunc
    2.78 +	x=$(($(get 0x14 /tmp/exe$$ 1)+0x40))
    2.79 +	printf "Adding bootiso DOS stub at %04X...\n" $(($n+$x))
    2.80 +	ddn if=/tmp/exe$$ of=$1 bs=1 seek=$(($n+$x)) skip=$((0x7F00+$x)) count=$((256-$x))
    2.81 +	x=$(($n/256+1))
    2.82 +	store $((0x15)) $x /tmp/exe$$ 8		### exe IP 
    2.83 +	store $((0x6c)) $x /tmp/exe$$ 8		### puts data 
    2.84 +	ddn if=/tmp/exe$$ of=$1 bs=128 count=1	### DOS header
    2.85 +	ddn if=/tmp/exe$$ of=$1 bs=1 count=24 seek=$((0x1A0)) skip=$((0x1A0))
    2.86 +	ddn if=$2 bs=1 skip=$((0x1B8)) seek=$((0x1B8)) count=72 of=$1
    2.87  	store 510 $((0xAA55)) $1
    2.88  	i=$SIZE; OFS=$(($SIZE+512))
    2.89  	store 417 $(($i/512)) $1 8	### isolinux boot sector
    2.90  	printf "Moving syslinux hybrid boot record at %04X (512 bytes) ...\n" $i
    2.91 -	ddq if=$2 bs=1 count=512 of=$1 seek=$i conv=notrunc
    2.92 +	ddn if=$2 bs=1 count=512 of=$1 seek=$i
    2.93  	if [ $(get $((0x7C00)) /tmp/exe$$) -eq 60905 ]; then	# partition boot code
    2.94 -		ddq if=/tmp/exe$$ bs=1 count=66 skip=$((0x7DBE)) of=$1 seek=$(($i + 0x1BE)) conv=notrunc
    2.95 -		ddq if=$1 bs=1 count=3 skip=$i of=$1 seek=$(($i + 0x1BE)) conv=notrunc
    2.96 -		ddq if=/tmp/exe$$ bs=1 count=3 skip=$((0x7C00)) of=$1 seek=$i conv=notrunc
    2.97 +		ddn if=/tmp/exe$$ bs=1 count=66 skip=$((0x7DBE)) of=$1 seek=$(($i + 0x1BE))
    2.98 +		ddn if=$1 bs=1 count=3 skip=$i of=$1 seek=$(($i + 0x1BE))
    2.99 +		ddn if=/tmp/exe$$ bs=1 count=3 skip=$((0x7C00)) of=$1 seek=$i
   2.100  	fi
   2.101  	rm -f /tmp/exe$$ /tmp/coff$$
   2.102  	if [ -z "$RECURSIVE_PARTITION" -a $(get 454 $1 4) -eq 0 ]; then
   2.103 @@ -127,9 +128,9 @@
   2.104  		OFS=$(( $OFS - $SIZE ))
   2.105  		printf "Adding floppy bootstrap file at %04X (%d bytes) ...\n" $OFS $SIZE
   2.106  		$0 --get bootfd.bin | \
   2.107 -		ddq of=$1 bs=1 count=512 seek=$OFS conv=notrunc
   2.108 +		ddn of=$1 bs=1 count=512 seek=$OFS
   2.109  		$0 --get bootfd.bin | \
   2.110 -		ddq of=$1 bs=1 skip=1024 seek=$((512 + $OFS)) conv=notrunc
   2.111 +		ddn of=$1 bs=1 skip=1024 seek=$((512 + $OFS))
   2.112  		store 26 $(($SIZE/512)) $1 8
   2.113  	fi
   2.114  }
   2.115 @@ -260,9 +261,9 @@
   2.116  restore_hybrid_mbr()
   2.117  {
   2.118  	if [ $(get 0 "$1") -eq 60905 ]; then
   2.119 -		ddq bs=1 conv=notrunc if="$1" of="$1" skip=$((0x1BE)) seek=0 count=3
   2.120 -		ddq bs=1 skip=$((0x1BE)) count=66 if="$2" | \
   2.121 -			ddq bs=1 seek=$((0x1BE)) count=66 of="$1" conv=notrunc
   2.122 +		ddn bs=1 if="$1" of="$1" skip=$((0x1BE)) seek=0 count=3
   2.123 +		ddn bs=1 skip=$((0x1BE)) count=66 if="$2" | \
   2.124 +			ddq bs=1 seek=$((0x1BE)) count=66 of="$1"
   2.125  		if [ -n "$RECURSIVE_PARTITION" ]; then
   2.126  			for i in 0 1 2 3 ; do
   2.127  				n=$(get $((0x1C6+16*i)) $1 4)
   2.128 @@ -324,7 +325,6 @@
   2.129  	ddq if=/dev/zero bs=32k count=1 of=$DATA
   2.130  	add_win32exe $DATA $2 > /dev/null
   2.131  	HSZ=$OFS
   2.132 -	add_dosexe $DATA > /dev/null
   2.133  	add_rootfs $DATA > /dev/null
   2.134  	add_doscom $DATA > /dev/null
   2.135  	add_fdbootstrap $DATA > /dev/null
   2.136 @@ -485,7 +485,7 @@
   2.137  	store 16 -2 /tmp/exe$$
   2.138  	store 20 256 /tmp/exe$$
   2.139  	store 22 -16 /tmp/exe$$
   2.140 -	ddq if=$2 bs=1 seek=64 of=/tmp/exe$$ conv=notrunc
   2.141 +	ddn if=$2 bs=1 seek=64 of=/tmp/exe$$
   2.142  	store 65 $(stat -c %s $3) /tmp/exe$$
   2.143  	store 68 $((0x100-0x40+$(stat -c %s $4))) /tmp/exe$$
   2.144  	cat /tmp/exe$$
   2.145 @@ -526,19 +526,19 @@
   2.146  		n=$(($(get 64 $1) + 0xC0 - ($(get 26 $1 1)*512) - ($b+1)*512))
   2.147  		ddq if=$1 bs=512 count=1 skip=$b of=/tmp/hymbr$$
   2.148  		restore_hybrid_mbr /tmp/hymbr$$ $1
   2.149 -		ddq if=/tmp/hymbr$$ of=$1 conv=notrunc
   2.150 +		ddn if=/tmp/hymbr$$ of=$1
   2.151  		rm -f /tmp/hymbr$$
   2.152  		if [ $(get 512 $1) -eq 17989 ]; then
   2.153  			n=$(($(get 0x25C $1)/512))
   2.154 -			ddq if=$1 bs=512 seek=44 count=20 skip=$n of=$1 conv=notrunc
   2.155 -			ddq if=/dev/zero bs=512 seek=9 count=35 of=$1 conv=notrunc
   2.156 -			ddq if=/dev/zero bs=512 seek=3 count=1 of=$1 conv=notrunc
   2.157 +			ddn if=$1 bs=512 seek=44 count=20 skip=$n of=$1
   2.158 +			ddn if=/dev/zero bs=512 seek=9 count=35 of=$1
   2.159 +			ddn if=/dev/zero bs=512 seek=3 count=1 of=$1
   2.160  		else
   2.161 -			ddq if=/dev/zero bs=512 seek=1 count=1 of=$1 conv=notrunc
   2.162 -			ddq if=$1 bs=512 seek=2 count=30 skip=$(($b+1)) of=$1 conv=notrunc
   2.163 -			ddq if=/dev/zero bs=1 seek=$n count=$((0x8000 - $n)) of=$1 conv=notrunc
   2.164 +			ddn if=/dev/zero bs=512 seek=1 count=1 of=$1
   2.165 +			ddn if=$1 bs=512 seek=2 count=30 skip=$(($b+1)) of=$1
   2.166 +			ddn if=/dev/zero bs=1 seek=$n count=$((0x8000 - $n)) of=$1
   2.167  		fi ;;
   2.168 -	    *)  ddq if=/dev/zero bs=1k count=32 of=$1 conv=notrunc ;;
   2.169 +	    *)  ddn if=/dev/zero bs=1k count=32 of=$1 ;;
   2.170  	    esac
   2.171  	    case "${2/--/-}" in
   2.172  	    -f*)
   2.173 @@ -571,19 +571,18 @@
   2.174  	rm -f /tmp/tazlito$$ /tmp/hybrid$$
   2.175  	
   2.176  	# keep the largest room for the tazlito info file
   2.177 -	add_dosexe $1
   2.178  	add_rootfs $1
   2.179  	add_doscom $1
   2.180  	add_fdbootstrap $1
   2.181  	printf "%d free bytes in %04X..%04X\n" $(($OFS-$HOLE)) $HOLE $OFS
   2.182  	store 440 $(date +%s) $1 32
   2.183  	[ "$2" ] && echo "$2               " | \
   2.184 -		ddq bs=1 seek=$((0x7FDE)) count=15 conv=notrunc of=$1
   2.185 +		ddn bs=1 seek=$((0x7FDE)) count=15 of=$1
   2.186  	if [ $(stat -c %s $1) -gt 34816 ]; then
   2.187  		echo "Adding ISO image md5 at 7FF0 (16 bytes) ..."
   2.188  		echo -en "$(ddq if=$1 bs=2k skip=16 count=$(($(get 32848 "$1" 4)-16)) | \
   2.189  			md5sum | cut -c-32 | sed 's/\(..\)/\\x\1/g')" | \
   2.190 -			ddq bs=16 seek=2047 conv=notrunc of=$1
   2.191 +			ddn bs=16 seek=2047 of=$1
   2.192  	fi
   2.193  	HEAP=$(($(custom_config_sector $1)*2048))
   2.194  	if [ "$append$initrd" ]; then
     3.1 --- a/syslinux/stuff/iso2exe/win32.rc	Sat Feb 23 11:05:52 2019 +0100
     3.2 +++ b/syslinux/stuff/iso2exe/win32.rc	Sat Feb 23 13:25:31 2019 +0100
     3.3 @@ -1,6 +1,7 @@
     3.4  /* http://msdn.microsoft.com/en-us/library/aa381058.aspx */
     3.5  
     3.6  /* id ICON "./win32.ico" */	/* BMP32x32 */
     3.7 +id ICON "./isohybrid.ico"
     3.8  VS_VERSION_INFO	VERSIONINFO
     3.9  FILEVERSION	1,0,0,0
    3.10  PRODUCTVERSION	1,0,0,0