Skip to contentSkip to conversation

package/uboot-tools: fix env image help text

PATCH In review Mirza Kapetanovic 5 participants 7 messages Jun 25, 2021 – Aug 4, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/uboot-tools: fix env image help text

BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE is passed almost as is to mkenvimage which, looking at the help text and source code of the tool, doesn't seem to support mulitple files as input.

I tried providing multiple files (space separated) and only the last file was included in the resulting environment image.

---
 package/uboot-tools/Config.in.host | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
package/uboot-tools/Config.in.host +2 -4
index 431cc8631d..7e5c5084c0 100644
@@ -56,15 +56,13 @@ config BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE
 if BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE
 
 config BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE
-	string "Source files for environment"
+	string "Source file for environment"
 	default BR2_TARGET_UBOOT_ENVIMAGE_SOURCE if BR2_TARGET_UBOOT_ENVIMAGE_SOURCE != "" # legacy
 	help
-	  Text files describing the environment. Files should have
+	  Text file describing the environment. File should have
 	  lines of the form var=value, one per line. Blank lines and
 	  lines starting with a # are ignored.
 
-	  Multiple source files are concatenated in the order listed.
-
 	  Leave empty to generate image from compiled-in env if a U-boot
 	  target build is configured (BR2_TARGET_UBOOT)
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 package/uboot-tools: fix env image help text

Mirza, All,

On 2021-06-25 11:19 +0200, Mirza Kapetanovic spake thusly:

Quoted 6 lines

BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE is passed almost as is to mkenvimage which, looking at the help text and source code of the tool, doesn't seem to support mulitple files as input.

I tried providing multiple files (space separated) and only the last file was included in the resulting environment image.

Can't we instead make that possible?

For example, this (totally untested) patch should be a step in that direction, I think:

    diff --git a/package/uboot-tools/uboot-tools.mk b/package/uboot-tools/uboot-tools.mk
    index 8963d6182e..d4392e47bf 100644
    --- a/package/uboot-tools/uboot-tools.mk
    +++ b/package/uboot-tools/uboot-tools.mk
    @@ -116,7 +116,7 @@ endif
     
     ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE),y)
     
    -UBOOT_TOOLS_GENERATE_ENV_FILE = $(call qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE))
    +UBOOT_TOOLS_ENV_FILE_SOURCES = $(call qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE))
     
     # If BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE is left empty, we
     # will use the default environment provided in the U-Boot build
    @@ -130,7 +130,7 @@ HOST_UBOOT_TOOLS_DEPENDENCIES += uboot
     
     # Handle the case where BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE
     # is left empty, use the default U-Boot environment.
    -ifeq ($(UBOOT_TOOLS_GENERATE_ENV_FILE),)
    +ifeq ($(UBOOT_TOOLS_ENV_FILE_SOURCES),)
     UBOOT_TOOLS_GENERATE_ENV_FILE = $(@D)/boot-env-defaults.txt
     define HOST_UBOOT_TOOLS_GENERATE_ENV_DEFAULTS
     	CROSS_COMPILE="$(TARGET_CROSS)" \
    @@ -138,7 +138,13 @@ define HOST_UBOOT_TOOLS_GENERATE_ENV_DEFAULTS
     		$(UBOOT_SRCDIR) \
     		> $(UBOOT_TOOLS_GENERATE_ENV_FILE)
     endef
    -endif # UBOOT_TOOLS_GENERATE_ENV_FILE
    +else
    +UBOOT_TOOLS_GENERATE_ENV_FILE = $(@D)/boot-env-buildroot.txt
    +define HOST_UBOOT_TOOLS_GENERATE_ENV_DEFAULTS
    +	cat $(UBOOT_TOOLS_ENV_FILE_SOURCES) \
    +		> $(UBOOT_TOOLS_GENERATE_ENV_FILE)
    +endef
    +endif # UBOOT_TOOLS_ENV_FILE_SOURCE
     endif # BR2_TARGET_UBOOT
     
     ifeq ($(BR_BUILDING),y)

As I said: totally untested... I can already see that it is broken for the case where uboot is not enabled, so this definitely needs a little bit more of thinking...

Can you look into that, please?

Regards,
Yann E. MORIN.

Quoted 34 lines
---
 package/uboot-tools/Config.in.host | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
package/uboot-tools/Config.in.host +2 -4
index 431cc8631d..7e5c5084c0 100644
@@ -56,15 +56,13 @@ config BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE
 if BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE
 
 config BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE
-	string "Source files for environment"
+	string "Source file for environment"
 	default BR2_TARGET_UBOOT_ENVIMAGE_SOURCE if BR2_TARGET_UBOOT_ENVIMAGE_SOURCE != "" # legacy
 	help
-	  Text files describing the environment. Files should have
+	  Text file describing the environment. File should have
 	  lines of the form var=value, one per line. Blank lines and
 	  lines starting with a # are ignored.
 
-	  Multiple source files are concatenated in the order listed.
-
 	  Leave empty to generate image from compiled-in env if a U-boot
 	  target build is configured (BR2_TARGET_UBOOT)
 
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 package/uboot-tools: fix env image help text

I created a new patch with your suggestions, now it concatenates the file
before passing it to the env tool. I thought I was replying to this thread
when I sent the patch, but it seems I ended up creating a separate patch
(patchwork link:
http://patchwork.ozlabs.org/project/buildroot/patch/20210705121933.1055057-1-mirza.kapetanovic at gmail.com), let me know if I need to change fix that somehow.

Quoted 117 lines · Yann E. MORIN

Mirza, All,

On 2021-06-25 11:19 +0200, Mirza Kapetanovic spake thusly:

Quoted 1 line

BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE is passed almost as is to

mkenvimage

Quoted 1 line

which, looking at the help text and source code of the tool, doesn't

seem to support

Quoted 3 lines

mulitple files as input.

I tried providing multiple files (space separated) and only the last

file was included

Quoted 1 line

in the resulting environment image.

Can't we instead make that possible?

For example, this (totally untested) patch should be a step in that direction, I think:

    diff --git a/package/uboot-tools/uboot-tools.mk b/package/uboot-tools/
uboot-tools.mk
    index 8963d6182e..d4392e47bf 100644
    --- a/package/uboot-tools/uboot-tools.mk
    +++ b/package/uboot-tools/uboot-tools.mk
    @@ -116,7 +116,7 @@ endif

     ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE),y)

    -UBOOT_TOOLS_GENERATE_ENV_FILE = $(call
qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE))
    +UBOOT_TOOLS_ENV_FILE_SOURCES = $(call

qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE))

     # If BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE is left empty, we
     # will use the default environment provided in the U-Boot build
    @@ -130,7 +130,7 @@ HOST_UBOOT_TOOLS_DEPENDENCIES += uboot

     # Handle the case where BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE
     # is left empty, use the default U-Boot environment.
    -ifeq ($(UBOOT_TOOLS_GENERATE_ENV_FILE),)
    +ifeq ($(UBOOT_TOOLS_ENV_FILE_SOURCES),)
     UBOOT_TOOLS_GENERATE_ENV_FILE = $(@D)/boot-env-defaults.txt
     define HOST_UBOOT_TOOLS_GENERATE_ENV_DEFAULTS
        CROSS_COMPILE="$(TARGET_CROSS)" \
    @@ -138,7 +138,13 @@ define HOST_UBOOT_TOOLS_GENERATE_ENV_DEFAULTS
                $(UBOOT_SRCDIR) \
                > $(UBOOT_TOOLS_GENERATE_ENV_FILE)
     endef
    -endif # UBOOT_TOOLS_GENERATE_ENV_FILE
    +else
    +UBOOT_TOOLS_GENERATE_ENV_FILE = $(@D)/boot-env-buildroot.txt
    +define HOST_UBOOT_TOOLS_GENERATE_ENV_DEFAULTS
    +   cat $(UBOOT_TOOLS_ENV_FILE_SOURCES) \
    +           > $(UBOOT_TOOLS_GENERATE_ENV_FILE)
    +endef
    +endif # UBOOT_TOOLS_ENV_FILE_SOURCE
     endif # BR2_TARGET_UBOOT

     ifeq ($(BR_BUILDING),y)

As I said: totally untested... I can already see that it is broken for the case where uboot is not enabled, so this definitely needs a little bit more of thinking...

Can you look into that, please?

Regards,
Yann E. MORIN.

Review

Quoted 6 lines
---
 package/uboot-tools/Config.in.host | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/package/uboot-tools/Config.in.host

package/uboot-tools/Config.in.host config BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE · line 60

Quoted 10 lines

index 431cc8631d..7e5c5084c0 100644

package/uboot-tools/Config.in.host +1 -1
@@ -56,15 +56,13 @@ config BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE
 if BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE
 
 config BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE
-     string "Source files for environment"
+     string "Source file for environment"
      default BR2_TARGET_UBOOT_ENVIMAGE_SOURCE if

BR2_TARGET_UBOOT_ENVIMAGE_SOURCE != "" # legacy

Quoted 14 lines
package/uboot-tools/Config.in.host +1 -4
      help
-       Text files describing the environment. Files should have
+       Text file describing the environment. File should have
        lines of the form var=value, one per line. Blank lines and
        lines starting with a # are ignored.
 
-       Multiple source files are concatenated in the order listed.
-
        Leave empty to generate image from compiled-in env if a U-boot
        target build is configured (BR2_TARGET_UBOOT)
 
--

2.25.1

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--

.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
     |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is
no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
 conspiracy.  |
Quoted 2 lines

'------------------------------^-------^------------------^--------------------'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210705/c9cd7e29/attachment.html>

#3 lore raw

PATCH 1/1 package/uboot-tools: concat files before passing to env image tool

In reply to Mirza Kapetanovic

Fix BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE so that files are actually concatenated as described in the help text.

---
 package/uboot-tools/uboot-tools.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/uboot-tools/uboot-tools.mk +3 -2
index 8963d6182e..4d1fc46e25 100644
@@ -156,11 +156,12 @@ endif #BR_BUILDING
 
 define HOST_UBOOT_TOOLS_GENERATE_ENVIMAGE
 	$(HOST_UBOOT_TOOLS_GENERATE_ENV_DEFAULTS)
-	$(@D)/tools/mkenvimage -s $(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE) \
+	cat $(UBOOT_TOOLS_GENERATE_ENV_FILE) | \
+		$(@D)/tools/mkenvimage -s $(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE) \
 		$(if $(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_REDUNDANT),-r) \
 		$(if $(filter "BIG",$(BR2_ENDIAN)),-b) \
 		-o $(@D)/tools/uboot-env.bin \
-		$(UBOOT_TOOLS_GENERATE_ENV_FILE)
+		-
 endef
 define HOST_UBOOT_TOOLS_INSTALL_ENVIMAGE
 	$(INSTALL) -m 0755 -D $(@D)/tools/uboot-env.bin $(BINARIES_DIR)/uboot-env.bin
Signature · 1 line
2.30.1 (Apple Git-130)
#4 lore raw

PATCH 1/1 package/uboot-tools: concat files before passing to env image tool

Hi Mirza,

Quoted 8 lines

From: Mirza Kapetanovic <[email protected]>
Sent: Monday, July 5, 2021 7:19 AM
To: buildroot at buildroot.org <[email protected]>
Cc: Weber, Matthew L Collins <[email protected]>; Mirza Kapetanovic <[email protected]>
Subject: [External] [PATCH 1/1] package/uboot-tools: concat files before passing to env image tool ?
Fix BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE so that files are actually concatenated as described in the help text.

#5 lore raw

PATCH 1/1 package/uboot-tools: concat files before passing to env image tool

In reply to Mirza Kapetanovic
Quoted 7 lines · On Mon, 5 Jul 2021 14:19:33 +0200 Mirza Kapetanovic…

Fix BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE so that files are actually concatenated as described in the help text.

---
 package/uboot-tools/uboot-tools.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

Re: [Buildroot] [PATCH 1/1] package/uboot-tools: concat files before passing to env image tool

In reply to Mirza Kapetanovic
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Mirza" == Mirza Kapetanovic <[email protected]> writes:

Fix BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE so that files are actually concatenated as described in the help text.

Committed to 2021.02.x and 2021.05.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot