Re: [Etherboot-developers] booting non linux images
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: Anuradha R. <anu...@gn...> - 2001-05-14 15:25:25
|
On Mon, 14 May 2001, Ken Yap wrote: > Etherboot users taken off recipients as they are probably not > interested. > > >1. memtest86.bin contains 512 bytes of boot sector, 2048 bytes of > > of setup and the "real" code. > > So the layout looks like a Linux kernel. What happens if you run > mknbi-linux on it as if it were a Linux kernel? After all LILO likes > it too. Actually the bootsect.S and setup.S _are_ sligntly changed versions of corresponding Linux files. They even carry the copyright message of Linus Torvalds. mknbi-linux reports that it is not a Linux kernel image. Actually I tried to _blindly_ build it with the build program of a newer linux kernel, but this didn't work. I am now trying the problem in a more methodical way. > >2. The os loads bootsector to the standard location (0x7c00) and > > transfers control to it. > > > >3. The code in the boot sector duplicates itself at 0x90000 and jumps > > to the new location. It loads setup at 0x90200 (does it load the > > rest of the code at 0x10000?) and transfers control to the setup. > > Looking more and more like a Linux kernel setup. Yep. > >4. Setup does necessary initilizations, detects memory etc. (does it > > handle the loading of the rest) and transfers control to > > 0x10000. > > > >5. The code at 0x10000 moves the code in relo.out to memory above 0x100000 > > etc. but we don't have to worry about this. > > Looks very familiar. I am not very sure about these last few steps. Also there can be missing points or wrong assumptions and addresses in my list. If anybody has gone through memtest86 code please let me know if I am wrong... > >Now about tagged image... > > > >1. First I write four bytes containing the magic number. > > > >2. Then I write the header of the tagged image so that the tagged image > > contains two sections (setup and the rest of the code) and the starting > > and loading address of setup is given as 0x902000? > > Don't deal with raw bits like this, there are methods defined to > handle the file format transparently. But first try running > mknbi-linux on it as if it were a Linux kernel. Since mknbi-linux didn't work, I started approaching the problem like this. First I wrote a small C program (well, to be honest, I am not at all good in Perl, althogh I use C, shell scripting and PHP extensively) to compare two binary files and find equal regions. Using this and hexdump I am comparing a real linux kernel and a tagged one with mknbi-linux. This shows that a tagged immage is a header plus the original image. If I am to write a program mknbi.memtest86 (in C), will I have to first write the header and "append" the "kernel" to it? I am halfway going through the process. I want to add a new tag to memtest86 Makefile to convert memtest86.bin to a tagged image _without_ changing the existing programs. BTW, please let me know if the documentation regarding a tagged images _with_ a first magic number is correct and whether etherboot handles them (unlike the ones with a second magic number)? Thanks for your time and attention. Regards, Anuradha |