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@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
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@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.
* Uwe Hermann uwe@hermann-uwe.de [070701 00:11]:
int i;
uint32_t *size_pos;
u32
No, this is userspace. We don't have u32 here.
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...
ieks. good point. Which are those again?
*/
archive.len = *(u32 *)0xfffffff4;
archive.start =(void *)(0UL-archive.len);
Something seems wrong with the patch, doesn't apply here (mailer issue?)
Yes, whitespaces are broken. I can't get the patches to my mailer except cut and paste :-((( ssh works, scp does not
On 01/07/07 21:12 +0200, Segher Boessenkool wrote:
OK, I guess, but not all systems might have strcasecmp (I think it's called stricmp() on some). Not critical right now, though...
ieks. good point. Which are those again?
Non-POSIX systems. Do we care?
No.
Jordan
On Sun, Jul 01, 2007 at 12:49:05AM +0200, Stefan Reinauer wrote:
- Uwe Hermann uwe@hermann-uwe.de [070701 00:11]:
int i;
uint32_t *size_pos;
u32
No, this is userspace. We don't have u32 here.
You mean in lar in general? We _do_ use u32 in lar code already, so maybe that needs fixing?
Uwe.