FAQ question fixup

Richard Smith smithbone at gmail.com
Wed Mar 2 05:25:01 CET 2005


I've been adding selected info from my V1 FAQ up into the wiki.  The
following is some info I compiled up on V1 start up.

If someone(s) would update this for V2 and post it t the wiki I think
it would be very useful.


================================
Help!  I'm a newbie and I'm completely lost in the code.

   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.



-- 
Richard A. Smith



More information about the coreboot mailing list