From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail.thorsis.com ([92.198.35.195]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iZVuE-0002Cz-Vo for ptxdist@pengutronix.de; Tue, 26 Nov 2019 09:09:07 +0100 Received: from localhost (localhost [127.0.0.1]) by mail.thorsis.com (Postfix) with ESMTP id 32AC036BB for ; Tue, 26 Nov 2019 09:10:29 +0100 (CET) Received: from mail.thorsis.com ([127.0.0.1]) by localhost (mail.thorsis.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sjzJRabVbLC0 for ; Tue, 26 Nov 2019 09:10:29 +0100 (CET) From: Alexander Dahl Date: Tue, 26 Nov 2019 09:09:00 +0100 Message-ID: <1934563.cjmWNKihP2@ada> In-Reply-To: <20191125180335.4491-1-bruno.thomsen@gmail.com> References: <20191125180335.4491-1-bruno.thomsen@gmail.com> Subject: Re: [ptxdist] [PATCH v5 1/2] u-boot: generate environment image List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ptxdist-bounces@pengutronix.de Sender: "ptxdist" To: ptxdist@pengutronix.de Cc: Denis OSTERLAND , Bruno Thomsen , bth@kamstrup.com Hello Bruno, thanks for your continued work on this. Overall this one looks good to me now, only some typos in commit message and help text left, but that's no blocker for me (see below for those). :-) I also tested putting the custom_env.config in different layers. Works fine. Tested-by: Alexander Dahl Am Montag, 25. November 2019, 19:03:34 CET schrieb Bruno Thomsen: > Add possiblity to generate a default or a custom environment possibility > 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 > Cc: Alexander Dahl > Signed-off-by: Bruno Thomsen > --- > v5: > - split imx dtb image cleanup into bugfix patch > - removed remove quotes in statedir > - remove quetes in platformconfigdir > - common prefix defines > - common env image name > - remove custom env image install and clean > 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 | 25 +++++++++++++++++++ > 2 files changed, 86 insertions(+) > > diff --git a/platforms/u-boot.in b/platforms/u-boot.in > index 9bac4a758..21baf7c72 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_ENV_IMAGE_NONE > + help > + U-Boot from version 2018.03 support out-of-tree environment > + image generation. supports > + > +config U_BOOT_ENV_IMAGE_NONE > + prompt "none" > + bool > + help > + Don't generate an U-Boot environment image. > + > +config U_BOOT_ENV_IMAGE_DEFAULT > + 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_ENV_IMAGE_CUSTOM > + 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_ENV_IMAGE_CUSTOM_SOURCE > + for use in e.g. device manufacturing or development. > + > +endchoice > + > +config U_BOOT_ENV_IMAGE_CUSTOM_SOURCE > + prompt "Custom environment source" > + string > + default "custom_env.config" > + depends on U_BOOT_ENV_IMAGE_CUSTOM > + 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_ENV_IMAGE_NONE > + > +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..9609dca97 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_ENV_IMAGE_CUSTOM > +U_BOOT_ENV_IMAGE_CUSTOM_SRC := $(call ptx/in-platformconfigdir, \ > + $(call remove_quotes, $(PTXCONF_U_BOOT_ENV_IMAGE_CUSTOM_SOURCE))) > +$(STATEDIR)/u-boot.compile: $(U_BOOT_ENV_IMAGE_CUSTOM_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_ENV_IMAGE_DEFAULT > + $(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_ENV_IMAGE_CUSTOM > + $(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 \ > + $(U_BOOT_ENV_IMAGE_CUSTOM_SRC) > endif > @$(call touch) > > @@ -147,6 +167,10 @@ 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 > +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) > @@ -172,6 +196,7 @@ $(STATEDIR)/u-boot.clean: > @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-env.img > @rm -vf $(IMAGEDIR)/u-boot-dtb.bin $(IMAGEDIR)/u-boot-with-spl-pbl.bin > > # > --------------------------------------------------------------------------- > - Greets Alex _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de