lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20070214112737.GA25412@flower.upol.cz>
Date:	Wed, 14 Feb 2007 12:27:37 +0100
From:	Oleg Verych <olecom@...wer.upol.cz>
To:	Sam Ravnborg <sam@...nborg.org>
Cc:	Randy Dunlap <randy.dunlap@...cle.com>,
	lkml <linux-kernel@...r.kernel.org>, zippel@...ux-m68k.org
Subject: [pp] kbuild: ARCH-setup (Re: kbuild feature/question: default ARCH)

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@...wer:/mnt/work/app-src-build/kernel.org/linux-2.6.20$
|olecom@...wer:/mnt/work/app-src-build/kernel.org/linux-2.6.20$ rm -rf /tmp/linuz
|olecom@...wer:/mnt/work/app-src-build/kernel.org/linux-2.6.20$ mkdir /tmp/linuz
|olecom@...wer:/mnt/work/app-src-build/kernel.org/linux-2.6.20$ make ARCH=i386 O=/tmp/linu
|linux-2.6.20/ linuz/
|olecom@...wer:/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@...wer:/mnt/work/app-src-build/kernel.org/linux-2.6.20$ cd /tmp/linuz
|olecom@...wer:/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@...wer:/tmp/linuz$ arch
|x86_64
|olecom@...wer:/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 majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ