[LinuxBIOS] printk()/post_code(): Compile failure for all hardware targets in v3

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Wed Nov 21 13:44:17 CET 2007

On 20.11.2007 18:12, Stefan Reinauer wrote:
> * Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net> [071120 17:44]:
>> Can we recreate an object file from the map file? Or can we avoid
>> stripping all symbols from stage0/1?
> Nope, and nope, unfortunately. The unstripped bootblock is an ELF file,
> but we need a binary blob there, so we have the reset vector and such in
> the right place...

We can recreate an object file from a small symbol file (similar to a
map file). Ph33r my m4d sk1llz! (I have no idea whether that is correct

Do not try to understand the command sequence below. It will rot your
brain. It was written by me with the help of sleep deprivation.
Do not try to be clever with the command sequence below. objcopy in one
step works, but the output file is 8 times bigger, plus you will trigger
an assertion in BFD.
Do not try to use the command sequence below for any architecture
besides x86(32bit).

objcopy --extract-symbol --strip-all --keep-symbols=keepsymbols.txt -O symbolsrec build/stage0.o build/stage0-onlysymbols.sym
objcopy -I symbolsrec -O elf32-i386 build/stage0-onlysymbols.sym build/stage0-onlysymbols.o
echo -en "\003\000"|dd of=build/stage0-onlysymbols.o bs=1 count=2 seek=18 conv=notrunc

keepsymbols.txt must contain all shared symbol names from stage 0, one
symbol name per line.
stage0-onlysymbols.o contains all shared symbols and has to be shipped
in the LAR. We can link initram and stage2 against it without any problems.

If we use LZMA compression for stage0-onlysymbols.o, it needs about 200
bytes. The qemu bootblock currently has about 4600 bytes free, so there
is plenty of space for such a symbol table.



More information about the coreboot mailing list