This is another attempt at removing ELF support from v3. I'll try to
do a better job of explaining and justifying this time. The patch
should be followed by:
svn rm include/elf_boot.h
svn rm include/elf.h
svn rm include/arch/x86/arch/elf.h
svn rm lib/elfboot.c
svn rm arch/x86/archelfboot.c
Another follow-on would be to fix lar so it never puts an ELF into the
lar without parsing it.
Here are my reasons:
1. It wasn't being used anyway.
Unless you used lar to load the elf in, the Makefile always
parsed the elf with -e
2. It duplicated code.
There is no reason for v3 to understand ELF when lar parses it.
3. It saves space.
Here's the last little bit of stage0.init.map
Without the patch:
ffffcc8c T rawpnp_write_config
ffffcca8 T rawpnp_set_logical_device
ffffcccb T rawpnp_set_iobase
ffffccf4 T rawpnp_set_enable
ffffcd19 T rawpnp_enter_ext_func_mode
ffffcd20 T rawpnp_exit_ext_func_mode
ffffd51f t __FUNCTION__.1410
ffffd540 t console_test.1503
ffffd57b T _estage0_1
fffffff0 A _ROMTOP
fffffff0 T _resetjump
With the patch:
ffffc885 T rawpnp_enter_ext_func_mode
ffffc88c T rawpnp_exit_ext_func_mode
ffffce20 t console_test.1503
ffffce5b T _estage0_1
fffffff0 A _ROMTOP
fffffff0 T _resetjump
I'm calculating the difference by subtracting the locations of _estage0_1
fffd57b - fffce5b = 0x720 = 1824 bytes
Not earth-shattering, but significant.
Myles
Signed-off-by: Myles Watson <[EMAIL PROTECTED]>
Index: Kconfig
===================================================================
--- Kconfig (revision 601)
+++ Kconfig (working copy)
@@ -96,35 +96,13 @@
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
Select this option if you have a payload image (an ELF file)
which coreboot should run as soon as the basic hardware
- initialization is completed.
+ initialization is completed. The build process will direct lar to
+ break each ELF segment into a LAR entry. Coreboot does not read ELF.
You will be able to specify the location and file name of the
payload image later.
@@ -143,10 +121,10 @@
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.
+ The path and filename of the ELF payload file.
endmenu
Index: include/post_code.h
===================================================================
--- include/post_code.h (revision 601)
+++ include/post_code.h (working copy)
@@ -58,8 +58,5 @@
#define POST_STAGE2_PCISCANBUS_ENTER 0x24
#define POST_STAGE2_PCISCANBUS_DONEFORLOOP 0x25
#define POST_STAGE2_PCISCANBUS_EXIT 0x55
-#define POST_ELFBOOT_JUMPING_TO_BOOTCODE 0xfe
-#define POST_ELFBOOT_LOADER_STARTED 0xf8
-#define POST_ELFBOOT_LOADER_IMAGE_FAILED 0xff
#endif /* POST_CODE_H */
Index: mainboard/emulation/qemu-x86/defconfig
===================================================================
--- mainboard/emulation/qemu-x86/defconfig (revision 601)
+++ mainboard/emulation/qemu-x86/defconfig (working copy)
@@ -83,6 +83,5 @@
#
# Payload
#
-# CONFIG_PAYLOAD_PREPARSE_ELF is not set
# CONFIG_PAYLOAD_ELF is not set
CONFIG_PAYLOAD_NONE=y
Index: arch/x86/stage1.c
===================================================================
--- arch/x86/stage1.c (revision 601)
+++ arch/x86/stage1.c (working copy)
@@ -28,11 +28,6 @@
#include <mc146818rtc.h>
#include <cpu.h>
-/* ah, well, what a mess! This is a hard code. FIX ME but how?
- * By getting rid of ELF ...
- */
-#define UNCOMPRESS_AREA (0x400000)
-
/* these prototypes should go into headers */
void uart_init(void);
void die(const char *msg);
@@ -86,22 +81,6 @@
return;
}
-/* until we get rid of elf */
-int legacy(struct mem_file *archive, char *name, void *where, struct lb_memory *mem)
-{
- int ret;
- int elfboot_mem(struct lb_memory *mem, void *where, int size);
- ret = copy_file(archive, name, where);
- if (ret) {
- printk(BIOS_ERR, "'%s' found, but could not load it.\n", name);
- }
-
- ret = elfboot_mem(mem, where, archive->reallen);
-
- printk(BIOS_ERR, "elfboot_mem returns %d\n", ret);
- return -1;
-}
-
/*
* This function is called from assembler code with its argument on the
* stack. Force the compiler to generate always correct code for this case.
@@ -110,7 +89,6 @@
{
int ret;
struct mem_file archive, result;
- int elfboot_mem(struct lb_memory *mem, void *where, int size);
void *entry;
/* we can't statically init this hack. */
@@ -202,10 +180,6 @@
printk(BIOS_DEBUG, "Stage2 code done.\n");
- ret = find_file(&archive, "normal/payload", &result);
- if (! ret)
- legacy(&archive, "normal/payload", (void *)UNCOMPRESS_AREA, mem);
-
entry = load_file_segments(&archive, "normal/payload");
if (entry != (void*)-1) {
/* Final coreboot call before handing off to the payload. */
Index: arch/x86/Makefile
===================================================================
--- arch/x86/Makefile (revision 601)
+++ arch/x86/Makefile (working copy)
@@ -78,7 +78,7 @@
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 \
+ $(Q)cd $(obj)/lar.tmp && ../util/lar/lar -e $(COMPRESSFLAG) -c \
../coreboot.rom \
$(LARFILES) \
-s $(ROM_SIZE) -b $(obj)/coreboot.bootblock
@@ -106,9 +106,9 @@
# 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_CPU_I586),y)
@@ -123,14 +123,6 @@
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
-endif
-
STAGE0_OBJ := $(patsubst %,$(obj)/lib/%,$(STAGE0_LIB_OBJ)) \
$(patsubst %,$(obj)/arch/x86/%,$(STAGE0_ARCH_X86_OBJ)) \
$(patsubst %,$(obj)/arch/x86/%,$(STAGE0_CAR_OBJ)) \
--
coreboot mailing list
[email protected]
http://www.coreboot.org/mailman/listinfo/coreboot