Skip to contentSkip to conversation

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

PATCH New Denis OSTERLAND 2 participants 8 messages Oct 2, 2018 – Aug 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 u-boot: add option to generate env image from default env

From: Denis Osterland <[email protected]>

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

---
 boot/uboot/Config.in | 15 +++++++++++++++
 boot/uboot/uboot.mk  |  6 +++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
boot/uboot/Config.in +15 -0
index 9e40c11fa1..a2e9c3866a 100644
@@ -468,8 +468,23 @@ menuconfig BR2_TARGET_UBOOT_ENVIMAGE
 
 if BR2_TARGET_UBOOT_ENVIMAGE
 
+choice
+	prompt "source"
+
+config BR2_TARGET_UBOOT_ENVIMAGE_TEXTFILE
+	bool "text file"
+
+config BR2_TARGET_UBOOT_ENVIMAGE_BUIILTIN
+	bool "compiled in"
+	help
+	  Use the default env from u-boot image.
+	  requires >= v2018.03
+
+endchoice # source
+
 config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE
 	string "Source files for environment"
+	depends on BR2_TARGET_UBOOT_ENVIMAGE_TEXTFILE
 	help
 	  Text files describing the environment. Files should have
 	  lines of the form var=value, one per line. Blank lines and
boot/uboot/uboot.mk +5 -1
index c5abc125f3..ae9e38c8c2 100644
@@ -263,7 +263,9 @@ endef
 
 ifneq ($(BR2_TARGET_UBOOT_ENVIMAGE),)
 define UBOOT_GENERATE_ENV_IMAGE
-	cat $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)) \
+	$(if $(BR2_TARGET_UBOOT_ENVIMAGE_BUIILTIN), \
+	CROSS_COMPILE="$(TARGET_CROSS)" $(@D)/scripts/get_default_envs.sh $(@D), \
+	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) \
@@ -376,9 +378,11 @@ endef
 
 ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y)
 ifeq ($(BR_BUILDING),y)
+ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE_TEXTFILE),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
+endif
 ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SIZE)),)
 $(error Please provide Uboot environment size (BR2_TARGET_UBOOT_ENVIMAGE_SIZE setting))
 endif
Signature · 15 lines
2.19.0



Diehl Connectivity Solutions GmbH
Gesch?ftsf?hrung: Horst Leonberger
Sitz der Gesellschaft: N?rnberg - Registergericht: Amtsgericht
N?rnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by
mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited. 
#1 lore raw

PATCH 1/1 u-boot: add option to generate env image from default env

Hi Denis,

I have a few very small comments about this patch.

Quoted 16 lines · Denis OSTERLAND

From: Denis Osterland <[email protected]>

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

---
 boot/uboot/Config.in | 15 +++++++++++++++
 boot/uboot/uboot.mk  |  6 +++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
boot/uboot/Config.in +0 -0
index 9e40c11fa1..a2e9c3866a 100644

boot/uboot/Config.in menuconfig BR2_TARGET_UBOOT_ENVIMAGE · line 472

Quoted 5 lines
boot/uboot/Config.in +2 -0
@@ -468,8 +468,23 @@ menuconfig BR2_TARGET_UBOOT_ENVIMAGE
 
 if BR2_TARGET_UBOOT_ENVIMAGE
 
+choice
+	prompt "source"

It's not immediately obvious that this is the source of the envimage, so better
"Source for environment".

boot/uboot/Config.in menuconfig BR2_TARGET_UBOOT_ENVIMAGE · line 474

Quoted 2 lines
boot/uboot/Config.in +2 -0
+
+config BR2_TARGET_UBOOT_ENVIMAGE_TEXTFILE

I would call this BR2_TARGET_UBOOT_ENVIMAGE_CUSTOM to be consistent with the
other uses of custom config files. However, see below.

boot/uboot/Config.in menuconfig BR2_TARGET_UBOOT_ENVIMAGE · line 475

Quoted 1 line
boot/uboot/Config.in +1 -0
+	bool "text file"

Here as well: "custom".

boot/uboot/Config.in menuconfig BR2_TARGET_UBOOT_ENVIMAGE · line 477

Quoted 2 lines
boot/uboot/Config.in +2 -0
+
+config BR2_TARGET_UBOOT_ENVIMAGE_BUIILTIN

and here _DEFAULT

boot/uboot/Config.in menuconfig BR2_TARGET_UBOOT_ENVIMAGE · line 478

Quoted 1 line
boot/uboot/Config.in +1 -0
+	bool "compiled in"

and "default".

boot/uboot/Config.in menuconfig BR2_TARGET_UBOOT_ENVIMAGE · line 487

Quoted 9 lines
boot/uboot/Config.in +7 -0
+	help
+	  Use the default env from u-boot image.
+	  requires >= v2018.03
+
+endchoice # source
+
 config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE
 	string "Source files for environment"
+	depends on BR2_TARGET_UBOOT_ENVIMAGE_TEXTFILE

However, I think it would be simpler to just allow this option to be empty. In
other words, remove the choice, and add something like the following at the end of the help text:

For U-Boot >= v2018.03, it is possible to leave this empty. In that case, the default environment for the target configuration will be used.

This is just an idea, if you don't like it, feel free to keep the current solution.

boot/uboot/uboot.mk endef · line 266

Quoted 13 lines
boot/uboot/Config.in +0 -0
 	help
 	  Text files describing the environment. Files should have
 	  lines of the form var=value, one per line. Blank lines and
boot/uboot/uboot.mk +1 -1
index c5abc125f3..ae9e38c8c2 100644
@@ -263,7 +263,9 @@ endef
 
 ifneq ($(BR2_TARGET_UBOOT_ENVIMAGE),)
 define UBOOT_GENERATE_ENV_IMAGE
-	cat $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)) \
+	$(if $(BR2_TARGET_UBOOT_ENVIMAGE_BUIILTIN), \

With the choice removed, this test could be:

	$(if $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)),

but then it is better to factor it out in a separate variable, e.g. UBOOT_GENERATE_ENV_FILE, that is protected by an ifdef.

Quoted 6 lines
boot/uboot/uboot.mk +2 -0
+	CROSS_COMPILE="$(TARGET_CROSS)" $(@D)/scripts/get_default_envs.sh $(@D), \
+	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) \

boot/uboot/uboot.mk endef · line 385

Quoted 8 lines
boot/uboot/uboot.mk +2 -0
@@ -376,9 +378,11 @@ endef
 
 ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y)
 ifeq ($(BR_BUILDING),y)
+ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE_TEXTFILE),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
+endif

With the choice removed, this entire condition+error would just be removed.

Regards,
Arnout

Quoted 4 lines
boot/uboot/uboot.mk +0 -0
 ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SIZE)),)
 $(error Please provide Uboot environment size (BR2_TARGET_UBOOT_ENVIMAGE_SIZE setting))
 endif
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#2 lore raw

PATCH 1/1 u-boot: add option to generate env image from default env

Hi Arnout,

thanks for the review.
Am Montag, den 08.10.2018, 19:33 +0200 schrieb Arnout Vandecappelle:

Quoted 5 lines

boot/uboot/Config.in menuconfig BR2_TARGET_UBOOT_ENVIMAGE · line 472

Quoted 3 lines

?

boot/uboot/Config.in +2 -0
+choice
+	prompt "source"

?It's not immediately obvious that this is the source of the envimage, so better "Source for environment".

clear

Quoted 10 lines

boot/uboot/Config.in menuconfig BR2_TARGET_UBOOT_ENVIMAGE · line 474

Quoted 4 lines
boot/uboot/Config.in +2 -0
+
+config BR2_TARGET_UBOOT_ENVIMAGE_TEXTFILE

?I would call this BR2_TARGET_UBOOT_ENVIMAGE_CUSTOM to be consistent with the other uses of custom config files. However, see below.

boot/uboot/Config.in menuconfig BR2_TARGET_UBOOT_ENVIMAGE · line 475

Quoted 2 lines
boot/uboot/Config.in +1 -0
+	bool "text file"

?Here as well: "custom".

okay

Quoted 9 lines

Review

Quoted 4 lines
(quoted diff) +2 -0
+
+config BR2_TARGET_UBOOT_ENVIMAGE_BUIILTIN

?and here _DEFAULT

boot/uboot/Config.in menuconfig BR2_TARGET_UBOOT_ENVIMAGE · line 478

Quoted 2 lines
boot/uboot/Config.in +1 -0
+	bool "compiled in"

?and "default".

okay

Quoted 15 lines

boot/uboot/Config.in menuconfig BR2_TARGET_UBOOT_ENVIMAGE · line 487

Quoted 11 lines
boot/uboot/Config.in +6 -0
+	help
+	??Use the default env from u-boot image.
+	??requires >= v2018.03
+
+endchoice # source
+

?config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE
? string "Source files for environment"

boot/uboot/Config.in +1 -0
+	depends on BR2_TARGET_UBOOT_ENVIMAGE_TEXTFILE

?However, I think it would be simpler to just allow this option to be empty. In other words, remove the choice, and add something like the following at the end of the help text:

Quoted 5 lines

??For U-Boot >= v2018.03, it is possible to leave this empty. In that ??case, the default environment for the target configuration will be ??used.

?This is just an idea, if you don't like it, feel free to keep the current solution.

Well, I thought about it.
contra:
?- adds additional configuration switches
pro:
?- clear on first look (not required to read help first)
?- easier to extend (add other sources in future)
?- keeps current behavior (failed to build, if only BR2_TARGET_UBOOT_ENVIMAGE is selected)

I think it is not very likely that other sources were implemented. Maybe it would be nice to just tick BR2_TARGET_UBOOT_ENVIMAGE and empty default of SOURCE will lead to default env.

What do you think?

Quoted 18 lines
Quoted 14 lines

? help
? ??Text files describing the environment. Files should have
? ??lines of the form var=value, one per line. Blank lines and

boot/uboot/uboot.mk +0 -0
index c5abc125f3..ae9e38c8c2 100644
@@ -263,7 +263,9 @@ endef

?
?ifneq ($(BR2_TARGET_UBOOT_ENVIMAGE),)
?define UBOOT_GENERATE_ENV_IMAGE

boot/uboot/uboot.mk endef · line 266

Quoted 2 lines
boot/uboot/uboot.mk +1 -1
-	cat $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)) \
+	$(if $(BR2_TARGET_UBOOT_ENVIMAGE_BUIILTIN), \

?With the choice removed, this test could be:

Quoted 4 lines
	$(if $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)),

but then it is better to factor it out in a separate variable, e.g. UBOOT_GENERATE_ENV_FILE, that is protected by an ifdef.

indeed

Quoted 17 lines
Quoted 8 lines
boot/uboot/uboot.mk +2 -0
+	CROSS_COMPILE="$(TARGET_CROSS)" $(@D)/scripts/get_default_envs.sh $(@D), \
+	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) \

boot/uboot/uboot.mk +0 -0
@@ -376,9 +378,11 @@ endef
Quoted 8 lines

?
?ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y)
?ifeq ($(BR_BUILDING),y)
+ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE_TEXTFILE),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
+endif

?With the choice removed, this entire condition+error would just be removed.

remove code is always nice ;-)

Quoted 3 lines

?Regards,
?Arnout

Regards Denis

Diehl Connectivity Solutions GmbH
Gesch?ftsf?hrung: Horst Leonberger
Sitz der Gesellschaft: N?rnberg - Registergericht: Amtsgericht N?rnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.

#3 lore raw

PATCH 1/1 u-boot: add option to generate env image from default env

Quoted 4 lines · Denis OSTERLAND

Hi Arnout,

thanks for the review.
Am Montag, den 08.10.2018, 19:33 +0200 schrieb Arnout Vandecappelle:

[snip]

Quoted 8 lines
Quoted 8 lines

?However, I think it would be simpler to just allow this option to be empty. In other words, remove the choice, and add something like the following at the end of the help text:

??For U-Boot >= v2018.03, it is possible to leave this empty. In that ??case, the default environment for the target configuration will be ??used.

Quoted 6 lines
Quoted 1 line

?This is just an idea, if you don't like it, feel free to keep the current solution.

Well, I thought about it.
contra:
?- adds additional configuration switches
pro:
?- clear on first look (not required to read help first)

This is a valid point.

Quoted 1 line

?- easier to extend (add other sources in future)

Hm, there is something to be said for this point as well. It might be possible
that U-Boot will start shipping internal environment fragments.

However, in that case, I think we would really want to add an additional list
of internal sources, again without an option to control enabling it.

Quoted 1 line

?- keeps current behavior (failed to build, if only BR2_TARGET_UBOOT_ENVIMAGE is selected)

This is really not important.

Quoted 5 lines

I think it is not very likely that other sources were implemented. Maybe it would be nice to just tick BR2_TARGET_UBOOT_ENVIMAGE and empty default of SOURCE will lead to default env.

What do you think?

That is indeed what I meant.

Regards,
Arnout

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#4 lore raw

PATCH 1/1 u-boot: add option to generate env image from default env

Hi Arnout,

Am Dienstag, den 09.10.2018, 10:01 +0200 schrieb Arnout Vandecappelle:

Quoted 21 lines · Denis OSTERLAND
Quoted 3 lines

pro:
?- clear on first look (not required to read help first)

?This is a valid point.

Quoted 2 lines

?- easier to extend (add other sources in future)

?Hm, there is something to be said for this point as well. It might be possible that U-Boot will start shipping internal environment fragments.

?However, in that case, I think we would really want to add an additional list of internal sources, again without an option to control enabling it.

Quoted 2 lines

?- keeps current behavior (failed to build, if only BR2_TARGET_UBOOT_ENVIMAGE is selected)

?This is really not important.

Quoted 1 line
Quoted 6 lines
Quoted 5 lines

I think it is not very likely that other sources were implemented. Maybe it would be nice to just tick BR2_TARGET_UBOOT_ENVIMAGE and empty default of SOURCE will lead to default env.

What do you think?

?That is indeed what I meant.

so... you vote for empty list?

What about this?
? ? ? ? $(if $(BR2_TARGET_UBOOT_ENVIMAGE_DEFAULT), \
????????CROSS_COMPILE="$(TARGET_CROSS)" $(@D)/scripts/get_default_envs.sh $(@D), \
????????echo "") | cat - $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)) \
????????????????>$(@D)/buildroot-env.txt

Introduce a bool DEFAULT to enable read of compiled in env and concatenate it with the files from SOURCES list.

Quoted 4 lines

?Regards,
?Arnout

Regards Denis

Diehl Connectivity Solutions GmbH
Gesch?ftsf?hrung: Horst Leonberger
Sitz der Gesellschaft: N?rnberg - Registergericht: Amtsgericht N?rnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.

#5 lore raw

PATCH v2 1/1 u-boot: add option to generate env image from default env

In reply to Denis OSTERLAND

From: Denis Osterland <[email protected]>

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

---
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(-)
boot/uboot/Config.in +2 -0
index ac6f8bc8c1..2e3a112874 100644
@@ -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
boot/uboot/uboot.mk +4 -4
index cbdfee6ac3..693fe69508 100644
@@ -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
Signature · 15 lines
2.19.1



Diehl Connectivity Solutions GmbH
Gesch?ftsf?hrung: Horst Leonberger
Sitz der Gesellschaft: N?rnberg - Registergericht: Amtsgericht
N?rnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by
mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited. 
#6 lore raw

PATCH v2 1/1 u-boot: add option to generate env image from default env

Hi,

any objections here?

Regards Denis

Am Montag, den 12.11.2018, 11:17 +0100 schrieb Denis OSTERLAND:

Quoted 51 lines

From: Denis Osterland <[email protected]>

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

---
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(-)

boot/uboot/Config.in +0 -0
index ac6f8bc8c1..2e3a112874 100644
@@ -466,6 +466,8 @@ menuconfig BR2_TARGET_UBOOT_ENVIMAGE

?
? ??The environment image will be called uboot-env.bin.
?

boot/uboot/Config.in +2 -0
+	??Leave empty to generate image from compiled-in env.
+

?if BR2_TARGET_UBOOT_ENVIMAGE
?
?config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE

boot/uboot/uboot.mk +0 -0
index cbdfee6ac3..693fe69508 100644
@@ -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

boot/uboot/uboot.mk +3 -1
-	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) \

boot/uboot/uboot.mk +0 -0
@@ -376,9 +379,6 @@ endef

?
?ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y)
?ifeq ($(BR_BUILDING),y)

boot/uboot/uboot.mk +0 -3
-ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)),)
-$(error Please define a source file for Uboot environment (BR2_TARGET_UBOOT_ENVIMAGE_SOURCE setting))
-endif
Quoted 3 lines

?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
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.