Author: stepan Date: 2007-07-01 00:03:39 +0200 (Sun, 01 Jul 2007) New Revision: 427
Modified: LinuxBIOSv3/arch/x86/stage1.c LinuxBIOSv3/util/lar/bootblock.c LinuxBIOSv3/util/lar/lar.c Log: 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@coresystems.de Acked-by: Ronald G. Minnich rminnich@gmail.com
Modified: LinuxBIOSv3/arch/x86/stage1.c =================================================================== --- LinuxBIOSv3/arch/x86/stage1.c 2007-06-30 20:57:47 UTC (rev 426) +++ LinuxBIOSv3/arch/x86/stage1.c 2007-06-30 22:03:39 UTC (rev 427) @@ -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
Modified: LinuxBIOSv3/util/lar/bootblock.c =================================================================== --- LinuxBIOSv3/util/lar/bootblock.c 2007-06-30 20:57:47 UTC (rev 426) +++ LinuxBIOSv3/util/lar/bootblock.c 2007-06-30 22:03:39 UTC (rev 427) @@ -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; }
Modified: LinuxBIOSv3/util/lar/lar.c =================================================================== --- LinuxBIOSv3/util/lar/lar.c 2007-06-30 20:57:47 UTC (rev 426) +++ LinuxBIOSv3/util/lar/lar.c 2007-06-30 22:03:39 UTC (rev 427) @@ -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;