|
Author |
Message |
|
|
Posted Apr 16, 2009 at 12:54:40 AM
Subject: Question on booting Linux kernel on Intel-based platform?
Hello Linux gurus,
I am looking for a way to boot Linux kernel onto my Intel-based embedded platform. The tricky part is that even though it's Intel based (Intel Core 2 Duo - Wolfdale) my system doesn't behave like a regular PC where I can alter BIOS and ask Bios to load Grub stage 1 from MBR and jump to Grub stage 1.5 or stage2. There is no hard drive on my platform and there is no way to alter BIOS boot up (press Del or F2). BIOS will just automatically boot to a home-grown bootloader prompt (written by another group). The requirement is I have to load Linux using this bootloader AS IS. This bootloader only support loading ELF image with an unique header.
Previously, I was able to achieve this task on a MIPS based (Cavium CPU) platform using Ram-based U-boot. The way I did it was to package this Ram-based Denx U-boot written by Cavium with the unique header required by our home-grown bootloader then:
Home-grown bootloader ---> load Ram-based U-boot ---> load Linux kernel
I can use similar concept for this Intel-based platform but here are 2 possible choices that I can choose:
1) Use U-boot and load it in RAM just like in the MIPS case. However, there is very little support for Intel (especially Intel Wolfdale CPU) in U-boot. If I take this route, I may end up adding support for this CPU. With no ICE and support from vendor, I may be in for a very rough ride.
2) Use GRUB. The good thing about this choice is GRUB has been primarily used for loading Linux on Intel-based platform. The tricky part is how to make my home-grown bootloader load GRUB.
One way I can think of is to build GRUB stage 2 and packaged it with our unique ELF header then use our bootloader to boot it. Once GRUB stage 2 took control and print out the menu, we can boot Linux from there. Is it feasible? Is there any better way to do this?
Currently look like GRUB stage2 is in exec format. How can I convert it to ELF format? Any help is greatly appreciated. I'm stuck.
Thanks,
|
|
Back to top
|
|
Rubberman
Joined Jul 30, 2007 Posts: 944
Location:40 miles west of Chicago
Other Topics
|
Posted:
Apr 17, 2009 12:22:03 AM
Can you describe the hardware a bit more thoroughly? Such as, what does it use for persistent storage (ee-prom, flash, battery-backed sram, ...), what does it first boot-strap from, etc. I spent a lot of years working on embedded systems, so I might be able to help, but as indicated, you haven't provided enough data as yet.
Sometimes real fast is almost as good as real time.
Remember, Google is your friend!
|
|
Back to top
|
|
eagerboy
Joined Apr 16, 2009 Posts: 4
Other Topics
|
Posted:
Apr 22, 2009 10:19:44 PM
Thanks for offering to help. My platform is a router. It has Intel CPU Core 2 Duo, MCH north bridge connects with 4GB of memory and GE ports; 16MB of flash memory for boot up code (which I'm not allowed to change), ICH9 connects to PCIe, USB devices and compact flash. There is no hard drive on the system.
Upon boot up, BIOS will run to initialize the CPU and memory, then it will transfer control to a home-grown bootloader developed by another team. Once it boots to this bootloader prompt, I come in and load Linux kernel. At this point, network is available, memory and compact flash has been initialized. USB will be initialized at this stage as well but not at this moment yet.
This bootloader can only load ELF image and nothing else. I can either convert Grub Makefile to compile Grub stage 2 to ELF format and load that or compile it natively and use a tool to convert it to ELF. Any good suggestion you may have?
|
|
Back to top
|
|
eagerboy
Joined Apr 16, 2009 Posts: 4
Other Topics
|
Posted:
Apr 22, 2009 10:26:10 PM
I forgot to add that the home-grown bootloader code resides in the 16MB flash along with BIOS. Linux kernel that I need to load resides on the network space. The home-grown booloader made sure network is up and alive at its prompt.
|
|
Back to top
|
|
Rubberman
Joined Jul 30, 2007 Posts: 944
Location:40 miles west of Chicago
Other Topics
|
Posted:
Apr 23, 2009 6:41:39 AM
What about writing a custom boot loader? I've done that in the past (deep, dark, long ago as in the mid-80's) - it really isn't too difficult. You just need to know where on the system the actual kernel is located to load it. Check out the grub source code and documentation for information how to do this in the Linux environment.
Sometimes real fast is almost as good as real time.
Remember, Google is your friend!
|
|
Back to top
|
|
eagerboy
Joined Apr 16, 2009 Posts: 4
Other Topics
|
Posted:
Apr 23, 2009 7:35:00 PM
I already checked out Grub 0.97 source code. I'm currently trying to change Grub Makefile to compile stage 2 to an ELF image. Do you know of a utility to package the original stage 2 (binary exec format) to ELF?
|
|
Back to top
|
|
Rubberman
Joined Jul 30, 2007 Posts: 944
Location:40 miles west of Chicago
Other Topics
|
Posted:
Apr 24, 2009 4:46:59 PM
The gcc compilers automatically generate ELF intermediaries. Just verify that you are using the correct compiler/linker options.
Sometimes real fast is almost as good as real time.
Remember, Google is your friend!
|
|
Back to top
|
|