Author: myles Date: 2008-02-25 19:32:23 +0100 (Mon, 25 Feb 2008) New Revision: 620
Modified: coreboot-v3/Kconfig coreboot-v3/arch/x86/Makefile Log: This is the part of the parse ELF patch that affects the coreboot build. It makes the default to parse the ELF, but leaves ELF parsing available. It doesn't include the removal of the per-file option "nocompress".
Signed-off-by: Myles Watson mylesgw@gmail.com The coreboot part looks OK and is Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Modified: coreboot-v3/Kconfig =================================================================== --- coreboot-v3/Kconfig 2008-02-25 17:20:27 UTC (rev 619) +++ coreboot-v3/Kconfig 2008-02-25 18:32:23 UTC (rev 620) @@ -96,29 +96,6 @@ prompt "Payload type" default PAYLOAD_NONE
-config PAYLOAD_PREPARSE_ELF - bool "Pre-parse ELF file and convert ELF segments to LAR entries" - depends EXPERT - 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 - to be decompressed to memory and then the segments have to be - copied. Plus, lar can't see the segments in the ELF -- to see all - segments, you have to extract the ELF and run readelf on it. - - There are problems with collisions of the decompressed ELF - location in memory and the segment locations in memory. - Finally, validation of the ELF is done at run time, once you have - 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 - segment into a LAR entry. ELF will not be used at all. Note that - (for now) coreboot is backward compatible -- if you put an ELF - payload in, coreboot can still parse it. We hope to remove ELF - entirely in the future. - config PAYLOAD_ELF bool "An ELF executable payload file" help @@ -143,10 +120,33 @@
config PAYLOAD_FILE string "Payload path and filename" - depends PAYLOAD_ELF || PAYLOAD_PREPARSE_ELF + depends PAYLOAD_ELF default "payload.elf" 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 + help + Until now, coreboot has used ELF for the payload. There are many + problems with this, not least being the inefficiency -- the ELF has + to be decompressed to memory and then the segments have to be + copied. Plus, lar can't see the segments in the ELF -- to see all + segments, you have to extract the ELF and run readelf on it. + + There are problems with collisions of the decompressed ELF + location in memory and the segment locations in memory. + Finally, validation of the ELF is done at run time, once you have + 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 + 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 + entirely in the future. + endmenu
Modified: coreboot-v3/arch/x86/Makefile =================================================================== --- coreboot-v3/arch/x86/Makefile 2008-02-25 17:20:27 UTC (rev 619) +++ coreboot-v3/arch/x86/Makefile 2008-02-25 18:32:23 UTC (rev 620) @@ -36,10 +36,8 @@
ROM_SIZE := $(shell expr $(CONFIG_COREBOOT_ROMSIZE_KB) * 1024)
-LARFILES := nocompress:normal/initram normal/stage2 nocompress:normal/option_table -ifneq ($(CONFIG_PAYLOAD_NONE),y) -LARFILES += normal/payload -endif +LARFILES_NOCOMPRESS := normal/initram normal/option_table +LARFILES_COMPRESSIBLE := normal/stage2
DECOMPRESSORS := ifeq ($(CONFIG_COMPRESSION_LZMA),y) @@ -64,24 +62,31 @@ $(Q)cp $(obj)/coreboot.initram $(obj)/lar.tmp/normal/initram $(Q)cp $(obj)/coreboot.stage2 $(obj)/lar.tmp/normal/stage2 $(Q)cp $(obj)/option_table $(obj)/lar.tmp/normal/option_table + $(Q)printf " LAR $(subst $(shell pwd)/,,$(@))\n" + $(Q)rm -f $(obj)/coreboot.rom + $(Q)cd $(obj)/lar.tmp && \ + ../util/lar/lar -e -c \ + ../coreboot.rom \ + $(LARFILES_NOCOMPRESS) \ + -s $(ROM_SIZE) -b $(obj)/coreboot.bootblock + $(Q)cd $(obj)/lar.tmp && \ + ../util/lar/lar -e $(COMPRESSFLAG) -a \ + ../coreboot.rom \ + $(LARFILES_COMPRESSIBLE) ifeq ($(CONFIG_PAYLOAD_NONE),y) $(Q)printf " PAYLOAD none (as specified by user)\n" else - $(Q)# TODO: Print sth. other than $(CONFIG_PAYLOAD_FILE) if compressed. $(Q)if [ -r $(CONFIG_PAYLOAD_FILE) ]; then \ - printf " PAYLOAD $(CONFIG_PAYLOAD_FILE)\n"; \ + printf " PAYLOAD $(CONFIG_PAYLOAD_FILE) $(COMPRESSFLAG)\n"; \ cp $(CONFIG_PAYLOAD_FILE) $(obj)/lar.tmp/normal/payload; \ else \ printf "Error: payload file '$(CONFIG_PAYLOAD_FILE)' not found.\n"; \ exit 1; \ fi + $(Q)cd $(obj)/lar.tmp && \ + ../util/lar/lar $(PARSEELF) $(COMPRESSFLAG) -a \ + ../coreboot.rom normal/payload; endif - $(Q)printf " LAR $(subst $(shell pwd)/,,$(@))\n" - $(Q)rm -f $(obj)/coreboot.rom - $(Q)cd $(obj)/lar.tmp && ../util/lar/lar $(PARSEELF) $(COMPRESSFLAG) -c \ - ../coreboot.rom \ - $(LARFILES) \ - -s $(ROM_SIZE) -b $(obj)/coreboot.bootblock $(Q)# QEMU wants bios.bin: $(Q)# Run "qemu -L build/ -serial stdio -hda /dev/zero". $(Q)printf " CP $(subst $(shell pwd)/,,$(obj)/bios.bin)\n" @@ -123,12 +128,10 @@ endif endif
- -# We now parse initram as ELF, so we need PARSEELF enabled unconditionally. ifeq ($(CONFIG_PAYLOAD_PREPARSE_ELF), y) PARSEELF = -e else - PARSEELF = -e + PARSEELF = endif
STAGE0_OBJ := $(patsubst %,$(obj)/lib/%,$(STAGE0_LIB_OBJ)) \