Skip to contentSkip to conversation

uboot-tools: Allow users to use uboot's sources

PATCH Superseded Maxime Hadjinlian 3 participants 4 messages Feb 3, 2014 – Feb 5, 2014

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 uboot-tools: Allow users to use uboot's sources

If the user has specified a custom U-Boot repository, he may also want to use it for U-Boot tools.

This could be usefull in two identified use case:
- User want the same version for U-Boot tools and U-Boot
- User has modified U-Boot tools in his U-Boot repository

---
Changes v1 -> v2:
- Add a choice option (Suggested by Luca Ceresoli)
- Add an if/then/else structure (Suggested by Luca Ceresoli)
- Take UBOOT_LICENSE and UBOOT_LICENCE_FILES into account (Suggested by Arnout Vandecappelle)

---
 package/uboot-tools/Config.in      | 18 ++++++++++++++++++
 package/uboot-tools/uboot-tools.mk | 17 +++++++++++++++--
 2 files changed, 33 insertions(+), 2 deletions(-)
package/uboot-tools/Config.in +18 -0
index 7c8f17c..29580dd 100644
@@ -7,6 +7,24 @@ config BR2_PACKAGE_UBOOT_TOOLS
 
 if BR2_PACKAGE_UBOOT_TOOLS
 
+if BR2_TARGET_UBOOT
+
+choice
+	prompt "version"
+	default BR2_PACKAGE_UBOOT_TOOLS_LATEST_VERSION
+	help
+	  Select the specific uboot-tools version you want to use
+
+config BR2_PACKAGE_UBOOT_TOOLS_LATEST_VERSION
+	bool "Use latest upstream version"
+
+config BR2_PACKAGE_UBOOT_TOOLS_USE_UBOOT_VERSION
+	bool "Use the same version as the uboot package"
+
+endchoice
+
+endif
+
 config BR2_PACKAGE_UBOOT_TOOLS_MKIMAGE
 	bool "mkimage"
 	help
package/uboot-tools/uboot-tools.mk +15 -2
index 398ce8b..71c64ee 100644
@@ -4,11 +4,24 @@
 #
 ################################################################################
 
+ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_USE_UBOOT_VERSION),y)
+# We have to use the BR2_TARGET_UBOOT_VERSION because of the order of inclusion
+# of the mk files.
+UBOOT_TOOLS_VERSION = $(call qstrip,$(BR2_TARGET_UBOOT_VERSION))
+UBOOT_TOOLS_SOURCE = $(UBOOT_SOURCE)
+UBOOT_TOOLS_SITE = $(UBOOT_SITE)
+ifneq ($(UBOOT_SITE_METHOD),)
+UBOOT_TOOL_SITE_METHOD = $(UBOOT_SITE_METHOD)
+endif
+UBOOT_TOOLS_LICENSE = $(UBOOT_LICENSE)
+UBOOT_TOOLS_LICENSE_FILES = $(UBOOT_LICENSE_FILES)
+else
 UBOOT_TOOLS_VERSION = 2014.01
-UBOOT_TOOLS_SOURCE  = u-boot-$(UBOOT_TOOLS_VERSION).tar.bz2
-UBOOT_TOOLS_SITE    = ftp://ftp.denx.de/pub/u-boot
+UBOOT_TOOLS_SOURCE = u-boot-$(UBOOT_TOOLS_VERSION).tar.bz2
+UBOOT_TOOLS_SITE = ftp://ftp.denx.de/pub/u-boot
 UBOOT_TOOLS_LICENSE = GPLv2+
 UBOOT_TOOLS_LICENSE_FILES = Licenses/gpl-2.0.txt
+endif
 
 define UBOOT_TOOLS_BUILD_CMDS
 	$(MAKE) -C $(@D) 			\
Signature · 1 line
1.8.5.3
#1 lore raw

PATCH v2 1/1 uboot-tools: Allow users to use uboot's sources

Dear Maxime Hadjinlian,

Quoted 11 lines · Maxime Hadjinlian
package/uboot-tools/Config.in +3 -0
index 7c8f17c..29580dd 100644
@@ -7,6 +7,24 @@ config BR2_PACKAGE_UBOOT_TOOLS
 
 if BR2_PACKAGE_UBOOT_TOOLS
 
+if BR2_TARGET_UBOOT
+
+choice

package/uboot-tools/Config.in config BR2_PACKAGE_UBOOT_TOOLS · line 22

Quoted 10 lines
package/uboot-tools/Config.in +10 -0
+	prompt "version"
+	default BR2_PACKAGE_UBOOT_TOOLS_LATEST_VERSION
+	help
+	  Select the specific uboot-tools version you want to use
+
+config BR2_PACKAGE_UBOOT_TOOLS_LATEST_VERSION
+	bool "Use latest upstream version"
+
+config BR2_PACKAGE_UBOOT_TOOLS_USE_UBOOT_VERSION
+	bool "Use the same version as the uboot package"

Shouldn't this option only be available if the U-Boot package has been enabled in the configuration?

package/uboot-tools/Config.in config BR2_PACKAGE_UBOOT_TOOLS · line 26

Quoted 4 lines
package/uboot-tools/Config.in +4 -0
+ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_USE_UBOOT_VERSION),y)
+# We have to use the BR2_TARGET_UBOOT_VERSION because of the order of inclusion
+# of the mk files.
+UBOOT_TOOLS_VERSION = $(call qstrip,$(BR2_TARGET_UBOOT_VERSION))

That's more of a question for Arnout, but does the order of .mk files inclusion matter since we're using '=' and not ':=' ?

Quoted 9 lines
package/uboot-tools/Config.in +8 -0
+UBOOT_TOOLS_SOURCE = $(UBOOT_SOURCE)
+UBOOT_TOOLS_SITE = $(UBOOT_SITE)
+ifneq ($(UBOOT_SITE_METHOD),)
+UBOOT_TOOL_SITE_METHOD = $(UBOOT_SITE_METHOD)
+endif
+UBOOT_TOOLS_LICENSE = $(UBOOT_LICENSE)
+UBOOT_TOOLS_LICENSE_FILES = $(UBOOT_LICENSE_FILES)
+else
 UBOOT_TOOLS_VERSION = 2014.01

package/uboot-tools/Config.in config BR2_PACKAGE_UBOOT_TOOLS

Quoted 10 lines
package/uboot-tools/Config.in +3 -2
-UBOOT_TOOLS_SOURCE  = u-boot-$(UBOOT_TOOLS_VERSION).tar.bz2
-UBOOT_TOOLS_SITE    = ftp://ftp.denx.de/pub/u-boot
+UBOOT_TOOLS_SOURCE = u-boot-$(UBOOT_TOOLS_VERSION).tar.bz2
+UBOOT_TOOLS_SITE = ftp://ftp.denx.de/pub/u-boot
 UBOOT_TOOLS_LICENSE = GPLv2+
 UBOOT_TOOLS_LICENSE_FILES = Licenses/gpl-2.0.txt
+endif
 
 define UBOOT_TOOLS_BUILD_CMDS
 	$(MAKE) -C $(@D) 			\

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH v2 1/1 uboot-tools: Allow users to use uboot's sources

Quoted 12 lines · Thomas Petazzoni

Dear Maxime Hadjinlian,

Quoted 8 lines · Maxime Hadjinlian
package/uboot-tools/Config.in +0 -0
index 7c8f17c..29580dd 100644
@@ -7,6 +7,24 @@ config BR2_PACKAGE_UBOOT_TOOLS
 
 if BR2_PACKAGE_UBOOT_TOOLS
 
Quoted 16 lines

package/uboot-tools/Config.in config BR2_PACKAGE_UBOOT_TOOLS · line 22

Quoted 13 lines
package/uboot-tools/Config.in +13 -0
+if BR2_TARGET_UBOOT
+
+choice
+     prompt "version"
+     default BR2_PACKAGE_UBOOT_TOOLS_LATEST_VERSION
+     help
+       Select the specific uboot-tools version you want to use
+
+config BR2_PACKAGE_UBOOT_TOOLS_LATEST_VERSION
+     bool "Use latest upstream version"
+
+config BR2_PACKAGE_UBOOT_TOOLS_USE_UBOOT_VERSION
+     bool "Use the same version as the uboot package"

Shouldn't this option only be available if the U-Boot package has been enabled in the configuration?

It is already in this patch.

Quoted 8 lines

package/uboot-tools/Config.in config BR2_PACKAGE_UBOOT_TOOLS · line 26

Quoted 5 lines
package/uboot-tools/Config.in +4 -0
+ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_USE_UBOOT_VERSION),y)
+# We have to use the BR2_TARGET_UBOOT_VERSION because of the order of inclusion
+# of the mk files.
+UBOOT_TOOLS_VERSION = $(call qstrip,$(BR2_TARGET_UBOOT_VERSION))

That's more of a question for Arnout, but does the order of .mk files inclusion matter since we're using '=' and not ':=' ?

Arnout will confirm (or not, if I misunderstood) with much more detail, but I found that the inclusion did matter, even with the use of '='.

Quoted 26 lines
Quoted 10 lines
package/uboot-tools/Config.in +8 -0
+UBOOT_TOOLS_SOURCE = $(UBOOT_SOURCE)
+UBOOT_TOOLS_SITE = $(UBOOT_SITE)
+ifneq ($(UBOOT_SITE_METHOD),)
+UBOOT_TOOL_SITE_METHOD = $(UBOOT_SITE_METHOD)
+endif
+UBOOT_TOOLS_LICENSE = $(UBOOT_LICENSE)
+UBOOT_TOOLS_LICENSE_FILES = $(UBOOT_LICENSE_FILES)
+else
 UBOOT_TOOLS_VERSION = 2014.01

package/uboot-tools/Config.in config BR2_PACKAGE_UBOOT_TOOLS

Quoted 10 lines
package/uboot-tools/Config.in +3 -2
-UBOOT_TOOLS_SOURCE  = u-boot-$(UBOOT_TOOLS_VERSION).tar.bz2
-UBOOT_TOOLS_SITE    = ftp://ftp.denx.de/pub/u-boot
+UBOOT_TOOLS_SOURCE = u-boot-$(UBOOT_TOOLS_VERSION).tar.bz2
+UBOOT_TOOLS_SITE = ftp://ftp.denx.de/pub/u-boot
 UBOOT_TOOLS_LICENSE = GPLv2+
 UBOOT_TOOLS_LICENSE_FILES = Licenses/gpl-2.0.txt
+endif
 
 define UBOOT_TOOLS_BUILD_CMDS
      $(MAKE) -C $(@D)                        \

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

#3 lore raw

PATCH v2 1/1 uboot-tools: Allow users to use uboot's sources

Quoted 39 lines · Maxime Hadjinlian
Quoted 12 lines · Thomas Petazzoni

Dear Maxime Hadjinlian,

Quoted 8 lines · Maxime Hadjinlian
package/uboot-tools/Config.in +0 -0
index 7c8f17c..29580dd 100644
@@ -7,6 +7,24 @@ config BR2_PACKAGE_UBOOT_TOOLS
 
 if BR2_PACKAGE_UBOOT_TOOLS
 
Quoted 16 lines

package/uboot-tools/Config.in config BR2_PACKAGE_UBOOT_TOOLS · line 22

Quoted 13 lines
package/uboot-tools/Config.in +13 -0
+if BR2_TARGET_UBOOT
+
+choice
+     prompt "version"
+     default BR2_PACKAGE_UBOOT_TOOLS_LATEST_VERSION
+     help
+       Select the specific uboot-tools version you want to use
+
+config BR2_PACKAGE_UBOOT_TOOLS_LATEST_VERSION
+     bool "Use latest upstream version"
+
+config BR2_PACKAGE_UBOOT_TOOLS_USE_UBOOT_VERSION
+     bool "Use the same version as the uboot package"

Shouldn't this option only be available if the U-Boot package has been enabled in the configuration?

It is already in this patch.

Quoted 8 lines

package/uboot-tools/Config.in config BR2_PACKAGE_UBOOT_TOOLS · line 26

Quoted 5 lines
package/uboot-tools/Config.in +4 -0
+ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_USE_UBOOT_VERSION),y)
+# We have to use the BR2_TARGET_UBOOT_VERSION because of the order of inclusion
+# of the mk files.
+UBOOT_TOOLS_VERSION = $(call qstrip,$(BR2_TARGET_UBOOT_VERSION))

That's more of a question for Arnout, but does the order of .mk files inclusion matter since we're using '=' and not ':=' ?

Quoted 3 lines

Arnout will confirm (or not, if I misunderstood) with much more detail, but I found that the inclusion did matter, even with the use of '='.

Indeed it does. The _VERSION is evaluated in generic-package and set to
'undefined' if it is empty. Since UBOOT_VERSION is only assigned later, when uboot.mk is included, UBOOT_TOOLS_VERSION is empty at the time it is evaluated. So it would always be undefined.

Quoted 2 lines
Quoted 2 lines

package/uboot-tools/Config.in config BR2_PACKAGE_UBOOT_TOOLS · line 27

Quoted 2 lines
package/uboot-tools/Config.in +1 -0
+UBOOT_TOOLS_SOURCE = $(UBOOT_SOURCE)

This statement is useless, for the same reason that you cannot use
UBOOT_TOOLS_VERSION = $(UBOOT_VERSION). In generic-package, UBOOT_TOOLS_SOURCE is evaluated to be empty so it will be set to the default $$($(2)_RAWNAME)-$$($(2)_VERSION).tar.gz. The default is OK in most cases, however, that's why you didn't notice.

Quoted 2 lines
Quoted 2 lines

package/uboot-tools/Config.in config BR2_PACKAGE_UBOOT_TOOLS · line 29

Quoted 2 lines
package/uboot-tools/Config.in +2 -0
+UBOOT_TOOLS_SITE = $(UBOOT_SITE)
+ifneq ($(UBOOT_SITE_METHOD),)

Since UBOOT_SITE_METHOD is not defined yet, this condition will never be
used.

Quoted 3 lines
Quoted 3 lines

package/uboot-tools/Config.in config BR2_PACKAGE_UBOOT_TOOLS

Quoted 3 lines
package/uboot-tools/Config.in +3 -0
+UBOOT_TOOL_SITE_METHOD = $(UBOOT_SITE_METHOD)
+endif
+UBOOT_TOOLS_LICENSE = $(UBOOT_LICENSE)

This one happens to work because generic-package uses a ?= for this one.
However, it will _not_ work for host-uboot-tools, because there an ifdef is used.

As you can see, all of this is extremely fragile. In essence, you need
to repeat all the logic from uboot.mk to derive these variables - or you have to check really really carefully if it works in all cases, for both uboot-tools and host-uboot-tools.

Bottom line: I don't think this is the way to do it. I mentioned it
briefly in the developer days: there should be infrastructural support for a shared-source package like this, so that the problem can be solved fundamentally and it never depends on the order of evaluation, and it doesn't break when a ?= in the package-generic is replaced with an ifndef.

The generic structure of the shared source support would be something
like this:

if shared source

assign VERSION, SOURCE, SITE, SITE_METHOD, LICENSE, LICENSE_FILES
according to the base package (with ?= so the derived package can still override it).

else

use the current way of assigning these variables

endif

There are some more manipulations required. E.g., the legal-info
infrastructure makes very heavy use of conditions, so that has to be rewritten as shell conditions.

Have fun with that :-)

Regards,
Arnout

Quoted 24 lines
Quoted 11 lines
Quoted 11 lines
package/uboot-tools/Config.in +5 -2
+UBOOT_TOOLS_LICENSE_FILES = $(UBOOT_LICENSE_FILES)
+else
 UBOOT_TOOLS_VERSION = 2014.01
-UBOOT_TOOLS_SOURCE  = u-boot-$(UBOOT_TOOLS_VERSION).tar.bz2
-UBOOT_TOOLS_SITE    = ftp://ftp.denx.de/pub/u-boot
+UBOOT_TOOLS_SOURCE = u-boot-$(UBOOT_TOOLS_VERSION).tar.bz2
+UBOOT_TOOLS_SITE = ftp://ftp.denx.de/pub/u-boot
 UBOOT_TOOLS_LICENSE = GPLv2+
 UBOOT_TOOLS_LICENSE_FILES = Licenses/gpl-2.0.txt
+endif
Quoted 8 lines
Quoted 2 lines

define UBOOT_TOOLS_BUILD_CMDS

      $(MAKE) -C $(@D)                        \

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F