public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] out-of-tree builds: preserve ARCH and CROSS_COMPILE settings
@ 2005-02-07 22:31 Ralph Siemsen
  0 siblings, 0 replies; only message in thread
From: Ralph Siemsen @ 2005-02-07 22:31 UTC (permalink / raw)
  To: trivial, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1081 bytes --]

[I am not subscribed, please CC: any replies]

When you build the 2.6 kernel outside of its source directory, using the 
O= option like so:

	make -C linux-2.6.10 O=../builddir

this conveniently produces a top-level Makefile in "builddir" which can 
be used to update/clean/rebuild the tree with a simple "make".  It also 
uses the ".config" file from "builddir", which makes it very convenient 
for managing multiple builds for different target systems.

However if you are cross-compiling, you must also set ARCH and 
CROSS_COMPILE variables as appropriate.  Unfortunately these settings 
are not recorded in the generated Makefile in "builddir", so one cannot 
simply do "make" anymore.

The attached patch fixes the script that generates the Makefile, so as 
to pass ARCH and CROSS_COMPILE settings, only when they are defined. 
Otherwise behaviour is exactly as it was before.

Since the contents of "builddir" are specific to ARCH and CROSS_COMPILER 
I see no reason why the values should not become fixed in "builddir".

Signed-off-by: Ralph Siemsen <ralphs@netwinder.org>

[-- Attachment #2: mkmakefile.patch --]
[-- Type: text/x-patch, Size: 672 bytes --]

diff -u mkmakefile
--- linux-2.6.10.orig/scripts/mkmakefile	27 Jan 2005 15:53:54 -0000
+++ linux-2.6.10/scripts/mkmakefile	7 Feb 2005 21:20:19 -0000
@@ -9,6 +9,8 @@
 # $3 - version
 # $4 - patchlevel
 
+test "$ARCH" != "" && ARCH="ARCH=$ARCH"
+test "$CROSS_COMPILE" != "" && CROSS="CROSS_COMPILE=$CROSS_COMPILE"
 
 cat << EOF
 # Automatically generated by $0: don't edit
@@ -22,10 +24,10 @@
 MAKEFLAGS += --no-print-directory
 
 all:
-	\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT)
+	\$(MAKE) $ARCH $CROSS -C \$(KERNELSRC) O=\$(KERNELOUTPUT)
 
 %::
-	\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@
+	\$(MAKE) $ARCH $CROSS -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@
 
 EOF
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-02-07 22:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-07 22:31 [PATCH] out-of-tree builds: preserve ARCH and CROSS_COMPILE settings Ralph Siemsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox