From: Oleg Verych <olecom@flower.upol.cz>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Randy Dunlap <randy.dunlap@oracle.com>,
lkml <linux-kernel@vger.kernel.org>,
zippel@linux-m68k.org
Subject: [pp] kbuild: ARCH-setup (Re: kbuild feature/question: default ARCH)
Date: Wed, 14 Feb 2007 12:27:37 +0100 [thread overview]
Message-ID: <20070214112737.GA25412@flower.upol.cz> (raw)
In-Reply-To: <20070214091144.GA25846@uranus.ravnborg.org>
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
prev parent reply other threads:[~2007-02-14 11:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-14 6:06 kbuild feature/question: default ARCH Randy Dunlap
2007-02-14 6:23 ` Randy Dunlap
2007-02-14 9:11 ` Sam Ravnborg
2007-02-14 11:27 ` Oleg Verych [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070214112737.GA25412@flower.upol.cz \
--to=olecom@flower.upol.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=randy.dunlap@oracle.com \
--cc=sam@ravnborg.org \
--cc=zippel@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).