# HG changeset patch # User Pascal Bellard # Date 1355575431 -3600 # Node ID 58b695f73790b20efb7b7f87806e31535f581d8c # Parent db0eb389448cc077d984ce7c9c839a12e30f4912 syslinux/iso2exe: only DOS 3, 4 and 6 supported :-/ diff -r db0eb389448c -r 58b695f73790 syslinux/stuff/iso2exe/README --- a/syslinux/stuff/iso2exe/README Fri Dec 14 22:52:32 2012 +0000 +++ b/syslinux/stuff/iso2exe/README Sat Dec 15 13:43:51 2012 +0100 @@ -18,7 +18,7 @@ - to start SliTaz in RAM (live) in graphics mode or text mode. - to install SliTaz "a la UMSDOS" in the \slitaz\ subdirectory. The easiest - way install to SliTaz. No partitioning. No questions. + way to install SliTaz. No partitioning. No questions. Usage: @@ -69,7 +69,9 @@ Limitations: -- Real mode support only. VM86 is not (yet?) supported. +- Only DOS 3, 4 and 6 supported. Checked with http://www.allbootdisks.com/ + +- Real mode support only. VM86 is not supported. - Image/zImage format not supported, bzImage only. Can't boot memtest or gpxe. diff -r db0eb389448c -r 58b695f73790 syslinux/stuff/iso2exe/bootiso.S --- a/syslinux/stuff/iso2exe/bootiso.S Fri Dec 14 22:52:32 2012 +0000 +++ b/syslinux/stuff/iso2exe/bootiso.S Sat Dec 15 13:43:51 2012 +0100 @@ -44,19 +44,25 @@ pushf pushw %ds pushw %es - pushw $0 - popw %ds call setreg rep movsw ljmp $0, $0x0600+start2 +readsector2: + incw %cx +readsector1: + movw %cx, (%bx) + incw %cx + movw $0x201, %ax + int $0x13 setreg: cld - pushw %ds - popw %es - movw $0x7C00, %si - movw %si, %bx + xorw %bx, %bx // Clear C + movw %bx, %ds + movw %bx, %es + movb $0x7C, %bh + movw %bx, %si movw $0x0600, %di movw $0x0100, %cx return: @@ -64,29 +70,26 @@ start2: movw $0x80, %dx dxloop: - movw $1, %cx - movw $0x201, %ax - int $0x13 - jc next - call setreg + call readsector1 repe cmpsw je dxfound next: - addb $0x7D, %dl // try every hard disk - andb $0x83, %dl // and floppy disk - cmpb $0x80, %dl + xorw %cx, %cx + xchgw %ax, %dx + addb $0x7D, %al // try every hard disk + andb $0x83, %al // and floppy disk + cmpb $0x80, %al + xchgw %ax, %dx jnz dxloop fail: int $0x19 dxfound: movw %dx, 10(%bp) - movb $2, %cl // %ch = 0 - movw $0x201, %ax - int $0x13 - jc fail - cmpw $0xAA55, 0x7DFE - jne fail + call readsector2 + lodsw + decw %ax + jz fail // read fail or not isohydrid popw %es popw %ds popf @@ -104,17 +107,18 @@ rmPaging: .ascii "Broken paging$" ERRvcpi: - .ascii "No VCPI 4.0+$" + .ascii "No EMM386/VCPI 4.0+$" chkerr: - .ascii "Broken ISO$" + .ascii "Broken ISO file$" realmodemsg: .ascii "Real mode$" vm86modemsg: .ascii "VM86 mode$" help: - .ascii "SliTaz GNU/Linux bootloader$" + .ascii "SliTaz GNU/Linux boot loader$" fixseg: + cld movb $EXESTR(help), %dl movw $0x100, %si cmpw $0x3F2F, -126(%si) # /? @@ -133,21 +137,21 @@ skip: pushf popw %ax - movw $0xF0F0, %cx - orb %ah, %ch + movw $0xF0F0, %dx + orb %ah, %dh andb $0xF, %ah pushw %ax popf pushf popw %ax - andb %cl, %ah - cmp %cl, %ah + andb %dl, %ah + cmp %dl, %ah je NotSupported // 8086 family - pushw %cx + pushw %dx popf pushf popw %ax - andb %cl, %ah + andb %dl, %ah jnz is386 // 80286 family NotSupported: movb $EXESTR(no386), %dl @@ -162,24 +166,19 @@ ret is386: - movb $0x30, %ah - int $0x21 - cmpb $3, %al - movb $EXESTR(noDOS3), %dl - jb abort movl %cr0, %eax andb $1, %al jne tstvcpi movb $EXESTR(rmPaging), %dl shll $1, %eax +cabort: jc abort movb $EXESTR(realmodemsg), %dl jmp realmode tstvcpi: pushw %ds - pushw $0 - popw %ds + movw %cx, %ds // %cx = 0 movw 0x67*4+2, %ds std movw $14, %si @@ -190,7 +189,6 @@ popw %ds NoVCPI: movb $EXESTR(ERRvcpi), %dl -goabort: jne abort shll $8, %eax cmpl $0x4D4D4500, %eax // [XQ]MME @@ -215,8 +213,12 @@ movb $EXESTR(vm86modemsg), %dl realmode: call puts + movb $0x30, %ah + int $0x21 + cmpb $3, %al + movb $EXESTR(noDOS3), %dl + jb cabort movw EXEADRS(comstart), %ax // .com address - cld movw $moveend-move, %cx movw $EXEADRS(move), %si movw $0xC000, %di diff -r db0eb389448c -r 58b695f73790 syslinux/stuff/iso2exe/bootlinux.c --- a/syslinux/stuff/iso2exe/bootlinux.c Fri Dec 14 22:52:32 2012 +0000 +++ b/syslinux/stuff/iso2exe/bootlinux.c Sat Dec 15 13:43:51 2012 +0100 @@ -88,12 +88,29 @@ #endasm } +static int versiondos; +static int dosversion(void) +{ +#asm + mov ah, #0x30 + int 0x21 + cbw + mov _versiondos, ax +#endasm +} + static void load(struct mem *p, unsigned long size) { if (vm86()) die("Need real mode"); switch (p->align) { case 0: // kernel + switch (dosversion()) { + case 3: case 4: case 6: break; + default: + printf("DOS %d not supported.\nTrying anyway...\n", + versiondos); + } p->align = 4096; break; case 4096: // first initrd diff -r db0eb389448c -r 58b695f73790 syslinux/stuff/iso2exe/init --- a/syslinux/stuff/iso2exe/init Fri Dec 14 22:52:32 2012 +0000 +++ b/syslinux/stuff/iso2exe/init Sat Dec 15 13:43:51 2012 +0100 @@ -4,7 +4,7 @@ get() { - od -j $1 -N ${3:-4} -t u${3:-4} -An $2 + od -j $1 -N ${3:-2} -t u${3:-2} -An $2 } getarg() @@ -15,8 +15,8 @@ gettazboot() { echo "Creating $(basename $1) ..." - O=$(($(get 34 /mnt/$ISO 2) - 0xE0)) - L=$((0x8000 - $(get 28 /mnt/$ISO 2) - $O)) + O=$(($(get 34 /mnt/$ISO) - 0xE0)) + L=$((0x8000 - $(get 28 /mnt/$ISO) - $O)) S=$((32+$L)) P=$((($S+511)/512)) E=$((4096-(32*$P))) @@ -30,7 +30,7 @@ checkmagic() { - [ -s $1 ] && [ $(getarg magic) == $(get 28 $1) ] + [ -s $1 ] && [ $(getarg magic) == $(get 28 $1 4) ] } getiso() @@ -52,7 +52,7 @@ uncpio() { echo "Extracting $(basename $1) ..." - case $(get 0 $1 2) in + case $(get 0 $1) in *35615) zcat $1 ;; *\ 93) unlzma -c $1 ;; *) cat $1 ;; @@ -291,11 +291,11 @@ Please plug your USB stick in now.\n " 18 70 [ $? -eq 0 ] || return + sleep 5 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 to its known size.\n\n" \ @@ -312,11 +312,11 @@ --title " Select the filesystem " \ --menu "\nPlease select the filesystem type to create.\n\n\ The filesystem creation will erase all the data \ -on the USB key." 14 70 4 \ +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" \ + "fat32" "Windows FAT32 filesystem" \ 2>&1 1>&3` retval=$? exec 3>&-