[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#857597: "isolinux.bin missing or corrupt" when booting USB flash drive in old PC



Hi,

more update for Bug#857597:

Correcting the wrong stack address of sectors/head yielded progress
on David's old BIOS.
The MBR code now correctly addresses and loads the first 4 blocks of
boot image file /isolinux/isolinux.bin .

Nevertheless, the stack interface between MBR and loaded isolinux.bin
has a similar bug as the LBA-to-CHS conversion had in the MBR code.
So again, addressing fails when the code in block 0 to 3 of isolinux.bin
tries to load its blocks 4 to 79 via C/H/S addressing.

Failure symptom is this message:

  ISOLINUX 6.03 20150819 CHDDisolinux: Image checksum error, sorry...

Now a new MBR change by Martin Str|mberg is ready for testing, which adapts
the PUSH stack operations of the MBR code to the POP stack operations of
the isolinux.bin code.
(This makes the previous correction unnecessary, as the old wrong
 memory addresses become valid by the changed stack order.)

--------------------------------------------
diff --git a/mbr/isohdpfx.S b/mbr/isohdpfx.S
index 17e1efe..14eca14 100644
--- a/mbr/isohdpfx.S
+++ b/mbr/isohdpfx.S
@@ -151,7 +151,7 @@ next:
 
        /* Check to see if we have EBIOS */
        pushw   %dx             /* drive number */
-       movb    $0x41, %ah      /* %al == 0 already */
+       movb    $0x41, %ah
        movw    $0x55aa, %bx
        xorw    %cx, %cx
        xorb    %dh, %dh
@@ -167,20 +167,22 @@ next:
           read_sector_cbios: movb $0x42, %ah ;  jmp read_common */
        movl    $0xeb42b4+((read_common-read_sector_cbios-4) << 24), \
                (read_sector_cbios)
-       jmp     1f
+       jmp     2f
 1:
+       xor     %cx, %cx        /* Clear EBIOS flag. */
+2:     
        popw    %dx
        pushw   %cx             /* EBIOS flag */
 
        /* Get (C)HS geometry */
        movb    $0x08, %ah
        int     $0x13
-       andw    $0x3f, %cx      /* Sector count */
        popw    %bx             /* EBIOS flag */
-       pushw   %cx             /* -16: Save sectors on the stack */
        movzbw  %dh, %ax        /* dh = max head */
        incw    %ax             /* From 0-based max to count */
-       pushw   %ax             /* -18: Save heads on the stack */
+       pushw   %ax             /* -16: Save heads on the stack */
+       andw    $0x3f, %cx      /* Sector count */
+       pushw   %cx             /* -18: Save sectors on the stack */
        mulw    %cx             /* Heads*sectors -> sectors per cylinder */
 
        pushw   %bx             /* -20: EBIOS flag */
-----------------------------------------------------

The binary MBR code
  http://www.ludd.ltu.se/~ams/tmp/isohdpfx.bin.170324
is supposed to fix C/H/S addressing in Debian ISOs if copied to their
first block:

  iso=debian-8.7.1-i386-xfce-CD-1.iso

  dd conv=notrunc bs=1 count=432 if=isohdpfx.bin.170324 of="$iso"

The ISO then still boots for me by -hda of qemu-system-i386. But that's
not a C/H/S needy BIOS.

So please cross fingers everybody ...

-------------------------------------------------------------------------

The all-zero block content read by the buggy address conversion on David's
BIOS is explainable by the two possible disk geometries of the now known
conversion 8444 -> 1/6/3:
  H/C= 128  S/H= 63
  H/C= 195  S/H= 42
In both cases the wrongly computed sector numbers of 1/2/125 or 1/1/60
exceed the respective sectors/head parameters.
(Conversion hand computed. Bear with me.)

-------------------------------------------------------------------------

Have a nice day :)

Thomas


Reply to: