Use the elf-parsing capabilities of LAR to parse the initram.o file,

and create a valid LAR header with an entry value. This will fix the
problems Ron is having on the ALIX 1C and probably allow it to boot.
It also sets the text base of the .o to 0, instead of whatever wacky
value gld is choosing, so all platforms will have the same value.
Get away from worrying about potential gld bugs, now and in the future.

As added benefit, we obsolete a lot of code without introducing
new code.

Qemu target entry point debugging has been added to be able to spot
problems with entry points in the future.

This patch is a joint work of Ron and Carl-Daniel.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@523 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Carl-Daniel Hailfinger 2007-11-27 14:38:43 +00:00
commit 7eb899b0bb
9 changed files with 35 additions and 34 deletions

View file

@ -36,7 +36,7 @@ SILENT := >/dev/null 2>&1
ROM_SIZE := $(shell expr $(CONFIG_LINUXBIOS_ROMSIZE_KB) \* 1024)
LARFILES := nocompress:normal/initram normal/stage2 nocompress:normal/option_table
LARFILES := nocompress:normal/initram.o normal/stage2 nocompress:normal/option_table
ifneq ($(CONFIG_PAYLOAD_NONE),y)
LARFILES += normal/payload
endif
@ -57,11 +57,11 @@ ifeq ($(CONFIG_DEFAULT_COMPRESSION_NRV2B),y)
COMPRESSFLAG := -C nrv2b
endif
$(obj)/linuxbios.rom $(obj)/linuxbios.map: $(obj)/linuxbios.bootblock $(obj)/util/lar/lar lzma nrv2b $(obj)/linuxbios.initram $(obj)/linuxbios.stage2 $(obj)/option_table
$(obj)/linuxbios.rom $(obj)/linuxbios.map: $(obj)/linuxbios.bootblock $(obj)/util/lar/lar lzma nrv2b $(obj)/linuxbios.initram.o $(obj)/linuxbios.stage2 $(obj)/option_table
$(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)cp $(obj)/linuxbios.initram.o $(obj)/lar.tmp/normal/initram.o
$(Q)cp $(obj)/linuxbios.stage2 $(obj)/lar.tmp/normal/stage2
$(Q)cp $(obj)/option_table $(obj)/lar.tmp/normal/option_table
ifeq ($(CONFIG_PAYLOAD_NONE),y)
@ -122,10 +122,12 @@ else
endif
endif
# We now parse initram as ELF, so we need PARSEELF enabled unconditionally.
ifeq ($(CONFIG_PAYLOAD_PREPARSE_ELF), y)
PARSEELF = -e
else
PARSEELF =
PARSEELF = -e
endif
STAGE0_OBJ := $(patsubst %,$(obj)/lib/%,$(STAGE0_LIB_OBJ)) \

View file

@ -138,17 +138,17 @@ void __attribute__((stdcall)) stage1_main(u32 bist)
// find first initram
if (check_normal_boot_flag()) {
printk(BIOS_DEBUG, "Choosing normal boot.\n");
ret = execute_in_place(&archive, "normal/initram");
ret = execute_in_place(&archive, "normal/initram.o/segment0");
} else {
printk(BIOS_DEBUG, "Choosing fallback boot.\n");
ret = execute_in_place(&archive, "fallback/initram");
ret = execute_in_place(&archive, "fallback/initram.o/segment0");
/* Try a normal boot if fallback doesn't exist in the lar.
* TODO: There are other ways to do this.
* It could be ifdef or the boot flag could be forced.
*/
if (ret) {
printk(BIOS_DEBUG, "Fallback failed. Try normal boot\n");
ret = execute_in_place(&archive, "normal/initram");
ret = execute_in_place(&archive, "normal/initram.o/segment0");
}
}