diff mbox series

[v2] u-boot: add option to generate env image from default env

Message ID 20181112101748.24707-1-Denis.Osterland@diehl.com
State Accepted
Headers show
Series [v2] u-boot: add option to generate env image from default env | expand

Commit Message

Denis Osterland-Heim Nov. 12, 2018, 10:18 a.m. UTC
From: Denis Osterland <Denis.Osterland@diehl.com>

This patch adds support to extract compiled in default env
via u-boots get_default_envs script and generate env image from it.

Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>
---
v1 -> v2: use compiled in env if sources list is empty,
          as suggested by Arnout Vandecappelle

 boot/uboot/Config.in | 2 ++
 boot/uboot/uboot.mk  | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

Comments

Denis Osterland-Heim Dec. 4, 2018, 12:55 p.m. UTC | #1
Hi,

any objections here?

Regards Denis

Am Montag, den 12.11.2018, 11:17 +0100 schrieb Denis OSTERLAND:
> From: Denis Osterland <Denis.Osterland@diehl.com>
> 
> This patch adds support to extract compiled in default env
> via u-boots get_default_envs script and generate env image from it.
> 
> Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>
> ---
> v1 -> v2: use compiled in env if sources list is empty,
>           as suggested by Arnout Vandecappelle
> 
>  boot/uboot/Config.in | 2 ++
>  boot/uboot/uboot.mk  | 8 ++++----
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
> index ac6f8bc8c1..2e3a112874 100644
> --- a/boot/uboot/Config.in
> +++ b/boot/uboot/Config.in
> @@ -466,6 +466,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
> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
> index cbdfee6ac3..693fe69508 100644
> --- a/boot/uboot/uboot.mk
> +++ b/boot/uboot/uboot.mk
> @@ -262,8 +262,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) \
> @@ -376,9 +379,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

Diehl Connectivity Solutions GmbH
Geschäftsführung: Horst Leonberger
Sitz der Gesellschaft: Nürnberg - Registergericht: Amtsgericht
Nürnberg: HRB 32315
Arnout Vandecappelle Aug. 1, 2019, 10:32 a.m. UTC | #2
On 14/01/2019 16:28, Denis OSTERLAND wrote:
> From: Denis Osterland <Denis.Osterland@diehl.com>
> 
> This patch adds support to extract compiled in default env
> via u-boots get_default_envs script and generate env image from it.
> 
> Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>

 Applied to master, thanks.

 Sorry it took so long.

 Regards,
 Arnout
diff mbox series

Patch

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index ac6f8bc8c1..2e3a112874 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -466,6 +466,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
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index cbdfee6ac3..693fe69508 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -262,8 +262,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) \
@@ -376,9 +379,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