diff --git a/arch/x86/stage1.c b/arch/x86/stage1.c index 3265741c72..7aa92bdf3d 100644 --- a/arch/x86/stage1.c +++ b/arch/x86/stage1.c @@ -101,8 +101,12 @@ void stage1_main(u32 bist) // 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 diff --git a/util/lar/bootblock.c b/util/lar/bootblock.c index bc5ce53011..dd235052d8 100644 --- a/util/lar/bootblock.c +++ b/util/lar/bootblock.c @@ -74,16 +74,16 @@ int load_bootblock(const char *bootblock) 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; } diff --git a/util/lar/lar.c b/util/lar/lar.c index 2deb426b62..487b4bb9de 100644 --- a/util/lar/lar.c +++ b/util/lar/lar.c @@ -96,10 +96,10 @@ int main(int argc, char *argv[]) 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;