diff --git a/arch/x86/Makefile b/arch/x86/Makefile index e2a31dc1ee..e3791e117a 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -52,8 +52,9 @@ initram: # This needs to be compressed with the default compressor # -linuxbios_ram: $(obj)/statictree.o +$(obj)/linuxbios.stage2: $(obj)/statictree.o $(Q)echo "building linuxbios_ram" + touch $(obj)/linuxbios.stage2 # # The payload as we love it. Get it from somewhere. @@ -70,13 +71,14 @@ payload: # build the lar archive # -$(obj)/linuxbios.lar: $(obj)/util/lar/lar lzma linuxbios.initram linuxbios_ram payload +$(obj)/linuxbios.lar: $(obj)/util/lar/lar lzma $(obj)/linuxbios.initram $(obj)/linuxbios.stage2 payload $(Q)echo "Building LinuxBIOS archive..." $(Q)rm -rf $(obj)/lar.tmp $(Q)mkdir $(obj)/lar.tmp $(Q)mkdir $(obj)/lar.tmp/normal $(Q)cp $(obj)/linuxbios.initram $(obj)/lar.tmp/normal/initram - $(Q)cd $(obj)/lar.tmp && ../util/lar/lar c ../linuxbios.lar.pre normal/initram + $(Q)cp $(obj)/linuxbios.stage2 $(obj)/lar.tmp/normal/stage2 + $(Q)cd $(obj)/lar.tmp && ../util/lar/lar c ../linuxbios.lar.pre normal/initram normal/stage2 # TODO: dynamically pad the lar archive. bs is image size - bootblock size (8k) $(Q)dd if=$(obj)/linuxbios.lar.pre of=$(obj)/linuxbios.lar bs=253952 count=1 conv=sync @@ -103,10 +105,10 @@ $(obj)/stage0.init: @$(CC) $(INITCFLAGS) -c $(src)/console/vtxprintf.c -o $(obj)/vtxprintf.o @$(CC) $(INITCFLAGS) -c $(src)/lib/uart8250.c -o $(obj)/uart8250.o # other lib parts - @$(CC) $(INITCFLAGS) -c $(src)/lib/memcpy.c -o $(obj)/memcpy.o + @$(CC) $(INITCFLAGS) -c $(src)/lib/mem.c -o $(obj)/mem.o @cd $(obj); $(CC) -m32 -nostdlib -static -T $(src)/arch/x86/ldscript.ld cachemain.o console.o uart8250.o \ - serial.o vtxprintf.o lar.o memcpy.o stage0_i586.o -o stage0.o + serial.o vtxprintf.o lar.o mem.o stage0_i586.o -o stage0.o @objcopy -O binary $(obj)/stage0.o $(obj)/stage0.init.pre # Pad boot block to 0x2000 - 0x100 diff --git a/arch/x86/cachemain.c b/arch/x86/cachemain.c index 8c8c03c379..e1731aa713 100644 --- a/arch/x86/cachemain.c +++ b/arch/x86/cachemain.c @@ -30,7 +30,7 @@ void console_init(void); void die(const char *msg); int find_file(struct mem_file *archive, char *filename, struct mem_file *result); -static void post_code(u8 value) +void post_code(u8 value) { outb(value, 0x80); } @@ -90,25 +90,33 @@ void stage1_main(u32 bist) // but NOT IN THE CODE. archive.len=LINUXBIOS_ROMSIZE_KB*1024; - archive.start=(void *)(0UL-archive.len); + archive.start=(void *)(0UL-archive.len); + /* This won't work; the for loop in lib/lar.c will always + * fail as adding len to start will be 0. + * shave off 0x1000 since we know that is the boot block + */ + archive.len-=0x1000; +printk(BIOS_INFO, "Start search at 0x%x, size %d\n", archive.start, archive.len); // FIXME check integrity // fixme: choose an initram image (normal/fallback) // find first initram - ret=find_file(&archive, "normal/initram", &result); - if(!ret) { - void (*initram)(void); - initram=(result.start); - printk(BIOS_INFO, "Jumping to RAM init code at 0x%08x\n", - result.start); - initram(); + ret = run_file(&archive, "normal/initram", (void *)(512*1024)); //CONFIG_CARBASE; - } + if (ret) + die("Failed ram init code\n"); - die ("FATAL: No initram module found\n"); + printk(BIOS_INFO, "Done ram init code\n"); + ret = run_file(&archive, "normal/stage2", (void *)0x1000); + if (ret) + die("Failed stage2 code\n"); + + printk(BIOS_INFO, "Done stage2 code\n"); + + die ("FATAL: This is as far as it goes\n"); } diff --git a/arch/x86/config.h b/arch/x86/config.h index b41ac1b316..104e532cad 100644 --- a/arch/x86/config.h +++ b/arch/x86/config.h @@ -20,9 +20,9 @@ /* This config file is a place holder and will be created dynamically soon */ -#define LINUXBIOS_VERSION "3.0.0-wth" +#define LINUXBIOS_VERSION "3.0.0" #define LINUXBIOS_BUILD "Fri Jan 19 15:24:28 CET 2007" -#define LINUXBIOS_ROMSIZE_KB 512 +#define LINUXBIOS_ROMSIZE_KB 256 #define TTYS0_BASE 0x3f8