[LinuxBIOS] [PATCH] v3 - put lar size in the bootblock

Uwe Hermann uwe at hermann-uwe.de
Sun Jul 1 00:11:42 CEST 2007


On Sat, Jun 30, 2007 at 11:58:15PM +0200, Stefan Reinauer wrote:
> Hi,
> 
> this patch puts the lar size in the bootblock and reads it from there.
> Why? This way we don't need to recompile the image when the size of the
> LinuxBIOS image changes. This alows building images for 50 motherboards
> and equipping each with 10 payloads, resulting in 500 images while you
> only have to build each payload once and each motherboard, too.

Nice! This will be a very important feature...


> There's also a small "fix" allowing the compression type to be case
> insensitive. Not really relevant I guess.
> 
> Signed-off-by: Stefan Reinauer <stepan at coresystems.de>
> 
> Index: util/lar/bootblock.c
> ===================================================================
> --- util/lar/bootblock.c        (revision 426)
> +++ util/lar/bootblock.c        (working copy)
> @@ -74,16 +74,16 @@
> 
>  int fixup_bootblock(void)
>  {
> -       /* Per definition the bootblock starts with 256 empty bytes.
> -        * These are utilized to make the bootblock part of a lar file,
> -        * and store the image size.
> -        *
> -        * We will also calculate a checksum here.
> -        */
> +       int i;
> +       uint32_t *size_pos;

u32


> -       /* first try. Clear out ugly left-over from ld hack */
> -       bootblock_code[bootblock_len - 13] = '\0';
> -       bootblock_code[bootblock_len - 12] = '\0';
> +       /* This cleans out the area after the reset vector */
> +       for(i=13; i>0; i--)

Coding style is broken (in a few other places, too).


> +               bootblock_code[bootblock_len - i] = '\0';
> +
> +       /* add lar size to image */
> +       size_pos=(uint32_t *)(bootblock_code+bootblock_len-12);

u32


> +       size_pos[0] = get_larsize();
> 
>         return 0;
>  }
> Index: util/lar/lar.c
> ===================================================================
> --- util/lar/lar.c      (revision 426)
> +++ util/lar/lar.c      (working copy)
> @@ -96,10 +96,10 @@
>                         larmode = CREATE;
>                         break;
>                 case 'C':
> -                       if (strcmp("lzma", optarg) == 0) {
> +                       if (strcasecmp("lzma", optarg) == 0) {

OK, I guess, but not all systems might have strcasecmp (I think it's
called stricmp() on some). Not critical right now, though...


>                                 algo = lzma;
>                         }
> -                       if (strcmp("nrv2b", optarg) == 0) {
> +                       if (strcasecmp("nrv2b", optarg) == 0) {
>                                 algo = nrv2b;
>                         }
>                         break;
> Index: arch/x86/stage1.c
> ===================================================================
> --- arch/x86/stage1.c   (revision 426)
> +++ arch/x86/stage1.c   (working copy)
> @@ -101,8 +101,12 @@
>         // FIXME this should be defined in the VPD area
>         // but NOT IN THE CODE.
> 
> -       archive.len=(CONFIG_LINUXBIOS_ROMSIZE_KB)*1024;
> -       archive.start=(void *)(0UL-(CONFIG_LINUXBIOS_ROMSIZE_KB*1024));
> +       /* The len field starts behind the reset vector on x86.
> +        * The start is not correct for all platforms. sc520 will
> +        * need some hands on here.
> +        */
> +       archive.len = *(u32 *)0xfffffff4;
> +       archive.start =(void *)(0UL-archive.len);
 

Something seems wrong with the patch, doesn't apply here (mailer issue?)


Uwe.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20070701/1a067906/attachment.sig>


More information about the coreboot mailing list