mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v4] u-boot: generate environment image
@ 2019-11-22 15:42 Bruno Thomsen
  2019-11-22 17:36 ` Alexander Dahl
  2019-11-25  8:44 ` Denis OSTERLAND
  0 siblings, 2 replies; 5+ messages in thread
From: Bruno Thomsen @ 2019-11-22 15:42 UTC (permalink / raw)
  To: ptxdist; +Cc: Alexander Dahl, Denis OSTERLAND, Bruno Thomsen, bth

Add possiblity to generate a default or a custom environment
image. Image can be used during manufacturing to avoid bootloader
console usage and speed up first boot. Other image use-cases
include device development edition, device demonstration
mode, etc.

Custom environment image is generated from an user provided
config file with one 'var=value' per line format. Input config
file name is configurable.

Cc: Denis OSTERLAND <denis.osterland@diehl.com>
Cc: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
---
v4:
- u-boot version limitation help.
- env image size is now Kconfig hex input
- custom env source file is now stored in platformconfigdir
- changes in custom env source file trigger rebuild
- use default mkenvimage pad
- cleanup of env images
- fix missing cleanup of imx dtb image
v3:
- remove multiple env images support
- use static image names
- rebase patches on top of: u-boot: Build out-of-tree
v2:
- remove HOST_U_BOOT_TOOLS dependency
- configurable default env image name
- add custom env image generation option
- move all options to sub menu

 platforms/u-boot.in | 61 +++++++++++++++++++++++++++++++++++++++++++++
 rules/u-boot.make   | 31 ++++++++++++++++++++++-
 2 files changed, 91 insertions(+), 1 deletion(-)

diff --git a/platforms/u-boot.in b/platforms/u-boot.in
index 9bac4a758..e6585b508 100644
--- a/platforms/u-boot.in
+++ b/platforms/u-boot.in
@@ -71,6 +71,67 @@ config U_BOOT_CONFIG
 
 endif
 
+choice
+	prompt "Generate environment image"
+	default U_BOOT_NONE_ENV_IMAGE
+	help
+	  U-Boot from version 2018.03 support out-of-tree environment
+	  image generation.
+
+config U_BOOT_NONE_ENV_IMAGE
+	prompt "none"
+	bool
+	help
+	  Don't generate an U-Boot environment image.
+
+config U_BOOT_DEFAULT_ENV_IMAGE
+	prompt "default"
+	bool
+	help
+	  Use U-Boot's mkenvimage to compile a default U-Boot environment
+	  image for use in e.g. device manufacturing or development.
+
+config U_BOOT_CUSTOM_ENV_IMAGE
+	prompt "custom"
+	bool
+	help
+	  Use U-Boot's mkenvimage to compile a custom U-Boot environment
+	  image based on the text file in U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
+	  for use in e.g. device manufacturing or development.
+
+endchoice
+
+config U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
+	prompt "Custom environment source"
+	string
+	default "custom_env.config"
+	depends on U_BOOT_CUSTOM_ENV_IMAGE
+	help
+	  Text file in platform config directory describing the custom
+	  environment.
+	  The file should have lines in the form var=value, one per line.
+	  Blank lines and lines starting with a # are ignored.
+
+if !U_BOOT_NONE_ENV_IMAGE
+
+config U_BOOT_ENV_IMAGE_SIZE
+	prompt "Environment image size"
+	hex
+	default 0x2000
+	help
+	  Enter the U-Boot environment size in hexadecimal for generation
+	  of image. A wrong size will typically cause crc error when used.
+	  Must match size defined in target config and "/etc/fw_env.config".
+
+config U_BOOT_ENV_IMAGE_REDUNDANT
+	prompt "Environment image with redundant copy"
+	bool
+	help
+	  Use to generate a redundant environment in the image.
+	  Must match target config and "/etc/fw_env.config".
+
+endif
+
 config U_BOOT_BOOT_SCRIPT
 	prompt "Compile U-Boot boot script"
 	bool
diff --git a/rules/u-boot.make b/rules/u-boot.make
index e3c2c2389..3d983378e 100644
--- a/rules/u-boot.make
+++ b/rules/u-boot.make
@@ -43,6 +43,12 @@ U_BOOT_BOOT_SCRIPT_BIN := $(call remove_quotes, \
 $(STATEDIR)/u-boot.compile: $(U_BOOT_BOOT_SCRIPT_TXT)
 endif
 
+ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
+U_BOOT_CUSTOM_ENV_SRC := $(call ptx/in-platformconfigdir, \
+	$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE))
+$(STATEDIR)/u-boot.compile: $(call remove_quotes, $(U_BOOT_CUSTOM_ENV_SRC))
+endif
+
 U_BOOT_WRAPPER_BLACKLIST := \
 	$(PTXDIST_LOWLEVEL_WRAPPER_BLACKLIST)
 
@@ -100,6 +106,20 @@ ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
 	@$(U_BOOT_BUILD_DIR)/tools/mkimage -T script -C none \
 		-d $(U_BOOT_BOOT_SCRIPT_TXT) \
 		$(U_BOOT_BUILD_DIR)/boot.scr.uimg
+endif
+ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
+	$(U_BOOT_MAKE_ENV) $(U_BOOT_DIR)/scripts/get_default_envs.sh $(U_BOOT_BUILD_DIR) | \
+		$(U_BOOT_BUILD_DIR)/tools/mkenvimage \
+		$(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
+		-s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
+		-o $(U_BOOT_BUILD_DIR)/u-boot-env.img -
+endif
+ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
+	$(U_BOOT_BUILD_DIR)/tools/mkenvimage \
+		$(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
+		-s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
+		-o $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
+		$(U_BOOT_CUSTOM_ENV_SRC)
 endif
 	@$(call touch)
 
@@ -147,6 +167,14 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL
 	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-with-spl-pbl.bin \
 		$(IMAGEDIR)/u-boot-with-spl-pbl.bin
 endif
+ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
+	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-env.img \
+		$(IMAGEDIR)/u-boot-env.img
+endif
+ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
+	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
+		$(IMAGEDIR)/u-boot-custom-env.img
+endif
 
 ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
 	@$(call install_init, u-boot)
@@ -171,7 +199,8 @@ $(STATEDIR)/u-boot.clean:
 	@$(call clean_pkg, U_BOOT)
 	@rm -vf $(IMAGEDIR)/u-boot.bin $(IMAGEDIR)/u-boot.srec $(IMAGEDIR)/u-boot.elf
 	@rm -vf $(IMAGEDIR)/u-boot.img $(IMAGEDIR)/SPL $(IMAGEDIR)/MLO
-	@rm -vf $(IMAGEDIR)/u-boot.imx
+	@rm -vf $(IMAGEDIR)/u-boot.imx $(IMAGEDIR)/u-boot-dtb.imx
+	@rm -vf $(IMAGEDIR)/u-boot-env.img $(IMAGEDIR)/u-boot-custom-env.img
 	@rm -vf	$(IMAGEDIR)/u-boot-dtb.bin $(IMAGEDIR)/u-boot-with-spl-pbl.bin
 
 # ----------------------------------------------------------------------------
-- 
2.23.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ptxdist] [PATCH v4] u-boot: generate environment image
  2019-11-22 15:42 [ptxdist] [PATCH v4] u-boot: generate environment image Bruno Thomsen
@ 2019-11-22 17:36 ` Alexander Dahl
  2019-11-25  9:15   ` Denis OSTERLAND
  2019-11-25  8:44 ` Denis OSTERLAND
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Dahl @ 2019-11-22 17:36 UTC (permalink / raw)
  To: ptxdist; +Cc: Alexander Dahl, Denis OSTERLAND, Bruno Thomsen, bth


[-- Attachment #1.1: Type: text/plain, Size: 6998 bytes --]

Hei hei,

I will test on Monday, but one short remark below.

On Fri, Nov 22, 2019 at 04:42:32PM +0100, Bruno Thomsen wrote:
> Add possiblity to generate a default or a custom environment
> image. Image can be used during manufacturing to avoid bootloader
> console usage and speed up first boot. Other image use-cases
> include device development edition, device demonstration
> mode, etc.
> 
> Custom environment image is generated from an user provided
> config file with one 'var=value' per line format. Input config
> file name is configurable.
> 
> Cc: Denis OSTERLAND <denis.osterland@diehl.com>
> Cc: Alexander Dahl <ada@thorsis.com>
> Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
> ---
> v4:
> - u-boot version limitation help.
> - env image size is now Kconfig hex input
> - custom env source file is now stored in platformconfigdir
> - changes in custom env source file trigger rebuild
> - use default mkenvimage pad
> - cleanup of env images
> - fix missing cleanup of imx dtb image

Could you please move the missing cleanup to a separate patch?
Installing that image was introduced in commit
58c48f349901988fb9bc63b7f2f9bbb30c6ef60d and I think this should be
fixed apart from the env stuff.

> v3:
> - remove multiple env images support
> - use static image names
> - rebase patches on top of: u-boot: Build out-of-tree
> v2:
> - remove HOST_U_BOOT_TOOLS dependency
> - configurable default env image name
> - add custom env image generation option
> - move all options to sub menu
> 
>  platforms/u-boot.in | 61 +++++++++++++++++++++++++++++++++++++++++++++
>  rules/u-boot.make   | 31 ++++++++++++++++++++++-
>  2 files changed, 91 insertions(+), 1 deletion(-)
> 
> diff --git a/platforms/u-boot.in b/platforms/u-boot.in
> index 9bac4a758..e6585b508 100644
> --- a/platforms/u-boot.in
> +++ b/platforms/u-boot.in
> @@ -71,6 +71,67 @@ config U_BOOT_CONFIG
>  
>  endif
>  
> +choice
> +	prompt "Generate environment image"
> +	default U_BOOT_NONE_ENV_IMAGE
> +	help
> +	  U-Boot from version 2018.03 support out-of-tree environment
> +	  image generation.
> +
> +config U_BOOT_NONE_ENV_IMAGE
> +	prompt "none"
> +	bool
> +	help
> +	  Don't generate an U-Boot environment image.
> +
> +config U_BOOT_DEFAULT_ENV_IMAGE
> +	prompt "default"
> +	bool
> +	help
> +	  Use U-Boot's mkenvimage to compile a default U-Boot environment
> +	  image for use in e.g. device manufacturing or development.
> +
> +config U_BOOT_CUSTOM_ENV_IMAGE
> +	prompt "custom"
> +	bool
> +	help
> +	  Use U-Boot's mkenvimage to compile a custom U-Boot environment
> +	  image based on the text file in U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
> +	  for use in e.g. device manufacturing or development.
> +
> +endchoice
> +
> +config U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
> +	prompt "Custom environment source"
> +	string
> +	default "custom_env.config"
> +	depends on U_BOOT_CUSTOM_ENV_IMAGE
> +	help
> +	  Text file in platform config directory describing the custom
> +	  environment.
> +	  The file should have lines in the form var=value, one per line.
> +	  Blank lines and lines starting with a # are ignored.
> +
> +if !U_BOOT_NONE_ENV_IMAGE
> +
> +config U_BOOT_ENV_IMAGE_SIZE
> +	prompt "Environment image size"
> +	hex
> +	default 0x2000
> +	help
> +	  Enter the U-Boot environment size in hexadecimal for generation
> +	  of image. A wrong size will typically cause crc error when used.
> +	  Must match size defined in target config and "/etc/fw_env.config".
> +
> +config U_BOOT_ENV_IMAGE_REDUNDANT
> +	prompt "Environment image with redundant copy"
> +	bool
> +	help
> +	  Use to generate a redundant environment in the image.
> +	  Must match target config and "/etc/fw_env.config".
> +
> +endif
> +
>  config U_BOOT_BOOT_SCRIPT
>  	prompt "Compile U-Boot boot script"
>  	bool
> diff --git a/rules/u-boot.make b/rules/u-boot.make
> index e3c2c2389..3d983378e 100644
> --- a/rules/u-boot.make
> +++ b/rules/u-boot.make
> @@ -43,6 +43,12 @@ U_BOOT_BOOT_SCRIPT_BIN := $(call remove_quotes, \
>  $(STATEDIR)/u-boot.compile: $(U_BOOT_BOOT_SCRIPT_TXT)
>  endif
>  
> +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> +U_BOOT_CUSTOM_ENV_SRC := $(call ptx/in-platformconfigdir, \
> +	$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE))
> +$(STATEDIR)/u-boot.compile: $(call remove_quotes, $(U_BOOT_CUSTOM_ENV_SRC))
> +endif
> +
>  U_BOOT_WRAPPER_BLACKLIST := \
>  	$(PTXDIST_LOWLEVEL_WRAPPER_BLACKLIST)
>  
> @@ -100,6 +106,20 @@ ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
>  	@$(U_BOOT_BUILD_DIR)/tools/mkimage -T script -C none \
>  		-d $(U_BOOT_BOOT_SCRIPT_TXT) \
>  		$(U_BOOT_BUILD_DIR)/boot.scr.uimg
> +endif
> +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> +	$(U_BOOT_MAKE_ENV) $(U_BOOT_DIR)/scripts/get_default_envs.sh $(U_BOOT_BUILD_DIR) | \
> +		$(U_BOOT_BUILD_DIR)/tools/mkenvimage \
> +		$(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> +		-s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> +		-o $(U_BOOT_BUILD_DIR)/u-boot-env.img -
> +endif
> +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> +	$(U_BOOT_BUILD_DIR)/tools/mkenvimage \
> +		$(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> +		-s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> +		-o $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> +		$(U_BOOT_CUSTOM_ENV_SRC)
>  endif
>  	@$(call touch)
>  
> @@ -147,6 +167,14 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL
>  	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-with-spl-pbl.bin \
>  		$(IMAGEDIR)/u-boot-with-spl-pbl.bin
>  endif
> +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> +	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-env.img \
> +		$(IMAGEDIR)/u-boot-env.img
> +endif
> +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> +	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> +		$(IMAGEDIR)/u-boot-custom-env.img
> +endif
>  
>  ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
>  	@$(call install_init, u-boot)
> @@ -171,7 +199,8 @@ $(STATEDIR)/u-boot.clean:
>  	@$(call clean_pkg, U_BOOT)
>  	@rm -vf $(IMAGEDIR)/u-boot.bin $(IMAGEDIR)/u-boot.srec $(IMAGEDIR)/u-boot.elf
>  	@rm -vf $(IMAGEDIR)/u-boot.img $(IMAGEDIR)/SPL $(IMAGEDIR)/MLO
> -	@rm -vf $(IMAGEDIR)/u-boot.imx
> +	@rm -vf $(IMAGEDIR)/u-boot.imx $(IMAGEDIR)/u-boot-dtb.imx

This single change to a different patch please.

> +	@rm -vf $(IMAGEDIR)/u-boot-env.img $(IMAGEDIR)/u-boot-custom-env.img
>  	@rm -vf	$(IMAGEDIR)/u-boot-dtb.bin $(IMAGEDIR)/u-boot-with-spl-pbl.bin
>  
>  # ----------------------------------------------------------------------------
> -- 
> 2.23.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

A

-- 
/"\ ASCII RIBBON | »With the first link, the chain is forged. The first
\ / CAMPAIGN     | speech censured, the first thought forbidden, the
 X  AGAINST      | first freedom denied, chains us all irrevocably.«
/ \ HTML MAIL    | (Jean-Luc Picard, quoting Judge Aaron Satie)

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 92 bytes --]

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ptxdist] [PATCH v4] u-boot: generate environment image
  2019-11-22 15:42 [ptxdist] [PATCH v4] u-boot: generate environment image Bruno Thomsen
  2019-11-22 17:36 ` Alexander Dahl
@ 2019-11-25  8:44 ` Denis OSTERLAND
  2019-11-25 12:30   ` Bruno Thomsen
  1 sibling, 1 reply; 5+ messages in thread
From: Denis OSTERLAND @ 2019-11-25  8:44 UTC (permalink / raw)
  To: ptxdist, bruno.thomsen; +Cc: ada, bth

Hi,

Am Freitag, den 22.11.2019, 16:42 +0100 schrieb Bruno Thomsen:
> Add possiblity to generate a default or a custom environment
> image. Image can be used during manufacturing to avoid bootloader
> console usage and speed up first boot. Other image use-cases
> include device development edition, device demonstration
> mode, etc.
> 
> Custom environment image is generated from an user provided
> config file with one 'var=value' per line format. Input config
> file name is configurable.
> 
> Cc: Denis OSTERLAND <denis.osterland@diehl.com>
> Cc: Alexander Dahl <ada@thorsis.com>
> Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
> ---
> v4:
> - u-boot version limitation help.
> - env image size is now Kconfig hex input
> - custom env source file is now stored in platformconfigdir
> - changes in custom env source file trigger rebuild
> - use default mkenvimage pad
> - cleanup of env images
> - fix missing cleanup of imx dtb image
> v3:
> - remove multiple env images support
> - use static image names
> - rebase patches on top of: u-boot: Build out-of-tree
> v2:
> - remove HOST_U_BOOT_TOOLS dependency
> - configurable default env image name
> - add custom env image generation option
> - move all options to sub menu
> 
>  platforms/u-boot.in | 61 +++++++++++++++++++++++++++++++++++++++++++++
>  rules/u-boot.make   | 31 ++++++++++++++++++++++-
>  2 files changed, 91 insertions(+), 1 deletion(-)
> 
> diff --git a/platforms/u-boot.in b/platforms/u-boot.in
> index 9bac4a758..e6585b508 100644
> --- a/platforms/u-boot.in
> +++ b/platforms/u-boot.in
> @@ -71,6 +71,67 @@ config U_BOOT_CONFIG
>  
>  endif
>  
> +choice
> +	prompt "Generate environment image"
> +	default U_BOOT_NONE_ENV_IMAGE
> +	help
> +	  U-Boot from version 2018.03 support out-of-tree environment
> +	  image generation.
> +
> +config U_BOOT_NONE_ENV_IMAGE
looks a little bit odd.
I would expect a common prefix, with the choice at the end.
U_BOOT_ENV_IMAGE_NONE
U_BOOT_ENV_IMAGE_DEFAULT
U_BOOT_ENV_IMAGE_CUSTOM

But that´s not a show stopper, I think.

> +	prompt "none"
> +	bool
> +	help
> +	  Don't generate an U-Boot environment image.
> +
> +config U_BOOT_DEFAULT_ENV_IMAGE
> +	prompt "default"
> +	bool
> +	help
> +	  Use U-Boot's mkenvimage to compile a default U-Boot environment
> +	  image for use in e.g. device manufacturing or development.
> +
> +config U_BOOT_CUSTOM_ENV_IMAGE
> +	prompt "custom"
> +	bool
> +	help
> +	  Use U-Boot's mkenvimage to compile a custom U-Boot environment
> +	  image based on the text file in U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
> +	  for use in e.g. device manufacturing or development.
> +
> +endchoice
> +
> +config U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
> +	prompt "Custom environment source"
> +	string
> +	default "custom_env.config"
> +	depends on U_BOOT_CUSTOM_ENV_IMAGE
> +	help
> +	  Text file in platform config directory describing the custom
> +	  environment.
> +	  The file should have lines in the form var=value, one per line.
> +	  Blank lines and lines starting with a # are ignored.
> +
> +if !U_BOOT_NONE_ENV_IMAGE
> +
> +config U_BOOT_ENV_IMAGE_SIZE
> +	prompt "Environment image size"
> +	hex
> +	default 0x2000
> +	help
> +	  Enter the U-Boot environment size in hexadecimal for generation
> +	  of image. A wrong size will typically cause crc error when used.
> +	  Must match size defined in target config and "/etc/fw_env.config".
> +
> +config U_BOOT_ENV_IMAGE_REDUNDANT
> +	prompt "Environment image with redundant copy"
> +	bool
> +	help
> +	  Use to generate a redundant environment in the image.
> +	  Must match target config and "/etc/fw_env.config".
> +
> +endif
> +
>  config U_BOOT_BOOT_SCRIPT
>  	prompt "Compile U-Boot boot script"
>  	bool
> diff --git a/rules/u-boot.make b/rules/u-boot.make
> index e3c2c2389..3d983378e 100644
> --- a/rules/u-boot.make
> +++ b/rules/u-boot.make
> @@ -43,6 +43,12 @@ U_BOOT_BOOT_SCRIPT_BIN := $(call remove_quotes, \
>  $(STATEDIR)/u-boot.compile: $(U_BOOT_BOOT_SCRIPT_TXT)
>  endif
>  
> +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> +U_BOOT_CUSTOM_ENV_SRC := $(call ptx/in-platformconfigdir, \
> +	$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE))
> +$(STATEDIR)/u-boot.compile: $(call remove_quotes, $(U_BOOT_CUSTOM_ENV_SRC))
> +endif
> +
>  U_BOOT_WRAPPER_BLACKLIST := \
>  	$(PTXDIST_LOWLEVEL_WRAPPER_BLACKLIST)
>  
> @@ -100,6 +106,20 @@ ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
>  	@$(U_BOOT_BUILD_DIR)/tools/mkimage -T script -C none \
>  		-d $(U_BOOT_BOOT_SCRIPT_TXT) \
>  		$(U_BOOT_BUILD_DIR)/boot.scr.uimg
> +endif
> +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> +	$(U_BOOT_MAKE_ENV) $(U_BOOT_DIR)/scripts/get_default_envs.sh $(U_BOOT_BUILD_DIR) | \
> +		$(U_BOOT_BUILD_DIR)/tools/mkenvimage \
> +		$(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> +		-s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> +		-o $(U_BOOT_BUILD_DIR)/u-boot-env.img -
> +endif
> +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> +	$(U_BOOT_BUILD_DIR)/tools/mkenvimage \
> +		$(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> +		-s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> +		-o $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
I see no need for a different env image name here.
Custom or default is the choice how to generate the image.
It is easier to pass the images to your factory if the have always the same name.
This gives you the chance to change image type, without a need to change production flow.

> +		$(U_BOOT_CUSTOM_ENV_SRC)
>  endif
>  	@$(call touch)
>  
> @@ -147,6 +167,14 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL
>  	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-with-spl-pbl.bin \
>  		$(IMAGEDIR)/u-boot-with-spl-pbl.bin
>  endif
> +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> +	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-env.img \
> +		$(IMAGEDIR)/u-boot-env.img
> +endif
> +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> +	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> +		$(IMAGEDIR)/u-boot-custom-env.img
> +endif
This will become:
+ifndef PTXCONF_U_BOOT_ENV_IMAGE_NONE
+	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-env.img \
+		$(IMAGEDIR)/u-boot-env.img
+endif

>  
>  ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
>  	@$(call install_init, u-boot)
> @@ -171,7 +199,8 @@ $(STATEDIR)/u-boot.clean:
>  	@$(call clean_pkg, U_BOOT)
>  	@rm -vf $(IMAGEDIR)/u-boot.bin $(IMAGEDIR)/u-boot.srec $(IMAGEDIR)/u-boot.elf
>  	@rm -vf $(IMAGEDIR)/u-boot.img $(IMAGEDIR)/SPL $(IMAGEDIR)/MLO
> -	@rm -vf $(IMAGEDIR)/u-boot.imx
> +	@rm -vf $(IMAGEDIR)/u-boot.imx $(IMAGEDIR)/u-boot-dtb.imx
Why u-boot-dtb.imx sneaks in here? Have i missed something?

> +	@rm -vf $(IMAGEDIR)/u-boot-env.img $(IMAGEDIR)/u-boot-custom-env.img
And this of course only u-boot-env.img.

Regards Denis
>  	@rm -vf	$(IMAGEDIR)/u-boot-dtb.bin $(IMAGEDIR)/u-boot-with-spl-pbl.bin
>  
>  # ----------------------------------------------------------------------------


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.
- Informationen zum Datenschutz, insbesondere zu Ihren Rechten, erhalten Sie unter https://www.diehl.com/group/de/transparenz-und-informationspflichten/

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. 
- For general information on data protection and your respective rights please visit https://www.diehl.com/group/en/transparency-and-information-obligations/
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ptxdist] [PATCH v4] u-boot: generate environment image
  2019-11-22 17:36 ` Alexander Dahl
@ 2019-11-25  9:15   ` Denis OSTERLAND
  0 siblings, 0 replies; 5+ messages in thread
From: Denis OSTERLAND @ 2019-11-25  9:15 UTC (permalink / raw)
  To: ptxdist

Hi Alexander,

thanks for the hint. I missed that line.

Regards Denis

Am Freitag, den 22.11.2019, 18:36 +0100 schrieb Alexander Dahl:
> Hei hei,
> 
> I will test on Monday, but one short remark below.
> 
> On Fri, Nov 22, 2019 at 04:42:32PM +0100, Bruno Thomsen wrote:
> > Add possiblity to generate a default or a custom environment
> > image. Image can be used during manufacturing to avoid bootloader
> > console usage and speed up first boot. Other image use-cases
> > include device development edition, device demonstration
> > mode, etc.
> > 
> > Custom environment image is generated from an user provided
> > config file with one 'var=value' per line format. Input config
> > file name is configurable.
> > 
> > Cc: Denis OSTERLAND <denis.osterland@diehl.com>
> > Cc: Alexander Dahl <ada@thorsis.com>
> > Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
> > ---
> > v4:
> > - u-boot version limitation help.
> > - env image size is now Kconfig hex input
> > - custom env source file is now stored in platformconfigdir
> > - changes in custom env source file trigger rebuild
> > - use default mkenvimage pad
> > - cleanup of env images
> > - fix missing cleanup of imx dtb image
> 
> Could you please move the missing cleanup to a separate patch?
> Installing that image was introduced in commit
> 58c48f349901988fb9bc63b7f2f9bbb30c6ef60d and I think this should be
> fixed apart from the env stuff.
> 
> > v3:
> > - remove multiple env images support
> > - use static image names
> > - rebase patches on top of: u-boot: Build out-of-tree
> > v2:
> > - remove HOST_U_BOOT_TOOLS dependency
> > - configurable default env image name
> > - add custom env image generation option
> > - move all options to sub menu
> > 
> >  platforms/u-boot.in | 61 +++++++++++++++++++++++++++++++++++++++++++++
> >  rules/u-boot.make   | 31 ++++++++++++++++++++++-
> >  2 files changed, 91 insertions(+), 1 deletion(-)
> > 
> > diff --git a/platforms/u-boot.in b/platforms/u-boot.in
> > index 9bac4a758..e6585b508 100644
> > --- a/platforms/u-boot.in
> > +++ b/platforms/u-boot.in
> > @@ -71,6 +71,67 @@ config U_BOOT_CONFIG
> >  
> >  endif
> >  
> > +choice
> > +	prompt "Generate environment image"
> > +	default U_BOOT_NONE_ENV_IMAGE
> > +	help
> > +	  U-Boot from version 2018.03 support out-of-tree environment
> > +	  image generation.
> > +
> > +config U_BOOT_NONE_ENV_IMAGE
> > +	prompt "none"
> > +	bool
> > +	help
> > +	  Don't generate an U-Boot environment image.
> > +
> > +config U_BOOT_DEFAULT_ENV_IMAGE
> > +	prompt "default"
> > +	bool
> > +	help
> > +	  Use U-Boot's mkenvimage to compile a default U-Boot environment
> > +	  image for use in e.g. device manufacturing or development.
> > +
> > +config U_BOOT_CUSTOM_ENV_IMAGE
> > +	prompt "custom"
> > +	bool
> > +	help
> > +	  Use U-Boot's mkenvimage to compile a custom U-Boot environment
> > +	  image based on the text file in U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
> > +	  for use in e.g. device manufacturing or development.
> > +
> > +endchoice
> > +
> > +config U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
> > +	prompt "Custom environment source"
> > +	string
> > +	default "custom_env.config"
> > +	depends on U_BOOT_CUSTOM_ENV_IMAGE
> > +	help
> > +	  Text file in platform config directory describing the custom
> > +	  environment.
> > +	  The file should have lines in the form var=value, one per line.
> > +	  Blank lines and lines starting with a # are ignored.
> > +
> > +if !U_BOOT_NONE_ENV_IMAGE
> > +
> > +config U_BOOT_ENV_IMAGE_SIZE
> > +	prompt "Environment image size"
> > +	hex
> > +	default 0x2000
> > +	help
> > +	  Enter the U-Boot environment size in hexadecimal for generation
> > +	  of image. A wrong size will typically cause crc error when used.
> > +	  Must match size defined in target config and "/etc/fw_env.config".
> > +
> > +config U_BOOT_ENV_IMAGE_REDUNDANT
> > +	prompt "Environment image with redundant copy"
> > +	bool
> > +	help
> > +	  Use to generate a redundant environment in the image.
> > +	  Must match target config and "/etc/fw_env.config".
> > +
> > +endif
> > +
> >  config U_BOOT_BOOT_SCRIPT
> >  	prompt "Compile U-Boot boot script"
> >  	bool
> > diff --git a/rules/u-boot.make b/rules/u-boot.make
> > index e3c2c2389..3d983378e 100644
> > --- a/rules/u-boot.make
> > +++ b/rules/u-boot.make
> > @@ -43,6 +43,12 @@ U_BOOT_BOOT_SCRIPT_BIN := $(call remove_quotes, \
> >  $(STATEDIR)/u-boot.compile: $(U_BOOT_BOOT_SCRIPT_TXT)
> >  endif
> >  
> > +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> > +U_BOOT_CUSTOM_ENV_SRC := $(call ptx/in-platformconfigdir, \
> > +	$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE))
> > +$(STATEDIR)/u-boot.compile: $(call remove_quotes, $(U_BOOT_CUSTOM_ENV_SRC))
> > +endif
> > +
> >  U_BOOT_WRAPPER_BLACKLIST := \
> >  	$(PTXDIST_LOWLEVEL_WRAPPER_BLACKLIST)
> >  
> > @@ -100,6 +106,20 @@ ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
> >  	@$(U_BOOT_BUILD_DIR)/tools/mkimage -T script -C none \
> >  		-d $(U_BOOT_BOOT_SCRIPT_TXT) \
> >  		$(U_BOOT_BUILD_DIR)/boot.scr.uimg
> > +endif
> > +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> > +	$(U_BOOT_MAKE_ENV) $(U_BOOT_DIR)/scripts/get_default_envs.sh $(U_BOOT_BUILD_DIR) | \
> > +		$(U_BOOT_BUILD_DIR)/tools/mkenvimage \
> > +		$(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> > +		-s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> > +		-o $(U_BOOT_BUILD_DIR)/u-boot-env.img -
> > +endif
> > +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> > +	$(U_BOOT_BUILD_DIR)/tools/mkenvimage \
> > +		$(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> > +		-s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> > +		-o $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> > +		$(U_BOOT_CUSTOM_ENV_SRC)
> >  endif
> >  	@$(call touch)
> >  
> > @@ -147,6 +167,14 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL
> >  	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-with-spl-pbl.bin \
> >  		$(IMAGEDIR)/u-boot-with-spl-pbl.bin
> >  endif
> > +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> > +	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-env.img \
> > +		$(IMAGEDIR)/u-boot-env.img
> > +endif
> > +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> > +	@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> > +		$(IMAGEDIR)/u-boot-custom-env.img
> > +endif
> >  
> >  ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
> >  	@$(call install_init, u-boot)
> > @@ -171,7 +199,8 @@ $(STATEDIR)/u-boot.clean:
> >  	@$(call clean_pkg, U_BOOT)
> >  	@rm -vf $(IMAGEDIR)/u-boot.bin $(IMAGEDIR)/u-boot.srec $(IMAGEDIR)/u-boot.elf
> >  	@rm -vf $(IMAGEDIR)/u-boot.img $(IMAGEDIR)/SPL $(IMAGEDIR)/MLO
> > -	@rm -vf $(IMAGEDIR)/u-boot.imx
> > +	@rm -vf $(IMAGEDIR)/u-boot.imx $(IMAGEDIR)/u-boot-dtb.imx
> 
> This single change to a different patch please.
> 
> > +	@rm -vf $(IMAGEDIR)/u-boot-env.img $(IMAGEDIR)/u-boot-custom-env.img
> >  	@rm -vf	$(IMAGEDIR)/u-boot-dtb.bin $(IMAGEDIR)/u-boot-with-spl-pbl.bin
> >  
> >  # ----------------------------------------------------------------------------
> > -- 
> > 2.23.0
> > 
> > 
> > _______________________________________________
> > ptxdist mailing list
> > ptxdist@pengutronix.de
> 
> A
> 
> 
> 
>   	 The message was neither encrypted nor digitally signed          
>  Z1 SecureMail Gateway Info - www.zertificon.com
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> +----------------------------------------------------------------------+
> > Z1 SecureMail Gateway Info - http://www.zertificon.comom               |
> 
> +----------------------------------------------------------------------+
> > - The message was neither encrypted nor digitally signed             |
> 
> +----------------------------------------------------------------------+


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.
- Informationen zum Datenschutz, insbesondere zu Ihren Rechten, erhalten Sie unter https://www.diehl.com/group/de/transparenz-und-informationspflichten/

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. 
- For general information on data protection and your respective rights please visit https://www.diehl.com/group/en/transparency-and-information-obligations/
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ptxdist] [PATCH v4] u-boot: generate environment image
  2019-11-25  8:44 ` Denis OSTERLAND
@ 2019-11-25 12:30   ` Bruno Thomsen
  0 siblings, 0 replies; 5+ messages in thread
From: Bruno Thomsen @ 2019-11-25 12:30 UTC (permalink / raw)
  To: Denis OSTERLAND; +Cc: ada, ptxdist, bth

Hi Denis,

Den man. 25. nov. 2019 kl. 09.44 skrev Denis OSTERLAND
<denis.osterland@diehl.com>:
> > +choice
> > +     prompt "Generate environment image"
> > +     default U_BOOT_NONE_ENV_IMAGE
> > +     help
> > +       U-Boot from version 2018.03 support out-of-tree environment
> > +       image generation.
> > +
> > +config U_BOOT_NONE_ENV_IMAGE
> looks a little bit odd.
> I would expect a common prefix, with the choice at the end.
> U_BOOT_ENV_IMAGE_NONE
> U_BOOT_ENV_IMAGE_DEFAULT
> U_BOOT_ENV_IMAGE_CUSTOM
>
> But that´s not a show stopper, I think.

Okay, I see what you mean, a little bit less Yoda :)

> > +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> > +     $(U_BOOT_MAKE_ENV) $(U_BOOT_DIR)/scripts/get_default_envs.sh $(U_BOOT_BUILD_DIR) | \
> > +             $(U_BOOT_BUILD_DIR)/tools/mkenvimage \
> > +             $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> > +             -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> > +             -o $(U_BOOT_BUILD_DIR)/u-boot-env.img -
> > +endif
> > +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> > +     $(U_BOOT_BUILD_DIR)/tools/mkenvimage \
> > +             $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> > +             -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> > +             -o $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> I see no need for a different env image name here.
> Custom or default is the choice how to generate the image.
> It is easier to pass the images to your factory if the have always the same name.
> This gives you the chance to change image type, without a need to change production flow.

Check, one image to rule them all.

> > -     @rm -vf $(IMAGEDIR)/u-boot.imx
> > +     @rm -vf $(IMAGEDIR)/u-boot.imx $(IMAGEDIR)/u-boot-dtb.imx
> Why u-boot-dtb.imx sneaks in here? Have i missed something?

My mistake, I will move it to a separate bugfix patch.

/Bruno

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-25 12:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 15:42 [ptxdist] [PATCH v4] u-boot: generate environment image Bruno Thomsen
2019-11-22 17:36 ` Alexander Dahl
2019-11-25  9:15   ` Denis OSTERLAND
2019-11-25  8:44 ` Denis OSTERLAND
2019-11-25 12:30   ` Bruno Thomsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox