From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>
Subject: [PATCH 3/6] kbuild: deb-pkg: set CROSS_COMPILE only when undefined
Date: Mon, 13 Mar 2023 05:07:28 +0900 [thread overview]
Message-ID: <20230312200731.599706-4-masahiroy@kernel.org> (raw)
In-Reply-To: <20230312200731.599706-1-masahiroy@kernel.org>
Commit 3ab18a625ce4 ("kbuild: deb-pkg: improve the usability of source
package") set needless CROSS_COMPILE.
For example, 'make allnoconfig bindeb-pkg' on a x86_64 system will set
CROSS_COMPILE=i686-linux-gnu-, where the biarch compiler 'gcc' should
work for building the i386 kernel.
$ uname -m
x86_64
$ make allnoconfig bindeb-pkg >/dev/null
dpkg-architecture: warning: specified GNU system type i686-linux-gnu does not match CC system type x86_64-linux-gnu, try setting a correct CC environment variable
dpkg-source --before-build .
debian/rules binary
scripts/Kconfig.include:39: C compiler 'i686-linux-gnu-gcc' not found
make[6]: *** [scripts/kconfig/Makefile:77: olddefconfig] Error 1
make[5]: *** [Makefile:693: olddefconfig] Error 2
make[4]: *** [Makefile:358: __build_one_by_one] Error 2
make[3]: *** [debian/rules:7: build-arch] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
make[2]: *** [scripts/Makefile.package:127: bindeb-pkg] Error 2
make[1]: *** [Makefile:1657: bindeb-pkg] Error 2
make: *** [Makefile:358: __build_one_by_one] Error 2
Check whether CROSS_COMPILE is defined, instead of whether it is non-empty.
If you invoke debian/rules via Kbuild, CROSS_COMPILE is always defined
in the top Makefile.
Fixes: 3ab18a625ce4 ("kbuild: deb-pkg: improve the usability of source package")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/package/deb-build-option | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/scripts/package/deb-build-option b/scripts/package/deb-build-option
index bd53624318f2..7950eff01781 100755
--- a/scripts/package/deb-build-option
+++ b/scripts/package/deb-build-option
@@ -1,9 +1,8 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
-# Set up CROSS_COMPILE if we are cross-compiling, but not called from the
-# kernel toplevel Makefile
-if [ -z "${CROSS_COMPILE}${cross_compiling}" -a "${DEB_HOST_ARCH}" != "${DEB_BUILD_ARCH}" ]; then
+# Set up CROSS_COMPILE if not defined yet
+if [ "${CROSS_COMPILE+set}" != "set" -a "${DEB_HOST_ARCH}" != "${DEB_BUILD_ARCH}" ]; then
echo CROSS_COMPILE=${DEB_HOST_GNU_TYPE}-
fi
--
2.34.1
next prev parent reply other threads:[~2023-03-12 20:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-12 20:07 [PATCH 0/6] kbuild: fix some packaging issues, and use git-archive for source package Masahiro Yamada
2023-03-12 20:07 ` [PATCH 1/6] kbuild: deb-pkg: make debian source package working again Masahiro Yamada
2023-03-12 20:07 ` [PATCH 2/6] kbuild: deb-pkg: do not take KERNELRELEASE from the source version Masahiro Yamada
2023-03-13 11:31 ` Péter Ujfalusi
2023-03-12 20:07 ` Masahiro Yamada [this message]
2023-03-12 20:07 ` [PATCH 4/6] kbuild: deb-pkg: split image and debug objects staging out into functions Masahiro Yamada
2023-03-12 20:07 ` [PATCH 5/6] kbuild: deb-pkg: use dh_listpackages to know enabled packages Masahiro Yamada
2023-03-12 20:07 ` [PATCH 6/6] kbuild: use git-archive for source package creation Masahiro Yamada
2023-04-06 15:25 ` youling257
2023-04-07 12:04 ` Masahiro Yamada
2023-03-12 23:26 ` [PATCH 0/6] kbuild: fix some packaging issues, and use git-archive for source package Linus Torvalds
2023-03-13 0:52 ` Masahiro Yamada
2023-03-13 17:33 ` Linus Torvalds
2023-03-16 10:22 ` Leon Romanovsky
2023-03-16 11:24 ` Nicolas Schier
2023-03-16 12:50 ` Leon Romanovsky
2023-03-19 1:12 ` Steev Klimaszewski
2023-03-19 2:19 ` Masahiro Yamada
2023-03-19 3:21 ` Steev Klimaszewski
2023-03-19 6:45 ` Steev Klimaszewski
2023-03-19 7:06 ` Masahiro Yamada
2023-03-19 7:57 ` Steev Klimaszewski
2023-03-19 7:02 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230312200731.599706-4-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox