What's wrong with the zImage?

Robert de Bath (rd103891@mayday.cix.co.uk)
Sat, 29 Nov 1997 17:21:01 +0000 (GMT)


I've been writing a program including a linux kernel loader on and off
for a little while now and I can _successfully_ load a bzImage with
command line and ramdisk.

BUT I ALWAYS GET CRC ERRORS WITH ZIMAGE!

Almost all the code is identical with the bzImage loader but that works
and this fails.

I load the first (file[497]+1) sectors at 9000:0000 then the rest of the
image file at 1Mb for bzimage and 64k for zImage.

I load the command line at 9000:4000.

No ramdisk this time.

Then for zImages ...

Do read back and do a crc check of the data loaded at 9000:0000 and
1000:0000 print this on the screen - it's exactly the same as the crc of
the zImage file calculated from the CD.

Open the A20 gate.

Then ...

__set_es(0x9000);

/* Save pointer to command line */
if( has_command_line )
{
__doke_es(0x0020, 0xA33F);
__doke_es(0x0022, COMMAND_LINE_POS);
}

if( !is_zimage )
__poke_es(0x210, 0xFF); /* Patch setup to deactivate safety switch */

/* Default boot drive is auto-detected floppy */
if( __peek_es(508) == 0 ) __poke_es(508, 0x200);

/* Finally do the deed */
{
#asm
! Kill the floppy motor, needed in case the kernel has no floppy driver.
mov dx,#0x3f2
xor al, al
outb

! Setup required registers and go ...
mov ax,$9000
mov bx,$4000-12
mov es,ax
mov fs,ax
mov gs,ax
mov ds,ax
mov ss,ax
mov sp,bx
jmpi 0,$9020 ! Note SETUPSEG NOT INITSEG
#endasm
}
}

The 'Decompressing' message appears followed by a reasonable number of dots
then 'crc error'. The zImage boots ok when put on a bare floppy and I've
tryed it with several kernel versions.

So WTF am I missing!
Why does bzImage work but zImage fail!!
Please say there's something stupidly obvious!!!
This is driving me batty!!!!

-- 
Rob.                           (Robert de Bath <http://www.cix.co.uk/~mayday>)
                                                 <http://poboxes.com/rdebath>