From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261287AbVBGWcP (ORCPT ); Mon, 7 Feb 2005 17:32:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261286AbVBGWcO (ORCPT ); Mon, 7 Feb 2005 17:32:14 -0500 Received: from pentafluge.infradead.org ([213.146.154.40]:21443 "EHLO pentafluge.infradead.org") by vger.kernel.org with ESMTP id S261287AbVBGWbz (ORCPT ); Mon, 7 Feb 2005 17:31:55 -0500 Message-ID: <4207EC54.8010301@netwinder.org> Date: Mon, 07 Feb 2005 17:31:48 -0500 From: Ralph Siemsen User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 X-Accept-Language: en-us, en MIME-Version: 1.0 To: trivial@rustcorp.com.au, linux-kernel@vger.kernel.org Subject: [PATCH] out-of-tree builds: preserve ARCH and CROSS_COMPILE settings Content-Type: multipart/mixed; boundary="------------080504060904080000020605" X-Spam-Score: 0.0 (/) X-SRS-Rewrite: SMTP reverse-path rewritten from by pentafluge.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------080504060904080000020605 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit [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 --------------080504060904080000020605 Content-Type: text/x-patch; name="mkmakefile.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mkmakefile.patch" 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 --------------080504060904080000020605--