wok-current rev 13697

syslinux/iso2exe: menu can create usbkey/floppy
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Dec 14 15:43:12 2012 +0100 (2012-12-14)
parents 34ea786c65bf
children db0eb389448c
files syslinux/stuff/iso2exe/README syslinux/stuff/iso2exe/boot.c syslinux/stuff/iso2exe/bootiso.S syslinux/stuff/iso2exe/bootlinux.c syslinux/stuff/iso2exe/init syslinux/stuff/iso2exe/iso2exe.sh
line diff
     1.1 --- a/syslinux/stuff/iso2exe/README	Fri Dec 14 15:53:34 2012 +0000
     1.2 +++ b/syslinux/stuff/iso2exe/README	Fri Dec 14 15:43:12 2012 +0100
     1.3 @@ -1,3 +1,5 @@
     1.4 +(c) GPLv2, Pascal Bellard <pascal.bellard@slitaz.org>
     1.5 +
     1.6  The iso2exe tool inserts a DOS .EXE header in an ISO image.
     1.7  The ISO image can be launched by DOS :
     1.8  
     1.9 @@ -8,14 +10,14 @@
    1.10  Why ?
    1.11  
    1.12  According to the SliTaz forum, some new users have problems burning CD-ROMs,
    1.13 -creating USB Keys and booting these devices with the BIOS. Others are lost 
    1.14 +creating USB Keys and booting these devices with the BIOS. Others are lost
    1.15  during the installation process or partitioning.
    1.16  
    1.17  The slitaz.exe program boots the SliTaz ISO image with a text menu:
    1.18  
    1.19  - to start SliTaz in RAM (live) in graphics mode or text mode.
    1.20  
    1.21 -- to install SliTaz "a la UMSDOS" in the \slitaz\ subdirectory. The simplest
    1.22 +- to install SliTaz "a la UMSDOS" in the \slitaz\ subdirectory. The easiest
    1.23    way install to SliTaz. No partitioning. No questions.
    1.24  
    1.25  
    1.26 @@ -25,12 +27,12 @@
    1.27  
    1.28  Default mode is menu. Mode can be:
    1.29  
    1.30 -- menu	  	start with an interactive menu
    1.31 -- live    	launch SliTaz in RAM with graphics
    1.32 -- text    	launch SliTaz in RAM with text mode
    1.33 -- install 	SliTaz UMSDOS like installation
    1.34 +- menu	 	start with an interactive menu
    1.35 +- live	 	launch SliTaz in RAM with graphics
    1.36 +- text	 	launch SliTaz in RAM with text mode
    1.37 +- install	SliTaz UMSDOS like installation
    1.38  
    1.39 -If the program name includes one of the supported modes; the according mode is
    1.40 +If the prognam name includes one of the supported modes, the according mode is
    1.41  assumed. Example 'C:\> slitazlive.exe' starts SliTaz in RAM with graphics.
    1.42  
    1.43  
    1.44 @@ -59,7 +61,7 @@
    1.45   1K +-----------------+
    1.46      | isohybrid boot  | Starts isolinux.bin
    1.47  512 +-----------------+
    1.48 -    |  iso2exe boot   |	Boot starts isohybrid (*), .EXE starts DOS .COM loader
    1.49 +    |  iso2exe boot   | Boot starts isohybrid (*), .EXE starts DOS .COM loader
    1.50    0 +-----------------+
    1.51  
    1.52  * Eltorito boot (i.e. bootable CD-ROM by BIOS) is not concerned by iso2exe.
    1.53 @@ -77,7 +79,7 @@
    1.54  - The DOS Linux loader and the ISO initramfs must fit in ~30Kb.
    1.55  
    1.56  - Old Linux kernels don't support multiple initramfs load. They will not
    1.57 -  find the /init.exe file. As a workaround, you can add the "text" argument:
    1.58 +  find the /init.exe file. Only the "text" mode will work:
    1.59  	C:\> slitaz.exe text
    1.60  
    1.61  - The ISO image must include the files /boot/bzImage and /boot/rootfs*.
     2.1 --- a/syslinux/stuff/iso2exe/boot.c	Fri Dec 14 15:53:34 2012 +0000
     2.2 +++ b/syslinux/stuff/iso2exe/boot.c	Fri Dec 14 15:43:12 2012 +0100
     2.3 @@ -101,16 +101,13 @@
     2.4  			cmdfile = NULL;
     2.5  #asm
     2.6  		push	ds
     2.7 -		push	ds
     2.8  		pop	es
     2.9 -		push	cs
    2.10 -		pop	ds
    2.11  		mov	si, #0x82
    2.12  		mov	di, #_args
    2.13  		mov	cx, #0x7E/2
    2.14  		rep
    2.15 +		 seg	cs
    2.16  		  movsw
    2.17 -		pop	ds
    2.18  #endasm
    2.19  		}
    2.20  	}
     3.1 --- a/syslinux/stuff/iso2exe/bootiso.S	Fri Dec 14 15:53:34 2012 +0000
     3.2 +++ b/syslinux/stuff/iso2exe/bootiso.S	Fri Dec 14 15:43:12 2012 +0100
     3.3 @@ -30,7 +30,7 @@
     3.4  end_header:
     3.5  
     3.6  chksum:
     3.7 -	.long	0
     3.8 +	.word	0
     3.9  comstart:
    3.10  	.word	0
    3.11  
    3.12 @@ -95,56 +95,68 @@
    3.13  
    3.14  ////////////////////////////// DOS EXE code ///////////////////////////////////
    3.15  
    3.16 +eol:
    3.17 +	.ascii	".\r\n$"
    3.18  no386:
    3.19  	.ascii	"No 386+$"
    3.20  noDOS3:
    3.21  	.ascii	"No DOS 3.0+$"
    3.22  rmPaging:
    3.23 -	.ascii	"Broken paging.$"
    3.24 +	.ascii	"Broken paging$"
    3.25  ERRvcpi:
    3.26  	.ascii	"No VCPI 4.0+$"
    3.27  chkerr:
    3.28 -	.ascii	"Broken ISO.$"
    3.29 +	.ascii	"Broken ISO$"
    3.30  realmodemsg:
    3.31 -	.ascii	"Real mode\r$"
    3.32 +	.ascii	"Real mode$"
    3.33  vm86modemsg:
    3.34 -	.ascii	"Vm86\r$"
    3.35 +	.ascii	"VM86 mode$"
    3.36  help:
    3.37 -	.ascii	"Linux kickstarter.\r\n$"
    3.38 +	.ascii	"SliTaz GNU/Linux bootloader$"
    3.39 +
    3.40  fixseg:
    3.41 -#if 1
    3.42  	movb	$EXESTR(help), %dl
    3.43 -	movw	0x82, %ax
    3.44 -	cmpw	$0x3F2F, %ax		# /?
    3.45 +	movw	$0x100, %si
    3.46 +	cmpw	$0x3F2F, -126(%si)	# /? 
    3.47  	je	abort
    3.48 -#endif
    3.49 +	movw	(%si), %cx
    3.50 +	jcxz	skip
    3.51 +	xorw	%dx, %dx
    3.52 +	movw	$0x7FE0/2, %cx
    3.53 +chklp:
    3.54 +	lodsw
    3.55 +	addw	%ax, %dx
    3.56 +	loop	chklp
    3.57 +	orw	%dx, %dx
    3.58 +	movb	$EXESTR(chkerr), %dl
    3.59 +	jne	abort
    3.60 +skip:
    3.61  	pushf
    3.62  	popw	%ax
    3.63  	movw	$0xF0F0, %cx
    3.64  	orb	%ah, %ch
    3.65  	andb	$0xF, %ah
    3.66 -	
    3.67  	pushw	%ax
    3.68  	popf
    3.69  	pushf
    3.70  	popw	%ax
    3.71  	andb	%cl, %ah
    3.72 -	
    3.73  	cmp	%cl, %ah
    3.74  	je	NotSupported	// 8086 family
    3.75 -	
    3.76  	pushw	%cx
    3.77  	popf
    3.78  	pushf
    3.79  	popw	%ax
    3.80  	andb	%cl, %ah
    3.81 -	
    3.82  	jnz	is386		// 80286 family
    3.83  NotSupported:
    3.84  	movb	$EXESTR(no386), %dl
    3.85  abort:
    3.86  puts:
    3.87  	movb	$1, %dh
    3.88 +	call	puts2
    3.89 +	movw	$EXEADRS(eol), %dx
    3.90 +puts2:
    3.91  	movb	$9, %ah
    3.92  	int	$0x21
    3.93  	ret
    3.94 @@ -155,13 +167,13 @@
    3.95  	cmpb	$3, %al
    3.96  	movb	$EXESTR(noDOS3), %dl
    3.97  	jb	abort
    3.98 -	smsw	%ax
    3.99 +	movl	%cr0, %eax
   3.100  	andb	$1, %al
   3.101  	jne	tstvcpi
   3.102 -	movl	%cr0, %eax
   3.103  	movb	$EXESTR(rmPaging), %dl
   3.104  	shll	$1, %eax
   3.105  	jc	abort
   3.106 +	movb	$EXESTR(realmodemsg), %dl
   3.107  	jmp	realmode
   3.108  
   3.109  tstvcpi:
   3.110 @@ -182,7 +194,6 @@
   3.111  	jne	abort
   3.112  	shll	$8, %eax
   3.113  	cmpl	$0x4D4D4500, %eax	// [XQ]MME
   3.114 -#if 1
   3.115  	movw	$EXEADRS(CmdVCPI), %si
   3.116  ChkVCPI:
   3.117  	jne	NoVCPI
   3.118 @@ -191,55 +202,20 @@
   3.119  	je	VersionVCPI
   3.120  	int	$0x67
   3.121  	jmp	ChkVCPI
   3.122 +
   3.123  CmdVCPI:
   3.124  	.byte	0x40			// status
   3.125  	.byte	0xDE			// vcpi present ?
   3.126  	.byte	0x46			// version
   3.127  	.byte	0
   3.128 +	
   3.129  VersionVCPI:
   3.130  	cmpb	$0x40, %al		// >= 4.0 ?
   3.131  	jb	NoVCPI
   3.132 -#else
   3.133 -	jne	NoVCPI
   3.134 -	movb	$0x40, %ah		// status
   3.135 -	int	$0x67
   3.136 -	testb	%ah, %ah
   3.137 -	jne	NoVCPI
   3.138 -	movb	$0x46, %ah		// version
   3.139 -	int	$0x67
   3.140 -	testb	%ah, %ah
   3.141 -	jne	NoVCPI
   3.142 -	cmpb	$0x40, %al		// >= 4.0 ?
   3.143 -	jb	NoVCPI
   3.144 -	movw	$0xDE00, %ax		// vcpi present ?
   3.145 -	int	$0x67
   3.146 -	testb	%ah, %ah
   3.147 -	jne	NoVCPI
   3.148 -#endif
   3.149 +	movb	$EXESTR(vm86modemsg), %dl
   3.150  realmode:
   3.151 -	movw	$0x100, %si
   3.152 -	lodsl
   3.153 -	xchgl	%eax, %edx
   3.154 -	orl	%edx, %edx
   3.155 -	jz	skip
   3.156 -	movw	$0x7FDC/4, %cx
   3.157 -chklp:
   3.158 -	lodsl
   3.159 -	addl	%eax, %edx
   3.160 -	loop	chklp
   3.161 -	orl	%edx, %edx
   3.162 -	movb	$EXESTR(chkerr), %dl
   3.163 -	jne	goabort
   3.164 -skip:
   3.165 -	movb	$EXESTR(realmodemsg), %dl
   3.166 -	smsww	%ax
   3.167 -	andb	$1, %al
   3.168 -	jz	isrealmode
   3.169 -	movb	$EXESTR(vm86modemsg), %dl
   3.170 -isrealmode:
   3.171  	call	puts
   3.172  	movw	EXEADRS(comstart), %ax			// .com address
   3.173 -
   3.174  	cld
   3.175  	movw	$moveend-move, %cx
   3.176  	movw	$EXEADRS(move), %si
     4.1 --- a/syslinux/stuff/iso2exe/bootlinux.c	Fri Dec 14 15:53:34 2012 +0000
     4.2 +++ b/syslinux/stuff/iso2exe/bootlinux.c	Fri Dec 14 15:43:12 2012 +0100
     4.3 @@ -162,17 +162,23 @@
     4.4  		xor	si, si
     4.5  		xor	di, di
     4.6  		rep
     4.7 -		  movsw
     4.8 +		  movsw			// move 64K data
     4.9  		push	es
    4.10  		pop	ds
    4.11  		push	es
    4.12  		pop	ss
    4.13 +		mov	ch, #0x70
    4.14 +		mov	es, cx
    4.15 +		mov	ch, #0x80
    4.16 +		rep
    4.17 +		 seg	cs
    4.18 +		  movsw			// move 64K code
    4.19  		popa
    4.20 -		jmpi	relocated, #0x8000
    4.21 +		jmpi	relocated, #0x7000
    4.22  relocated:
    4.23  #endasm
    4.24  				kernelmem.base = 0x10000;
    4.25 -				if (syssize > 0x70000)
    4.26 +				if (syssize > 0x60000)	/* 384K max */
    4.27  #endif
    4.28  				die("Not a bzImage format");
    4.29  			}
     5.1 --- a/syslinux/stuff/iso2exe/init	Fri Dec 14 15:53:34 2012 +0000
     5.2 +++ b/syslinux/stuff/iso2exe/init	Fri Dec 14 15:43:12 2012 +0100
     5.3 @@ -15,7 +15,7 @@
     5.4  gettazboot()
     5.5  {
     5.6  	echo "Creating $(basename $1) ..."
     5.7 -	O=$(($(get 36 /mnt/$ISO 2) - 0xE0))
     5.8 +	O=$(($(get 34 /mnt/$ISO 2) - 0xE0))
     5.9  	L=$((0x8000 - $(get 28 /mnt/$ISO 2) - $O))
    5.10  	S=$((32+$L))
    5.11  	P=$((($S+511)/512))
    5.12 @@ -157,7 +157,7 @@
    5.13  You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
    5.14  To uninstall SliTaz, you have only to remove this directory.
    5.15  The file \\boot.ini or \\config.sys may be modified too.\n\n
    5.16 -To do a traditional installation with disk partitioning -
    5.17 +To do a traditional installation with disk partitioning,
    5.18  start SliTaz Live with 'SliTaz RAM boot' menu.\n
    5.19  " 16 70
    5.20  	[ $? -eq 0 -a -x /usr/sbin/mount.posixovl ] || return
    5.21 @@ -172,7 +172,7 @@
    5.22  		--title " SliTaz bootloader for DOS " \
    5.23  		--yes-label "Install" --yesno \
    5.24  "\nThe file TAZBOOT.EXE will be created in the top directory. It supports
    5.25 -a bzImage linux kernel, multiple initramfs', a kernel command line and
    5.26 +a bzImage linux kernel, multiple initramfs, a kernel command line and
    5.27  an ISO image file loopback (retrieves files from an ISO file).\n\n
    5.28  Usage: tazboot.exe [[@commands]|[kernel=<bzimage>] 
    5.29  [initrd=<rootfs>[,<rootfs2>...]] [iso=<isofile>] cmdline args ...]\n\n
    5.30 @@ -189,6 +189,142 @@
    5.31  	gettazboot /mnt/tazboot.exe
    5.32  }
    5.33  
    5.34 +md5()
    5.35 +{
    5.36 +	( cd /media/cdrom ; md5sum -c md5sum ) | tee /tmp/data
    5.37 +	$DIALOG --clear \
    5.38 +		--title " Checked files " \
    5.39 +		--textbox /tmp/data 24 78
    5.40 +	rm -f /tmp/data
    5.41 +}
    5.42 +
    5.43 +readme()
    5.44 +{
    5.45 +	$DIALOG --clear \
    5.46 +		--title " Readme " \
    5.47 +		--textbox /media/cdrom/README 24 78
    5.48 +}
    5.49 +
    5.50 +bootlog()
    5.51 +{
    5.52 +	$DIALOG --clear \
    5.53 +		--title " Linux boot messages " \
    5.54 +		--textbox /tmp/dmesg 24 78
    5.55 +}
    5.56 +
    5.57 +memtest()
    5.58 +{
    5.59 +	$DIALOG --clear \
    5.60 +		--title " Memtest86 " \
    5.61 +		--yes-label "Install" --yesno \
    5.62 +"\nMemtest86 is a thorough, stand alone memory test for x86 architecture
    5.63 +computers. BIOS based memory tests are a quick, cursory check and often
    5.64 +miss many of the failures that are detected by Memtest86.\n
    5.65 +" 12 70
    5.66 +	[ $? -eq 0 ] || return
    5.67 +	cp /media/cdrom/boot/memtest /mnt
    5.68 +}
    5.69 +
    5.70 +fdmemtest()
    5.71 +{
    5.72 +	$DIALOG --clear \
    5.73 +		--title " Create a Memtest86 boot floppy " \
    5.74 +		--yes-label "Create floppy" --yesno \
    5.75 +"\nMemtest86 is a thorough, stand alone memory test for x86 architecture
    5.76 +computers. BIOS based memory tests are a quick, cursory check and often
    5.77 +miss many of the failures that are detected by Memtest86.\n\n
    5.78 +Please insert a blank disk in floppy drive.\n
    5.79 +" 12 70
    5.80 +	[ $? -eq 0 ] || return
    5.81 +	dd if=/media/cdrom/boot/memtest of=/dev/fd0
    5.82 +}
    5.83 +
    5.84 +gpxe()
    5.85 +{
    5.86 +	$DIALOG --clear \
    5.87 +		--title " SliTaz Web boot " \
    5.88 +		--yes-label "Install" --yesno \
    5.89 +"\nBoot your operating system from the internet and enjoy a full system
    5.90 +working entirely in RAM with speed and stability in mind. The Linux Kernel
    5.91 +and the complete SliTaz compressed root filesystem will be loaded into RAM
    5.92 +from the Web using PXE and HTTP protocols.\n
    5.93 +" 12 70
    5.94 +	[ $? -eq 0 ] || return
    5.95 +	cp /media/cdrom/boot/gpxe /mnt
    5.96 +}
    5.97 +
    5.98 +fdgpxe()
    5.99 +{
   5.100 +	$DIALOG --clear \
   5.101 +		--title " Create a SliTaz Web boot floppy " \
   5.102 +		--yes-label "Create floppy" --yesno \
   5.103 +"\nBoot your operating system from the internet and enjoy a full system
   5.104 +working entirely in RAM with speed and stability in mind. The Linux Kernel
   5.105 +and the complete SliTaz compressed root filesystem will be loaded into RAM
   5.106 +from the Web using PXE and HTTP protocols.\n\n
   5.107 +Please insert a blank disk in floppy drive.\n
   5.108 +" 12 70
   5.109 +	[ $? -eq 0 ] || return
   5.110 +	dd if=/media/cdrom/boot/gpxe of=/dev/fd0
   5.111 +}
   5.112 +
   5.113 +cdfile()
   5.114 +{
   5.115 +	[ -s /media/cdrom/$1 ] && echo -en "$2	${3// /.}"
   5.116 +}
   5.117 +
   5.118 +usbkey()
   5.119 +{
   5.120 +	$DIALOG --clear \
   5.121 +		--title " Create a SliTaz USB key " \
   5.122 +		--yes-label "Continue" --yesno \
   5.123 +"\nUnlike a hard drive install, the filesystem is kept in a compressed
   5.124 +rootfs.gz. The filesystem is loaded entirely into memory upon boot.
   5.125 +This should increase responsiveness, protect the filesystem against
   5.126 +accidental corruption and reduce read/writes to the USB drive.
   5.127 +Once setup, the tazusb utility can rewrite the root filesystem
   5.128 +with any changes you have made since booting up, 
   5.129 +giving the effective benefits of a hard drive install.\n\n
   5.130 +/home is mounted on boot using the UUID of your particular flash drive.
   5.131 +Unlike a device name, the UUID has the benefit of never changing from machine
   5.132 +to machine.\n\n
   5.133 +Please plug your USB stick in now.\n 
   5.134 +" 18 70
   5.135 +	[ $? -eq 0 ] || return
   5.136 +	DEV="$(grep -l 1 /sys/block/*/removable | \
   5.137 +		sed 's|/sys/block/\(.*\)/removable|\1|')"
   5.138 +	[ -n "$DEV" ] || return
   5.139 +	exec 3>&1
   5.140 +	sleep 5
   5.141 +	device=`$DIALOG  --clear \
   5.142 +	--title " Select your USB key " \
   5.143 +	--menu "\nPlease select the USB key according its known size.\n\n" \
   5.144 +	14 70 4 \
   5.145 +	$(for i in $DEV ; do
   5.146 +		echo "/dev/$i $(( $(cat /sys/block/$i/size) / 1024 ))MB"	 
   5.147 +	done) \
   5.148 +	2>&1 1>&3`
   5.149 +	retval=$?
   5.150 +	exec 3>&-
   5.151 +	[ $retval -eq 0 ] || continue
   5.152 +	exec 3>&1
   5.153 +	format=`$DIALOG  --clear \
   5.154 +	--title " Select the filesystem " \
   5.155 +	--menu "\nPlease select the filesystem type to create.\n\n\
   5.156 +The filesystem creation will erase all the datas \
   5.157 +in the USB key." 14 70 4 \
   5.158 +		"none"	"Do not erase the USB key" \
   5.159 +		"ext3"	"Ext3 journaling filesystem" \
   5.160 +		"ext2"	"Ext2 filesystem" \
   5.161 +		"fat32"	"Window FAT32 filesystem" \
   5.162 +	2>&1 1>&3`
   5.163 +	retval=$?
   5.164 +	exec 3>&-
   5.165 +	[ $retval -eq 0 ] || continue
   5.166 +	[ "$format" != "none" ] && tazusb format $device "SliTaz" $format
   5.167 +	tazusb gen-iso2usb /mnt/$ISO $device
   5.168 +}
   5.169 +
   5.170  text()
   5.171  {
   5.172  	umount -d /media/cdrom
   5.173 @@ -220,9 +356,15 @@
   5.174  	/sbin/poweroff -f
   5.175  }
   5.176  
   5.177 +shell()
   5.178 +{
   5.179 +	/sbin/getty -n -l /bin/ash 38400 tty1
   5.180 +}
   5.181 +
   5.182  [ -x /usr/sbin/mount.posixovl ] ||
   5.183  mv /usr/sbin/mount.posixovl.iso2exe /usr/sbin/mount.posixovl
   5.184  mount -t proc /proc /proc
   5.185 +dmesg > /tmp/dmesg
   5.186  ISO="$(getarg iso | sed 's/.://;s|\\|/|g')"
   5.187  getiso
   5.188  case "$(basename $ISO | tr [A-Z] [a-z])$(getarg mode)" in
   5.189 @@ -235,14 +377,22 @@
   5.190  	exec 3>&1
   5.191  	value=`$DIALOG  --clear \
   5.192  	--title " Welcome to SliTaz " \
   5.193 -	--menu "\nPlease select" 15 70 7 \
   5.194 -		"live"		"SliTaz RAM boot" \
   5.195 -		"text"		"SliTaz RAM boot (text mode only)" \
   5.196 -		"install"	"Hard disk installation" \
   5.197 -		"tazboot"	"Get tazboot.exe Linux loader" \
   5.198 -		"reboot"	"Restart the computer" \
   5.199 -		"poweroff"	"Power off" \
   5.200 -		"ash"		"Shell prompt" \
   5.201 +	--menu "\nPlease select" 17 70 9 \
   5.202 +			"live"		"SliTaz RAM boot" \
   5.203 +			"text"		"SliTaz RAM boot (text mode only)" \
   5.204 +$(cdfile README		"readme"	"Show the README file") \
   5.205 +$(cdfile md5sum		"md5"		"Check ISO files") \
   5.206 +			"install"	"Hard disk installation" \
   5.207 +			"usbkey"	"USB key installation" \
   5.208 +			"tazboot"	"Get tazboot.exe Linux loader" \
   5.209 +$(cdfile Xboot/memtest	"memtest"	"Get Memtest86") \
   5.210 +$(cdfile boot/memtest	"fdmemtest"	"Create a Memtest86 boot floppy") \
   5.211 +$(cdfile Xboot/gpxe	"gpxe"		"Get SliTaz Web boot utility") \
   5.212 +$(cdfile boot/gpxe	"fdgpxe"	"Create a SliTaz Web boot floppy") \
   5.213 +			"reboot"	"Restart the computer" \
   5.214 +			"poweroff"	"Power off" \
   5.215 +			"bootlog"	"Linux boot messages" \
   5.216 +			"shell"		"Shell prompt" \
   5.217  	2>&1 1>&3`
   5.218  	retval=$?
   5.219  	exec 3>&-
     6.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Fri Dec 14 15:53:34 2012 +0000
     6.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Fri Dec 14 15:43:12 2012 +0100
     6.3 @@ -66,8 +66,17 @@
     6.4  	OFS=$(( $OFS - $SIZE ))
     6.5  	printf "Adding DOS boot file at %04X...\n" $OFS
     6.6  	$0 --get lzcom.bin boot.com.lzma | ddq of=$1 bs=1 seek=$OFS conv=notrunc
     6.7 -	store 36 $(($OFS+0xE0)) $1
     6.8 +	store 34 $(($OFS+0xE0)) $1
     6.9  	store 30 ${RANDOM:-0} $1
    6.10 +	i=34
    6.11 +	n=0
    6.12 +	echo -n "Adding checksum..."
    6.13 +	while [ $i -lt 32768 ]; do
    6.14 +		n=$(($n + $(od -j $i -N 2 -t u2 -An $1) ))
    6.15 +		i=$(($i + 2))
    6.16 +	done
    6.17 +	store 32 -$n $1
    6.18 +	echo " done."
    6.19  }
    6.20  
    6.21  main $@ <<EOT