From d90986dcafdd04db05f693836b991b31a16ea35a Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Wed, 8 Nov 2017 23:14:21 +0100 Subject: u-boot-fw-utils: follow the compile fixes for native/cross used in oe-core The U-Boot Makefile has a unusual way of compiling the user space tools which results in the wrong toolchain (native vs. target) being used. Drop our downstream fix in favour of how openembedded-core does this now. Signed-off-by: Max Krummenacher Acked-by: Marcel Ziswiler --- recipes-bsp/u-boot/files/default-gcc.patch | 39 +++++++++++++++++++++++ recipes-bsp/u-boot/u-boot-toradex-fw-utils_git.bb | 15 +++++++-- 2 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 recipes-bsp/u-boot/files/default-gcc.patch (limited to 'recipes-bsp') diff --git a/recipes-bsp/u-boot/files/default-gcc.patch b/recipes-bsp/u-boot/files/default-gcc.patch new file mode 100644 index 0000000..04184df --- /dev/null +++ b/recipes-bsp/u-boot/files/default-gcc.patch @@ -0,0 +1,39 @@ +OE needs to be able to change the default compiler. If we pass in HOSTCC +through the make command, it overwrites not only this setting but also the +setting in tools/Makefile wrapped in ifneq ($(CROSS_BUILD_TOOLS),) which +breaks the build. + +We therefore use override to ensure the value of HOSTCC is overwritten when +needed. + +RP: Updated the patch to the version being submitted to upstream u-boot + +Upstream-Status: Submitted [emailed to Masahiro Yamada for discussion] +RP 2017/3/11 + +Index: git/tools/Makefile +=================================================================== +--- git.orig/tools/Makefile ++++ git/tools/Makefile +@@ -262,7 +262,7 @@ $(LICENSE_H): $(obj)/bin2header $(srctre + subdir- += env + + ifneq ($(CROSS_BUILD_TOOLS),) +-HOSTCC = $(CC) ++override HOSTCC = $(CC) + + quiet_cmd_crosstools_strip = STRIP $^ + cmd_crosstools_strip = $(STRIP) $^; touch $@ +Index: git/tools/env/Makefile +=================================================================== +--- git.orig/tools/env/Makefile ++++ git/tools/env/Makefile +@@ -8,7 +8,7 @@ + # fw_printenv is supposed to run on the target system, which means it should be + # built with cross tools. Although it may look weird, we only replace "HOSTCC" + # with "CC" here for the maximum code reuse of scripts/Makefile.host. +-HOSTCC = $(CC) ++override HOSTCC = $(CC) + + # Compile for a hosted environment on the target + HOST_EXTRACFLAGS = $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \ diff --git a/recipes-bsp/u-boot/u-boot-toradex-fw-utils_git.bb b/recipes-bsp/u-boot/u-boot-toradex-fw-utils_git.bb index f0b8191..904415b 100644 --- a/recipes-bsp/u-boot/u-boot-toradex-fw-utils_git.bb +++ b/recipes-bsp/u-boot/u-boot-toradex-fw-utils_git.bb @@ -25,6 +25,7 @@ SRCREV_use-head-next = "${AUTOREV}" SRCBRANCH_use-head-next = "2016.11-toradex-next" SRC_URI = " \ git://git.toradex.com/u-boot-toradex.git;protocol=git;branch=${SRCBRANCH} \ + file://default-gcc.patch \ file://fw_env.config \ " SRC_URI_append_tegra3 = " file://fw_unlock_mmc.sh" @@ -37,9 +38,9 @@ S = "${WORKDIR}/git" #actually this depend on the upstream U-Boot version and not on the machine CC_remove = "-mfpu=neon" -EXTRA_OEMAKE = 'CC="${CC}"' - -INSANE_SKIP_${PN} = "already-stripped ldflags" +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' +EXTRA_OEMAKE_class-cross = 'ARCH=${TARGET_ARCH} CC="${CC} ${CFLAGS} ${LDFLAGS}" V=1' inherit pkgconfig uboot-config @@ -73,4 +74,12 @@ pkg_postinst_${PN}_colibri-t20 () { grep u-boot-env /proc/mtd | awk '{print "/dev/" substr($1,0,4) " 0x00000000 0x00010000 0x" $3 " 1" >> "/etc/fw_env.config" }' } +do_install_class-cross () { + install -d ${D}${bindir_cross} + install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_printenv + install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_setenv +} + +SYSROOT_DIRS_append_class-cross = " ${bindir_cross}" + PACKAGE_ARCH = "${MACHINE_ARCH}" -- cgit v1.2.3