On 5/28/2011 2:19 AM, Mark Morgan Lloyd wrote:
A few weeks ago (mid March) I mentioned that I had some ARM boards that I'd like use as Linux development systems. Unfortunately, they come with CE, and while the manufacturer does supply Linux it's prohibitively expensive.
CE is booted from a partitioned CompactFlash card, and I initially thought that the code in the partition and filesystem boot sectors was relevant, i.e. that there was something equivalent to a PC's BIOS in Flash. However on inspection I think that the code is x86, which implies that the loader in Flash is reading and transferring control to the OS image directly.
Is it possible to build Open Firmware to look like a CE image, which would possibly allow this board (and potentially many other devices) to run Linux without modification to the content of internal Flash?
It should be relatively easy. The ARM version of OFW is dynamically relocatable, so all you have to do is put it somewhere in memory and jump to it.
I believe that WinCE use the PECOFF image format, documented at http://msdn.microsoft.com/en-us/windows/hardware/gg463125
There is also /usr/include/linux/coff.h which may clarify some things.
PECOFF has a lot of features but I think all you need is file header followed by a single section header. My best guess is that the section name should be ".text". The physical address and virtual address should be the desired load address (which is pretty flexible as I mentioned), and the file pointer would be the offset to the OFW image data.
This is the sort of thing - slapping on random headers as required by some pre-existing bootloader - that I do routinely when porting to a new platform.
The thing to do is to hex dump the first thousand bytes of the CE image and see if you can make sense of it as a PECOFF header. Then put a similar header on the front of the OFW image.
cpu/arm/savefort.fth contains an example of making a header (in this case in AIF - ARM Image Format) then writing the header and the OFW dictionary image out to a file.