From: blaisorblade_spam@yahoo.it
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, blaisorblade_spam@yahoo.it,
julian@sektor37.de, mcr@sandelman.ottawa.on.ca, sam@ravnborg.org
Subject: [patch 2/2] kbuild: fix crossbuild base config
Date: Wed, 03 Nov 2004 00:20:00 +0100 [thread overview]
Message-ID: <20041102232001.370174C0BC@zion.localdomain> (raw)
From: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
Cc: Julian Scheid <julian@sektor37.de>, Michael Richardson <mcr@sandelman.ottawa.on.ca>, Sam Ravnborg <sam@ravnborg.org>
When we are doing "make %config" on a normal build, we search a file to read
default settings from: we take the 1st existing one in a list specified in
scripts/kconfig/confdata.c. This list includes also /boot/config-$VER,
/lib/modules/$VER/.config, which is a wrong choice when we are
cross-compiling. So when cross-compiling we should ignore most files except
.config and arch/$ARCH/defconfig.
This has actually created not-working UML binaries (since UML is always
"cross-compiled" for this purpose), as reported by Julian Scheid.
We all agreed on this kind of general, not UML-only fix, and I (Paolo)
implemented it.
Implementation notes:
- I used a environment var, instead of adding yet another option, because it
was the least intrusive way. Adding a new option and parsing it in all
configurators, even the one not yet accepting command line option, was very
intrusive.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
---
vanilla-linux-2.6.9-paolo/scripts/kconfig/Makefile | 8 ++++++++
vanilla-linux-2.6.9-paolo/scripts/kconfig/confdata.c | 19 +++++++++++++++++--
vanilla-linux-2.6.9-paolo/scripts/kconfig/lkc.h | 1 -
3 files changed, 25 insertions(+), 3 deletions(-)
diff -puN scripts/kconfig/confdata.c~kbuild-fix-crossbuild-defconfig scripts/kconfig/confdata.c
--- vanilla-linux-2.6.9/scripts/kconfig/confdata.c~kbuild-fix-crossbuild-defconfig 2004-11-03 00:18:27.359070256 +0100
+++ vanilla-linux-2.6.9-paolo/scripts/kconfig/confdata.c 2004-11-03 00:18:27.365069344 +0100
@@ -18,7 +18,9 @@ const char conf_def_filename[] = ".confi
const char conf_defname[] = "arch/$ARCH/defconfig";
-const char *conf_confnames[] = {
+/*These are used only when conf_read(NULL) is called, i.e. when doing
+ * make config */
+static const char *__conf_confnames[] = {
".config",
"/lib/modules/$UNAME_RELEASE/.config",
"/etc/kernel-config",
@@ -27,6 +29,19 @@ const char *conf_confnames[] = {
NULL,
};
+/* If we are doing a cross-compilation, using the host system config is
+ * dangerous (silently broken binaries can be the result).*/
+static const char *__cross_conf_confnames[] = {
+ ".config",
+ conf_defname,
+ NULL,
+};
+
+static inline const char **get_conf_confnames(void)
+{
+ return getenv("__KBUILD_CROSS_COMPILING") ? __cross_conf_confnames: __conf_confnames;
+}
+
static char *conf_expand_value(const signed char *in)
{
struct symbol *sym;
@@ -83,7 +98,7 @@ int conf_read(const char *name)
if (name) {
in = zconf_fopen(name);
} else {
- const char **names = conf_confnames;
+ const char **names = get_conf_confnames();
while ((name = *names++)) {
name = conf_expand_value(name);
in = zconf_fopen(name);
diff -puN scripts/kconfig/lkc.h~kbuild-fix-crossbuild-defconfig scripts/kconfig/lkc.h
--- vanilla-linux-2.6.9/scripts/kconfig/lkc.h~kbuild-fix-crossbuild-defconfig 2004-11-03 00:18:27.361069952 +0100
+++ vanilla-linux-2.6.9-paolo/scripts/kconfig/lkc.h 2004-11-03 00:18:27.365069344 +0100
@@ -36,7 +36,6 @@ char *zconf_curname(void);
/* confdata.c */
extern const char conf_def_filename[];
-extern char conf_filename[];
char *conf_get_default_confname(void);
diff -puN scripts/kconfig/Makefile~kbuild-fix-crossbuild-defconfig scripts/kconfig/Makefile
--- vanilla-linux-2.6.9/scripts/kconfig/Makefile~kbuild-fix-crossbuild-defconfig 2004-11-03 00:18:27.362069800 +0100
+++ vanilla-linux-2.6.9-paolo/scripts/kconfig/Makefile 2004-11-03 00:18:27.365069344 +0100
@@ -4,6 +4,14 @@
.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig
+ifneq ($(SUBARCH),$(ARCH))
+ # This is used in scripts/kconfig/confdata.c
+ export __KBUILD_CROSS_COMPILING := 1
+else
+ #Let's prevent interferences from the environment.
+ unexport __KBUILD_CROSS_COMPILING
+endif
+
xconfig: $(obj)/qconf
$< arch/$(ARCH)/Kconfig
_
next reply other threads:[~2004-11-02 23:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-02 23:20 blaisorblade_spam [this message]
2004-11-03 16:56 ` Roman Zippel
2004-11-03 17:48 ` Tom Rini
2004-11-03 18:19 ` Roman Zippel
2004-11-03 18:34 ` Tom Rini
2004-11-03 20:32 ` Blaisorblade
2004-11-04 0:06 ` Roman Zippel
2004-11-04 0:04 ` Roman Zippel
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=20041102232001.370174C0BC@zion.localdomain \
--to=blaisorblade_spam@yahoo.it \
--cc=akpm@osdl.org \
--cc=julian@sektor37.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mcr@sandelman.ottawa.on.ca \
--cc=sam@ravnborg.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
all inboxes | Powered by JetHome®