Fix coreboot makefiles not to produce half baked output.
It looks like the cbfstool utility generates the output file even when it fails to generate it properly. This causes make, if started second time in a row, after cbfstool failure, to continue beyond the point of failure (as the corrupted output file is present in the output tree, the second make invocation presumes that it is valid, as it is newer than the dependencies). The output file should be created only when successful, in an atomic operation. There could be other places in the make system which require a similar fix, this needs to be investigated further. Change-Id: I7c17f033ee5937eb712b1a594122430cee5c9146 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://review.coreboot.org/750 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
cde7801c2e
commit
10fea92477
|
@ -58,13 +58,15 @@ extract_nth=$(word $(1), $(subst |, ,$(2)))
|
||||||
ifneq ($(CONFIG_UPDATE_IMAGE),y)
|
ifneq ($(CONFIG_UPDATE_IMAGE),y)
|
||||||
prebuild-files = \
|
prebuild-files = \
|
||||||
$(foreach file,$(cbfs-files), \
|
$(foreach file,$(cbfs-files), \
|
||||||
$(CBFSTOOL) $@ add $(call extract_nth,1,$(file)) $(call extract_nth,2,$(file)) $(call extract_nth,3,$(file)) $(call extract_nth,4,$(file)); )
|
$(CBFSTOOL) $@.tmp add $(call extract_nth,1,$(file)) \
|
||||||
|
$(call extract_nth,2,$(file)) $(call extract_nth,3,$(file)) \
|
||||||
|
$(call extract_nth,4,$(file)) &&)
|
||||||
prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
|
prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
|
||||||
|
|
||||||
$(obj)/coreboot.pre1: $(obj)/coreboot.bootblock $$(prebuilt-files) $(CBFSTOOL)
|
$(obj)/coreboot.pre1: $(obj)/coreboot.bootblock $$(prebuilt-files) $(CBFSTOOL)
|
||||||
rm -f $@
|
$(CBFSTOOL) $@.tmp create $(CONFIG_COREBOOT_ROMSIZE_KB)K $(obj)/coreboot.bootblock
|
||||||
$(CBFSTOOL) $@ create $(CONFIG_COREBOOT_ROMSIZE_KB)K $(obj)/coreboot.bootblock
|
$(prebuild-files) true
|
||||||
$(prebuild-files)
|
mv $@.tmp $@
|
||||||
else
|
else
|
||||||
.PHONY: $(obj)/coreboot.pre1
|
.PHONY: $(obj)/coreboot.pre1
|
||||||
$(obj)/coreboot.pre1: $(CBFSTOOL)
|
$(obj)/coreboot.pre1: $(CBFSTOOL)
|
||||||
|
@ -269,10 +271,10 @@ endif
|
||||||
|
|
||||||
$(obj)/coreboot.pre: $(obj)/coreboot.romstage $(obj)/coreboot.pre1 $(CBFSTOOL)
|
$(obj)/coreboot.pre: $(obj)/coreboot.romstage $(obj)/coreboot.pre1 $(CBFSTOOL)
|
||||||
@printf " CBFS $(subst $(obj)/,,$(@))\n"
|
@printf " CBFS $(subst $(obj)/,,$(@))\n"
|
||||||
rm -f $@
|
cp $(obj)/coreboot.pre1 $@.tmp
|
||||||
cp $(obj)/coreboot.pre1 $@
|
$(CBFSTOOL) $@.tmp add-stage $(obj)/romstage.elf \
|
||||||
$(CBFSTOOL) $@ add-stage $(obj)/romstage.elf \
|
|
||||||
$(CONFIG_CBFS_PREFIX)/romstage x 0x$(shell cat $(obj)/location.txt)
|
$(CONFIG_CBFS_PREFIX)/romstage x 0x$(shell cat $(obj)/location.txt)
|
||||||
|
mv $@.tmp $@
|
||||||
#FIXME: location.txt might require an offset of header size
|
#FIXME: location.txt might require an offset of header size
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
Loading…
Reference in New Issue