Information about BIOS and the boot process

Greg Watson gwatson at lanl.gov
Fri Mar 28 11:28:00 CET 2003


Other people probably know much more about this than me, but here's 
my experience.

There seem to be two main parts to linuxbios. The first is 
arch/{arch}/config/ctr0.base which does the very low level 
initialization, like turning on memory, etc. The second is 
arch/{arch}/lib/c_start.S which does whatever else is necessary to 
call the C function hardwaremain(). hardwaremain() then does whatever 
else is necessary to load linux.

c_start.S is linked with linuxbios.a, a library containing generic 
support routines (those found in the lib directory) and anything 
specified using the 'object'  directive in a Config file (and other 
stuff). The resultant 'executable' is called linuxbios_c. The loader 
script used to link linuxbios_c is config/linuxbios_c.ld, and is 
configured to be loaded relative to _RAMBASE.

crt0.base is not linked against anything. Any additional assembly 
routines you need must be specified using the 'mainboardinit' 
directive in a Config file. This causes the specified assembly file 
to be added to "crt0_includes.h" which is in turn included at the 
start of crt0.base (or at the end in the case of the ppc version). 
The loader script used to link crt0.base is in 
arch/{arch}/config/ldscript.base. The resultant 'executable' is 
called linuxbios and will be loaded at _ROMBASE. The tricky thing is 
that this loader script will also load the linuxbios_c 'executable' 
at a location called _payload in this file. The main task of 
crt0.base is then to initialize enough hardware so that this payload 
can be copied from rom into ram (which may also involve uncompressing 
code). Then control is transferred to _start, which is the first 
location in linuxbios_c.

To get an idea of how crt0.base works, look at the following files. 
This is the order of execution specified by the configuration file 
for sis735.

cpu/i386/entry16.inc
cpu/i386/entry32.inc
superio/sis/950/setup_serial.inc
pc80/serial.inc
arch/i386/lib/console.inc
cpu/k7/earlymtrr.inc
northsouthbridge/sis/735/raminit.inc
arch/i386/config/crt0.base

Next look at c_start.S which will show you what happens once control 
is transferred to _start. Finally, look at 
arch/{arch}/lib/hardwaremain.c to see what other stuff is done to get 
linux loaded.

Most other files are specific to particular hardware, so it can be 
pretty confusing to just browse the tree.

Hope this helps,

Greg


At 7:00 PM +0500 3/28/03, dkotian3 at vsnl.net wrote:
>Agreed, I am also looking for a good documention.
>Atleast the flow in terms of implemented functions
>or assembly code and some kind of Do's and Dont's
>if any.
>One good advantage would be more and more people
>would be easily aware about the code architecture and
>would get invovled in LinuxBIOS if one is interested.
>
>
>
>ivan at munix.com.br wrote
>         I am writing some code to fixup the video chipset trident
>cyberblade and V1621 RGB->CS encoder ,
>and also trying to fix the IDE_BOOT for my mainboard (B860T or EPIA), so
>I am looking for information
>about the real bios process, and about the layout of the common bios
>files, and of course, any information
>about bios as possible.
>
>My main problem is to find good documentation about the post, the boot
>process.
>
>        I read on some places which the CS is set F000 and EIP FFF0, so
>in other websites I had seen CS is FFF0,
>  in other 000F , causing some confusion with me.
>
>I need some documentation about 20bits addressing lines, and the GATE
>A20 function also.
>
>Tanks in advance.
>
>
>_______________________________________________
>Linuxbios mailing list
>Linuxbios at clustermatic.org
>http://www.clustermatic.org/mailman/listinfo/linuxbios
>
>_______________________________________________
>Linuxbios mailing list
>Linuxbios at clustermatic.org
>http://www.clustermatic.org/mailman/listinfo/linuxbios




More information about the coreboot mailing list