Skip to contentSkip to conversation

u-boot-fw-utils: Backport a patch for out-of-tree builds

PATCH In review Daisuke Yamane 2 participants 4 messages Dec 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 u-boot-fw-utils: Backport a patch for out-of-tree builds

This patch fixs the following error of u-boot-fw-utils when ${S} != ${B}:
| cp: cannot create regular file 'tools/version.h': No such file or directory

---
 ...sure-tools-directory-exists-in-output-pri.patch | 41 ++++++++++++++++++++++
 meta/recipes-bsp/u-boot/u-boot-fw-utils_2020.01.bb |  5 ++-
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-bsp/u-boot/files/0001-Makefile-Ensure-tools-directory-exists-in-output-pri.patch
meta/recipes-bsp/u-boot/files/0001-Makefile-Ensure-tools-directory-exists-in-output-pri.patch new file +41 -0
new file mode 100644
index 0000000..217c500
@@ -0,0 +1,41 @@
+Upstream-Status: Backport [https://gitlab.denx.de/u-boot/u-boot/commit/fb013eee68d08403572ef3c579f6688bbe33fd47]
+
+This patch fixs the following error of u-boot-fw-utils when ${S} != ${B}:
+| cp: cannot create regular file 'tools/version.h': No such file or directory
+
+Signed-off-by: Daisuke Yamane <[email protected]>
+
+From fb013eee68d08403572ef3c579f6688bbe33fd47 Mon Sep 17 00:00:00 2001
+From: Tom Rini <[email protected]>
+Date: Wed, 4 Dec 2019 18:54:30 -0500
+Subject: [PATCH] Makefile: Ensure tools directory exists in output prior to
+ use
+
+With the change to make tools/version.h a file we need to make sure that
+the output directory exists first otherwise we will get a build failure.
+
+Reported-by: Peter Robinson <[email protected]>
+Tested-by: Peter Robinson <[email protected]>
+Fixes: 4d90f6cd9813 ("tools: Avoid creating symbolic links for tools/version.h")
+Signed-off-by: Tom Rini <[email protected]>
+Reviewed-by: Bin Meng <[email protected]>
+Reviewed-by: Simon Glass <[email protected]>
+---
+ Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Makefile b/Makefile
+index b6a091a..0766f78 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1889,6 +1889,7 @@ checkarmreloc: u-boot
+ 	fi
+ 
+ tools/version.h: include/version.h
++	$(Q)mkdir -p $(dir $@)
+ 	$(call if_changed,copy)
+ 
+ envtools: scripts_basic $(version_h) $(timestamp_h) tools/version.h
+-- 
+2.7.4
+
meta/recipes-bsp/u-boot/u-boot-fw-utils_2020.01.bb +4 -1
index 7de91ff..c30c490 100644
@@ -3,7 +3,10 @@ require u-boot-common.inc
 SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities"
 DEPENDS += "mtd-utils"
 
-SRC_URI += "file://0001-include-env.h-Ensure-ulong-is-defined.patch"
+SRC_URI += " \
+	file://0001-include-env.h-Ensure-ulong-is-defined.patch \
+	file://0001-Makefile-Ensure-tools-directory-exists-in-output-pri.patch \
+	"
 
 INSANE_SKIP_${PN} = "already-stripped"
 EXTRA_OEMAKE_class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" V=1'
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 2/3 u-boot-tools: Add capability of building from out-of-tree

This patch also helps to build with EXTERNALSRC.

---
 meta/recipes-bsp/u-boot/u-boot-tools_2020.01.bb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/recipes-bsp/u-boot/u-boot-tools_2020.01.bb +3 -3
index bede984..414ee33 100644
@@ -25,14 +25,14 @@ SED_CONFIG_EFI_armeb = ''
 SED_CONFIG_EFI_aarch64 = ''
 
 do_compile () {
-	oe_runmake sandbox_defconfig
+	oe_runmake -C ${S} sandbox_defconfig O=${B}
 
 	# Disable CONFIG_CMD_LICENSE, license.h is not used by tools and
 	# generating it requires bin2header tool, which for target build
 	# is built with target tools and thus cannot be executed on host.
-	sed -i -e "s/CONFIG_CMD_LICENSE=.*/# CONFIG_CMD_LICENSE is not set/" ${SED_CONFIG_EFI} .config
+	sed -i -e "s/CONFIG_CMD_LICENSE=.*/# CONFIG_CMD_LICENSE is not set/" ${SED_CONFIG_EFI} ${B}/.config
 
-	oe_runmake cross_tools NO_SDL=1
+	oe_runmake -C ${S} cross_tools NO_SDL=1 O=${B}
 }
 
 do_install () {
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 3/3 u-boot: Move B from u-boot.inc to u-boot-common.inc

In reply to Daisuke Yamane

Use the same value of B between u-boot, u-boot-fw-utils and u-boot-tools. This patch also enable the out-of-tree builds of u-boot-fw-utils and u-boot-tools actually.

---
 meta/recipes-bsp/u-boot/u-boot-common.inc | 1 +
 meta/recipes-bsp/u-boot/u-boot.inc        | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
meta/recipes-bsp/u-boot/u-boot-common.inc +1 -0
index a0f9c41..48402e4 100644
@@ -21,3 +21,4 @@ SRC_URI = "git://git.denx.de/u-boot.git \
           "
 
 S = "${WORKDIR}/git"
+B = "${WORKDIR}/build"
meta/recipes-bsp/u-boot/u-boot.inc +0 -2
index 55d8b47..ec77762 100644
@@ -1,8 +1,6 @@
 SUMMARY = "Universal Boot Loader for embedded devices"
 PROVIDES = "virtual/bootloader"
 
-B = "${WORKDIR}/build"
-
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 DEPENDS += "kern-tools-native"
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH v3 3/3] u-boot: Move B from u-boot.inc to u-boot-common.inc

Quoted 3 lines · Daisuke Yamane

Use the same value of B between u-boot, u-boot-fw-utils and u-boot-tools. This patch also enable the out-of-tree builds of u-boot-fw-utils and u-boot-tools actually.

If you're doing out of tree builds you need to ensure that ${B} is empty.

After setting ${B}, add:

do_configure[cleandirs] = "${B}"

Ross