Re: [Etherboot-developers] NetBSD ELF/a.out support
Brought to you by:
marty_connor,
stefanhajnoczi
From: <ebi...@ln...> - 2003-02-25 06:17:09
|
Wojciech Puchar <wo...@te...> writes: > anyone working on it? > > how can i help? > > all i found is that kernel should be loaded beginning from > LMA(VMA)-c0000000 (which is 1MB in all kernels i looked at from version > 1.3.3 to 1.6) > > Idx Name Size VMA LMA File off Algn > 0 .text 0014df54 c0100000 c0100000 00001000 2**2 > CONTENTS, ALLOC, LOAD, READONLY, CODE > 1 .rodata 000287a1 c024df60 c024df60 0014ef60 2**5 > CONTENTS, ALLOC, LOAD, READONLY, DATA > 2 .data 0001acf0 c0277720 c0277720 00177720 2**5 > CONTENTS, ALLOC, LOAD, DATA > 3 .bss 0003e1fc c0292420 c0292420 00192420 2**5 > > > kernel should be started in flat mode with paging off, given parameters on > stack with C standard: > > (howto, [bootdev], bootinfo, esym, basemem, extmem) > > howto is (2 if single user)|(1 if ask for boot device)|(4 if start > debugger) > > it could be always 0 for etherboot > > bootdev should be 0 for new kernels - not used. > > esym is used for debugger if kernel symbols are loaded to memory. it's > probably offset from kernel code to beginning of symbols, 0 if no symbols. > > bootinfo is a pointer to bootinfo structure. first 4 bytes says how many > elements it has, then there are elements (like boot console info, bios > disk geometry etc.) - all well defined in NetBSD's bootinfo.h > > > how can i help to support it (my assembly isn't best right now)? > > tried using FreeBSD support in etherboot - kernel is loaded fine then > hangs. > > > NetBSD already has ROM files but for only few cards and needs 32K ROMs, > and > pxeboot.bin that works for any PXE capable cards. > > anyway having this in etherboot will give user a flexibility to run any OS > without reprogramming EPROM We have that: There are 2 ways to go. Either small modifications to NetBSD, or write a mkelf-BSD. - Alternative 1 (tweaking BSD). Modify the linker script so the LMA is 0x100000. Once the physical addresses are correct etherboot will load your ELF executable into memory just fine. The ELF loader in 5.1.x with no special options passes a pointer to a structure using the standard C calling conventions. After the header the structure contains an array of tagged records, allowing etherboot or whomever use the format to pass whatever values make sense. The structure has a magic number at the start, and a checksum so you can test to see if you were actually passed the appropriate structure. It is fairly well defined in etherboot's elf_boot.h The memory size information along with the dhcp options is present there. And this same format (with different tagged values is used on multiple architectures). So with a little extra code to parse the etherboot's elf boot structure, and a small tweak to your linker script you can have native support of etherboot. - Alternative 2 (writing a converter). You can write a little stub piece of code that reads etherboot's elf boot structure and converts it into a form that NetBSD can use today. In addition this requires a stub program to glue the converter code and the NetBSD kernel together into one image. Examples are out there for several other formats. See mknbi/mkelf and mkelfImage. I hope this helps, And my apologies for not sending this off earlier I got distracted just before I hit send. Eric |