Skip to contentSkip to conversation

package/uboot-tools: resolve uboot env source file error

PATCH Superseded Matt Weber 5 participants 11 messages Jan 25, 2021 – Jan 28, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Matt Weber

author
#0 lore raw

PATCH 1/2 package/uboot-tools: resolve uboot env source file error

From: Kalpesh Panchal <[email protected]>

If Target u-boot is not available, the host build of uboot-tools requires user to provide u-boot environment source file. This change resolves a missing parentheses and updates the comment for the same.

---
 package/uboot-tools/uboot-tools.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
package/uboot-tools/uboot-tools.mk +4 -4
index 1313107e0e..10cbd1cdd9 100644
@@ -139,11 +139,11 @@ ifeq ($(BR_BUILDING),y)
 ifeq ($(call qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE)),)
 $(error Please provide U-Boot environment size (BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE setting))
 endif
-# If U-Boot is available, ENVIMAGE_SOURCE is optional because the default can
-# be taken from U-Boot.
+# If U-Boot is not available, ENVIMAGE_SOURCE must be provided by user,
+# otherwise it is optional because the default can be taken from U-Boot
 ifeq ($(BR2_TARGET_UBOOT),)
-ifeq ($(call qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE),)
-$(error Please provide U-Boot environment file BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE setting))
+ifeq ($(call qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE)),)
+$(error Please provide U-Boot environment file (BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE setting))
 endif
 endif #BR2_TARGET_UBOOT
 endif #BR_BUILDING
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/2 package/uboot-tools: env/script generation need BINARIES_DIR

From: Kalpesh Panchal <[email protected]>

The host build of uboot-tools can occur early in the build process and may require the creation of BINARIES_DIR before generation of an enabled envimage and/or boot script binary.

---
 package/uboot-tools/uboot-tools.mk | 2 ++
 1 file changed, 2 insertions(+)
package/uboot-tools/uboot-tools.mk +2 -0
index 10cbd1cdd9..f9ff170266 100644
@@ -128,6 +128,7 @@ endif
 
 define HOST_UBOOT_TOOLS_GENERATE_ENV_IMAGE
 	$(HOST_UBOOT_TOOLS_GENERATE_ENV_DEFAULTS)
+	mkdir -p $(BINARIES_DIR)
 	$(HOST_DIR)/bin/mkenvimage -s $(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE) \
 		$(if $(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_REDUNDANT),-r) \
 		$(if $(filter "BIG",$(BR2_ENDIAN)),-b) \
@@ -164,6 +165,7 @@ define HOST_UBOOT_TOOLS_INSTALL_CMDS
 	$(INSTALL) -m 0755 -D $(@D)/tools/dumpimage $(HOST_DIR)/bin/dumpimage
 	$(HOST_UBOOT_TOOLS_GENERATE_ENV_IMAGE)
 	$(if $(BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT),
+		mkdir -p $(BINARIES_DIR); \
 		$(MKIMAGE) -C none -A $(MKIMAGE_ARCH) -T script \
 			-d $(call qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE)) \
 			$(BINARIES_DIR)/boot.scr)
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 package/uboot-tools: env/script generation need BINARIES_DIR

Quoted 8 lines · On Mon, 25 Jan 2021 08:57:42 -0600 Matt Weber…

From: Kalpesh Panchal <[email protected]>

The host build of uboot-tools can occur early in the build process and may require the creation of BINARIES_DIR before generation of an enabled envimage and/or boot script binary.

Hum, while this works, I'm in fact not too happy with the proposed solution. I would prefer that we move the mkenvimage/$(MKIMAGE) invocations to a BUILD_CMDS step, that produces its results in $(@D), and then INSTALL_CMDS does a $(INSTALL) ... of that file, which with the -D option would create $(BINARIES_DIR).

I know it's a bit bike-shedding, but it feels a little bit better. What do you think ?

Thomas

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

PATCH 2/2 package/uboot-tools: env/script generation need BINARIES_DIR

Thomas/Yann,

Quoted 13 lines · Thomas Petazzoni
Quoted 8 lines · On Mon, 25 Jan 2021 08:57:42 -0600 Matt Weber…

From: Kalpesh Panchal <[email protected]>

The host build of uboot-tools can occur early in the build process and may require the creation of BINARIES_DIR before generation of an enabled envimage and/or boot script binary.

Quoted 8 lines

Hum, while this works, I'm in fact not too happy with the proposed solution. I would prefer that we move the mkenvimage/$(MKIMAGE) invocations to a BUILD_CMDS step, that produces its results in $(@D), and then INSTALL_CMDS does a $(INSTALL) ... of that file, which with the -D option would create $(BINARIES_DIR).

I know it's a bit bike-shedding, but it feels a little bit better. What do you think ?

I've added Yann to the discussion as he suggested the mkdir :-)

Whatever is better to maintain.

-Matt

#4 lore raw

PATCH 2/2 package/uboot-tools: env/script generation need BINARIES_DIR

Matthew, Thomas, All,

On 2021-01-25 15:22 -0600, Matthew Weber via buildroot spake thusly:

Quoted 18 lines
Quoted 16 lines · Thomas Petazzoni
Quoted 7 lines · On Mon, 25 Jan 2021 08:57:42 -0600 Matt Weber…

From: Kalpesh Panchal <[email protected]>
The host build of uboot-tools can occur early in the build process and may require the creation of BINARIES_DIR before generation of an enabled envimage and/or boot script binary.

Hum, while this works, I'm in fact not too happy with the proposed solution. I would prefer that we move the mkenvimage/$(MKIMAGE) invocations to a BUILD_CMDS step, that produces its results in $(@D), and then INSTALL_CMDS does a $(INSTALL) ... of that file, which with the -D option would create $(BINARIES_DIR).

Quoted 4 lines
Quoted 2 lines

I know it's a bit bike-shedding, but it feels a little bit better. What do you think ?

I've added Yann to the discussion as he suggested the mkdir :-)

On principle, I do agree with Thomas.

However, I would point out that this is way wider than just the script image. Indeed, we also have HOST_UBOOT_TOOLS_GENERATE_ENV_IMAGE which is only called at install time.

If we wanted to mandate clean, separate build and install steps for the script image generation, so would we want for the environment image too.

Which is a wider endeavour than just catering for the script image.

Of course, if one would want to actually tackle the issue and actually separate the build and install steps, that would be awesome.

Otherwise, I am fine with just the mkdir.

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 2/2 package/uboot-tools: env/script generation need BINARIES_DIR

Quoted 5 lines · On Mon, 25 Jan 2021 22:42:55 +0100 "Yann E. MORIN" <[email protected]>…

On principle, I do agree with Thomas.

However, I would point out that this is way wider than just the script image. Indeed, we also have HOST_UBOOT_TOOLS_GENERATE_ENV_IMAGE which is only called at install time.

Well, the patch is also adding a mkdir inside the code generating the environment image.

Thomas

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

[Buildroot] [External] Re: [PATCH 2/2] package/uboot-tools: env/script generation need BINARIES_DIR

All,

Quoted 4 lines · Thomas Petazzoni

On Mon, 25 Jan 2021 22:42:55 +0100
"Yann E. MORIN" <[email protected]> wrote:

Quoted 8 lines
Quoted 5 lines

On principle, I do agree with Thomas.

However, I would point out that this is way wider than just the script image. Indeed, we also have HOST_UBOOT_TOOLS_GENERATE_ENV_IMAGE which is only called at install time.

Well, the patch is also adding a mkdir inside the code generating the environment image.

v2 will be out in a bit, i'll mark this one as superseded.

Regards,
Matt

#7 lore raw

PATCH 1/2 package/uboot-tools: resolve uboot env source file error

In reply to Matt Weber
Quoted 7 lines · On Mon, 25 Jan 2021 08:57:41 -0600 Matt Weber…

From: Kalpesh Panchal <[email protected]>

If Target u-boot is not available, the host build of uboot-tools requires user to provide u-boot environment source file. This change resolves a missing parentheses and updates the comment for the same.

Quoted 5 lines
---
 package/uboot-tools/uboot-tools.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied to master, thanks. I think this bug really shows we need some unit tests for this uboot-tools package functionality, in supporting/testing/.

Thomas

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

PATCH 1/2 package/uboot-tools: resolve uboot env source file error

Thomas,

Quoted 17 lines · Thomas Petazzoni
Quoted 7 lines · On Mon, 25 Jan 2021 08:57:41 -0600 Matt Weber…

From: Kalpesh Panchal <[email protected]>

If Target u-boot is not available, the host build of uboot-tools requires user to provide u-boot environment source file. This change resolves a missing parentheses and updates the comment for the same.

Quoted 5 lines
---
 package/uboot-tools/uboot-tools.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 3 lines

Applied to master, thanks. I think this bug really shows we need some unit tests for this uboot-tools package functionality, in supporting/testing/.

I did add autobuilder testing of this feature but it didn't do a case for when the file isn't provided....
https://github.com/buildroot/buildroot/blob/master/utils/genrandconfig#L304

Matt

#9 lore raw

PATCH 1/2 package/uboot-tools: resolve uboot env source file error

Quoted 7 lines · On Mon, 25 Jan 2021 15:30:42 -0600 Matthew Weber <[email protected]>…
Quoted 3 lines

Applied to master, thanks. I think this bug really shows we need some unit tests for this uboot-tools package functionality, in supporting/testing/.

I did add autobuilder testing of this feature but it didn't do a case for when the file isn't provided....
https://github.com/buildroot/buildroot/blob/master/utils/genrandconfig#L304

I think this sort of feature gets better tested by specific targeted tests in support/testing/.

Thomas

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

PATCH 1/2 package/uboot-tools: resolve uboot env source file error

In reply to Matt Weber
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Matt" == Matt Weber <[email protected]> writes:

From: Kalpesh Panchal <[email protected]> If Target u-boot is not available, the host build of uboot-tools requires user to provide u-boot environment source file. This change resolves a missing parentheses and updates the comment for the same.

Committed to 2020.11.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard