# HG changeset patch # User Pascal Bellard # Date 1355496192 -3600 # Node ID d47403fdd90003d50f58ef648a509dc3f6a9d16c # Parent 34ea786c65bfa323fa642e172a3b37e62af1ee7b syslinux/iso2exe: menu can create usbkey/floppy diff -r 34ea786c65bf -r d47403fdd900 syslinux/stuff/iso2exe/README --- a/syslinux/stuff/iso2exe/README Fri Dec 14 15:53:34 2012 +0000 +++ b/syslinux/stuff/iso2exe/README Fri Dec 14 15:43:12 2012 +0100 @@ -1,3 +1,5 @@ +(c) GPLv2, Pascal Bellard + The iso2exe tool inserts a DOS .EXE header in an ISO image. The ISO image can be launched by DOS : @@ -8,14 +10,14 @@ Why ? According to the SliTaz forum, some new users have problems burning CD-ROMs, -creating USB Keys and booting these devices with the BIOS. Others are lost +creating USB Keys and booting these devices with the BIOS. Others are lost during the installation process or partitioning. The slitaz.exe program boots the SliTaz ISO image with a text menu: - to start SliTaz in RAM (live) in graphics mode or text mode. -- to install SliTaz "a la UMSDOS" in the \slitaz\ subdirectory. The simplest +- to install SliTaz "a la UMSDOS" in the \slitaz\ subdirectory. The easiest way install to SliTaz. No partitioning. No questions. @@ -25,12 +27,12 @@ Default mode is menu. Mode can be: -- menu start with an interactive menu -- live launch SliTaz in RAM with graphics -- text launch SliTaz in RAM with text mode -- install SliTaz UMSDOS like installation +- menu start with an interactive menu +- live launch SliTaz in RAM with graphics +- text launch SliTaz in RAM with text mode +- install SliTaz UMSDOS like installation -If the program name includes one of the supported modes; the according mode is +If the prognam name includes one of the supported modes, the according mode is assumed. Example 'C:\> slitazlive.exe' starts SliTaz in RAM with graphics. @@ -59,7 +61,7 @@ 1K +-----------------+ | isohybrid boot | Starts isolinux.bin 512 +-----------------+ - | iso2exe boot | Boot starts isohybrid (*), .EXE starts DOS .COM loader + | iso2exe boot | Boot starts isohybrid (*), .EXE starts DOS .COM loader 0 +-----------------+ * Eltorito boot (i.e. bootable CD-ROM by BIOS) is not concerned by iso2exe. @@ -77,7 +79,7 @@ - The DOS Linux loader and the ISO initramfs must fit in ~30Kb. - Old Linux kernels don't support multiple initramfs load. They will not - find the /init.exe file. As a workaround, you can add the "text" argument: + find the /init.exe file. Only the "text" mode will work: C:\> slitaz.exe text - The ISO image must include the files /boot/bzImage and /boot/rootfs*. diff -r 34ea786c65bf -r d47403fdd900 syslinux/stuff/iso2exe/boot.c --- a/syslinux/stuff/iso2exe/boot.c Fri Dec 14 15:53:34 2012 +0000 +++ b/syslinux/stuff/iso2exe/boot.c Fri Dec 14 15:43:12 2012 +0100 @@ -101,16 +101,13 @@ cmdfile = NULL; #asm push ds - push ds pop es - push cs - pop ds mov si, #0x82 mov di, #_args mov cx, #0x7E/2 rep + seg cs movsw - pop ds #endasm } } diff -r 34ea786c65bf -r d47403fdd900 syslinux/stuff/iso2exe/bootiso.S --- a/syslinux/stuff/iso2exe/bootiso.S Fri Dec 14 15:53:34 2012 +0000 +++ b/syslinux/stuff/iso2exe/bootiso.S Fri Dec 14 15:43:12 2012 +0100 @@ -30,7 +30,7 @@ end_header: chksum: - .long 0 + .word 0 comstart: .word 0 @@ -95,56 +95,68 @@ ////////////////////////////// DOS EXE code /////////////////////////////////// +eol: + .ascii ".\r\n$" no386: .ascii "No 386+$" noDOS3: .ascii "No DOS 3.0+$" rmPaging: - .ascii "Broken paging.$" + .ascii "Broken paging$" ERRvcpi: .ascii "No VCPI 4.0+$" chkerr: - .ascii "Broken ISO.$" + .ascii "Broken ISO$" realmodemsg: - .ascii "Real mode\r$" + .ascii "Real mode$" vm86modemsg: - .ascii "Vm86\r$" + .ascii "VM86 mode$" help: - .ascii "Linux kickstarter.\r\n$" + .ascii "SliTaz GNU/Linux bootloader$" + fixseg: -#if 1 movb $EXESTR(help), %dl - movw 0x82, %ax - cmpw $0x3F2F, %ax # /? + movw $0x100, %si + cmpw $0x3F2F, -126(%si) # /? je abort -#endif + movw (%si), %cx + jcxz skip + xorw %dx, %dx + movw $0x7FE0/2, %cx +chklp: + lodsw + addw %ax, %dx + loop chklp + orw %dx, %dx + movb $EXESTR(chkerr), %dl + jne abort +skip: pushf popw %ax movw $0xF0F0, %cx orb %ah, %ch andb $0xF, %ah - pushw %ax popf pushf popw %ax andb %cl, %ah - cmp %cl, %ah je NotSupported // 8086 family - pushw %cx popf pushf popw %ax andb %cl, %ah - jnz is386 // 80286 family NotSupported: movb $EXESTR(no386), %dl abort: puts: movb $1, %dh + call puts2 + movw $EXEADRS(eol), %dx +puts2: movb $9, %ah int $0x21 ret @@ -155,13 +167,13 @@ cmpb $3, %al movb $EXESTR(noDOS3), %dl jb abort - smsw %ax + movl %cr0, %eax andb $1, %al jne tstvcpi - movl %cr0, %eax movb $EXESTR(rmPaging), %dl shll $1, %eax jc abort + movb $EXESTR(realmodemsg), %dl jmp realmode tstvcpi: @@ -182,7 +194,6 @@ jne abort shll $8, %eax cmpl $0x4D4D4500, %eax // [XQ]MME -#if 1 movw $EXEADRS(CmdVCPI), %si ChkVCPI: jne NoVCPI @@ -191,55 +202,20 @@ je VersionVCPI int $0x67 jmp ChkVCPI + CmdVCPI: .byte 0x40 // status .byte 0xDE // vcpi present ? .byte 0x46 // version .byte 0 + VersionVCPI: cmpb $0x40, %al // >= 4.0 ? jb NoVCPI -#else - jne NoVCPI - movb $0x40, %ah // status - int $0x67 - testb %ah, %ah - jne NoVCPI - movb $0x46, %ah // version - int $0x67 - testb %ah, %ah - jne NoVCPI - cmpb $0x40, %al // >= 4.0 ? - jb NoVCPI - movw $0xDE00, %ax // vcpi present ? - int $0x67 - testb %ah, %ah - jne NoVCPI -#endif + movb $EXESTR(vm86modemsg), %dl realmode: - movw $0x100, %si - lodsl - xchgl %eax, %edx - orl %edx, %edx - jz skip - movw $0x7FDC/4, %cx -chklp: - lodsl - addl %eax, %edx - loop chklp - orl %edx, %edx - movb $EXESTR(chkerr), %dl - jne goabort -skip: - movb $EXESTR(realmodemsg), %dl - smsww %ax - andb $1, %al - jz isrealmode - movb $EXESTR(vm86modemsg), %dl -isrealmode: call puts movw EXEADRS(comstart), %ax // .com address - cld movw $moveend-move, %cx movw $EXEADRS(move), %si diff -r 34ea786c65bf -r d47403fdd900 syslinux/stuff/iso2exe/bootlinux.c --- a/syslinux/stuff/iso2exe/bootlinux.c Fri Dec 14 15:53:34 2012 +0000 +++ b/syslinux/stuff/iso2exe/bootlinux.c Fri Dec 14 15:43:12 2012 +0100 @@ -162,17 +162,23 @@ xor si, si xor di, di rep - movsw + movsw // move 64K data push es pop ds push es pop ss + mov ch, #0x70 + mov es, cx + mov ch, #0x80 + rep + seg cs + movsw // move 64K code popa - jmpi relocated, #0x8000 + jmpi relocated, #0x7000 relocated: #endasm kernelmem.base = 0x10000; - if (syssize > 0x70000) + if (syssize > 0x60000) /* 384K max */ #endif die("Not a bzImage format"); } diff -r 34ea786c65bf -r d47403fdd900 syslinux/stuff/iso2exe/init --- a/syslinux/stuff/iso2exe/init Fri Dec 14 15:53:34 2012 +0000 +++ b/syslinux/stuff/iso2exe/init Fri Dec 14 15:43:12 2012 +0100 @@ -15,7 +15,7 @@ gettazboot() { echo "Creating $(basename $1) ..." - O=$(($(get 36 /mnt/$ISO 2) - 0xE0)) + O=$(($(get 34 /mnt/$ISO 2) - 0xE0)) L=$((0x8000 - $(get 28 /mnt/$ISO 2) - $O)) S=$((32+$L)) P=$((($S+511)/512)) @@ -157,7 +157,7 @@ You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n To uninstall SliTaz, you have only to remove this directory. The file \\boot.ini or \\config.sys may be modified too.\n\n -To do a traditional installation with disk partitioning - +To do a traditional installation with disk partitioning, start SliTaz Live with 'SliTaz RAM boot' menu.\n " 16 70 [ $? -eq 0 -a -x /usr/sbin/mount.posixovl ] || return @@ -172,7 +172,7 @@ --title " SliTaz bootloader for DOS " \ --yes-label "Install" --yesno \ "\nThe file TAZBOOT.EXE will be created in the top directory. It supports -a bzImage linux kernel, multiple initramfs', a kernel command line and +a bzImage linux kernel, multiple initramfs, a kernel command line and an ISO image file loopback (retrieves files from an ISO file).\n\n Usage: tazboot.exe [[@commands]|[kernel=] [initrd=[,...]] [iso=] cmdline args ...]\n\n @@ -189,6 +189,142 @@ gettazboot /mnt/tazboot.exe } +md5() +{ + ( cd /media/cdrom ; md5sum -c md5sum ) | tee /tmp/data + $DIALOG --clear \ + --title " Checked files " \ + --textbox /tmp/data 24 78 + rm -f /tmp/data +} + +readme() +{ + $DIALOG --clear \ + --title " Readme " \ + --textbox /media/cdrom/README 24 78 +} + +bootlog() +{ + $DIALOG --clear \ + --title " Linux boot messages " \ + --textbox /tmp/dmesg 24 78 +} + +memtest() +{ + $DIALOG --clear \ + --title " Memtest86 " \ + --yes-label "Install" --yesno \ +"\nMemtest86 is a thorough, stand alone memory test for x86 architecture +computers. BIOS based memory tests are a quick, cursory check and often +miss many of the failures that are detected by Memtest86.\n +" 12 70 + [ $? -eq 0 ] || return + cp /media/cdrom/boot/memtest /mnt +} + +fdmemtest() +{ + $DIALOG --clear \ + --title " Create a Memtest86 boot floppy " \ + --yes-label "Create floppy" --yesno \ +"\nMemtest86 is a thorough, stand alone memory test for x86 architecture +computers. BIOS based memory tests are a quick, cursory check and often +miss many of the failures that are detected by Memtest86.\n\n +Please insert a blank disk in floppy drive.\n +" 12 70 + [ $? -eq 0 ] || return + dd if=/media/cdrom/boot/memtest of=/dev/fd0 +} + +gpxe() +{ + $DIALOG --clear \ + --title " SliTaz Web boot " \ + --yes-label "Install" --yesno \ +"\nBoot your operating system from the internet and enjoy a full system +working entirely in RAM with speed and stability in mind. The Linux Kernel +and the complete SliTaz compressed root filesystem will be loaded into RAM +from the Web using PXE and HTTP protocols.\n +" 12 70 + [ $? -eq 0 ] || return + cp /media/cdrom/boot/gpxe /mnt +} + +fdgpxe() +{ + $DIALOG --clear \ + --title " Create a SliTaz Web boot floppy " \ + --yes-label "Create floppy" --yesno \ +"\nBoot your operating system from the internet and enjoy a full system +working entirely in RAM with speed and stability in mind. The Linux Kernel +and the complete SliTaz compressed root filesystem will be loaded into RAM +from the Web using PXE and HTTP protocols.\n\n +Please insert a blank disk in floppy drive.\n +" 12 70 + [ $? -eq 0 ] || return + dd if=/media/cdrom/boot/gpxe of=/dev/fd0 +} + +cdfile() +{ + [ -s /media/cdrom/$1 ] && echo -en "$2 ${3// /.}" +} + +usbkey() +{ + $DIALOG --clear \ + --title " Create a SliTaz USB key " \ + --yes-label "Continue" --yesno \ +"\nUnlike a hard drive install, the filesystem is kept in a compressed +rootfs.gz. The filesystem is loaded entirely into memory upon boot. +This should increase responsiveness, protect the filesystem against +accidental corruption and reduce read/writes to the USB drive. +Once setup, the tazusb utility can rewrite the root filesystem +with any changes you have made since booting up, +giving the effective benefits of a hard drive install.\n\n +/home is mounted on boot using the UUID of your particular flash drive. +Unlike a device name, the UUID has the benefit of never changing from machine +to machine.\n\n +Please plug your USB stick in now.\n +" 18 70 + [ $? -eq 0 ] || return + DEV="$(grep -l 1 /sys/block/*/removable | \ + sed 's|/sys/block/\(.*\)/removable|\1|')" + [ -n "$DEV" ] || return + exec 3>&1 + sleep 5 + device=`$DIALOG --clear \ + --title " Select your USB key " \ + --menu "\nPlease select the USB key according its known size.\n\n" \ + 14 70 4 \ + $(for i in $DEV ; do + echo "/dev/$i $(( $(cat /sys/block/$i/size) / 1024 ))MB" + done) \ + 2>&1 1>&3` + retval=$? + exec 3>&- + [ $retval -eq 0 ] || continue + exec 3>&1 + format=`$DIALOG --clear \ + --title " Select the filesystem " \ + --menu "\nPlease select the filesystem type to create.\n\n\ +The filesystem creation will erase all the datas \ +in the USB key." 14 70 4 \ + "none" "Do not erase the USB key" \ + "ext3" "Ext3 journaling filesystem" \ + "ext2" "Ext2 filesystem" \ + "fat32" "Window FAT32 filesystem" \ + 2>&1 1>&3` + retval=$? + exec 3>&- + [ $retval -eq 0 ] || continue + [ "$format" != "none" ] && tazusb format $device "SliTaz" $format + tazusb gen-iso2usb /mnt/$ISO $device +} + text() { umount -d /media/cdrom @@ -220,9 +356,15 @@ /sbin/poweroff -f } +shell() +{ + /sbin/getty -n -l /bin/ash 38400 tty1 +} + [ -x /usr/sbin/mount.posixovl ] || mv /usr/sbin/mount.posixovl.iso2exe /usr/sbin/mount.posixovl mount -t proc /proc /proc +dmesg > /tmp/dmesg ISO="$(getarg iso | sed 's/.://;s|\\|/|g')" getiso case "$(basename $ISO | tr [A-Z] [a-z])$(getarg mode)" in @@ -235,14 +377,22 @@ exec 3>&1 value=`$DIALOG --clear \ --title " Welcome to SliTaz " \ - --menu "\nPlease select" 15 70 7 \ - "live" "SliTaz RAM boot" \ - "text" "SliTaz RAM boot (text mode only)" \ - "install" "Hard disk installation" \ - "tazboot" "Get tazboot.exe Linux loader" \ - "reboot" "Restart the computer" \ - "poweroff" "Power off" \ - "ash" "Shell prompt" \ + --menu "\nPlease select" 17 70 9 \ + "live" "SliTaz RAM boot" \ + "text" "SliTaz RAM boot (text mode only)" \ +$(cdfile README "readme" "Show the README file") \ +$(cdfile md5sum "md5" "Check ISO files") \ + "install" "Hard disk installation" \ + "usbkey" "USB key installation" \ + "tazboot" "Get tazboot.exe Linux loader" \ +$(cdfile Xboot/memtest "memtest" "Get Memtest86") \ +$(cdfile boot/memtest "fdmemtest" "Create a Memtest86 boot floppy") \ +$(cdfile Xboot/gpxe "gpxe" "Get SliTaz Web boot utility") \ +$(cdfile boot/gpxe "fdgpxe" "Create a SliTaz Web boot floppy") \ + "reboot" "Restart the computer" \ + "poweroff" "Power off" \ + "bootlog" "Linux boot messages" \ + "shell" "Shell prompt" \ 2>&1 1>&3` retval=$? exec 3>&- diff -r 34ea786c65bf -r d47403fdd900 syslinux/stuff/iso2exe/iso2exe.sh --- a/syslinux/stuff/iso2exe/iso2exe.sh Fri Dec 14 15:53:34 2012 +0000 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Fri Dec 14 15:43:12 2012 +0100 @@ -66,8 +66,17 @@ OFS=$(( $OFS - $SIZE )) printf "Adding DOS boot file at %04X...\n" $OFS $0 --get lzcom.bin boot.com.lzma | ddq of=$1 bs=1 seek=$OFS conv=notrunc - store 36 $(($OFS+0xE0)) $1 + store 34 $(($OFS+0xE0)) $1 store 30 ${RANDOM:-0} $1 + i=34 + n=0 + echo -n "Adding checksum..." + while [ $i -lt 32768 ]; do + n=$(($n + $(od -j $i -N 2 -t u2 -An $1) )) + i=$(($i + 2)) + done + store 32 -$n $1 + echo " done." } main $@ <