wok rev 17489

syslinux/iso2exe: add knoppix support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jan 01 22:09:19 2015 +0100 (2015-01-01)
parents cef92bf1f7cb
children 3cbe0810030e
files syslinux/receipt syslinux/stuff/iso2exe/Makefile syslinux/stuff/iso2exe/boot.c syslinux/stuff/iso2exe/bootlinux.c syslinux/stuff/iso2exe/init syslinux/stuff/iso2exe/iso2exe.c syslinux/stuff/iso2exe/iso2exe.sh syslinux/stuff/iso2exe/iso9660.c
line diff
     1.1 --- a/syslinux/receipt	Wed Dec 31 11:31:10 2014 -0500
     1.2 +++ b/syslinux/receipt	Thu Jan 01 22:09:19 2015 +0100
     1.3 @@ -13,7 +13,7 @@
     1.4  
     1.5  DEPENDS="ipxe memtest"
     1.6  BUILD_DEPENDS="kbd-base perl nasm dev86 lzma mingw32-gcc upx posixovl \
     1.7 -util-linux-uuid-dev"
     1.8 +util-linux-uuid-dev advancecomp"
     1.9  
    1.10  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.11  compile_rules()
     2.1 --- a/syslinux/stuff/iso2exe/Makefile	Wed Dec 31 11:31:10 2014 -0500
     2.2 +++ b/syslinux/stuff/iso2exe/Makefile	Thu Jan 01 22:09:19 2015 +0100
     2.3 @@ -9,17 +9,18 @@
     2.4  	objcopy -O binary meminfo.o meminfo.exe
     2.5  	chmod +x $@
     2.6  
     2.7 -iso2exe: iso2exe.sh boot.com bootiso.bin init win32.exe
     2.8 +iso2exe: iso2exe.sh boot.com bootiso.bin init win32.exe ../mbr/isohdpfx.bin
     2.9 +	cp ../mbr/isohdpfx.bin .
    2.10  	cp iso2exe.sh $@
    2.11  	chmod +x $@
    2.12 -	./$@ --build boot.com bootiso.bin init win32.exe
    2.13 +	./$@ --build boot.com bootiso.bin init win32.exe isohdpfx.bin
    2.14  
    2.15  isohybrid.res: isohybrid.rc isohybrid.ico
    2.16  	i586-pc-mingw32-windres $< -O coff -o $@
    2.17  
    2.18 -iso2exe.h: iso2exe ../mbr/isohdpfx.bin
    2.19 +iso2exe.h: iso2exe
    2.20  	chmod +x iso2exe.sh
    2.21 -	./iso2exe.sh --array ../mbr/isohdpfx.bin > $@
    2.22 +	./iso2exe.sh --array isohdpfx.bin > $@
    2.23  
    2.24  iso2exe.com: iso2exe.c iso2exe.h
    2.25  	$(BCC) $(BCCFLAGS) -o $@ iso2exe.c && upx --ultra-brute $@
     3.1 --- a/syslinux/stuff/iso2exe/boot.c	Wed Dec 31 11:31:10 2014 -0500
     3.2 +++ b/syslinux/stuff/iso2exe/boot.c	Thu Jan 01 22:09:19 2015 +0100
     3.3 @@ -10,10 +10,10 @@
     3.4  static void usage(char *iso)
     3.5  {
     3.6  	printf("Usage: %s [[@commands]|[kernel=<bzimage>] \
     3.7 -[initrd=<rootfs>[,<rootfs2>...]] [iso=<isofile>] ...]\n\n\
     3.8 +[initrd=<rootfs>[,<rootfs2>...]] [bootfrom=<isofile>] ...]\n\n\
     3.9  Defaults: %s @tazboot.cmd  or  %s kernel=bzImage auto\n\n\
    3.10  Examples for tazboot.cmd:\n\n\
    3.11 -  iso=\\isos\\slitaz-4.0.iso\n\
    3.12 +  bootfrom=\\isos\\slitaz-4.0.iso\n\
    3.13    kernel=boot/bzImage\n\
    3.14    initrd=boot/rootfs4.gz,boot/rootfs3.gz,boot/rootfs2.gz,boot/rootfs1.gz,\\slitaz\\extrafs.gz\n\
    3.15    rw root=/dev/null vga=normal autologin\n\n\
    3.16 @@ -25,30 +25,52 @@
    3.17  static void bootiso(char **iso)
    3.18  {
    3.19  	char *init = " rdinit=/init.exe", *mode="menu", *fmt="";
    3.20 -	char c, rootfs[16], cmdline[256];
    3.21 -	int restart;
    3.22 +	char *s, c, rootfs[16], fallback[16], cmdline[256];
    3.23 +	int restart, isknoppix = 0;
    3.24  	unsigned long magic;
    3.25  	
    3.26 -	if (isoreset(*iso) || isoopen("boot")) return;
    3.27 +	if (isoreset(*iso)) return;
    3.28 +	!isoopen("boot") ||
    3.29 +	!isoopen("live") ||	// debian
    3.30 +	!isoopen("casper") ||	// ubuntu
    3.31 +	!isoopen("isolinux");	// zeroshell
    3.32  	if (iso[1] && !strcmp(mode = iso[1], "text"))
    3.33  		init = "";
    3.34 +	do {
    3.35 +		if (!isoopen(mode)	||	// custom
    3.36 +		    !isoopen("bzImage")	|| 	// SliTaz
    3.37 +		    !isoopen("linux24")	||	// dsl
    3.38 +		    !isoopen("vmlinuz")	||	// misc
    3.39 +		    (!isoopen("linux") && ++isknoppix)) {
    3.40 +			magic = loadkernel();
    3.41 +			break;
    3.42 +		}
    3.43 +	} while (!isoopen("isolinux"));		// Knoppix
    3.44 +	fallback[0] = 0;
    3.45  	for (c = 0, restart = 1; isoreaddir(restart) == 0; restart = 0) {
    3.46 +		if (strstr(isofilename, ".gz"))
    3.47 +			strcpy(fallback, isofilename);
    3.48  		if (strncmp(isofilename, "rootfs", 6) 
    3.49  			|| c > isofilename[6]) continue;
    3.50  		strcpy(rootfs, isofilename);
    3.51  		c = isofilename[6];
    3.52  	}
    3.53 -	if (isoopen(mode))
    3.54 -		isoopen("bzImage");
    3.55 -	magic = loadkernel();
    3.56 +
    3.57  	if (magic < 0x20630)
    3.58  		init = ""; // Does not support multiple initramfs
    3.59 +
    3.60  	if (magic > 0) {
    3.61 -		fmt = "rw root=/dev/null%s iso=%s magic=%lu mode=%s autologin";
    3.62 -		if (rootfs[6] != '.' && !isoopen("rootfs.gz"))
    3.63 -			loadinitrd();	// for loram
    3.64 -		isoopen(rootfs);
    3.65 -		loadinitrd();
    3.66 +		char *initrd = fallback;
    3.67 +
    3.68 +		fmt = "rw root=/dev/null bootfrom=%s%s magic=%lu mode=%s autologin";
    3.69 +		if (rootfs[0]) {
    3.70 +			initrd = rootfs;
    3.71 +			if (rootfs[6] != '.' && !isoopen("rootfs.gz"))
    3.72 +				loadinitrd();	// for loram
    3.73 +		}
    3.74 +		if (!isoopen(initrd)) {
    3.75 +			loadinitrd();
    3.76 +		}
    3.77  		if (*init) {
    3.78  			lseek(isofd, 24L, SEEK_SET);
    3.79  			read(isofd, &magic, 4);
    3.80 @@ -58,7 +80,13 @@
    3.81  			else init="";
    3.82  		}
    3.83  	}
    3.84 -	sprintf(cmdline, fmt, init, *iso, magic, mode);
    3.85 +	if (isknoppix) {
    3.86 +		if (iso[0][1] == ':')
    3.87 +			*iso += 2;
    3.88 +		for (s = *iso; *s; s++)
    3.89 +			if (*s == '\\') *s = '/';
    3.90 +	}
    3.91 +	sprintf(cmdline, fmt, *iso, init, magic, mode);
    3.92  	close(isofd);
    3.93  	bootlinux(cmdline);
    3.94  }
    3.95 @@ -159,7 +187,7 @@
    3.96  			kernel = s + 7;
    3.97  		else if (stricmp("initrd=", s) == 0)
    3.98  			initrd = s + 7;
    3.99 -		else if (stricmp("iso=", s) == 0)
   3.100 +		else if (stricmp("bootfrom=", s) == 0)
   3.101  			iso = s + 4;
   3.102  		else {
   3.103  			cmdline = s;
     4.1 --- a/syslinux/stuff/iso2exe/bootlinux.c	Wed Dec 31 11:31:10 2014 -0500
     4.2 +++ b/syslinux/stuff/iso2exe/bootlinux.c	Thu Jan 01 22:09:19 2015 +0100
     4.3 @@ -139,7 +139,7 @@
     4.4  #endasm
     4.5  }
     4.6  
     4.7 -static unsigned zimage = 0;
     4.8 +static unsigned vgamode, zimage = 0;
     4.9  static unsigned getss(void)
    4.10  {
    4.11  #asm
    4.12 @@ -260,6 +260,7 @@
    4.13  			syssize = LONG(buffer + SYSSIZE) << 4;
    4.14  			if (!syssize) syssize = 0x7F000;
    4.15  			setup = (1 + buffer[SETUPSECTORS]) << 9;
    4.16 +			vgamode = WORD(buffer + VIDEOMODE);
    4.17  			if (setup == 512) {
    4.18  #ifdef LINUX001_SUPPORT
    4.19  				if (WORD(buffer + 0x3F) == 0x3AE8) /* linux 0.01 */
    4.20 @@ -355,10 +356,26 @@
    4.21  
    4.22  void bootlinux(char *cmdline)
    4.23  {
    4.24 +	char *s;
    4.25 +	
    4.26 +	s = strstr(cmdline," vga=");
    4.27 +	if (s) {
    4.28 +		vgamode = -1;
    4.29 +		s += 5;
    4.30 +		switch (*s | 0x20) {
    4.31 +		case 'a' : vgamode--;
    4.32 +		case 'e' : vgamode--;
    4.33 +		case 'n' : break;
    4.34 +		default  : vgamode = atoi(s);
    4.35 +		}
    4.36 +	}
    4.37  	dosshutdown();
    4.38  #asm
    4.39  	cld
    4.40  	mov	es, _setupseg
    4.41 +	mov	ax, _vgamode
    4.42 +	seg	es
    4.43 +	mov	VIDEOMODE, ax
    4.44  	mov	ax, _setup_version
    4.45  	cmp	ax, #0x200
    4.46  	jb	noinitrd
     5.1 --- a/syslinux/stuff/iso2exe/init	Wed Dec 31 11:31:10 2014 -0500
     5.2 +++ b/syslinux/stuff/iso2exe/init	Thu Jan 01 22:09:19 2015 +0100
     5.3 @@ -18,6 +18,71 @@
     5.4  	sed "/$1=/!d;s/.*$1=\\([^ ]*\\).*/\\1/" /proc/cmdline
     5.5  }
     5.6  
     5.7 +clear()
     5.8 +{
     5.9 +	echo -e "\x1B[1;1H\x1B[J"
    5.10 +}
    5.11 +
    5.12 +tinydialog()
    5.13 +{
    5.14 +	clear
    5.15 +	label=""
    5.16 +	while [ "$1" ]; do
    5.17 +		case "$1" in
    5.18 +		--title) title="   \x1B[30;47m$2\x1B[37;40m\n"
    5.19 +			 echo -e $title; shift ;;
    5.20 +		--yes-label) label="$2" ; shift ;;
    5.21 +		--textbox)
    5.22 +			less "$2" < /dev/tty0 > /dev/tty0
    5.23 +			break;;
    5.24 +		--gauge)
    5.25 +			t="        "
    5.26 +			echo -e "$t$2\n"
    5.27 +			while read pct ; do
    5.28 +				s="                              "
    5.29 +				s="$s$pct%$s"
    5.30 +				pct=$((($pct*63)/100))
    5.31 +				echo -en "\r$t\x1B[30;47m$(echo "$s" | cut -c-$pct)\x1B[37;40m$(echo "$s" | cut -c$(($pct+1))-)"
    5.32 +			done
    5.33 +			break;;
    5.34 +		--yesno)
    5.35 +			while true; do
    5.36 +				clear
    5.37 +				echo "$2" | sed 's/\\n/\n/g'
    5.38 +				echo -en "\n  <-  1:${label:-Yes}  2:Cancel\r"
    5.39 +				read x
    5.40 +				case "$x" in
    5.41 +				''|Y*|y*|1) return 0;;
    5.42 +				N*|n*|2|0) return 1;;
    5.43 +				esac
    5.44 +			done ;;
    5.45 +		--menu|--radiolist)
    5.46 +			label="$2"
    5.47 +			shift 5
    5.48 +			echo -e "$title\n$label\n0	Cancel" > /tmp/data
    5.49 +			n=1
    5.50 +			while [ "$1" ]; do
    5.51 +				eval key_$n='$1'
    5.52 +				echo "$((n++))	$2"
    5.53 +				case "$3" in on|off) shift;; esac
    5.54 +				shift 2
    5.55 +			done >> /tmp/data
    5.56 +			while ! grep -q "^$n	" /tmp/data ; do
    5.57 +				clear
    5.58 +				[ $(wc -l < /tmp/data) -gt 20 ] && 
    5.59 +				less /tmp/data || cat /tmp/data
    5.60 +				echo -en "\n   <- Enter the selection number\r"
    5.61 +				read n
    5.62 +			done 2> /dev/null
    5.63 +			rm -f /tmp/data
    5.64 +			[ $n -eq 0 ] && return 1
    5.65 +			eval echo -n \$key_$n 1>&2
    5.66 +			return 0;;
    5.67 +		esac
    5.68 +		shift
    5.69 +	done
    5.70 +}
    5.71 +
    5.72  mount_proc()
    5.73  {
    5.74  	mount -t proc /proc /proc
    5.75 @@ -69,11 +134,11 @@
    5.76  getiso()
    5.77  {
    5.78  	mkdir -p /media/cdrom
    5.79 -	blkid | while read dev info ; do
    5.80 -		mount ${dev%:} /mnt
    5.81 +	for dev in /sys/block/?d?/?d??* ; do
    5.82 +		mount /dev/$(basename $dev) /mnt
    5.83  		if checkmagic /mnt/$ISO; then
    5.84  			mount -o loop,ro /mnt/$ISO /media/cdrom
    5.85 -			echo "Found $ISO on ${dev%:}"
    5.86 +			echo "Found $ISO on $(basename $dev)"
    5.87  			break
    5.88  		fi
    5.89  		umount /mnt
    5.90 @@ -82,6 +147,7 @@
    5.91  
    5.92  uncpio()
    5.93  {
    5.94 +	[ -s "$1" ] || return
    5.95  	echo -en "\n Extracting $(basename $1) ..."
    5.96  	case $(get 0 $1) in
    5.97  	*35615)	( zcat || gunzip ) ;;
    5.98 @@ -363,10 +429,10 @@
    5.99  any linux kernel, multiple initramfs, a kernel command line and
   5.100  an ISO image file loopback (retrieves files from an ISO file).\n\n
   5.101  Usage: tazboot.exe [[@commands]|[kernel=<bzimage>] 
   5.102 -[initrd=<rootfs>[,<rootfs2>...]] [iso=<isofile>] cmdline args ...]\n\n
   5.103 +[initrd=<rootfs>[,<rootfs2>...]] [bootfrom=<isofile>] cmdline args ...]\n\n
   5.104  Defaults: tazboot @tazboot.cmd or tazboot kernel=bzImage auto\n\n\
   5.105  Examples for tazboot.cmd:\n\n\
   5.106 -  iso=\\isos\\slitaz-4.0.iso\n\
   5.107 +  bootfrom=\\isos\\slitaz-4.0.iso\n\
   5.108    kernel=boot/bzImage\n\
   5.109    initrd=boot/rootfs4.gz,boot/rootfs3.gz,boot/rootfs2.gz,boot/rootfs1.gz\n\
   5.110    rw root=/dev/null autologin\n\n\
   5.111 @@ -380,7 +446,7 @@
   5.112  md5()
   5.113  {
   5.114  	dotwait "Checking files"
   5.115 -	( cd /media/cdrom ; md5sum -c md5sum* ) > /tmp/data
   5.116 +	( cd /media/cdrom ; ${1:-md5sum -c md5sum*} ) > /tmp/data
   5.117  	rm -f /tmp/wait
   5.118  	$DIALOG --clear \
   5.119  		--title " Checked files " \
   5.120 @@ -388,11 +454,19 @@
   5.121  	rm -f /tmp/data
   5.122  }
   5.123  
   5.124 +sha()
   5.125 +{
   5.126 +	gotcdfile sha*sum*
   5.127 +	sha=$(basename $file)
   5.128 +	md5 "${sha%sum*}sum -c ${file#/media/cdrom/}"
   5.129 +}
   5.130 +
   5.131  readme()
   5.132  {
   5.133 +	gotcdfile README*
   5.134  	$DIALOG --clear \
   5.135  		--title " Readme " \
   5.136 -		--textbox /media/cdrom/README 24 78
   5.137 +		--textbox $file 24 78
   5.138  }
   5.139  
   5.140  bootlog()
   5.141 @@ -424,14 +498,11 @@
   5.142  computers. BIOS based memory tests are a quick, cursory check and often
   5.143  miss many of the failures that are detected by Memtest86.\n
   5.144  " 12 70
   5.145 -	[ $? -eq 0 ] || return
   5.146 -	cp /media/cdrom/boot/memtest /mnt/memtest.exe
   5.147 +	[ $? -eq 0 ] && gotcdfile memtest* && cp $file /mnt/memtest.exe
   5.148  }
   5.149  
   5.150 -mkfloppy()
   5.151 +mkfat12()
   5.152  {
   5.153 -	dotwait "Create a $(basename $1) boot floppy"
   5.154 -	ddq if=$1 of=/dev/fd0
   5.155  	[ $(($(get 0 $1) - 0x5A4D)) -eq 0 ] || return
   5.156  	J=$(($(get 3 $1 1) + 0x02))
   5.157  	R=$((1 + $(get 497 $1 1) + 1 + ($(get 500 $1)-1)/32))
   5.158 @@ -452,6 +523,13 @@
   5.159  		bytes2bin 0xF0 0xFF 0xFF | ddq bs=512 seek=$i of=/dev/fd0
   5.160  	done
   5.161  	echo -n $(basename $1) | ddq bs=1 seek=3 count=8 of=/dev/fd0
   5.162 +}
   5.163 +
   5.164 +mkfloppy()
   5.165 +{
   5.166 +	dotwait "Create a $(basename $1) boot floppy"
   5.167 +	ddq if=$1 of=/dev/fd0
   5.168 +	mkfat12 $1
   5.169  	rm -f /tmp/wait
   5.170  }
   5.171  
   5.172 @@ -465,12 +543,13 @@
   5.173  miss many of the failures that are detected by Memtest86.\n\n
   5.174  Please insert a blank disk in floppy drive.\n
   5.175  " 12 70
   5.176 -	[ $? -eq 0 ] && mkfloppy /media/cdrom/boot/memtest
   5.177 +	[ $? -eq 0 ] && gotcdfile memtest* && mkfloppy $file
   5.178  }
   5.179  
   5.180  pxe()
   5.181  {
   5.182 -	pxe=$(ls /media/cdrom/boot/?pxe)
   5.183 +	gotcdfile ?pxe
   5.184 +	pxe=$(ls $file)
   5.185  	$DIALOG --clear \
   5.186  		--title " Create $(basename $pxe).exe ? " \
   5.187  		--yes-label "Install" --yesno \
   5.188 @@ -494,7 +573,7 @@
   5.189  from the Web using PXE and HTTP protocols.\n\n
   5.190  Please insert a blank disk in floppy drive.\n
   5.191  " 12 70
   5.192 -	[ $? -eq 0 ] && mkfloppy /media/cdrom/boot/?pxe
   5.193 +	[ $? -eq 0 ] && gotcdfile ?pxe && mkfloppy $file
   5.194  }
   5.195  
   5.196  gotposixovl()
   5.197 @@ -508,11 +587,17 @@
   5.198  	[ "$(which $1)" ] && echo -en "\"$2\"	\"$3\""
   5.199  }
   5.200  
   5.201 +gotcdfile()
   5.202 +{
   5.203 +	for file in /media/cdrom/$1 /media/cdrom/*/$1 \
   5.204 +		    /media/cdrom/*/isolinux/$1 ; do
   5.205 +		[ -s $file ] && break
   5.206 +	done
   5.207 +}
   5.208 +
   5.209  cdfile()
   5.210  {
   5.211 -	for i in ${1//,/ }; do
   5.212 -		[ -s /media/cdrom/$i ] && echo -en "\"$2\"	\"$3\"" && break
   5.213 -	done
   5.214 +	gotcdfile "$1" && echo -en "\"$2\"	\"$3\""
   5.215  }
   5.216  
   5.217  cdfilex()
   5.218 @@ -522,7 +607,8 @@
   5.219  
   5.220  cdexe()
   5.221  {
   5.222 -	[ $(get 0 /media/cdrom/$1 2> /dev/null || echo 0) -eq 23117 ] &&
   5.223 +	gotcdfile "$1" &&
   5.224 +	[ $(get 0 $file 2>/dev/null || echo 0) -eq 23117 ] &&
   5.225  	echo -en "\"$2\"	\"$3\""
   5.226  }
   5.227  
   5.228 @@ -723,18 +809,21 @@
   5.229  	poweroff -f
   5.230  }
   5.231  
   5.232 -runmemtest()
   5.233 +dokexec()
   5.234  {
   5.235 -	kexec -l /media/cdrom/boot/memtest
   5.236 +	kexec -l $file
   5.237  	dosync
   5.238  	kexec -e
   5.239  }
   5.240  
   5.241 +runmemtest()
   5.242 +{
   5.243 +	gotcdfile memtest* && dokexec
   5.244 +}
   5.245 +
   5.246  runpxe()
   5.247  {
   5.248 -	kexec -l /media/cdrom/boot/?pxe
   5.249 -	dosync
   5.250 -	kexec -e
   5.251 +	gotcdfile ?pxe && dokexec
   5.252  }
   5.253  
   5.254  shell()
   5.255 @@ -744,9 +833,9 @@
   5.256  
   5.257  BIN=bin/mount.posixovl
   5.258  [ -x /usr/s$BIN ] || mv /bin/mount.posixovl.iso2exe \
   5.259 -/usr/s$BIN 2> /dev/null || mv /bin/mount.posixovl.iso2exe /$BIN
   5.260 +/usr/s$BIN 2> /dev/null || mv /bin/mount.posixovl.iso2exe /$BIN 2> /dev/null
   5.261  mount_proc
   5.262 -ISO="$(getarg iso | sed 's/.://;s|\\|/|g')"
   5.263 +ISO="$(getarg bootfrom | sed 's/.://;s|\\|/|g')"
   5.264  getiso
   5.265  mount_loram
   5.266  case "${ISO##*/}$(getarg mode)" in
   5.267 @@ -754,7 +843,7 @@
   5.268  *live*|*LIVE*)		live ;;
   5.269  *text*|*TEXT*)		text ;;
   5.270  esac
   5.271 -which $DIALOG 2> /dev/null || live
   5.272 +which $DIALOG 2> /dev/null || DIALOG=tinydialog
   5.273  dmesg > /tmp/dmesg
   5.274  
   5.275  while true; do
   5.276 @@ -762,14 +851,15 @@
   5.277  	locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2> /dev/null)"
   5.278  	cat > /tmp/dialog <<EOT
   5.279  $DIALOG  --clear \
   5.280 -	--title " Welcome to SliTaz " \
   5.281 +	--title " Welcome to Linux " \
   5.282  	--menu "" 23 70 17 \
   5.283 -$(xfile tazkeymap	"tazkeymap"	"Select keyboard ($keymap)") \
   5.284 -$(xfile tazlocale	"tazlocale"	"Select locale ($locale)") \
   5.285 -$(cdfile boot/bzImage	"live"		"SliTaz RAM boot") \
   5.286 -			"text"		"SliTaz RAM boot (text mode only)" \
   5.287 -$(cdfile README		"readme"	"Show the README file") \
   5.288 +$(xfile tazkeymap	"tazkeymap"	"Select keyboard (${keymap:-none})") \
   5.289 +$(xfile tazlocale	"tazlocale"	"Select locale (${locale:-none})") \
   5.290 +$(cdfile boot/bzImage	"live"		"Linux RAM boot (full desktop)") \
   5.291 +			"text"		"Linux RAM boot" \
   5.292 +$(cdfile README*	"readme"	"Show the README file") \
   5.293  $(cdfile md5sum*	"md5"		"Check ISO files") \
   5.294 +$(cdfile sha*sum*	"sha"		"Check ISO files") \
   5.295  $(gotposixovl		"install"	"Hard disk installation (UMSDOS way)") \
   5.296  $(gotposixovl		"installtaz"	"Hard disk installation (TAZUSB way)") \
   5.297  $(xfile tazusb		"usbkey"	"USB key read/write installation") \
   5.298 @@ -777,14 +867,12 @@
   5.299  $(fddata		"fdbootstrap"	"Create a floppy bootstrap") \
   5.300  $(cdfile boot/bzImage	"tazboot"	"Get tazboot.exe Linux loader") \
   5.301  $(cdexe boot/bzImage	"bzimage"	"Get linux DOS/EXE file") \
   5.302 -$(cdexe boot/memtest	"memtest"	"Get Memtest86 DOS/EXE file") \
   5.303 -$(cdfile boot/memtest,boot/isolinux/memtest \
   5.304 -			"fdmemtest"	"Create a Memtest86 boot floppy") \
   5.305 -$(cdfilex boot/memtest,boot/isolinux/memtest \
   5.306 -			"runmemtest"	"Start Memtest86") \
   5.307 -$(cdexe boot/?pxe	"pxe"		"Get SliTaz Web boot DOS/EXE utility") \
   5.308 -$(cdfile boot/?pxe	"fdpxe"		"Create a SliTaz Web boot floppy") \
   5.309 -$(cdfilex boot/?pxe	"runpxe"	"Start the SliTaz Web boot utility") \
   5.310 +$(cdexe memtest*	"memtest"	"Get Memtest86 DOS/EXE file") \
   5.311 +$(cdfile memtest*	"fdmemtest"	"Create a Memtest86 boot floppy") \
   5.312 +$(cdfilex memtest*	"runmemtest"	"Start Memtest86") \
   5.313 +$(cdexe ?pxe		"pxe"		"Get SliTaz Web boot DOS/EXE utility") \
   5.314 +$(cdfile ?pxe		"fdpxe"		"Create a SliTaz Web boot floppy") \
   5.315 +$(cdfilex ?pxe		"runpxe"	"Start the SliTaz Web boot utility") \
   5.316  $(xfile reboot		"restart"	"Restart the computer") \
   5.317  $(xfile poweroff	"stop"		"Power off") \
   5.318  			"bootlog"	"Linux boot messages" \
   5.319 @@ -792,7 +880,7 @@
   5.320  
   5.321  EOT
   5.322  	exec 3>&1
   5.323 -	value=$(sh /tmp/dialog 2>&1 1>&3)
   5.324 +	value=$(. /tmp/dialog 2>&1 1>&3)
   5.325  	retval=$?
   5.326  	exec 3>&-
   5.327  	[ $retval -eq 0 ] || continue
     6.1 --- a/syslinux/stuff/iso2exe/iso2exe.c	Wed Dec 31 11:31:10 2014 -0500
     6.2 +++ b/syslinux/stuff/iso2exe/iso2exe.c	Thu Jan 01 22:09:19 2015 +0100
     6.3 @@ -12,7 +12,7 @@
     6.4  #include "iso2exe.h"
     6.5  
     6.6  static int fd, forced, status = 1;
     6.7 -static char tazlitoinfo[10*1024];
     6.8 +static char tazlitoinfo[0x8000U - BOOTISOSZ];
     6.9  #define buffer tazlitoinfo
    6.10  #define BUFFERSZ 2048
    6.11  #define WORD(n)	* (unsigned short *) (n)
    6.12 @@ -31,7 +31,7 @@
    6.13  {
    6.14  #define heads 64
    6.15  #define sectors 32
    6.16 -#define partition 446
    6.17 +#define partition (446+16)
    6.18  #define trksz (512UL * heads * sectors)
    6.19  	unsigned long size, catalog, lba;
    6.20  	int cylinders, i, j, isohybrid;
    6.21 @@ -69,14 +69,23 @@
    6.22  		LONG(bootiso + isohybrid + 440) = rand();
    6.23  		LONG(bootiso + isohybrid + partition) = 0x10080UL;
    6.24  		WORD(bootiso + isohybrid + 510) = 0xAA55U;
    6.25 +#if 0
    6.26  		size = lseek(fd, 0UL, SEEK_END);
    6.27 -		cylinders = (size + trksz - 1) / trksz;
    6.28 +		size += 0x000FFFFFUL;
    6.29 +		size &= 0xFFF00000UL;
    6.30 +#else
    6.31 +		for (size = 0x000FFFFFUL; /* 1M - 1 */
    6.32 +		     read(fd, tazlitoinfo, 1024) == 1024;
    6.33 +		     size += 1024);
    6.34 +		size &= 0xFFF00000UL; /* round */    
    6.35 +#endif
    6.36 +		cylinders = (size >> 20) - 1;
    6.37  		bootiso[isohybrid + partition + 4] = 23; /* "Windows hidden IFS" */
    6.38  		bootiso[isohybrid + partition + 5] = heads - 1;
    6.39 -		bootiso[isohybrid + partition + 6] = (((cylinders - 1) & 0x300) >> 2) + sectors;
    6.40 -		bootiso[isohybrid + partition + 7] = (cylinders - 1) & 0xFF;
    6.41 +		bootiso[isohybrid + partition + 6] = ((cylinders & 0x300) >> 2) + sectors;
    6.42 +		bootiso[isohybrid + partition + 7] = cylinders & 0xFF;
    6.43  		LONG(bootiso + isohybrid + partition + 8) = 0;
    6.44 -		LONG(bootiso + isohybrid + partition + 12) = cylinders * sectors * heads;
    6.45 +		LONG(bootiso + isohybrid + partition + 12) = (size >> 9);
    6.46  
    6.47  		/* Copy the partition table */
    6.48  		memcpy(bootiso + 0x1BE, bootiso + isohybrid + 0x1BE, 66);
    6.49 @@ -93,8 +102,7 @@
    6.50  	n = (bootiso[69] + 1) * 512;
    6.51  	lseek(fd, 0UL, SEEK_SET);
    6.52  	write(fd, bootiso, n); /* EXE/PE + isohybrid mbr */
    6.53 -	write(fd, tazlitoinfo, ((0x8000U - BOOTISOSZ) > sizeof(tazlitoinfo)) 
    6.54 -		? sizeof(tazlitoinfo) : (0x8000U - BOOTISOSZ));
    6.55 +	write(fd, tazlitoinfo, sizeof(tazlitoinfo));
    6.56  	write(fd, bootiso + n, BOOTISOSZ - n); /* COM + rootfs + EXE/DOS */
    6.57  
    6.58  	/* Compute the checksum */
     7.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Wed Dec 31 11:31:10 2014 -0500
     7.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Thu Jan 01 22:09:19 2015 +0100
     7.3 @@ -20,7 +20,11 @@
     7.4  
     7.5  compress()
     7.6  {
     7.7 -	if [ "$(which xz 2> /dev/null)" ]; then
     7.8 +	if [ "$1" ]; then
     7.9 +		gzip -9 > $1
    7.10 +		[ "$(which advdef 2> /dev/null)" ] &&
    7.11 +		advdef -z4 $1 > /dev/null
    7.12 +	elif [ "$(which xz 2> /dev/null)" ]; then
    7.13  		xz -z -e --format=lzma --lzma1=mode=normal --stdout
    7.14  	else
    7.15  		lzma e -si -so
    7.16 @@ -33,12 +37,16 @@
    7.17  	mkdir -p $TMP/bin $TMP/dev
    7.18  	cp -a /dev/?d?* /dev/tty /dev/tty0 $TMP/dev
    7.19  	$0 --get init > $TMP/init.exe
    7.20 -	grep -q mount.posixovl.iso2exe $TMP/init.exe &&
    7.21 -	cp /usr/sbin/mount.posixovl $TMP/bin/mount.posixovl.iso2exe \
    7.22 -		2> /dev/null && echo "Store mount.posixovl ($(wc -c \
    7.23 -			< /usr/sbin/mount.posixovl) bytes) ..."
    7.24 +#	mount -o loop,ro $1 $TMP
    7.25 +#	oldslitaz="$(ls $TMP/boot/isolinux/splash.lss 2> /dev/null)"
    7.26 +#	umount -d $TMP
    7.27 +#	[ "$oldslitaz" ] && # for SliTaz <= 3.0 only...
    7.28 +#	grep -q mount.posixovl.iso2exe $TMP/init.exe &&
    7.29 +#	cp /usr/sbin/mount.posixovl $TMP/bin/mount.posixovl.iso2exe \
    7.30 +#		2> /dev/null && echo "Store mount.posixovl ($(wc -c \
    7.31 +#			< /usr/sbin/mount.posixovl) bytes) ..."
    7.32  	find $TMP -type f -print0 | xargs -0 chmod +x
    7.33 -	( cd $TMP ; find * | cpio -o -H newc ) | compress > $TMP/rootfs.gz
    7.34 +	( cd $TMP ; find * | cpio -o -H newc ) | compress $TMP/rootfs.gz
    7.35  	SIZE=$(wc -c < $TMP/rootfs.gz)
    7.36  	store 24 $SIZE $1
    7.37  	OFS=$(( $OFS - $SIZE ))
    7.38 @@ -66,7 +74,6 @@
    7.39  
    7.40  add_win32exe()
    7.41  {
    7.42 -	ddq if=/tmp/exe$$ of=$1 conv=notrunc
    7.43  	SIZE=$($0 --get win32.exe 2> /dev/null | tee /tmp/exe$$ | wc -c)
    7.44  	printf "Adding WIN32 file at %04X (%d bytes) ...\n" 0 $SIZE
    7.45  	ddq if=/tmp/exe$$ of=$1 conv=notrunc
    7.46 @@ -209,7 +216,7 @@
    7.47  	esac
    7.48  	case "$(get 0 $1)" in
    7.49  	23117)	echo "The file $1 is already an EXE file." 1>&2 && exit 1;;
    7.50 -	0)	[ -x /usr/bin/isohybrid ] && isohybrid $1 && echo "Do isohybrid"
    7.51 +	0)	$0 --get isohdpfx.bin | ddq bs=512 count=1 of=$1 conv=notrunc
    7.52  	esac
    7.53  		
    7.54  	echo "Read hybrid & tazlito data..."
     8.1 --- a/syslinux/stuff/iso2exe/iso9660.c	Wed Dec 31 11:31:10 2014 -0500
     8.2 +++ b/syslinux/stuff/iso2exe/iso9660.c	Thu Jan 01 22:09:19 2015 +0100
     8.3 @@ -1,11 +1,14 @@
     8.4  #include <sys/types.h>
     8.5  #include <fcntl.h>
     8.6  #include <stdio.h>
     8.7 +#include <string.h>
     8.8  #include "iso9660.h"
     8.9  #define __ROCKRIDGE
    8.10 +#ifdef __AS386_16__
    8.11  #asm
    8.12  		use16	86
    8.13  #endasm
    8.14 +#endif
    8.15  
    8.16  char *isofilename;
    8.17  unsigned long isofileofs, isofilesize;
    8.18 @@ -69,7 +72,7 @@
    8.19  		dirsize = isodirsize;
    8.20  		pos = SECTORSZ;
    8.21  	}
    8.22 -	if (pos >= SECTORSZ) {
    8.23 +	if (pos >= SECTORSZ || * (short *) (buffer + pos) == 0) {
    8.24  		if (dirsize < SECTORSZ) return -1;
    8.25  		readsector(dirofs);
    8.26  		dirofs += SECTORSZ;
    8.27 @@ -124,6 +127,9 @@
    8.28  	return 0;
    8.29  }
    8.30  
    8.31 +#ifndef __AS386_16__
    8.32 +#define cpuhaslm()	(0)
    8.33 +#else
    8.34  static int cpuhaslm(void)
    8.35  {
    8.36  #asm
    8.37 @@ -164,6 +170,7 @@
    8.38  not386:
    8.39  #endasm
    8.40  }
    8.41 +#endif
    8.42  
    8.43  #define IS_DIR(x)( ((x) & ~0777) == 040000)
    8.44  int isoopen(char *filename)
    8.45 @@ -187,7 +194,7 @@
    8.46  			char *n = name, *i = isofilename;
    8.47  			if (_64bits) {
    8.48  				int len = strlen(name);
    8.49 -				if (strncmp(name, isofilename), len) continue;
    8.50 +				if (strncmp(name, isofilename, len)) continue;
    8.51  				n = "64";
    8.52  				i += len;
    8.53  			}