From b7d81e05bb3e4058cbb28adcc5af0bdccfe88337 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 9 Jun 2013 21:10:10 -0700 Subject: [PATCH] ARM: Put the ROM stage into the image before other bits. On ARM, there's frequently some firmware built into the SOC which runs first and which loads other firmware like Coreboot from some other media. To prevent the bootblock from having to know how to find and load the ROM stage from what may be a complicated source (sd card, netbooting, etc.), we can put the ROM stage immediately after the bootblock and ensure that they're both loaded at the same time. This change adjusts the Makefile.inc for ARM so that the ROM stage is put into the image before any other files so that we know it comes first. This changes the behavior of the CONFIG_UPDATE_IMAGE config option used by abuild, although it's not entirely clear whether that's still used. Change-Id: I832386243788156db5f5abbc9760a4e2026cf2cd Signed-off-by: Gabe Black Reviewed-on: http://review.coreboot.org/3420 Reviewed-by: Patrick Georgi Tested-by: build bot (Jenkins) --- src/arch/armv7/Makefile.inc | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/arch/armv7/Makefile.inc b/src/arch/armv7/Makefile.inc index 2c280f47e1..104577445c 100644 --- a/src/arch/armv7/Makefile.inc +++ b/src/arch/armv7/Makefile.inc @@ -46,16 +46,20 @@ prebuild-files = \ prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file))) # TODO Change -b to Kconfig variable. -$(obj)/coreboot.pre1: $(objcbfs)/bootblock.bin $$(prebuilt-files) $(CBFSTOOL) +$(obj)/coreboot.pre: $(objcbfs)/bootblock.bin $(objcbfs)/romstage.elf $$(prebuilt-files) $(CBFSTOOL) $(CBFSTOOL) $@.tmp create -m armv7 -s $(CONFIG_COREBOOT_ROMSIZE_KB)K \ -B $(objcbfs)/bootblock.bin -a 64 -b 0x0000 \ -H $(CONFIG_CBFS_HEADER_ROM_OFFSET) \ -o $(CONFIG_CBFS_ROM_OFFSET) + @printf " CBFS $(subst $(obj)/,,$(@))\n" + $(CBFSTOOL) $@.tmp add-stage \ + -f $(objcbfs)/romstage.elf -b 0 \ + -n $(CONFIG_CBFS_PREFIX)/romstage -c none $(prebuild-files) true mv $@.tmp $@ else -.PHONY: $(obj)/coreboot.pre1 -$(obj)/coreboot.pre1: $(CBFSTOOL) +.PHONY: $(obj)/coreboot.pre +$(obj)/coreboot.pre: $(CBFSTOOL) mv $(obj)/coreboot.rom $@ endif @@ -183,17 +187,6 @@ ifeq ($(CONFIG_HAVE_BUS_CONFIG),y) ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c endif -################################################################################ -# Build the final rom image - -$(obj)/coreboot.pre: $(objcbfs)/romstage.elf $(obj)/coreboot.pre1 $(CBFSTOOL) - @printf " CBFS $(subst $(obj)/,,$(@))\n" - cp $(obj)/coreboot.pre1 $@.tmp - $(CBFSTOOL) $@.tmp add-stage \ - -f $(objcbfs)/romstage.elf \ - -n $(CONFIG_CBFS_PREFIX)/romstage -c none - mv $@.tmp $@ - ################################################################################ # Build the bootblock