Author: myles Date: 2008-03-13 14:22:44 +0100 (Thu, 13 Mar 2008) New Revision: 640
Modified: coreboot-v3/Kconfig coreboot-v3/arch/x86/Makefile coreboot-v3/arch/x86/stage1.c Log: This patch is a hopefully less controversial version of a previous patch which removed the ELF loader from coreboot v3. This adds a Kconfig option PAYLOAD_ELF_LOADER which builds the loader into v3. In order to make it a little safer, I changed PAYLOAD_PREPARSE_ELF to PAYLOAD_NO_PREPARSE_ELF and made that option depend on PAYLOAD_ELF_LOADER so that no one adds an unparsed ELF without the loader.
One part that was strange to me was that I first tried adding elfboot.o and archelfboot.o to the beginning of the list of object files. I added them to the end of the list instead.
Myles
Signed-off-by: Myles Watson mylesgw@gmail.com Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Modified: coreboot-v3/Kconfig =================================================================== --- coreboot-v3/Kconfig 2008-03-13 03:02:33 UTC (rev 639) +++ coreboot-v3/Kconfig 2008-03-13 13:22:44 UTC (rev 640) @@ -92,6 +92,12 @@
menu "Payload"
+config PAYLOAD_ELF_LOADER + bool "Include ELF payload loader" + default n + help + This option allows an unparsed ELF paylaod to be added and loaded. + choice prompt "Payload type" default PAYLOAD_NONE @@ -125,10 +131,10 @@ help The path and filename of the ELF executable file to use as payload.
-config PAYLOAD_PREPARSE_ELF - bool "Pre-parse ELF file and convert ELF segments to LAR entries" - depends PAYLOAD_ELF - default y +config PAYLOAD_NO_PREPARSE_ELF + bool "Add ELF without parsing and converting to LAR entries" + depends PAYLOAD_ELF && PAYLOAD_ELF_LOADER + default n help Until now, coreboot has used ELF for the payload. There are many problems with this, not least being the inefficiency -- the ELF has @@ -142,7 +148,7 @@ flashed the FLASH and rebooted the machine. Boot time is really not the time you want to find out your ELF payload is broken.
- With this option, coreboot will direct lar to break each ELF + Without this option, coreboot will direct lar to break each ELF segment into a LAR entry. ELF will not be used at all. Note that (for now) coreboot is not backward compatible -- if you put an ELF payload in, coreboot can not parse it. We hope to remove ELF
Modified: coreboot-v3/arch/x86/Makefile =================================================================== --- coreboot-v3/arch/x86/Makefile 2008-03-13 03:02:33 UTC (rev 639) +++ coreboot-v3/arch/x86/Makefile 2008-03-13 13:22:44 UTC (rev 640) @@ -105,11 +105,17 @@ # initram module and the various stages and payload files. #
-STAGE0_LIB_OBJ = uart8250.o mem.o elfboot.o lar.o delay.o vtxprintf.o \ + +STAGE0_LIB_OBJ = uart8250.o mem.o lar.o delay.o vtxprintf.o \ vsprintf.o console.o string.o $(DECOMPRESSORS) -STAGE0_ARCH_X86_OBJ = stage1.o serial.o archelfboot.o speaker.o \ +STAGE0_ARCH_X86_OBJ = stage1.o serial.o speaker.o \ udelay_io.o mc146818rtc.o post_code.o
+ifeq ($(CONFIG_PAYLOAD_ELF_LOADER),y) +STAGE0_LIB_OBJ += elfboot.o +STAGE0_ARCH_X86_OBJ += archelfboot.o +endif + ifeq ($(CONFIG_CPU_I586),y) STAGE0_CAR_OBJ = stage0_i586.o else @@ -122,10 +128,10 @@ endif endif
-ifeq ($(CONFIG_PAYLOAD_PREPARSE_ELF), y) +ifeq ($(CONFIG_PAYLOAD_NO_PREPARSE_ELF), y) + PARSEELF = +else PARSEELF = -e -else - PARSEELF = endif
STAGE0_OBJ := $(patsubst %,$(obj)/lib/%,$(STAGE0_LIB_OBJ)) \
Modified: coreboot-v3/arch/x86/stage1.c =================================================================== --- coreboot-v3/arch/x86/stage1.c 2008-03-13 03:02:33 UTC (rev 639) +++ coreboot-v3/arch/x86/stage1.c 2008-03-13 13:22:44 UTC (rev 640) @@ -28,10 +28,12 @@ #include <mc146818rtc.h> #include <cpu.h>
+#ifdef CONFIG_PAYLOAD_ELF_LOADER /* ah, well, what a mess! This is a hard code. FIX ME but how? * By getting rid of ELF ... */ #define UNCOMPRESS_AREA (0x400000) +#endif /* CONFIG_PAYLOAD_ELF_LOADER */
/* these prototypes should go into headers */ void uart_init(void); @@ -86,6 +88,8 @@ return; }
+ +#ifdef CONFIG_PAYLOAD_ELF_LOADER /* until we get rid of elf */ int legacy(struct mem_file *archive, char *name, void *where, struct lb_memory *mem) { @@ -101,6 +105,7 @@ printk(BIOS_ERR, "elfboot_mem returns %d\n", ret); return -1; } +#endif /* CONFIG_PAYLOAD_ELF_LOADER */
/* * This function is called from assembler code with its argument on the @@ -110,7 +115,9 @@ { int ret; struct mem_file archive, result; +#ifdef CONFIG_PAYLOAD_ELF_LOADER int elfboot_mem(struct lb_memory *mem, void *where, int size); +#endif /* CONFIG_PAYLOAD_ELF_LOADER */ void *entry;
/* we can't statically init this hack. */ @@ -202,9 +209,11 @@
printk(BIOS_DEBUG, "Stage2 code done.\n");
+#ifdef CONFIG_PAYLOAD_ELF_LOADER ret = find_file(&archive, "normal/payload", &result); if (! ret) legacy(&archive, "normal/payload", (void *)UNCOMPRESS_AREA, mem); +#endif /* CONFIG_PAYLOAD_ELF_LOADER */
entry = load_file_segments(&archive, "normal/payload"); if (entry != (void*)-1) {