From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mout.kundenserver.de ([217.72.192.75]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iUxuh-000553-DB for ptxdist@pengutronix.de; Wed, 13 Nov 2019 20:02:47 +0100 Date: Wed, 13 Nov 2019 20:02:41 +0100 From: Alexander Dahl Message-ID: <20191113190240.z2eeuhsxsdllqvc3@falbala.internal.home.lespocky.de> References: <20191113170559.15307-1-bruno.thomsen@gmail.com> MIME-Version: 1.0 In-Reply-To: <20191113170559.15307-1-bruno.thomsen@gmail.com> Subject: Re: [ptxdist] [PATCH v2] 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 Content-Type: multipart/mixed; boundary="===============0313792734==" Errors-To: ptxdist-bounces@pengutronix.de Sender: "ptxdist" To: ptxdist@pengutronix.de Cc: Alexander Dahl --===============0313792734== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="36mi3nbk7pzqfhuq" Content-Disposition: inline --36mi3nbk7pzqfhuq Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hei hei, On Wed, Nov 13, 2019 at 06:05:59PM +0100, Bruno Thomsen wrote: > Add possiblity to generate both a default and/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. >=20 > Custom environment image is generated from an user > provided config file with one 'var=3Dvalue' per line > format. Input config file name is configurable. >=20 > Both outputs has configurable image names so it's > easier to see specific use-case. >=20 > Examples: > u-boot-demo-env.img > u-boot-development-env.img > u-boot-manufacturing-env.img > u-boot-default-env.img >=20 > Signed-off-by: Bruno Thomsen > Tested-by: Alexander Dahl I did not test v2! Will do in a few days, but technically I did not it. Alex > --- > v2: > - remove HOST_U_BOOT_TOOLS dependency > - configurable default env image name > - add custom env image generation option > - move all options to sub menu >=20 > platforms/u-boot.in | 64 +++++++++++++++++++++++++++++++++++++++++++++ > rules/u-boot.make | 22 ++++++++++++++++ > 2 files changed, 86 insertions(+) >=20 > diff --git a/platforms/u-boot.in b/platforms/u-boot.in > index 9bac4a758..629fc9482 100644 > --- a/platforms/u-boot.in > +++ b/platforms/u-boot.in > @@ -71,6 +71,70 @@ config U_BOOT_CONFIG > =20 > endif > =20 > +menuconfig U_BOOT_GENERATE_ENV_IMAGE > + bool > + prompt "Generate environment image " > + > +if U_BOOT_GENERATE_ENV_IMAGE > + > +config U_BOOT_DEFAULT_ENV_IMAGE > + prompt "Generate default environment image" > + 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_DEFAULT_ENV_IMAGE_FILE > + prompt "Default environment image filename" > + string > + default "u-boot-env.img" > + help > + Change default environment output image name. > + > +config U_BOOT_CUSTOM_ENV_IMAGE > + prompt "Generate custom environment image" > + 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. > + > +config U_BOOT_CUSTOM_ENV_IMAGE_SOURCE > + prompt "Custom environment source" > + string > + default "custom_env.config" > + help > + Text file in PTXDIST_WORKSPACE describing the custom environment. > + The file should have lines in the form var=3Dvalue, one per line. > + Blank lines and lines starting with a # are ignored. > + > +config U_BOOT_CUSTOM_ENV_IMAGE_FILE > + prompt "Custom environment image filename" > + string > + default "u-boot-custom-env.img" > + help > + Change custom environment output image name. > + > +comment "common options ---" > + > +config U_BOOT_ENV_IMAGE_SIZE > + prompt "Environment image size" > + string > + default "0x2000" > + help > + Enter the U-Boot environment size for generation of image. > + Size can be prefixed with 0x for hexadecimal values. > + 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 8f9290ea7..c3c426d6d 100644 > --- a/rules/u-boot.make > +++ b/rules/u-boot.make > @@ -94,6 +94,20 @@ ifdef PTXCONF_U_BOOT_BOOT_SCRIPT > @$(U_BOOT_DIR)/tools/mkimage -T script -C none \ > -d $(U_BOOT_BOOT_SCRIPT_TXT) \ > $(U_BOOT_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_DIR)/tools/mkenvimage -p 0x0 \ > + $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \ > + -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \ > + -o $(U_BOOT_DIR)/$(PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE_FILE) - > +endif > +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE > + $(U_BOOT_DIR)/tools/mkenvimage -p 0x0 \ > + $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \ > + -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \ > + -o $(U_BOOT_DIR)/$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_FILE) \ > + $(PTXDIST_WORKSPACE)/$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE) > endif > @$(call touch) > =20 > @@ -141,6 +155,14 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL > @install -v -D -m644 $(U_BOOT_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_DIR)/$(PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE_F= ILE) \ > + $(IMAGEDIR)/$(PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE_FILE) > +endif > +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE > + @install -v -D -m644 $(U_BOOT_DIR)/$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_FI= LE) \ > + $(IMAGEDIR)/$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_FILE) > +endif > =20 > ifdef PTXCONF_U_BOOT_BOOT_SCRIPT > @$(call install_init, u-boot) > --=20 > 2.23.0 >=20 >=20 > _______________________________________________ > ptxdist mailing list > ptxdist@pengutronix.de --=20 /"\ ASCII RIBBON | =BBWith 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.=AB / \ HTML MAIL | (Jean-Luc Picard, quoting Judge Aaron Satie) --36mi3nbk7pzqfhuq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEwo7muQJjlc+Prwj6NK3NAHIhXMYFAl3MU0sACgkQNK3NAHIh XMbwsg//TZsA7nMbGNd6JDGhncouYa18GSXXlCTVkwWQeZIm8aDTTlC3z7a3Q+hd E/ovAshdA+VSXfXhPzGurJHfja8jhRp3YQRa62UPS4OMz7R+kPEWuFEABJJthn6b slBTbeBV/CuokvL0QvKN1H0Ve8Q7T3kcTtmmKFi7zGoClccohsNGiUfSOGcV990w vpKfv7Hd5WlDGkEr6D9ERqrp5gbAmzTQZ6YnBLwWBMpGamUNntpL8D4NMwH/nhjg CACW08gmysGMxWtYCj1OVIjDHZBipTTEZWwizV6PTQSglMmma3mRWhFUG+/l7Sm8 siioC/pGkIjdq2mickr0Rbiu4hC2GKQvCPtiJLFc5cCISqPkGBpCrSOSos40HFkS dcow0Wn2/Jn2jxH+56dzdAubJqITTD2lAaqR4E+wQaUC30QoZ3ECLaOeQUET5Bj3 17fCTquivJ80SZf1uhNeTybiPrGo+kebDEaw70B5coG7T6GUfO8mytc6g3GUeRp6 m2oXSvstXjMN01zKlXU6hUjc0g2C3U1V7Mx457vc6DwMIwxQ777vEOvIN25jpj0N 5m3O33KdMrULhCYXlAixQFVh56DMGdBkGgx8NPtGzObofsAbfxP0QNH3MFwGpwKu BNr7lphoKx9bDIcLOi/ZyvGGyKHe/InmOYj6ijyd7uRomqLx4Ig= =LhgT -----END PGP SIGNATURE----- --36mi3nbk7pzqfhuq-- --===============0313792734== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de --===============0313792734==--