All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Subject: [PATCH 09/11] x86: enable "make ARCH=x86"
Date: Sat, 10 Nov 2007 00:20:43 +0100	[thread overview]
Message-ID: <1194650446684-git-send-email-sam@ravnborg.org> (raw)
In-Reply-To: <20071109230812.GA5176@uranus.ravnborg.org>

After unification of the Kconfig files it required
only trivial changes to enable "make ARCH=x86".
This patch unteach kconfig about SRCARCH and
let kbuild compute x86 for `uname -m` equals x86_64
and the i.86 variants.

The selection of 32 versus 64 bit is now done as a
configuration step like we select SMP, PREMPT etc.

Two drawbacks of this patch:
1) People are used to select 32 versus 64 using ARCH={i386,x86_64}
2) we lost the possibility to generate a true allmodconfig
   for a 64 bit x86 kernel with a simple command.

The workaround is to do:
$ cat myconfig
CONFIG_X86_32=n
CONFIG_X86_64=y
$ make allmodconfig KCONFIG_ALLCONFIG=myconfig

Lot's of scripts will break because they assume
i386 or x86_64 but with this patch we take the logical
step and name the architecture x86 as one would really expect.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile                    |    6 ++----
 arch/x86/Kconfig            |   21 +++++++++++++++++++++
 arch/x86/Kconfig.i386       |   18 ------------------
 arch/x86/Kconfig.x86_64     |   20 --------------------
 arch/x86/Makefile           |    6 +++---
 arch/x86/boot/Makefile      |    6 +++---
 arch/x86/kernel/Makefile_32 |    3 ++-
 arch/x86/kernel/Makefile_64 |    2 ++
 arch/x86/vdso/Makefile      |    2 +-
 scripts/kconfig/Makefile    |    7 +------
 10 files changed, 35 insertions(+), 56 deletions(-)
 delete mode 100644 arch/x86/Kconfig.i386
 delete mode 100644 arch/x86/Kconfig.x86_64

diff --git a/Makefile b/Makefile
index e28dde8..afeeef8 100644
--- a/Makefile
+++ b/Makefile
@@ -165,7 +165,8 @@ export srctree objtree VPATH TOPDIR
 # then ARCH is assigned, getting whatever value it gets normally, and 
 # SUBARCH is subsequently ignored.
 
-SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/        \
+				  -e s/sun4u/sparc64/                    \
 				  -e s/arm.*/arm/ -e s/sa110/arm/ \
 				  -e s/s390x/s390/ -e s/parisc64/parisc/ \
 				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
@@ -197,9 +198,6 @@ CROSS_COMPILE	?=
 UTS_MACHINE 	:= $(ARCH)
 SRCARCH 	:= $(ARCH)
 
-# for i386 and x86_64 we use SRCARCH equal to x86
-SRCARCH := $(if $(filter x86_64 i386,$(SRCARCH)),x86,$(SRCARCH))
-
 KCONFIG_CONFIG	?= .config
 
 # SHELL used by kbuild
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 34517bf..153c26c 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1,5 +1,26 @@
 # x86 configuration
 
+# Select 32 or 64 bit
+choice
+	bool "Select 32 or 64 bit"
+	default X86_32
+
+config X86_32
+	bool "32 bit (former ARCH=i386)"
+	help
+	  This is Linux's home port.  Linux was originally native to the Intel
+	  386, and runs on all the later x86 processors including the Intel
+	  486, 586, Pentiums, and various instruction-set-compatible chips by
+	  AMD, Cyrix, and others.
+
+config X86_64
+	bool "64 bit (former ARCH=x86_64)"
+	help
+	  Port to the x86-64 architecture. x86-64 is a 64-bit extension to the
+	  classical 32-bit x86 architecture. For details see
+	  <http://www.x86-64.org/>.
+endchoice
+
 ### Arch settings
 config X86
 	bool
diff --git a/arch/x86/Kconfig.i386 b/arch/x86/Kconfig.i386
deleted file mode 100644
index 7b8dc26..0000000
--- a/arch/x86/Kconfig.i386
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
-#
-
-mainmenu "Linux Kernel Configuration"
-
-config X86_32
-	bool
-	default y
-	help
-	  This is Linux's home port.  Linux was originally native to the Intel
-	  386, and runs on all the later x86 processors including the Intel
-	  486, 586, Pentiums, and various instruction-set-compatible chips by
-	  AMD, Cyrix, and others.
-
-
-source "arch/x86/Kconfig"
diff --git a/arch/x86/Kconfig.x86_64 b/arch/x86/Kconfig.x86_64
deleted file mode 100644
index b262aae..0000000
--- a/arch/x86/Kconfig.x86_64
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
-#
-# Note: ISA is disabled and will hopefully never be enabled.
-# If you managed to buy an ISA x86-64 box you'll have to fix all the
-# ISA drivers you need yourself.
-#
-
-mainmenu "Linux Kernel Configuration"
-
-config X86_64
-	bool
-	default y
-	help
-	  Port to the x86-64 architecture. x86-64 is a 64-bit extension to the
-	  classical 32-bit x86 architecture. For details see
-	  <http://www.x86-64.org/>.
-
-source "arch/x86/Kconfig"
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 3095973..ee94224 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -1,12 +1,12 @@
 # Unified Makefile for i386 and x86_64
 
-# select defconfig based on actual architecture
-KBUILD_DEFCONFIG := $(ARCH)_defconfig
+# select i386 defconfig file as default config
+KBUILD_DEFCONFIG := i386_defconfig
 
 # # No need to remake these files
 $(srctree)/arch/x86/Makefile%: ;
 
-ifeq ($(ARCH),i386)
+ifeq ($(CONFIG_X86_32),y)
         include $(srctree)/arch/x86/Makefile_32
 else
         include $(srctree)/arch/x86/Makefile_64
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 89dbf97..7a3116c 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -49,10 +49,10 @@ HOSTCFLAGS_build.o := $(LINUXINCLUDE)
 
 # How to compile the 16-bit code.  Note we always compile for -march=i386,
 # that way we can complain to the user if the CPU is insufficient.
-cflags-i386   := 
-cflags-x86_64 := -m32
+cflags-$(CONFIG_X86_32) :=
+cflags-$(CONFIG_X86_64) := -m32
 KBUILD_CFLAGS	:= $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
-		   $(cflags-$(ARCH)) \
+		   $(cflags-y) \
 		   -Wall -Wstrict-prototypes \
 		   -march=i386 -mregparm=3 \
 		   -include $(srctree)/$(src)/code16gcc.h \
diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index b9d6798..a7bc93c 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -3,6 +3,7 @@
 #
 
 extra-y := head_32.o init_task.o vmlinux.lds
+CPPFLAGS_vmlinux.lds += -Ui386
 
 obj-y	:= process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \
 		ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \
@@ -60,7 +61,7 @@ quiet_cmd_syscall = SYSCALL $@
       cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \
 		          -Wl,-T,$(filter-out FORCE,$^) -o $@
 
-export CPPFLAGS_vsyscall_32.lds += -P -C -U$(ARCH)
+export CPPFLAGS_vsyscall_32.lds += -P -C -Ui386
 
 vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
 		 $(call ld-option, -Wl$(comma)--hash-style=sysv)
diff --git a/arch/x86/kernel/Makefile_64 b/arch/x86/kernel/Makefile_64
index 24671c3..5a88890 100644
--- a/arch/x86/kernel/Makefile_64
+++ b/arch/x86/kernel/Makefile_64
@@ -3,7 +3,9 @@
 #
 
 extra-y 	:= head_64.o head64.o init_task.o vmlinux.lds
+CPPFLAGS_vmlinux.lds += -Ux86_64
 EXTRA_AFLAGS	:= -traditional
+
 obj-y	:= process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \
 		ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \
 		x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 7a2ba45..e7bff0f 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -20,7 +20,7 @@ quiet_cmd_syscall = SYSCALL $@
       cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \
 		          -Wl,-T,$(filter-out FORCE,$^) -o $@
 
-export CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
+export CPPFLAGS_vdso.lds += -P -C
 
 vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \
 		 $(call ld-option, -Wl$(comma)--hash-style=sysv) \
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 5959412..3c9db07 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -4,12 +4,7 @@
 
 PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
 
-# If a arch/$(SRCARCH)/Kconfig.$(ARCH) file exist use it
-ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/Kconfig.$(ARCH)),)
-        Kconfig := arch/$(SRCARCH)/Kconfig.$(ARCH)
-else
-        Kconfig := arch/$(SRCARCH)/Kconfig
-endif
+Kconfig := arch/$(ARCH)/Kconfig
 
 xconfig: $(obj)/qconf
 	$< $(Kconfig)
-- 
1.5.3.4.1157.g0e74-dirty


  parent reply	other threads:[~2007-11-09 23:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-09 23:08 [PATCH 0/11 v3] enable "make ARCH=x86" Sam Ravnborg
2007-11-09 23:20 ` [PATCH 01/11] x86: unification of cfufreq/Kconfig Sam Ravnborg
2007-11-09 23:20 ` [PATCH 02/11] x86: start unification of arch/x86/Kconfig.* Sam Ravnborg
2007-11-09 23:20 ` [PATCH 03/11] x86: arch/x86/Kconfig.cpu unification Sam Ravnborg
2007-11-09 23:20 ` [PATCH 04/11] x86: add X86_32 dependency to i386 specific symbols in Kconfig.i386 Sam Ravnborg
2007-11-09 23:20 ` [PATCH 05/11] x86: add X86_64 dependency to x86_64 specific symbols in Kconfig.x86_64 Sam Ravnborg
2007-11-09 23:20 ` [PATCH 06/11] x86: copy x86_64 specific Kconfig symbols to Kconfig.i386 Sam Ravnborg
2007-11-09 23:20 ` [PATCH 07/11] x86: move all simple arch settings to Kconfig Sam Ravnborg
2007-11-09 23:20 ` [PATCH 08/11] x86: move the rest of the menu's " Sam Ravnborg
2007-11-09 23:20 ` Sam Ravnborg [this message]
2007-11-09 23:20 ` [PATCH 10/11] x86: drop backward compatibility symlinks to i386/boot and x86_64/boot Sam Ravnborg
2007-11-09 23:20 ` [PATCH 11/11] kbuild: sanity check the specified arch Sam Ravnborg
2007-11-10  3:23 ` [PATCH 0/11 v3] enable "make ARCH=x86" Jeff Garzik
2007-11-10  3:37   ` Randy Dunlap
2007-11-10  3:50   ` Adrian Bunk
2007-11-10  4:05   ` Brian Gerst
2007-11-10  4:12     ` Jeff Garzik
2007-11-14 20:13       ` Roman Zippel
2007-11-10  7:54   ` Sam Ravnborg
2007-11-10  5:26     ` Nick Piggin
2007-11-10  8:21     ` Paul Mundt
2007-11-10  8:24       ` Jeff Garzik
2007-11-10  8:44         ` Paul Mundt
2007-11-10 20:35           ` H. Peter Anvin
2007-11-10 20:46             ` Sam Ravnborg
2007-11-10 21:24             ` Theodore Tso
2007-11-10  9:39         ` Sam Ravnborg
2007-11-10 10:32           ` david
2007-11-10  9:21       ` Adrian Bunk
2007-11-10  9:26         ` Paul Mundt
2007-11-10  8:23     ` Jeff Garzik
2007-11-10 10:13       ` Adrian Bunk
2007-11-10 15:53 ` Christoph Hellwig
2007-11-12 11:59 ` Frans Pop

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=1194650446684-git-send-email-sam@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.