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

Stefan Reinauer stepan at coresystems.de
Sat Jun 30 23:58:15 CEST 2007


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.

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;

-       /* 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--)
+               bootblock_code[bootblock_len - i] = '\0';
+
+       /* add lar size to image */
+       size_pos=(uint32_t *)(bootblock_code+bootblock_len-12);
+       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) {
                                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);

        // FIXME check integrity



-- 
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/




More information about the coreboot mailing list