Skip to content

Commit

Permalink
package/uboot: detect missing user-supplied environment source files
Browse files Browse the repository at this point in the history
Since 0542bb7 (uboot: Support multiple environment source files),
missing user-supplied environment source files is no longer detected.

This is because we cat them all, and feed the concatenation to the stdin
of mkenvimage. So, if one source file is missing, the cat exits in error,
but the compound command exits with the exit code of the last command,
which is that of mkenvimage, which happens to be happy with whatever it
is fed on its stdin, even is empty.

We fix that by creating a temporary file, that we even leave afterward
for the user to inspect.

We also move it out of the _CMDS block and into a macro of its own, so
that it is easier to write and maintain.

Signed-off-by: "Yann E. MORIN" <[email protected]>
Cc: Cam Hutchison <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
  • Loading branch information
yann-morin-1998 authored and tpetazzoni committed Dec 14, 2017
1 parent 8636a3c commit c9b6604
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions boot/uboot/uboot.mk
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,18 @@ define UBOOT_BUILD_OMAP_IFT
-c $(call qstrip,$(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG))
endef

ifneq ($(BR2_TARGET_UBOOT_ENVIMAGE),)
define UBOOT_GENERATE_ENV_IMAGE
cat $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)) \
>$(@D)/buildroot-env.txt
$(HOST_DIR)/bin/mkenvimage -s $(BR2_TARGET_UBOOT_ENVIMAGE_SIZE) \
$(if $(BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT),-r) \
$(if $(filter BIG,$(BR2_ENDIAN)),-b) \
-o $(BINARIES_DIR)/uboot-env.bin \
$(@D)/buildroot-env.txt
endef
endif

define UBOOT_INSTALL_IMAGES_CMDS
$(foreach f,$(UBOOT_BINS), \
cp -dpf $(@D)/$(f) $(BINARIES_DIR)/
Expand All @@ -254,12 +266,7 @@ define UBOOT_INSTALL_IMAGES_CMDS
cp -dpf $(@D)/$(f) $(BINARIES_DIR)/
)
)
$(if $(BR2_TARGET_UBOOT_ENVIMAGE),
cat $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)) | \
$(HOST_DIR)/bin/mkenvimage -s $(BR2_TARGET_UBOOT_ENVIMAGE_SIZE) \
$(if $(BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT),-r) \
$(if $(filter BIG,$(BR2_ENDIAN)),-b) \
-o $(BINARIES_DIR)/uboot-env.bin -)
$(UBOOT_GENERATE_ENV_IMAGE)
$(if $(BR2_TARGET_UBOOT_BOOT_SCRIPT),
$(HOST_DIR)/bin/mkimage -C none -A $(MKIMAGE_ARCH) -T script \
-d $(call qstrip,$(BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE)) \
Expand Down

0 comments on commit c9b6604

Please sign in to comment.