[LinuxBIOS] patch: extending LAR, and removing elf from linuxbios (it is not needed)

Stefan Reinauer stepan at coresystems.de
Tue Aug 28 17:13:05 CEST 2007


* Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net> [070828 01:54]:
> What about creating directories for each payload so we can differentiate
> between multiple payloads (in the original sense)?
 
Yes, I would prefer something like that, too


>   normal/payload0/segment0 (33192 bytes, lzma compressed to 18088 bytes @0x38 load @0x100000, entry 0x105258)
>   normal/payload0/segment1 (72 bytes, lzma compressed to 47 bytes @0x4718 load @0x1225a0, entry 0x105258)
>   normal/payload1/segment0 (xxx bytes, lzma compressed to yyy bytes @0xfoo load @0xbar, entry 0xbaz)

Sounds reasonable and allows use of Uwe's multiple payloads in the same
breath.

> Maybe we should introduce a major/minor version in the LAR header? Or a
> different magic string for each revision?

I generally hate versions. Think features, not numbers. But since this
is probably not doable without significant overhead, I'd just go with a
normal version header that gets increased every time we change the
format. No need for major, minor, subminor, ...

> >  	void *start;
> >  	int len;
> >  	u32 reallen;
> > +	void * entry;
> > +	void * loadaddress;
> 
> void *entry;
> void *loadaddress;
 
Not sure how these pointers sneaked in here. They do break portability
and cross compilability. Compiling LinuxBIOS on a 64bit host without
compiling lar 32bit is not possible with such things in the header.

I really don't like this.

> >  #include <console.h>
> >  
> > +int (*pk)(int msg_level, const char *fmt, ...) = printk;
> > +
> >  int main(void)
> >  {
> > -	printk(BIOS_INFO, "RAM init code started.\n");
> > -	printk(BIOS_INFO, "Nothing to do.\n");
> > +	pk(BIOS_INFO, "RAM init code started.\n");
> > +	pk(BIOS_INFO, "Nothing to do.\n");
> >  
> >  	return 0;
> >  }
> 
> My eyes!
 
:-) This is not supposed to go into the repo like that, but it fixes an
issue.

What was that linker auto rename trick that Marc mentioned recently?

> >  INITRAM_OBJ = $(obj)/mainboard/$(MAINBOARDDIR)/initram.o
> > +$(obj)/mainboard/$(MAINBOARDDIR)/initram.o: $(src)/mainboard/$(MAINBOARDDIR)/initram.c
> > +	cc -c $(INITCFLAGS)  -fPIE $(src)/mainboard/$(MAINBOARDDIR)/initram.c -o $(obj)/mainboard/$(MAINBOARDDIR)/initram.o

Rules per file are not exactly nice. Especially not when we start doing
non-trivial initram sequences.

Let's do this instead:

INITRAM_OBJ = $(obj)/mainboard/$(MAINBOARDDIR)/PICOBJ/initram.o

and have a rule that handles all PICOBJ objects differently?

> > -	$(Q)$(LD)  -Ttext 0x80000 $(INITRAM_OBJ) \
> > -		--entry=main -o $(obj)/linuxbios.initram.o
> > +	$(Q)$(LD)  $(INITRAM_OBJ) \
> > +		--entry=main -R $(obj)/stage0.o -o $(obj)/linuxbios.initram.o
> >  	$(Q)printf "  OBJCOPY $(subst $(shell pwd)/,,$(@))\n"
> >  	$(Q)$(OBJCOPY) -O binary $(obj)/linuxbios.initram.o \
> >  		$(obj)/linuxbios.initram
> 
> Could you explain that one?

Initram was changed to link statically against printf a while ago. For
some reason this does not work because it craps out when jumping to the
serial_tx_byte (?) function.

Instead we decided the code has to become position independent. This
brings in another layer of problems we have to solve, like printk can't
just be printk like that. And linking the code at 0x80000 as we did
before creates a 4G file.


Stefan

-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.dehttp://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866




More information about the coreboot mailing list