linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] preserve ARCH and CROSS_COMPILE in the build directory generated Makefile
@ 2005-04-29 11:35 Pavel Pisa
  2005-04-29 21:00 ` Sam Ravnborg
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Pisa @ 2005-04-29 11:35 UTC (permalink / raw)
  To: Linux Kernel Mailing List, kai, sam

This patch ensures, that architecture and target cross-tools prefix
is preserved in the Makefile generated in the build directory for
out of source tree kernel compilation. This prevents accidental
screwing of configuration and builds for the case, that make without
full architecture specific options is invoked in the build
directory. It is secure use accustomed "make", "make xconfig",
etc. without fear and special care now.

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>

Index: linux-2.6.11.5/scripts/mkmakefile
===================================================================
--- linux-2.6.11.5.orig/scripts/mkmakefile
+++ linux-2.6.11.5/scripts/mkmakefile
@@ -29,3 +29,9 @@ all:
 
 EOF
 
+if [ -n "${ARCH}" ] ; then
+	echo "ARCH ?= ${ARCH}"
+fi
+if [ -n "${CROSS_COMPILE}" ] ; then
+	echo "CROSS_COMPILE ?= ${CROSS_COMPILE}"
+fi


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] preserve ARCH and CROSS_COMPILE in the build directory generated Makefile
  2005-04-29 11:35 [PATCH] preserve ARCH and CROSS_COMPILE in the build directory generated Makefile Pavel Pisa
@ 2005-04-29 21:00 ` Sam Ravnborg
  2005-04-29 21:42   ` Russell King
  2005-04-29 22:26   ` Daniel Jacobowitz
  0 siblings, 2 replies; 5+ messages in thread
From: Sam Ravnborg @ 2005-04-29 21:00 UTC (permalink / raw)
  To: Pavel Pisa; +Cc: Linux Kernel Mailing List, kai

On Fri, Apr 29, 2005 at 01:35:33PM +0200, Pavel Pisa wrote:
> This patch ensures, that architecture and target cross-tools prefix
> is preserved in the Makefile generated in the build directory for
> out of source tree kernel compilation. This prevents accidental
> screwing of configuration and builds for the case, that make without
> full architecture specific options is invoked in the build
> directory. It is secure use accustomed "make", "make xconfig",
> etc. without fear and special care now.

Hi Pavel.
I will not apply this path because it introduce a difference when
building usign a separate output direcory compared to an in-tree build.

I have briefly looked into a solution where I could add this information
in .config but was sidetracked by other stuff so I newer got it working.

The build system for the kernel needs to be as predictable as possible
and introducing functionality that is only valid when using a separate
output directory does not help here.

	Sam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] preserve ARCH and CROSS_COMPILE in the build directory generated Makefile
  2005-04-29 21:00 ` Sam Ravnborg
@ 2005-04-29 21:42   ` Russell King
  2005-04-29 22:32     ` Pavel Pisa
  2005-04-29 22:26   ` Daniel Jacobowitz
  1 sibling, 1 reply; 5+ messages in thread
From: Russell King @ 2005-04-29 21:42 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Pavel Pisa, Linux Kernel Mailing List, kai

On Fri, Apr 29, 2005 at 11:00:53PM +0200, Sam Ravnborg wrote:
> On Fri, Apr 29, 2005 at 01:35:33PM +0200, Pavel Pisa wrote:
> > This patch ensures, that architecture and target cross-tools prefix
> > is preserved in the Makefile generated in the build directory for
> > out of source tree kernel compilation. This prevents accidental
> > screwing of configuration and builds for the case, that make without
> > full architecture specific options is invoked in the build
> > directory. It is secure use accustomed "make", "make xconfig",
> > etc. without fear and special care now.
> 
> Hi Pavel.
> I will not apply this path because it introduce a difference when
> building usign a separate output direcory compared to an in-tree build.
> 
> I have briefly looked into a solution where I could add this information
> in .config but was sidetracked by other stuff so I newer got it working.
> 
> The build system for the kernel needs to be as predictable as possible
> and introducing functionality that is only valid when using a separate
> output directory does not help here.

Without it, folk will then do (and this is taken from someone elses
example):

  cd /usr/src
  tar -xjf /path/to/linux-2.6.x.tar.bz
  cd linux-2.6.x
  mkdir -p _build/arm
  cd _build/arm
  cat >GNUmakefile <<EOF
VERSION = 2
PATCHLEVEL = 6
                                                                                
KERNELSRC    := /usr/src/linux-2.6.x
KERNELOUTPUT := /usr/src/linux-2.6.x/_build/arm
                                                                                
MAKEFLAGS += --no-print-directory
                                                                                
ARCH            = arm
#CROSS_COMPILE  = arm-unknown-linux-gnu-
CROSS_COMPILE   = arm-linux-
                                                                                
all:
        $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNELSRC) O=$(KERNELOUTPUT)
                                                                                
%::
        $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNELSRC) O=$(KERNELOUTPUT) $@
EOF
  make xconfig
  make

which I think you'll agree is far worse.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] preserve ARCH and CROSS_COMPILE in the build directory generated Makefile
  2005-04-29 21:00 ` Sam Ravnborg
  2005-04-29 21:42   ` Russell King
@ 2005-04-29 22:26   ` Daniel Jacobowitz
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2005-04-29 22:26 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Pavel Pisa, Linux Kernel Mailing List, kai

On Fri, Apr 29, 2005 at 11:00:53PM +0200, Sam Ravnborg wrote:
> On Fri, Apr 29, 2005 at 01:35:33PM +0200, Pavel Pisa wrote:
> > This patch ensures, that architecture and target cross-tools prefix
> > is preserved in the Makefile generated in the build directory for
> > out of source tree kernel compilation. This prevents accidental
> > screwing of configuration and builds for the case, that make without
> > full architecture specific options is invoked in the build
> > directory. It is secure use accustomed "make", "make xconfig",
> > etc. without fear and special care now.
> 
> Hi Pavel.
> I will not apply this path because it introduce a difference when
> building usign a separate output direcory compared to an in-tree build.
> 
> I have briefly looked into a solution where I could add this information
> in .config but was sidetracked by other stuff so I newer got it working.
> 
> The build system for the kernel needs to be as predictable as possible
> and introducing functionality that is only valid when using a separate
> output directory does not help here.

You could drop it into a file unrelated to .config or Makefile; that
might be simpler.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] preserve ARCH and CROSS_COMPILE in the build directory generated Makefile
  2005-04-29 21:42   ` Russell King
@ 2005-04-29 22:32     ` Pavel Pisa
  0 siblings, 0 replies; 5+ messages in thread
From: Pavel Pisa @ 2005-04-29 22:32 UTC (permalink / raw)
  To: Russell King, Sam Ravnborg; +Cc: Linux Kernel Mailing List

On Friday 29 April 2005 23:42, Russell King wrote:
> On Fri, Apr 29, 2005 at 11:00:53PM +0200, Sam Ravnborg wrote:
> > On Fri, Apr 29, 2005 at 01:35:33PM +0200, Pavel Pisa wrote:
> > > This patch ensures, that architecture and target cross-tools prefix
> > > is preserved in the Makefile generated in the build directory for
> > > out of source tree kernel compilation. This prevents accidental
> > > screwing of configuration and builds for the case, that make without
> > > full architecture specific options is invoked in the build
> > > directory. It is secure use accustomed "make", "make xconfig",
> > > etc. without fear and special care now.
> >
> > Hi Pavel.
> > I will not apply this path because it introduce a difference when
> > building usign a separate output direcory compared to an in-tree build.
> >
> > I have briefly looked into a solution where I could add this information
> > in .config but was sidetracked by other stuff so I newer got it working.
> >
> > The build system for the kernel needs to be as predictable as possible
> > and introducing functionality that is only valid when using a separate
> > output directory does not help here.

> Without it, folk will then do (and this is taken from someone elses
> example):

> which I think you'll agree is far worse.

Hello Sam and Russell,

thanks, Russell, for defending me through pointing me
as an bad example :-) .

Excuse me for that outcome of my two neurons scratch,
but I have decided to send my ideas for discussion
and possibly to help others. The decision,
what is good thing to do now and what should
be left in air for future better decisions
is on you. Thanks for energy put into reading
and thinking about my ideas.

I provide another idea, which is not dependant
on out of source tree build

ifeq ("$(origin ARCH)", "command line")
prepare1: archpreserve

archpreserve:
	echo "ARCH ?= $(ARCH)" >$(objtree)/.archconfig
	echo "CROSS_COMPILE ?= $(CROSS_COMPILE)" >>$(objtree)/.archconfig
else
-include $(objtree)/.archconfig
endif

With wish of sunny weekend 

                Pavel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-04-29 22:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-29 11:35 [PATCH] preserve ARCH and CROSS_COMPILE in the build directory generated Makefile Pavel Pisa
2005-04-29 21:00 ` Sam Ravnborg
2005-04-29 21:42   ` Russell King
2005-04-29 22:32     ` Pavel Pisa
2005-04-29 22:26   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).