Subject: Re: Boot ROM hacking
To: None <M.Drochner@fz-juelich.de>
From: Andrew Gillham <gillhaa@ghost.whirlpool.com>
List: port-i386
Date: 12/21/1999 16:33:52
Matthias Drochner writes:
> 
> gillhaa@ghost.whirlpool.com said:
> > Has anyone here done much with 'netboot' ROMs?
> 
> A lot. Works well.

Cool!  What cards do you typically use?

> You could have a look at the header of the NCR BIOS extension
> and check which additional headers (PCI or PnP or whatever) it uses.

Actually I've discovered a few bits of info about this.  The BIOS on 
my machine (Award 4.51PG based) only attempts to load PCI expansion
ROMs (that are stuffed into the BIOS image) for mass-storage controllers
that it finds on the PCI bus.  e.g. I was able to rebuild a netboot.rom
with the vendor and device ID of my NCR SCSI controller, and when the
controller is in the box, the BIOS is activated.
I've also figured out that version of the Award CBROM utility I had was
too old.  (1.01 I think)  The latest I could find (2.01a) allows for
a '/isa image.rom' option, that loads ISA expansion ROMs.  Turns out
I couldn't get this to work for several reasons.  The early version
didn't implement it, and when I got the newer version I was attempting
to add a ROM with a PCI header, which the BIOS appears to ignore.
A netboot.rom built without '-DPCIROM' is easily installed in my
BIOS image with 'cbrom bios.bin /isa netboot.rom', and is correctly
installed/invoked.  Yeah!

My only problem is that the 'quit' feature doesn't seem to allow the
BIOS to continue with the normal boot path, so it won't boot a floppy
now. :(  So I need to pull the chip and re-flash it.  The trick of
using my NCR controller is actually pretty handy. :-)  I figure that
I will just temporarily add something like this to start_rom.S:
** Press <space> to BYPASS netboot. **

Initially I don't think a timeout facility matters, I can just press
something else to continue the netboot.  Eventually this feature might
be nice, perhaps looping for a few cycles while calling the BIOS 
"is a keystroke available" function, and then continueing if there is
no keystroke.  An option could be put into the Makefile so this could
be enabled/disabled or the test inverted. (e.g. press any key to
ACTIVATE netboot)

What do you think?

> > I created a 64K ROM
> 
> For expansion ROMs, this is too much in most cases. BIOSes
> tend to ignore ROMs they don't find space for.
> (You know, it must be within the ISA hole, even for PCI devs.)

Yeah, this is going to be a problem.  A 64K ROM size is sort of ideal
I guess, unless some sort of compression hack is used.  It would be nice
to have something like this:
|---------------|
| decompressor  |
| (xx K bytes)  |
|---------------|
| actual ROM    |
| or just raw   |
| code. gzip -9 |
| compressed.   |
|---------------|
(or bzip2)
Looking at the 'CREAD' code, it appears to be almost 20Kbytes!  This
leaves only about 12Kbytes for compressed code.  The current netboot.rom
I have compresses down to about 11.5K (no CREAD), so with the 20K overhead
of unzip support, I pretty much break even. (e.g. compression doesn't
buy me anything)  Unless there is some smaller (< X Kbytes) decompression
code available in assembler or something.

With an approximately 8KB decompressor, there would be 24K of compressed
space available, perhaps allowing 48K of code. (enough to have a ROM
with CREAD support, etc all in 32K)

Now a 64K ROM would have 56K available for perhaps 100K of code!  Enough
for most supported network drivers, etc.  I'm not sure how much space
is available for relocating code though. (e.g. 9000:0 is only 64K or
can it overlap into a000:0?)

Theoretically perhaps just the netboot with COMCONSOLE support would
be enough.

> Technically it should be possible, but indeed somewhat hackish.
> Since there is normally no EEPROM or so to store configuration
> data, it is hard to tell the code whether to netboot or diskboot
> in a clean way. The devopen() function is the key point. (And make
> sure you disable the filesystems of the other sort - the f_devdata
> are different for disk/net.)

Thanks, I'll look at it a bit more.  Ultimately it might be possible
to stick a flags byte into the CMOS somewhere. (though messy perhaps)

As far as the "cleanup on exit" for netboot, does the quit option
work for you, or does it hang your machine also?

-Andrew
-- 
-----------------------------------------------------------------
Andrew Gillham                            | This space left blank
gillham@whirlpool.com                     | inadvertently.
I speak for myself, not for my employer.  | Contact the publisher.