Re: No BIOS, load Linux fr EEPROM

H. Peter Anvin (hpa@transmeta.com)
12 Sep 1998 22:09:20 GMT


Followup to: <3.0.5.32.19980912175004.00e0b320@MAIL.INAME.COM>
By author: Dave <DGMDGM@INAME.COM>
In newsgroup: linux.dev.kernel

I presume we're talking about i386 here...

> My question is to what extent (if any) does Linux rely on the BIOS after it
> is loaded and running?

Once the setup code has been run (arch/i386/boot/setup.S) the BIOS is
pretty much never consulted; the PCI and APM protected-mode BIOS
functions are queried if they exist, but their presence isn't
required.

> I assume that the BIOS is required for booting but I am thinking that I
> would boot from an array of EEPROM devices to a RAM disk and run Linux from
> the RAM Disk.

> Does anyone know of someone who has implemented something along these
> lines? Can you point me to any resources that could be helpful.

Loading Linux itself really isn't hard: for a bzImage you load the
setup code into address 0x90200 absolute and the rest of the image
into address 0x100000 absolute, poke a few fields into the header (at
address 0x90200) and then jump to address 0x9020:0000. If you're
loading an initial RAMdisk (initrd) you load it at the end of RAM and
poke a pointer to it into the header. The initrd image can be
compressed with gzip; the kernel will detect it and uncompress it
automagically.

Look at setup.S for the format of the header.

If you have no BIOS support at all, you probably have to provide the
real-mode services that setup.S provides yourself (i.e. you have to
provide your own version of setup.S); this really shouldn't be very
hard, although it is a little more work, of course.

At the very end of setup.S, the kernel enters protected mode and jumps
to the protected-mode entrypoint; from this point on the BIOS
shouldn't be necessary.

Feel free to email me for more info.

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
        I am Bahá'í -- ask me about it or see http://www.bahai.org/
   "To love another person is to see the face of God." -- Les Misérables

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/faq.html