Control: blocked -1 by 980324
Control: tags -1 + patch

> With this applied, an attempted cross compile shows the exported
> variable is still needed:
[...]
> Other tools in u-boot's Makefiles probably need it as well...

I had forgotten the changes setting CROSS_COMPILE on the command line,
so it was not passed at all.

The attached patch builds qemu on amd64, and cross-builds tools on
amd64 for armel (for tools, the installation breaks because of 980324,
but the build succeeds).
>From d7cdef584e72caa1a4f8e7e707849222b31797ed Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 16 Jan 2021 12:06:22 +0100
Subject: Set CROSS_COMPILE on the Make command line instead of exporting

The two methods are equivalent because Makefile exports the value from
the command line, but the command line makes the scope of the
assignment evident.

diff --git a/debian/rules b/debian/rules
index 17c7f9e16e..1e82ad0a6b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,7 +5,7 @@ include /usr/share/dpkg/pkg-info.mk
 export DEBIAN_REVISION ?= $(shell echo $(DEB_VERSION) | sed -e 
's,.*+dfsg,+dfsg,')
 
 ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
-export CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
+CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
 cross_build_tools ?= y
 endif
 
@@ -76,25 +76,25 @@ build-targets: configs/novena-rawsd_defconfig 
configs/am335x_boneblack_defconfig
                                ;; \
                esac;\
                case $$arch in \
-                       all:armhf) export CROSS_COMPILE=arm-linux-gnueabihf- ;;\
-                       all:arm64) export CROSS_COMPILE=aarch64-linux-gnu- ;;\
-                       all:mips) export CROSS_COMPILE=mips-linux-gnu- ;;\
-                       all:mipsel) export CROSS_COMPILE=mipsel-linux-gnu- ;;\
-                       all:mips64el) export 
CROSS_COMPILE=mips64el-linux-gnuabi64- ;;\
-                       all:powerpc) export CROSS_COMPILE=powerpc-linux-gnu- ;;\
-                       all:riscv64) export CROSS_COMPILE=riscv64-linux-gnu- ;;\
-                       all:i386) export CROSS_COMPILE=i686-linux-gnu- ;;\
-                       all:amd64) export CROSS_COMPILE=x86_64-linux-gnu- ;;\
-                       *) ;; \
+                       all:armhf) CROSS_COMPILE=arm-linux-gnueabihf- ;;\
+                       all:arm64) CROSS_COMPILE=aarch64-linux-gnu- ;;\
+                       all:mips) CROSS_COMPILE=mips-linux-gnu- ;;\
+                       all:mipsel) CROSS_COMPILE=mipsel-linux-gnu- ;;\
+                       all:mips64el) CROSS_COMPILE=mips64el-linux-gnuabi64- ;;\
+                       all:powerpc) CROSS_COMPILE=powerpc-linux-gnu- ;;\
+                       all:riscv64) CROSS_COMPILE=riscv64-linux-gnu- ;;\
+                       all:i386) CROSS_COMPILE=i686-linux-gnu- ;;\
+                       all:amd64) CROSS_COMPILE=x86_64-linux-gnu- ;;\
+                       *) CROSS_COMPILE=$(CROSS_COMPILE) ;; \
                esac;\
                case $$subarch in \
                        sunxi) export SCP=/dev/null ;;\
                        *) unset SCP ;;\
                esac;\
                mkdir -p $$builddir; \
-               dh_auto_build -- V=$(VERBOSE) O=$$builddir 
$${platform}_defconfig; \
+               dh_auto_build -- V=$(VERBOSE) O=$$builddir 
CROSS_COMPILE=$${CROSS_COMPILE} $${platform}_defconfig; \
                sed -i -e 's,CONFIG_FIT_SIGNATURE=y,# CONFIG_FIT_SIGNATURE is 
not set,g' $$builddir/.config; \
-               dh_auto_build -- V=$(VERBOSE) O=$$builddir; \
+               dh_auto_build -- V=$(VERBOSE) O=$$builddir 
CROSS_COMPILE=$${CROSS_COMPILE}; \
                case "$$targets" in \
                        *uboot.elf*) \
                                install -m 644 $$builddir/u-boot 
$$builddir/uboot.elf; \

Reply via email to