[pp] kbuild: ARCH-setup (Re: kbuild feature/question: default ARCH)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hallo.

On Wed, Feb 14, 2007 at 10:11:44AM +0100, Sam Ravnborg wrote:
> On Tue, Feb 13, 2007 at 10:06:19PM -0800, Randy Dunlap wrote:
> > Hi,
> > 
> > I'd like for kbuild to default ARCH to the already-symlinked
> > arch in include/asm-$(ARCH) if ARCH is not specified on the
> > command line or in the environment.
> Another approach I have been toying with previously was to
> include ARCH in .config. But I somehow failed
> to get it working and it went on my TODO list.

Sam, IMHO this is one inconvenience of the many, due to absence of
conf-build, build mechanism (you have my message about just for fun
thoughts ;).

> If kconfig get extended to so it can include Kconfig
> files for all archs then it could be a Kconfig
> option like anything else to select architecture
> and this would also solve your issue.
> 
> As for the "export ARCH=i386" proposal this is of no
> use for people crosscompiling a lot.
> Think of the 'Al Viro' setup with crosscompile for 5+
> different architectures.

While trying to do something with lguest and "private" asm-offsets on
AMD64, i must use ARCH=i386 for testing stuff. Thus, i give you my patch
proposition (proposed patch, whatever) that remembers ARCH in Makefile
in $(objtree). Once you have setup, you may use just 
`make target' there.

Randy, maybe this is *something* to have, than nothing. Testing is
appreciated.

,-*- shell -*-
|olecom@flower:/mnt/work/app-src-build/kernel.org/linux-2.6.20$
|olecom@flower:/mnt/work/app-src-build/kernel.org/linux-2.6.20$ rm -rf /tmp/linuz
|olecom@flower:/mnt/work/app-src-build/kernel.org/linux-2.6.20$ mkdir /tmp/linuz
|olecom@flower:/mnt/work/app-src-build/kernel.org/linux-2.6.20$ make ARCH=i386 O=/tmp/linu
|linux-2.6.20/ linuz/
|olecom@flower:/mnt/work/app-src-build/kernel.org/linux-2.6.20$ make ARCH=i386 O=/tmp/linuz/ defconfig > /dev/null
|/mnt/work/app-src-build/kernel.org/linux-2.6.20/arch/i386/defconfig:1122:warning:
|trying to assign nonexistent symbol USB_MULTITHREAD_PROBE
|olecom@flower:/mnt/work/app-src-build/kernel.org/linux-2.6.20$ cd /tmp/linuz
|olecom@flower:/tmp/linuz$ make prepare
|make -C /mnt/work/app-src-build/kernel.org/linux-2.6.20 O=/dev/shm/linuz prepare
|scripts/kconfig/conf -s arch/i386/Kconfig
|  Using /mnt/work/app-src-build/kernel.org/linux-2.6.20 as source for kernel
|  CHK     include/linux/version.h
|  UPD     include/linux/version.h
|  CHK     include/linux/utsrelease.h
|  UPD     include/linux/utsrelease.h
|  SYMLINK include/asm -> include/asm-i386
|  CC      arch/i386/kernel/asm-offsets.s
|  GEN     include/asm-i386/asm-offsets.h
|olecom@flower:/tmp/linuz$ arch
|x86_64
|olecom@flower:/tmp/linuz$
`-*-

Thanks.

---
 Changes for mkmakefile:
 * bugfix: _really_ generate Makefile once '!'
 * use shell paramenter expansion only where needed, thus Makefile's body
   is a little bit easy to read and write.

 Makefile           |    2 +-
 scripts/mkmakefile |   26 ++++++++++++++++----------
 2 files changed, 17 insertions(+), 11 deletions(-)

Index: linux-2.6.20/scripts/mkmakefile
===================================================================
--- linux-2.6.20.orig/scripts/mkmakefile	2007-02-14 11:53:43.972144500 +0100
+++ linux-2.6.20/scripts/mkmakefile	2007-02-14 11:55:34.879075750 +0100
@@ -9,12 +9,13 @@
 # $3 - version
 # $4 - patchlevel
+# $5 - ARCH
 
-
-test ! -r $2/Makefile -o -O $2/Makefile || exit 0
+test ! -r $2/Makefile -o ! -O $2/Makefile || exit 0
 echo "  GEN     $2/Makefile"
 
-cat << EOF > $2/Makefile
-# Automatically generated by $0: don't edit
-
+echo "#
+# Automatically generated by
+# $0
+#
 VERSION = $3
 PATCHLEVEL = $4
@@ -22,15 +23,20 @@ PATCHLEVEL = $4
 KERNELSRC    := $1
 KERNELOUTPUT := $2
+ARCH         := $5
+" > $2/Makefile
+
+cat << "EOF" >> $2/Makefile
+MAKEFLAGS    += -rR --no-print-directory
 
-MAKEFLAGS += --no-print-directory
+export ARCH
 
-.PHONY: all \$(MAKECMDGOALS)
+.PHONY: all $(MAKECMDGOALS)
 
 all:
-	\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT)
+	$(MAKE) -C $(KERNELSRC) O=$(KERNELOUTPUT)
 
 Makefile:;
 
-\$(filter-out all Makefile,\$(MAKECMDGOALS)) %/:
-	\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@
+$(filter-out all Makefile,$(MAKECMDGOALS)) %/:
+	$(MAKE) -C $(KERNELSRC) O=$(KERNELOUTPUT) $@
 EOF
Index: linux-2.6.20/Makefile
===================================================================
--- linux-2.6.20.orig/Makefile	2007-02-14 11:55:50.068025000 +0100
+++ linux-2.6.20/Makefile	2007-02-14 11:56:56.756192750 +0100
@@ -358,5 +358,5 @@ outputmakefile:
 ifneq ($(KBUILD_SRC),)
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
-	    $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
+	    $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) $(ARCH)
 endif
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux