boot/uboot: add option to generate env image from default env
authorDenis Osterland <Denis.Osterland@diehl.com>
Mon, 12 Nov 2018 10:18:19 +0000 (10:18 +0000)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Thu, 1 Aug 2019 10:52:29 +0000 (12:52 +0200)
This patch adds support to extract compiled in default env
via u-boot's get_default_envs script and generate env image from it.

Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
boot/uboot/Config.in
boot/uboot/uboot.mk

index 1aa29a7d920f03cc17503b3af0aacde9d604435d..993979f27361694b6804d6fc59f322d665519472 100644 (file)
@@ -487,6 +487,8 @@ menuconfig BR2_TARGET_UBOOT_ENVIMAGE
 
          The environment image will be called uboot-env.bin.
 
+         Leave empty to generate image from compiled-in env.
+
 if BR2_TARGET_UBOOT_ENVIMAGE
 
 config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE
index ae09c37d84cbd69281ad1a7fe7ab01e351ac8dd5..0a8856d7db616020aac46a316fda7b74bb05ac8b 100644 (file)
@@ -271,8 +271,11 @@ define UBOOT_BUILD_OMAP_IFT
 endef
 
 ifneq ($(BR2_TARGET_UBOOT_ENVIMAGE),)
+UBOOT_GENERATE_ENV_FILE=$(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE))
 define UBOOT_GENERATE_ENV_IMAGE
-       cat $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)) \
+       $(if $(UBOOT_GENERATE_ENV_FILE), \
+               cat $(UBOOT_GENERATE_ENV_FILE), \
+               CROSS_COMPILE="$(TARGET_CROSS)" $(@D)/scripts/get_default_envs.sh $(@D)) \
                >$(@D)/buildroot-env.txt
        $(HOST_DIR)/bin/mkenvimage -s $(BR2_TARGET_UBOOT_ENVIMAGE_SIZE) \
                $(if $(BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT),-r) \
@@ -385,9 +388,6 @@ endef
 
 ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y)
 ifeq ($(BR_BUILDING),y)
-ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)),)
-$(error Please define a source file for Uboot environment (BR2_TARGET_UBOOT_ENVIMAGE_SOURCE setting))
-endif
 ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SIZE)),)
 $(error Please provide Uboot environment size (BR2_TARGET_UBOOT_ENVIMAGE_SIZE setting))
 endif