Subject: Calling the kernel from a mini-bootloader

From: "Guillaume Dargaud" <[email-masked]>
Date: Thu, 17 Jul 2008 15:22:28 +0200

Hello all,
I'm in the process of writing a mini-bootloaler for a custom board and would 
like some feedback on my boot methodology.

Basically the kernel code (elf file) is copied into memory by a JTAG 
debugger. A custom program (yet to be finished) then copies it onto an 
onboard flash memory using serial commands. This flash is not part of the 
flat memory addressing.

When I want to boot, I have a small bootloader put into an eprom that _is_ 
part of the flat memory addressing. This (finished but not tested yet) 
bootloader basically does two things:
- it copies the content of the first flash into RAM
- it launches it using a custom function call like "0x400000();"

Now, I'd like to know if this is a reasonable approach ? I couldn't think of 
a better way, but maybe there are issues I didn't think off.

One additional question, if the above is valid, is that I would like to pass 
a particular argument to the kernel to set its MAC address. I can read an 
external value (similar to jumpers) from the bootloader via GPIO. Is there a 
way to pass this value to the kernel so that a modified 
arch/ppc/boot/simple/embed_config.c can use it to set the MAC address ?

Maybe the main() of the kernel can receive argv/argc the usual way, and I 
just need to call "0x400000(argc, argv);" but I have no idea if that works. 
Thanks for suggestions.
-- 
Guillaume Dargaud
http://www.gdargaud.net/