Commit b16f521a5e87208cebbd17964452e11704416c3f
Committed by
Simon Glass
1 parent
8a487a4417
Exists in
master
and in
54 other branches
x86: Allow excluding reset vector code from u-boot
When running from coreboot we don't want this code. This version works by ifdef-ing out all of the code that would go into those sections and all the code that refers to it. The sections are then empty, and the linker will either leave them empty for the loader to ignore or remove them entirely. Signed-off-by: Gabe Black <gabeblack@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 4 changed files with 13 additions and 5 deletions Side-by-side Diff
Makefile
... | ... | @@ -231,8 +231,8 @@ |
231 | 231 | |
232 | 232 | OBJS = $(CPUDIR)/start.o |
233 | 233 | ifeq ($(CPU),x86) |
234 | -OBJS += $(CPUDIR)/start16.o | |
235 | -OBJS += $(CPUDIR)/resetvec.o | |
234 | +RESET_OBJS-$(CONFIG_X86_NO_RESET_VECTOR) += $(CPUDIR)/start16.o | |
235 | +RESET_OBJS-$(CONFIG_X86_NO_RESET_VECTOR) += $(CPUDIR)/resetvec.o | |
236 | 236 | endif |
237 | 237 | ifeq ($(CPU),ppc4xx) |
238 | 238 | OBJS += $(CPUDIR)/resetvec.o |
... | ... | @@ -241,7 +241,7 @@ |
241 | 241 | OBJS += $(CPUDIR)/resetvec.o |
242 | 242 | endif |
243 | 243 | |
244 | -OBJS := $(addprefix $(obj),$(OBJS)) | |
244 | +OBJS := $(addprefix $(obj),$(OBJS) $(RESET_OBJS-)) | |
245 | 245 | |
246 | 246 | HAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n) |
247 | 247 |
README
... | ... | @@ -3664,6 +3664,10 @@ |
3664 | 3664 | be used if available. These functions may be faster under some |
3665 | 3665 | conditions but may increase the binary size. |
3666 | 3666 | |
3667 | +- CONFIG_X86_NO_RESET_VECTOR | |
3668 | + If defined, the x86 reset vector code is excluded. You will need | |
3669 | + to do this when U-Boot is running from Coreboot. | |
3670 | + | |
3667 | 3671 | Freescale QE/FMAN Firmware Support: |
3668 | 3672 | ----------------------------------- |
3669 | 3673 |
arch/x86/cpu/Makefile
... | ... | @@ -28,12 +28,13 @@ |
28 | 28 | |
29 | 29 | LIB = $(obj)lib$(CPU).o |
30 | 30 | |
31 | -START = start.o start16.o resetvec.o | |
31 | +START-y = start.o | |
32 | +RESET_OBJS-$(CONFIG_X86_NO_RESET_VECTOR) += resetvec.o start16.o | |
32 | 33 | COBJS = interrupts.o cpu.o |
33 | 34 | |
34 | 35 | SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) |
35 | 36 | OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) |
36 | -START := $(addprefix $(obj),$(START)) | |
37 | +START := $(addprefix $(obj),$(START-y) $(RESET_OBJS-)) | |
37 | 38 | |
38 | 39 | all: $(obj).depend $(START) $(LIB) |
39 | 40 |
arch/x86/cpu/u-boot.lds
... | ... | @@ -86,6 +86,8 @@ |
86 | 86 | __bios_start = LOADADDR(.bios); |
87 | 87 | __bios_size = SIZEOF(.bios); |
88 | 88 | |
89 | +#ifndef CONFIG_X86_NO_RESET_VECTOR | |
90 | + | |
89 | 91 | /* |
90 | 92 | * The following expressions place the 16-bit Real-Mode code and |
91 | 93 | * Reset Vector at the end of the Flash ROM |
... | ... | @@ -95,5 +97,6 @@ |
95 | 97 | |
96 | 98 | . = RESET_VEC_LOC; |
97 | 99 | .resetvec : AT (CONFIG_SYS_TEXT_BASE + (CONFIG_SYS_MONITOR_LEN - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); } |
100 | +#endif | |
98 | 101 | } |