Skip to contentSkip to conversation

omap-u-boot-utils: add new package

PATCH Superseded Luca Ceresoli 3 participants 10 messages Sep 13, 2011 – Sep 21, 2011

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 omap-u-boot-utils: add new package

---
 boot/Config.in                                 |    1 +
 boot/omap-u-boot-utils/Config.in               |    7 ++++++
 package/omap-u-boot-utils/omap-u-boot-utils.mk |   25 ++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 boot/omap-u-boot-utils/Config.in
 create mode 100644 package/omap-u-boot-utils/omap-u-boot-utils.mk
boot/Config.in +1 -0
index 2a97695..7e5a52d 100644
@@ -7,6 +7,7 @@ source "boot/uboot/Config.in"
 source "boot/at91bootstrap/Config.in"
 source "boot/at91dataflashboot/Config.in"
 source "boot/xloader/Config.in"
+source "boot/omap-u-boot-utils/Config.in"
 
 endmenu
 
boot/omap-u-boot-utils/Config.in new file +7 -0
new file mode 100644
index 0000000..3e4567c
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS
+	bool "omap-u-boot-utils"
+	help
+	  U-Boot Utilities for Texas Instrument's OMAP platforms.
+	  Say Y if you want these utilities on the development host.
+
+	  https://github.com/nmenon/omap-u-boot-utils
package/omap-u-boot-utils/omap-u-boot-utils.mk new file +25 -0
new file mode 100644
index 0000000..dc5b22c
@@ -0,0 +1,25 @@
+#############################################################
+#
+# omap-u-boot-utils
+#
+#############################################################
+
+OMAP_U_BOOT_UTILS_VERSION = d086cb5c0
+OMAP_U_BOOT_UTILS_SOURCE = omap-u-boot-utils-$(OMAP_U_BOOT_UTILS_VERSION).tar.gz
+OMAP_U_BOOT_UTILS_SITE = git://github.com/nmenon/omap-u-boot-utils.git
+OMAP_U_BOOT_UTILS_SITE_METHOD = git
+
+OMAP_U_BOOT_UTILS_TARGETS = gpsign pserial tagger ucmd ukermit
+
+define HOST_OMAP_U_BOOT_UTILS_BUILD_CMDS
+	$(MAKE) -C $(@D)
+endef
+
+define HOST_OMAP_U_BOOT_UTILS_INSTALL_CMDS
+	for f in ${OMAP_U_BOOT_UTILS_TARGETS} ; do \
+		[ -f ${HOST_DIR}/usr/bin/$$f ] || \
+		  install -m 755 -D $(@D)/$$f ${HOST_DIR}/usr/bin/$$f ; \
+	done
+endef
+
+$(eval $(call GENTARGETS,package,omap-u-boot-utils,host))
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 2/2 u-boot: build signed image for OMAP processors

---
 boot/uboot/Config.in |   15 +++++++++++++++
 boot/uboot/uboot.mk  |   24 ++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)
boot/uboot/Config.in +15 -0
index a0b2bfc..5a8af98 100644
@@ -91,6 +91,21 @@ config BR2_TARGET_UBOOT_FORMAT_LDR
 
 endchoice
 
+config BR2_TARGET_UBOOT_OMAP_IFT
+	depends on BR2_TARGET_UBOOT_FORMAT_BIN
+	select BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS
+	bool "produce a .ift signed image (OMAP)"
+	help
+	  Use gpsign to produce an image of u-boot.bin signed with
+	  a Configuration Header for booting on OMAP processors.
+
+if BR2_TARGET_UBOOT_OMAP_IFT
+
+config BR2_TARGET_UBOOT_OMAP_IFT_CONFIG
+	string "gpsign Configuration Header config file"
+
+endif
+
 menuconfig BR2_TARGET_UBOOT_NETWORK
 	bool "Network Settings"
 	default y
boot/uboot/uboot.mk +24 -0
index 776bdef..499aab9 100644
@@ -29,6 +29,9 @@ else ifeq ($(BR2_TARGET_UBOOT_FORMAT_LDR),y)
 UBOOT_BIN          = u-boot.ldr
 else
 UBOOT_BIN          = u-boot.bin
+ifeq ($(BR2_TARGET_UBOOT_OMAP_IFT),y)
+UBOOT_BIN_IFT      = ${UBOOT_BIN}.ift
+endif
 endif
 
 UBOOT_ARCH=$(KERNEL_ARCH)
@@ -84,10 +87,31 @@ define UBOOT_BUILD_CMDS
 		$(UBOOT_MAKE_TARGET)
 endef
 
+define UBOOT_BUILD_OMAP_IFT
+	${HOST_DIR}/usr/bin/gpsign -f $(@D)/u-boot.bin \
+		-c $(call qstrip,$(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG))
+endef
+
 define UBOOT_INSTALL_IMAGES_CMDS
 	cp -dpf $(@D)/$(UBOOT_BIN) $(BINARIES_DIR)/
 endef
 
+define UBOOT_INSTALL_OMAP_IFT_IMAGE
+	cp -dpf $(@D)/$(UBOOT_BIN_IFT) $(BINARIES_DIR)/
+endef
+
+ifeq ($(BR2_TARGET_UBOOT_OMAP_IFT),y)
+# we NEED a config file unless we're at make source
+ifeq ($(filter source,$(MAKECMDGOALS)),)
+ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG)),)
+$(error No gpsign config file. Check your BR2_TARGET_UBOOT_OMAP_IFT_CONFIG setting)
+endif
+endif
+UBOOT_DEPENDENCIES += host-omap-u-boot-utils
+UBOOT_POST_BUILD_HOOKS += UBOOT_BUILD_OMAP_IFT
+UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_INSTALL_OMAP_IFT_IMAGE
+endif
+
 $(eval $(call GENTARGETS,boot,uboot))
 
 ifeq ($(BR2_TARGET_UBOOT),y)
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/2 u-boot: build signed image for OMAP processors

Quoted 11 lines · Luca Ceresoli
---
 boot/uboot/Config.in |   15 +++++++++++++++
 boot/uboot/uboot.mk  |   24 ++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)
boot/uboot/Config.in +0 -0
index a0b2bfc..5a8af98 100644

boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_LDR · line 100

Quoted 10 lines
boot/uboot/Config.in +7 -0
@@ -91,6 +91,21 @@ config BR2_TARGET_UBOOT_FORMAT_LDR
 
 endchoice
 
+config BR2_TARGET_UBOOT_OMAP_IFT
+	depends on BR2_TARGET_UBOOT_FORMAT_BIN
+	select BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS
+	bool "produce a .ift signed image (OMAP)"
+	help
+	  Use gpsign to produce an image of u-boot.bin signed with
+	  a Configuration Header for booting on OMAP processors.

Maybe make it depend on BR2_ARCH = arm || armeb to avoid pointless options for other architectures?
Regards.

#3 lore raw

PATCH 2/2 u-boot: build signed image for OMAP processors

Gustavo Zacarias wrote:
...

Quoted 10 lines
Quoted 7 lines

+config BR2_TARGET_UBOOT_OMAP_IFT
+ depends on BR2_TARGET_UBOOT_FORMAT_BIN
+ select BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS
+ bool "produce a .ift signed image (OMAP)"
+ help
+ Use gpsign to produce an image of u-boot.bin signed with
+ a Configuration Header for booting on OMAP processors.

Maybe make it depend on BR2_ARCH = arm || armeb to avoid pointless options for other architectures?

Right, will do.

Thanks,
Luca

#4 lore raw

PATCH 1/2 omap-u-boot-utils: add new package

In reply to Luca Ceresoli

Le Tue, 13 Sep 2011 19:19:32 +0200,
Luca Ceresoli <[email protected]> a ?crit :

boot/omap-u-boot-utils/Config.in line 7

Quoted 9 lines

+++ b/boot/omap-u-boot-utils/Config.in

boot/omap-u-boot-utils/Config.in new file +7 -0
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS
+	bool "omap-u-boot-utils"
+	help
+	  U-Boot Utilities for Texas Instrument's OMAP platforms.
+	  Say Y if you want these utilities on the development host.
+
+	  https://github.com/nmenon/omap-u-boot-utils

This is a pure host package, so it shouldn't be present in any Config.in file. See package/fakeroot as an example.

And even if it also was a target package, the Config.in should be in the package directory, not in boot/.

package/omap-u-boot-utils/omap-u-boot-utils.mk line 8

Quoted 2 lines
package/omap-u-boot-utils/omap-u-boot-utils.mk new file +2 -0
+OMAP_U_BOOT_UTILS_VERSION = d086cb5c0
+OMAP_U_BOOT_UTILS_SOURCE = omap-u-boot-utils-$(OMAP_U_BOOT_UTILS_VERSION).tar.gz

xxx_SOURCE is useless with the git download method.

Quoted 1 line

+OMAP_U_BOOT_UTILS_TARGETS = gpsign pserial tagger ucmd ukermit

Used only once, just hardcode.

Otherwise looks good!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#5 lore raw

PATCH 1/2 omap-u-boot-utils: add new package

Thomas,
thanks for the review.

Quoted 16 lines · Thomas Petazzoni

Le Tue, 13 Sep 2011 19:19:32 +0200,
Luca Ceresoli<[email protected]> a ?crit :

boot/omap-u-boot-utils/Config.in line 7

Quoted 9 lines

+++ b/boot/omap-u-boot-utils/Config.in

boot/omap-u-boot-utils/Config.in new file +7 -0
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS
+	bool "omap-u-boot-utils"
+	help
+	  U-Boot Utilities for Texas Instrument's OMAP platforms.
+	  Say Y if you want these utilities on the development host.
+
+	  https://github.com/nmenon/omap-u-boot-utils

This is a pure host package, so it shouldn't be present in any Config.in file. See package/fakeroot as an example.

Quoted 2 lines

And even if it also was a target package, the Config.in should be in the package directory, not in boot/.

If I understand correctly your point, you would make omap-u-boot-utils automatically compile if BR2_TARGET_UBOOT_OMAP_IFT (patch 2/2) is on, without any user-visible option.

But this would reduce flexibility.

To understand why, consider this package is a set of utilities, loosely related to each other.

gpsign is absolutely OMAP-specific, and it's what I use in patch 2/2 in order to build a .ift image from a .bin image.

OTOH, ucmd "sends a command and expects a provided matching response from target", and is aimed at creating automated scripts to interact with a commandline program over a serial line. This can be used in any architecture. I have board-specific scripts that use it to write bootloader + kernel + rootfs onto a new (or bricked) board from files in output/images.

So, while omap-u-boot-utils is a requirement for building a signed image, I think it should be also available as a user option in menuconfig.
I'm not sure boot/omap-u-boot-utils/Config.in is the correct place anyway, I'm open to suggestions on a better location.

Oh, and to be complete, this might be a target package too; I did not implement that because cross-compilation is a bit tricky and the use case is possibly not interesting to anybody.

Quoted 5 lines

package/omap-u-boot-utils/omap-u-boot-utils.mk line 8

Quoted 3 lines
package/omap-u-boot-utils/omap-u-boot-utils.mk new file +2 -0
+OMAP_U_BOOT_UTILS_VERSION = d086cb5c0
+OMAP_U_BOOT_UTILS_SOURCE = omap-u-boot-utils-$(OMAP_U_BOOT_UTILS_VERSION).tar.gz

xxx_SOURCE is useless with the git download method.

Right. Will fix.

Quoted 4 lines
Quoted 2 lines

+OMAP_U_BOOT_UTILS_TARGETS = gpsign pserial tagger ucmd ukermit

Used only once, just hardcode.

Well, ok. Will do.

Luca

#6 lore raw

PATCH v2 1/2 omap-u-boot-utils: add new package

In reply to Luca Ceresoli

---

New in v2:
- xxx_SOURCE is useless with the git download method, remove it;
- OMAP_U_BOOT_UTILS_TARGETS is used only once, hardcoded it.

---
 boot/Config.in                                 |    1 +
 boot/omap-u-boot-utils/Config.in               |    7 +++++++
 package/omap-u-boot-utils/omap-u-boot-utils.mk |   22 ++++++++++++++++++++++
 3 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 boot/omap-u-boot-utils/Config.in
 create mode 100644 package/omap-u-boot-utils/omap-u-boot-utils.mk
boot/Config.in +1 -0
index 2a97695..7e5a52d 100644
@@ -7,6 +7,7 @@ source "boot/uboot/Config.in"
 source "boot/at91bootstrap/Config.in"
 source "boot/at91dataflashboot/Config.in"
 source "boot/xloader/Config.in"
+source "boot/omap-u-boot-utils/Config.in"
 
 endmenu
 
boot/omap-u-boot-utils/Config.in new file +7 -0
new file mode 100644
index 0000000..3e4567c
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS
+	bool "omap-u-boot-utils"
+	help
+	  U-Boot Utilities for Texas Instrument's OMAP platforms.
+	  Say Y if you want these utilities on the development host.
+
+	  https://github.com/nmenon/omap-u-boot-utils
package/omap-u-boot-utils/omap-u-boot-utils.mk new file +22 -0
new file mode 100644
index 0000000..8bc6c23
@@ -0,0 +1,22 @@
+#############################################################
+#
+# omap-u-boot-utils
+#
+#############################################################
+
+OMAP_U_BOOT_UTILS_VERSION = d086cb5c0
+OMAP_U_BOOT_UTILS_SITE = git://github.com/nmenon/omap-u-boot-utils.git
+OMAP_U_BOOT_UTILS_SITE_METHOD = git
+
+define HOST_OMAP_U_BOOT_UTILS_BUILD_CMDS
+	$(MAKE) -C $(@D)
+endef
+
+define HOST_OMAP_U_BOOT_UTILS_INSTALL_CMDS
+	for f in gpsign pserial tagger ucmd ukermit ; do \
+		[ -f ${HOST_DIR}/usr/bin/$$f ] || \
+		  install -m 755 -D $(@D)/$$f ${HOST_DIR}/usr/bin/$$f ; \
+	done
+endef
+
+$(eval $(call GENTARGETS,package,omap-u-boot-utils,host))
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH v2 2/2 u-boot: build signed image for OMAP processors

---

New in v2: add depends on BR2_arm || BR2_armeb.

---
 boot/uboot/Config.in |   16 ++++++++++++++++
 boot/uboot/uboot.mk  |   24 ++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)
boot/uboot/Config.in +16 -0
index daccd8b..ade6330 100644
@@ -91,6 +91,22 @@ config BR2_TARGET_UBOOT_FORMAT_LDR
 
 endchoice
 
+config BR2_TARGET_UBOOT_OMAP_IFT
+	depends on BR2_TARGET_UBOOT_FORMAT_BIN
+	depends on BR2_arm || BR2_armeb
+	select BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS
+	bool "produce a .ift signed image (OMAP)"
+	help
+	  Use gpsign to produce an image of u-boot.bin signed with
+	  a Configuration Header for booting on OMAP processors.
+
+if BR2_TARGET_UBOOT_OMAP_IFT
+
+config BR2_TARGET_UBOOT_OMAP_IFT_CONFIG
+	string "gpsign Configuration Header config file"
+
+endif
+
 menuconfig BR2_TARGET_UBOOT_NETWORK
 	bool "Custom Network Settings"
 	help
boot/uboot/uboot.mk +24 -0
index 202995a..71397f8 100644
@@ -29,6 +29,9 @@ else ifeq ($(BR2_TARGET_UBOOT_FORMAT_LDR),y)
 UBOOT_BIN          = u-boot.ldr
 else
 UBOOT_BIN          = u-boot.bin
+ifeq ($(BR2_TARGET_UBOOT_OMAP_IFT),y)
+UBOOT_BIN_IFT      = ${UBOOT_BIN}.ift
+endif
 endif
 
 UBOOT_ARCH=$(KERNEL_ARCH)
@@ -84,10 +87,31 @@ define UBOOT_BUILD_CMDS
 		$(UBOOT_MAKE_TARGET)
 endef
 
+define UBOOT_BUILD_OMAP_IFT
+	${HOST_DIR}/usr/bin/gpsign -f $(@D)/u-boot.bin \
+		-c $(call qstrip,$(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG))
+endef
+
 define UBOOT_INSTALL_IMAGES_CMDS
 	cp -dpf $(@D)/$(UBOOT_BIN) $(BINARIES_DIR)/
 endef
 
+define UBOOT_INSTALL_OMAP_IFT_IMAGE
+	cp -dpf $(@D)/$(UBOOT_BIN_IFT) $(BINARIES_DIR)/
+endef
+
+ifeq ($(BR2_TARGET_UBOOT_OMAP_IFT),y)
+# we NEED a config file unless we're at make source
+ifeq ($(filter source,$(MAKECMDGOALS)),)
+ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG)),)
+$(error No gpsign config file. Check your BR2_TARGET_UBOOT_OMAP_IFT_CONFIG setting)
+endif
+endif
+UBOOT_DEPENDENCIES += host-omap-u-boot-utils
+UBOOT_POST_BUILD_HOOKS += UBOOT_BUILD_OMAP_IFT
+UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_INSTALL_OMAP_IFT_IMAGE
+endif
+
 $(eval $(call GENTARGETS,boot,uboot))
 
 ifeq ($(BR2_TARGET_UBOOT),y)
Signature · 1 line
1.7.4.1
#8 lore raw

PATCH v2 1/2 omap-u-boot-utils: add new package

In reply to Luca Ceresoli

Le Mon, 19 Sep 2011 16:53:26 +0200,
Luca Ceresoli <[email protected]> a ?crit :

boot/omap-u-boot-utils/Config.in line 7

Quoted 7 lines
boot/omap-u-boot-utils/Config.in new file +7 -0
+config BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS
+	bool "omap-u-boot-utils"
+	help
+	  U-Boot Utilities for Texas Instrument's OMAP platforms.
+	  Say Y if you want these utilities on the development host.
+
+	  https://github.com/nmenon/omap-u-boot-utils

I continue to disagree with the fact of adding an host utility in the Config.in menu, or at least not without a broader discussion about this.

Since we have started to normalize the generation of host packages (late 2009/early 2010), we decided that host packages should *not* appear in the menuconfig, but that they rather should only be handled through make dependencies. If we decide to change this decision, we need to think about it globally, i.e what we want to do for *all* host packages and not only particular cases.

I must admit there are other cases for which being able to show host packages to users would be useful. For example, on AT91 platforms, there is an host utility called SAM-BA which allows to reflash an AT91 device through the USB device port. This host utility could be conveniently downloaded, extracted and installed into $(HOST_DIR) by Buildroot, but we have currently no way of doing this.

Some thing for OpenOCD. Jean-Christophe has recently added support for it for the target, but being able to build OpenOCD on the host and install it in $(HOST_DIR) would also be useful for those of us who want to build ready-to-use development environments with Buildroot.

Anyway, in the mean time, I'm NACKing those patches until a proper discussion has taken place, resulting in the definition of a solution that works for all host packages.

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#9 lore raw

PATCH v2 1/2 omap-u-boot-utils: add new package

Thomas,

Quoted 14 lines · Thomas Petazzoni

Le Mon, 19 Sep 2011 16:53:26 +0200,
Luca Ceresoli<[email protected]> a ?crit :

boot/omap-u-boot-utils/Config.in line 7

Quoted 7 lines
boot/omap-u-boot-utils/Config.in new file +7 -0
+config BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS
+	bool "omap-u-boot-utils"
+	help
+	  U-Boot Utilities for Texas Instrument's OMAP platforms.
+	  Say Y if you want these utilities on the development host.
+
+	  https://github.com/nmenon/omap-u-boot-utils

I continue to disagree with the fact of adding an host utility in the Config.in menu, or at least not without a broader discussion about this.

Quoted 4 lines

Since we have started to normalize the generation of host packages (late 2009/early 2010), we decided that host packages should *not* appear in the menuconfig, but that they rather should only be handled through make dependencies.

Sorry, I didn't know: I was not closely following the buildroot development at that time.

Quoted 11 lines

If we decide to change this decision, we
need to think about it globally, i.e what we want to do for *all* host packages and not only particular cases.

I must admit there are other cases for which being able to show host packages to users would be useful. For example, on AT91 platforms, there is an host utility called SAM-BA which allows to reflash an AT91 device through the USB device port. This host utility could be conveniently downloaded, extracted and installed into $(HOST_DIR) by Buildroot, but we have currently no way of doing this.

Quoted 8 lines

Some thing for OpenOCD. Jean-Christophe has recently added support for it for the target, but being able to build OpenOCD on the host and install it in $(HOST_DIR) would also be useful for those of us who want to build ready-to-use development environments with Buildroot.

Anyway, in the mean time, I'm NACKing those patches until a proper discussion has taken place, resulting in the definition of a solution that works for all host packages.

I understand. I just posted a v2 to have the trivial fixes and improvements requested so far and stop thinking about them.

I'm going to start a new thread right now to open the discussion.

Luca