wok rev 19828

syslinux/iso2exe: follow boot flag (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Mar 09 09:54:22 2017 +0100 (2017-03-09)
parents e619bff66a02
children ce7157786dac
files syslinux/stuff/iso2exe/bootiso.S syslinux/stuff/iso2exe/iso2exe.sh
line diff
     1.1 --- a/syslinux/stuff/iso2exe/bootiso.S	Wed Mar 08 15:32:40 2017 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/bootiso.S	Thu Mar 09 09:54:22 2017 +0100
     1.3 @@ -1,5 +1,6 @@
     1.4  	.text
     1.5  	.code16
     1.6 +	.arch	i8086
     1.7  	.org	0
     1.8  
     1.9  CODESZ	=	0x8000			// 16 sectors = 32Kb
    1.10 @@ -121,7 +122,7 @@
    1.11  	.org	0x01B8
    1.12  
    1.13  ////////////////////////// partition boot code ////////////////////////////////
    1.14 -// assume CS=DS=SS=0 BX=7C00 DL=<drive> SI=7DBE
    1.15 +// assume CS=DS=SS=0 AH=00 BX=7C00 CX=0100 DL=<drive> SI=7DBE
    1.16  
    1.17  	.org	0x7C00
    1.18  	jmp	bootpartition
    1.19 @@ -134,28 +135,31 @@
    1.20  	popw	%di
    1.21  	movw	$table,%si
    1.22  	call	movepartition
    1.23 +	movw	$patch-16,%di
    1.24  	movb	$4,%cl
    1.25 -	movw	$table-16,%di
    1.26 +	movb	$16,%al
    1.27  next:
    1.28 -	addw	$16,%di
    1.29 +	addw	%ax,%di
    1.30  	cmpb	%ch,(%di)		// boot flag ?
    1.31  	loope	next
    1.32  	pushw	%ds
    1.33  	pushw	%ds
    1.34 -	pushl	8(%di)
    1.35 +	pushw	10(%di)
    1.36 +	pushw	8(%di)
    1.37  	pushw	%ds
    1.38  	pushw	%bx
    1.39 -	pushw	$1
    1.40 -	pushw	$0x10
    1.41 +	movb	$1,%cl
    1.42 +	pushw	%cx
    1.43 +	pushw	%ax
    1.44  	movw	%sp,%si			// assume %ds = %ss
    1.45 +	pushw	%bx
    1.46 +	cmpw	%ax,2(%di)		// empty or isolinux partition ?
    1.47 +	jbe	default
    1.48  	movb	$0x42,%ah
    1.49 -	pushw	%bx
    1.50 -	cmpw	$63,2(%di)		// empty or isolinux partition ?
    1.51 -	jbe	default
    1.52  	int	$0x13
    1.53  default:
    1.54  	ret
    1.55 -	.org	0x7DEF
    1.56 +	.org	0x7DF0
    1.57  bootpartition:
    1.58  	pushw	%ds
    1.59  	popw	%es
    1.60 @@ -163,12 +167,12 @@
    1.61  	movw	%bx,%di
    1.62  	movsw
    1.63  	movsb
    1.64 -	movw	$partcode+0x100,%di
    1.65 +	movw	$0x7E00,%di
    1.66  	pushw	%di
    1.67  movepartition:
    1.68 -	movw	$66/2,%cx
    1.69 +	movb	$66,%cl			// 0142 and 0042
    1.70  	rep
    1.71 -	  movsw
    1.72 +	  movsb
    1.73  	ret
    1.74  	.org	0x7E00
    1.75  
    1.76 @@ -207,6 +211,7 @@
    1.77  	popfw				// restore flags (IOPL)
    1.78  	addb	%ah, %bh		// test F0 and 00 cases
    1.79  	js	is86			// NS=386+, NC=286
    1.80 +	.arch	i486
    1.81  is386:
    1.82  	smsww	%ax			// not privileged
    1.83  	andb	$1, %al
    1.84 @@ -220,6 +225,7 @@
    1.85  	//movb	$EXESTR(realmodemsg), %al
    1.86  realmode:
    1.87  	call	*%bp
    1.88 +	.arch	i8086
    1.89  is86:
    1.90  	movw	comstart-end_header(%di), %si		// .com address
    1.91  	pushw	%di
    1.92 @@ -228,6 +234,7 @@
    1.93  	movsw
    1.94  	ret
    1.95  
    1.96 +	.arch	i486
    1.97  CallVCPI:
    1.98  	int	$0x67
    1.99  	testb	%ah, %ah
     2.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Wed Mar 08 15:32:40 2017 +0100
     2.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Thu Mar 09 09:54:22 2017 +0100
     2.3 @@ -123,7 +123,7 @@
     2.4  	store 417 $(($i/512)) $1 8
     2.5  	printf "Moving syslinux hybrid boot record at %04X (512 bytes) ...\n" $i
     2.6  	ddq if=$2 bs=1 count=512 of=$1 seek=$i conv=notrunc
     2.7 -	if [ $(get $((0x7C00)) /tmp/exe$$) -eq 60649 ]; then
     2.8 +	if [ $(get $((0x7C00)) /tmp/exe$$) -eq 60905 ]; then
     2.9  		ddq if=/tmp/exe$$ bs=1 count=66 skip=$((0x7DBE)) of=$1 seek=$(($i + 0x1BE)) conv=notrunc
    2.10  		ddq if=$1 bs=1 count=3 skip=$i of=$1 seek=$(($i + 0x1BE)) conv=notrunc
    2.11  		ddq if=/tmp/exe$$ bs=1 count=3 skip=$((0x7C00)) of=$1 seek=$i conv=notrunc
    2.12 @@ -270,7 +270,7 @@
    2.13  		fileofs $f
    2.14  		[ $SIZE -eq 0 ] ||
    2.15  		ddq bs=1 count=$SIZE skip=$OFFSET if="$ISO" >$f
    2.16 -		if [ "$f" == "syslinux.mbr" ] && [ $(get 0 "$f") -eq 60649 ]; then
    2.17 +		if [ "$f" == "syslinux.mbr" ] && [ $(get 0 "$f") -eq 60905 ]; then
    2.18  			ddq bs=1 conv=notrunc if="$f" of="$f" skip=$((0x1BE)) seek=0 count=3
    2.19  			ddq bs=1 skip=$((0x1BE)) count=66 if="$ISO" | \
    2.20  				ddq bs=1 seek=$((0x1BE)) count=66 of="$f" conv=notrunc