Re: Etherboot 5.5
Marty Connor <[email protected]>
| Newsgroups | gmane.network.etherboot.devel |
|---|---|
| Message-ID | <[email protected]> |
On May 20, 2005, at 9:46 AM, Michael Brown wrote:
> On the subject of which, I've added some more documentation, including
> a
> mostly complete description of how the build system works
> (http://www.etherboot.org/api/build_sys.html). Questions would be
> extremely welcome. :)
This is great stuff. I'm sure I'll have questions, and as soon as I
figure how to work doxygen, I may even be able to add some of the
answers to the documentation myself.
I really like the new build system. I know that ld, ar, and make are
being used efficiently to put together an image, and it's neat to see
how it happens.
It's certainly a lot easier to understand than the previous build
method, for this target. I am amazed that after stripping the ELF
stuff that the double-word alignments work. I guess I need to dump the
ELF file to see how that works.
Below is my annotation of a build. I'd appreciate any corrections or
clarifications. I hope this can add to the great doxygen documentation
that Michael has started.
I did:
make -n bin/rtl8139.dsk
Which means "don't actually make the target, but show me what you would
do if I left off '-n'"
And I got the following output (edited for clarity):
-------
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 :)
-------
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?
-------
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...
-------
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
-------
3. rm -f bin/blib.a
# delete the library file
-------
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
-------
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
-------
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.
-------
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.
-------
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.
-------
10. rm bin/rtl8139.dsk.tmp
# This deletes the temporary ELF file.
-------
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.
Ahh, stuff to fix :)
Marty
-------------------------------------------------------
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