wok rev 14267

syslinux/iso2exe: add boot error message
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Apr 02 08:37:23 2013 +0200 (2013-04-02)
parents ff85ea851c53
children 19258b949c1b
files syslinux/stuff/iso2exe/bootiso.S syslinux/stuff/iso2exe/iso2exe.c syslinux/stuff/iso2exe/iso2exe.sh syslinux/stuff/iso2exe/mvcom.S
line diff
     1.1 --- a/syslinux/stuff/iso2exe/bootiso.S	Mon Apr 01 17:47:04 2013 +0200
     1.2 +++ b/syslinux/stuff/iso2exe/bootiso.S	Tue Apr 02 08:37:23 2013 +0200
     1.3 @@ -87,24 +87,39 @@
     1.4  	cmpb	$0x80, %al
     1.5  	xchgw	%ax, %dx
     1.6  	jnz	dxloop
     1.7 -fail:
     1.8 -//	movw	$0x0600+noloader, %si
     1.9 -//	call	putslp
    1.10 -stop:
    1.11 -	hlt
    1.12 -	jmp	stop
    1.13  dxfound:
    1.14  	movw	%dx, 10(%bp)
    1.15 +	call	checkboot
    1.16 +noboot:
    1.17 +	.ascii	"No isolinux mbr."
    1.18 +noboot_end:
    1.19 +
    1.20 +	.org	0x0080
    1.21 +////////////////////////////// EXE/PE header //////////////////////////////////
    1.22 +
    1.23 +	.org	0x01A0
    1.24 +checkboot:
    1.25  	call	readsectorX
    1.26  	lodsw
    1.27 +	popw	%si
    1.28  	shrw	$1, %ax
    1.29 -	jz	fail			// read fail or not isohydrid
    1.30 +	jz	error			// read fail or not isohydrid
    1.31  	popw	%es
    1.32  	popa
    1.33  	iret
    1.34  
    1.35 -	.org	0x0080
    1.36 -////////////////////////////// EXE/PE header //////////////////////////////////
    1.37 +error:
    1.38 +	movw	$noboot_end-noboot, %cx
    1.39 +putsloop:
    1.40 +	lodsb
    1.41 +	movw	$7, %bx
    1.42 +	movb	$0xE, %ah
    1.43 +	int	$0x10
    1.44 +	loop	putsloop
    1.45 +halt:
    1.46 +	hlt
    1.47 +	jmp	halt
    1.48 +	.org	0x01BE
    1.49  
    1.50  	.org	0x7EE0
    1.51  ////////////////////////////// DOS EXE code ///////////////////////////////////
     2.1 --- a/syslinux/stuff/iso2exe/iso2exe.c	Mon Apr 01 17:47:04 2013 +0200
     2.2 +++ b/syslinux/stuff/iso2exe/iso2exe.c	Tue Apr 02 08:37:23 2013 +0200
     2.3 @@ -70,7 +70,7 @@
     2.4  	* (unsigned long *) &bootiso[isohybrid + partition + 12] = cylinders * sectors * heads;
     2.5  
     2.6  	// Copy the partition table
     2.7 -	memcpy(bootiso + 0x1B8, bootiso + isohybrid + 0x1B8, 0x48);
     2.8 +	memcpy(bootiso + 0x1BE, bootiso + isohybrid + 0x1BE, 66);
     2.9  
    2.10  	// Install iso2exe boot sector
    2.11  	* (unsigned short *) (bootiso + 26) = rand();
     3.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Mon Apr 01 17:47:04 2013 +0200
     3.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Tue Apr 02 08:37:23 2013 +0200
     3.3 @@ -66,12 +66,13 @@
     3.4  	ddq if=/tmp/exe$$ of=$1 bs=128 count=1 conv=notrunc
     3.5  	store $((0x94)) $((0xE0 - 12*8)) $1
     3.6  	store $((0xF4)) $((16 - 12)) $1
     3.7 -	ddq if=$1 of=/tmp/exe$$ bs=1 skip=$((0x178)) count=$((0x88))
     3.8 -	ddq if=/tmp/exe$$ of=$1 conv=notrunc bs=1 seek=$((0x178 - 12*8))
     3.9 -	ddq if=$2 bs=1 skip=$((0x1B8)) seek=$((0x1B8)) count=72 of=$1 conv=notrunc
    3.10 +	ddq if=$1 of=/tmp/coff$$ bs=1 skip=$((0x178)) count=$((0x88))
    3.11 +	ddq if=/tmp/coff$$ of=$1 conv=notrunc bs=1 seek=$((0x178 - 12*8))
    3.12 +	ddq if=/tmp/exe$$ of=$1 bs=1 count=30 seek=$((0x1A0)) skip=$((0x1A0)) conv=notrunc
    3.13 +	ddq if=$2 bs=1 skip=$((0x1BE)) seek=$((0x1BE)) count=66 of=$1 conv=notrunc
    3.14  	store 69 $(($SIZE/512)) $1 8
    3.15  	store 510 $((0xAA55)) $1
    3.16 -	rm -f /tmp/exe$$ 
    3.17 +	rm -f /tmp/exe$$ /tmp/coff$$
    3.18  	printf "Moving syslinux hybrid boot record at %04X ...\n" $SIZE
    3.19  	ddq if=$2 bs=1 count=512 of=$1 seek=$SIZE conv=notrunc
    3.20  	OFS=$(($SIZE+512))
     4.1 --- a/syslinux/stuff/iso2exe/mvcom.S	Mon Apr 01 17:47:04 2013 +0200
     4.2 +++ b/syslinux/stuff/iso2exe/mvcom.S	Tue Apr 02 08:37:23 2013 +0200
     4.3 @@ -10,10 +10,12 @@
     4.4  	movw	$0, %si		// .com size
     4.5  	movw	$0, %bx		// .com loc
     4.6  #if 1
     4.7 +// Move up EXE/PE and DOS/COM to ensure that bootiso[]
     4.8 +// in EXE/PE will not be affected by the DOS/COM move.
     4.9  	pushw	%si
    4.10  	leaw	1-64-256(%bx,%si), %cx
    4.11  	leaw	(%bx,%si), %si
    4.12 -	movw	$0xF000, %di
    4.13 +	movw	$0xF000, %di	// Keep 4K for stack
    4.14  	cmpw	%si, %di
    4.15  	jc	skip
    4.16  	std