[LinuxBIOS] patch: extending LAR, and removing elf from linuxbios (it is not needed)
ron minnich
rminnich at gmail.com
Tue Aug 28 18:19:58 CEST 2007
On 8/28/07, Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net> wrote:
>
> lib/lar.c and util/lar/example.c differ in subtle ways in find_file.
> Inverted logic in one file, bogus calculations in the other one. We
> might want to make sure they behave the same way.
>
> > header = (struct lar_header *)walk;
> > fullname = walk + sizeof(struct lar_header);
> >
> > printk(BIOS_SPEW, "LAR: current filename is %s\n", fullname);
> > // FIXME: check checksum
> >
> > if (strcmp(fullname, filename) == 0) {
> > printk(BIOS_SPEW, "LAR: it matches %s @ %p\n",
> > fullname, header);
> > result->start = walk + ntohl(header->offset);
> > result->len = ntohl(header->len);
> > result->reallen = ntohl(header->reallen);
> > result->compression = ntohl(header->compression);
> > result->entry = (void *)ntohl(header->entry);
> > result->loadaddress = (void
> > *)ntohl(header->loadaddress);
> > printk(BIOS_SPEW, "start %p len %d reallen %d
> > compression %x entry %p loadaddress %p\n",
> > result->start, result->len,
> > result->reallen, result->compression, result->entry,
> > result->loadaddress);
> > return 0;
> > }
> > // skip file
> > walk += (ntohl(header->len) + ntohl(header->offset) -
> > 1) & 0xfffffff0;
>
> ARGH! Shouldn't that be
>
> walk += (ntohl(header->len) + ntohl(header->offset) + 15) & 0xfffffff0;
OK, I added this to the code:
if (strcmp(&walk[0], "LARCHIVE") != 0)
continue;
before the other fix I created. It dies:
LinuxBIOS-3.0.0 Tue Aug 28 08:21:43 PDT 2007 starting...
Choosing fallback boot.
LAR: Attempting to open 'fallback/initram'.
LAR: Start 0xfff00000 len 0x100000
LAR: search for normal/payload
LAR: search for normal/option_table
LAR: search for normal/stage2
LAR: search for normal/initram
LAR: search for %s @ %p
So I put in your fix (replace -1 with +15)
And it is worse:
LinuxBIOS-3.0.0 Tue Aug 28 08:21:43 PDT 2007 starting...
Choosing fallback boot.
LAR: Attempting to open 'fallback/initram'.
LAR: Start 0xfff00000 len 0x100000
LAR: search for normal/payload
LAR: search for normal/stage2
LAR: search for %s @ %p
So, how about we leave my patch in for now while I try to track this
nasty bug down?
thanks
ron
More information about the coreboot
mailing list