Joshua Wise joshua@joshuawise.com writes:
On Thursday 18 December 2003 7:36 pm, Eric W. Biederman wrote:
Brainstorming earlier today I think I have found a way to use an linux kernel for the boot loader and to implement pcbios compatibility without too much cost. The idea is to use a uclinux kernel. And implement a ``user space'' aplication that is a user space shim that makes kernel calls.
The way I implement my bootloader on ARM is like this:
- First stage assembly loader sets up serial and DRAM.
- First stage loader probes RAM, and sets up tagged list.
Roughly what LinuxBIOS does.
- First stage jumps into zImage of special LAB (Linux As Bootldr) kernel.
(currently just a 2.6.0 kernel from handhelds.org that has CONFIG_LAB defined.) 4) LAB kernel boots up until it gets ready to jump into init. 5) #ifdef'ed code takes over and calls a LAB main function which does all sorts of cool stuff including giving the user a CLI if requested (usually by holding the iPAQ's joypad down), or autobooting (running a predefined mkdir/mount/armboot sequence.)
Conceivably you could write a subapp for the CLI that does what you want, and put it in the autoboot script.
Somehow I could write a subapp that would make linux look like a normal pcbios, but I can be surprised.
LAB for ARM's zImage is currently ~509kbytes for those who care. (We must keep it below 512KB.)
Ouch! My x86 images are below that, at least before decompression.
There are a few nasty details to work out like how to handle services that are expected to work in vm86 mode. But I'm not certain I care.
I've tinkered with writing an OS, but I still don't know too much about the x86 architecture, so I couldn't help there. Sorry.
Other thoughts?
Check out my LAB code, see what you think. It's in handhelds.org anoncvs, module linux/kernel26. Relevant crap is in bootldr/, drivers/bootldr/, and arch/arm/boot/.
I probably will. Doing that stuff inside the kernel does not really feel proper to me. I already have an x86 kernel that can load another kernel from user space. I'm just trying to find a good long term architecture for using the kernel as a bootloader.
After I come back from my christmas vacation I am going to have to try it and see how will it will actually work.
Take care, have a nice vacation.
Thanks.
Eric