Re: Etherboot 5.5

Michael Brown <[email protected]>
Newsgroups gmane.network.etherboot.devel
Message-ID <[email protected]>
On Fri, 20 May 2005, Marty Connor wrote:
> 0.  Generating Makefile rules for exe media
>       ...
> 
> #I think lines of this type are responsible for generating the compile 
> commands:
> #
> #        $(foreach OBJ,$(if $(OBJS_$(4)),$(OBJS_$(4)),$(4)), \
> #                $(call obj_template,$(1),$(2),$(3),$(OBJ)))
> #
> # ( that was in src/Makefile.housekeeping along with a lot of really 
> cool stuff :)

Correct.  :)

> 1.  /usr/bin/perl ./util/mkconfig.pl config.h
> 
> # I think this splits the config.h file into lots of little config.h 
> files for each subsystem?

Yes.  Also tweaks timestamps so that the config files appear to be 
unmodified if the contents are the same as before, so that we don't 
rebuild things unnecessarily.

>      Generating Makefile rules for drivers/bus/isa.c
>        ...
> 
> # more generated makefile rules which will eventually be used to 
> compile stuff
> # I should check the Makefile to see why they are after the mkconfig.pl 
> command...

Because drivers/bus/isa.c depends on config/isa.h, which is generated by 
mkconfig.pl.

> 2.  cc -o bin/btext.o
>       ...
> 
> # Now it looks like all the files are actually getting compiled.  There 
> are a
> # lot of them. I'm pretty sure their 'cc' commands were made in the 
> previous step

Correct.

> 3.  rm -f bin/blib.a
> 
> # delete the library file

Indeed.

> 4.  ar r bin/blib.a  bin/btext.o bin/buffer.o bin/config.o
>      bin/console.o bin/dev.o bin/disk.o bin/errno.o bin/heap.o
>      bin/i82365.o bin/image.o bin/init.o bin/main.o bin/misc.o
>      bin/nic.o bin/osloader.o bin/pc_kbd.o bin/pcmcia.o
>      bin/proto.o bin/proto_eth_slow.o bin/pxe_errors.o
>      bin/pxe_export.o bin/resolv.o bin/serial.o bin/string.o
>      bin/timer.o bin/url.o bin/vsprintf.o bin/dns.o bin/fsp.o
>      bin/http.o bin/nfs.o bin/nmb.o bin/slam.o bin/tcp.o
>      bin/tftm.o bin/tftp.o bin/eisa.o bin/isa.o bin/isa_ids.o
>      bin/isapnp.o bin/mca.o bin/pci.o bin/3c509.o
>      bin/3c509-eisa.o bin/3c515.o bin/3c529.o bin/3c595.o
>      bin/3c5x9.o bin/3c90x.o bin/amd8111e.o bin/cs89x0.o
>      bin/davicom.o bin/depca.o bin/dmfe.o bin/e1000.o
>      bin/eepro100.o bin/eepro.o bin/epic100.o bin/forcedeth.o
>      bin/mtd80x.o bin/natsemi.o bin/ns83820.o bin/ns8390.o
>      bin/pcnet32.o bin/pnic.o bin/prism2_pci.o bin/prism2_plx.o
>      bin/r8169.o bin/rtl8139.o bin/sis900.o bin/skel.o
>      bin/smc9000.o bin/sundance.o bin/tg3.o bin/tlan.o
>      bin/tulip.o bin/via-rhine.o bin/w89c840.o bin/cpu.o
>      bin/elf.o bin/hooks.o bin/i386_timer.o bin/load_buffer.o
>      bin/pci_io.o bin/pic8259.o bin/pxe_callbacks.o
>      bin/pxe_loader.o bin/realmode.o bin/relocate.o
>      bin/video_subr.o bin/librm_mgmt.o bin/int19exit.o
>      bin/select_isapnp.o bin/select_pci.o bin/basemem.o
>      bin/bios.o bin/bios_console.o bin/gateA20.o bin/hidemem.o
>      bin/memsizes.o bin/nbi.o bin/bios_disks.o bin/undi.o
>      bin/floppy.o bin/realmode_asm.o bin/setjmp.o bin/setup.o
>      bin/setup16.o bin/start32.o bin/virtaddr.o bin/libkir.o
>      bin/libpm.o bin/librm.o bin/bImageprefix.o
>      bin/zbImageprefix.o bin/comprefix.o bin/dskprefix.o
>      bin/zdskprefix.o bin/elf_dprefix.o bin/elfprefix.o
>      bin/zelfprefix.o bin/exeprefix.o bin/liloprefix.o
>      bin/zliloprefix.o bin/lmelf_dprefix.o bin/lmelf_prefix.o
>      bin/nullprefix.o bin/pxeprefix.o bin/zpxeprefix.o
>      bin/isaprefix.o bin/zisaprefix.o bin/pciprefix.o
>      bin/zpciprefix.o bin/unnrv2b.o bin/unnrv2b16.o
>      bin/e820mangler.o
> 
> # Now that we have made all the '.o' files, we are going to make a 
> library out
> # of them, which ld will use to put together the final image

Yes.

> 5.  ranlib bin/blib.a
> 
> # ranlib generates an index for the library, and speeds up linking
> # "man ranlib" has a lot of info, and says that "ar -s" is completely
> # equivalent to doing ranlib

Yes.

> 6.  ld -N  -T arch/i386/scripts/i386.lds  -u obj_dskprefix
>      --defsym check_obj_dskprefix=obj_dskprefix   -u obj_rtl8139
>      --defsym check_obj_rtl8139=obj_rtl8139   -u obj_config
>      --defsym check_obj_config=obj_config  --defsym
>      pci_vendor_id=0x10ec --defsym pci_device_id=0x8139
>      bin/blib.a -o bin/rtl8139.dsk.tmp \
>              -Map bin/rtl8139.dsk.tmp.map
> 
> # The main event.  ld picks out just the right parts from the library 
> 'bin/blib.a" and
> # makes a an ELF file called "bin/rtl8139.dsk.tmp" that contains the 
> image, wrapped
> # in ELF formatting.

Correct.

> 7.  objdump -ht bin/rtl8139.dsk.tmp | /usr/bin/perl 
> ./util/sortobjdump.pl >> \
>          bin/rtl8139.dsk.tmp.map
> 
> # I think this is reformatting the symbol map, but it seems to be 
> overwriting
> # file that was created in step 6.

Appending to.  The linker-generated symbol map is quite difficult to read 
and doesn't include local symbols.  We use objdump together with a small 
Perl script to produce a symbol listing that includes all local symbols 
and sorts them into a logical sequence to make debugging easier.

> 9.  objcopy -O binary bin/rtl8139.dsk.tmp bin/rtl8139.dsk
> 
> # This takes the ELF image and strips the ELF formatting, leaving a pure
> # binary image that is in the format we requested.

Yes.

> 10. rm bin/rtl8139.dsk.tmp
> 
> # This deletes the temporary ELF file.

Yes.

> There's certainly a lot more to understand, but this looks great so 
> far.  Now we can figure out what the toolset dependencies so we know 
> what versions of gcc, make, and binutils are required.
> 
> I wonder if getting .rom to work would be reasonably easy.  It seems 
> like it would be like .dsk, except that there would be no floppy 
> loader, and a ROM header would start the image.

.rom is one of the trickier prefixes, mainly because it includes the UNDI 
loader.  It also needs a reasonable number of conceptual fixes; we 
currently have many compile-time options for working around various BIOS 
deficiences, which is fine for someone compiling their own ROM for a 
machine they already own, but totally useless from the point of view of 
providing generic, work-with-anything Etherboot ROMs.

Michael





-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.