lkml.org 
[lkml]   [2005]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] out-of-tree builds: preserve ARCH and CROSS_COMPILE settings
[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>
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
\
 
 \ /
  Last update: 2005-03-22 14:10    [W:0.037 / U:0.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site