mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Denis OSTERLAND <denis.osterland@diehl.com>
To: "ptxdist@pengutronix.de" <ptxdist@pengutronix.de>
Subject: Re: [ptxdist] [PATCH 6/7] u-boot: allow generation of custom environment binary
Date: Tue, 16 Oct 2018 10:58:50 +0000	[thread overview]
Message-ID: <1539687529.10449.32.camel@diehl.com> (raw)
In-Reply-To: <20181010120338.2717-6-a.fatoum@pengutronix.de>

Hi Ahmad,

Am Mittwoch, den 10.10.2018, 14:03 +0200 schrieb Ahmad Fatoum:
> U-Boot can be configured at compile-time to expect the environment at a
> set offset of e.g. the MMC.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  platforms/u-boot.in | 27 +++++++++++++++++++++++++++
>  rules/u-boot.make   | 32 ++++++++++++++++++++++++++++++++
>  2 files changed, 59 insertions(+)
> 
> diff --git a/platforms/u-boot.in b/platforms/u-boot.in
> index bcb78cfc3f5a..4e19d09c74f5 100644
> --- a/platforms/u-boot.in
> +++ b/platforms/u-boot.in
> @@ -35,6 +35,33 @@ config U_BOOT_CONFIG
>  	  "yourbox_config". See Uboot's main Makefile for possible
>  	  configuration targets.
>  
> +config U_BOOT_ENV
> +	prompt "Generate U-Boot environment binary image"
> +	bool
> +	help
> +	  Use U-Boot's mkenvimage to generate an U-Boot environment binary image
> +	  (uboot-env.bin) out of a text file (uboot-env.txt)
> +	  with entries of the form:
> +	  key1=value1
> +	  key2=value2
> +
> +if U_BOOT_ENV
> +
> +config U_BOOT_ENV_IMAGE_SIZE
> +	prompt "U-Boot environment image size"
> +	string
> +	default '0x2000'
> +	help
> +	  The output image size
> +
> +config U_BOOT_ENV_FLASH_REDUNDANT
> +	prompt "Environment has multiple copies in flash"
> +	bool
> +	help
> +	  Whether there are multiple copies of the U-Boot environment in flash
> +
> +endif
> +
>  comment "target install"
>  
>  config U_BOOT_INSTALL_SREC
> diff --git a/rules/u-boot.make b/rules/u-boot.make
> index d9bcdf5ca64d..39228dbcaf9c 100644
> --- a/rules/u-boot.make
> +++ b/rules/u-boot.make
> @@ -33,6 +33,16 @@ U_BOOT_CONFIG	:= $(call ptx/in-platformconfigdir, \
>  # Prepare
>  # ----------------------------------------------------------------------------
>  
> +U_BOOT_ENV_TXT	:= $(call ptx/in-platformconfigdir, uboot-env.txt)
> +U_BOOT_ENV_BIN	:= $(IMAGEDIR)/uboot-env.bin
> +
> +ifdef PTXCONF_ENDIAN_BIG
> +	U_BOOT_ENV_FLAGS += -b
> +endif
> +ifdef PTXCONF_U_BOOT_ENV_FLASH_REDUNDANT
> +	U_BOOT_ENV_FLAGS += -r
> +endif
> +
>  U_BOOT_WRAPPER_BLACKLIST := \
>  	TARGET_HARDEN_RELRO \
>  	TARGET_HARDEN_BINDNOW \
> @@ -64,6 +74,23 @@ endif
>  
>  $(STATEDIR)/u-boot.prepare: $(U_BOOT_CONFIG)
>  
> +# ----------------------------------------------------------------------------
> +# Compile
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/u-boot.compile:
> +	@$(call targetinfo)
> +	@+cd $(U_BOOT_DIR) && $(U_BOOT_PATH) \
> +		$(MAKE) $(U_BOOT_MAKE_OPT)
I would prefer @$(call world/compile, U_BOOT) here.
> +ifdef PTXCONF_U_BOOT_ENV
> +	@$(U_BOOT_DIR)/tools/mkenvimage \
> +		$(U_BOOT_ENV_FLAGS) -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> +		-o $(U_BOOT_DIR)/uboot-env.bin \
> +		$(U_BOOT_ENV_TXT)
> +endif
We had a similar case, but end up with an image of compiled in env, using get_default_envs script.
We didn´t had the time to clean it up.

--- a/rules/u-boot.make
+++ b/rules/u-boot.make
@@ -41,6 +41,19 @@ $(STATEDIR)/u-boot.prepare:
 		$(MAKE) $(U_BOOT_MAKE_OPT) $(PTXCONF_U_BOOT_CONFIG)
 	@$(call touch)
 
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/u-boot.compile:
+	@$(call targetinfo)
+	@$(call world/compile, U_BOOT)
+	cd $(U_BOOT_DIR) && \
+		$(U_BOOT_MAKE_OPT) \
+		$(U_BOOT_DIR)/scripts/get_default_envs.sh \
+		| $(U_BOOT_DIR)/tools/mkenvimage -s 262144 -r -o u-boot_env.bin -
+	@$(call touch)
+
 # ----------------------------------------------------------------------------
 # Install
 # ----------------------------------------------------------------------------

> +	@$(call touch)
> +
> +
>  # ----------------------------------------------------------------------------
>  # Install
>  # ----------------------------------------------------------------------------
> @@ -102,6 +129,10 @@ 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_ENV
> +	@install -v -D -m644 $(U_BOOT_DIR)/uboot-env.bin $(U_BOOT_ENV_BIN)
> +endif
>  	@$(call touch)
>  
>  # ----------------------------------------------------------------------------
> @@ -114,6 +145,7 @@ $(STATEDIR)/u-boot.clean:
>  	@rm -vf $(IMAGEDIR)/u-boot.bin $(IMAGEDIR)/u-boot.srec
>  	@rm -vf $(IMAGEDIR)/u-boot.elf $(IMAGEDIR)/u-boot.imx
>  	@rm -vf	$(IMAGEDIR)/u-boot-dtb.bin $(IMAGEDIR)/u-boot-with-spl-pbl.bin
> +	@rm -vf $(U_BOOT_ENV_BIN)
>  
>  # ----------------------------------------------------------------------------
>  # oldconfig / menuconfig

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. 
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

  parent reply	other threads:[~2018-10-16 10:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 12:03 [ptxdist] [PATCH 1/7] u-boot: specify GPL-2.0-only as LICENSE Ahmad Fatoum
2018-10-10 12:03 ` [ptxdist] [PATCH 2/7] u-boot: add support for oldconfig/menuconfig Ahmad Fatoum
2018-10-16  7:52   ` Michael Olbrich
2018-10-16  8:02     ` Alexander Dahl
2018-10-16  8:25   ` Michael Olbrich
2018-10-10 12:03 ` [ptxdist] [PATCH 3/7] u-boot: add V=$(PTXDIST_VERBOSE) to make options Ahmad Fatoum
2018-10-11  6:52   ` Alexander Dahl
2018-10-10 12:03 ` [ptxdist] [PATCH 4/7] u-boot: run install(1)/rm(1) with -v Ahmad Fatoum
2018-10-10 12:03 ` [ptxdist] [PATCH 5/7] u-boot: add u-boot{-dtb, -with-spl-pbl}.bin image installation options Ahmad Fatoum
2019-02-05  7:30   ` Alexander Dahl
2019-02-05  9:29     ` Ahmad Fatoum
2018-10-10 12:03 ` [ptxdist] [PATCH 6/7] u-boot: allow generation of custom environment binary Ahmad Fatoum
2018-10-16  8:13   ` Michael Olbrich
2018-10-16 10:58   ` Denis OSTERLAND [this message]
2018-10-16 11:27     ` Alexander Dahl
2018-10-16 12:26       ` Michael Olbrich
2018-10-16 13:13         ` Alexander Dahl
2019-04-04 14:17         ` Alexander Dahl
2018-10-16 11:20   ` Alexander Dahl
2018-10-10 12:03 ` [ptxdist] [PATCH 7/7] u-boot: allow generation of boot script Ahmad Fatoum
2018-10-11  6:44 ` [ptxdist] [PATCH 1/7] u-boot: specify GPL-2.0-only as LICENSE Alexander Dahl
2018-10-11  9:05   ` Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1539687529.10449.32.camel@diehl.com \
    --to=denis.osterland@diehl.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox