summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2014-04-30 01:07:06 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2014-04-30 01:08:53 +0200
commit96b68fb7047d2d355a6d3cc8409a0f1db95acec9 (patch)
tree8842fd79d60699a37fdeddd34ce4b3b690b87d4d
parent81d7f759d5c9bff2cfedfe121dbdff2f7842dcc2 (diff)
fix 32 bit userland with 64 bit kernel support
after onger discussion with Phil, I understood his old patches and fixed support for x86 systems with 32 Bit userland and 64 Bit kernel by using a biarch toolchain instead of a multilib one.
-rw-r--r--package/genext2fs/Makefile2
-rw-r--r--target/config/Config.in2
-rw-r--r--target/x86/Makefile18
-rw-r--r--target/x86/kernel/qemu-x86_6420
-rw-r--r--target/x86/sys-available/qemu-x86_64-3211
-rw-r--r--target/x86_64/sys-available/toolchain-x86_64_3212
-rw-r--r--toolchain/binutils/Makefile6
-rw-r--r--toolchain/gcc/Makefile13
-rw-r--r--toolchain/gcc/patches/4.8.2/abi32.patch54
9 files changed, 58 insertions, 80 deletions
diff --git a/package/genext2fs/Makefile b/package/genext2fs/Makefile
index 4e8fea5bd..cf88ab095 100644
--- a/package/genext2fs/Makefile
+++ b/package/genext2fs/Makefile
@@ -11,6 +11,8 @@ PKG_DESCR:= genext2fs utility
PKG_SECTION:= fs
PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=genext2fs/}
+DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
+
PKG_CFLINE_GENEXT2FS:= depends on ADK_HOST_ONLY
include $(TOPDIR)/mk/host.mk
diff --git a/target/config/Config.in b/target/config/Config.in
index 3d613bb1e..b1725b876 100644
--- a/target/config/Config.in
+++ b/target/config/Config.in
@@ -242,7 +242,7 @@ config ADK_TARGET_CUBOX_I1
endchoice
# global symbols
-config ADK_TARGET_KERNEL_MAY_64BIT
+config ADK_TARGET_KERNEL_64
boolean
config ADK_TOOLCHAIN_ONLY
diff --git a/target/x86/Makefile b/target/x86/Makefile
index 736f1c359..89e59095a 100644
--- a/target/x86/Makefile
+++ b/target/x86/Makefile
@@ -8,6 +8,16 @@ include $(TOPDIR)/mk/kernel-build.mk
include $(TOPDIR)/mk/image.mk
KERNEL:=$(LINUX_DIR)/arch/x86/boot/bzImage
+
+QEMU_ARGS:=-M pc
+QEMU_ARGS+=${ADK_QEMU_ARGS}
+
+ifeq ($(ADK_TARGET_SYSTEM_QEMU_X86_64_32),y)
+QEMU_ARCH:=x86_84
+else
+QEMU_ARCH:=i386
+endif
+
ifeq ($(ADK_TARGET_QEMU_WITH_BOOTLOADER),y)
ifeq ($(ADK_TARGET_QEMU_WITHOUT_GRAPHIC),y)
CREATE:=./scripts/create.sh -g -t
@@ -43,9 +53,9 @@ ifeq ($(ADK_HARDWARE_QEMU),y)
@echo "$(CREATE) qemu-${CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
@echo "Start qemu with following command line:"
ifeq ($(ADK_TARGET_QEMU_WITH_BOOTLOADER),y)
- @echo 'qemu-system-i386 ${ADK_QEMU_ARGS} -net user -net nic,model=e1000 qemu-${CPU_ARCH}.img'
+ @echo 'qemu-system-${QEMU_ARCH} ${QEMU_ARGS} -net user -net nic,model=e1000 qemu-${CPU_ARCH}.img'
else
- @echo 'qemu-system-i386 ${ADK_QEMU_ARGS} -net user -net nic,model=e1000 -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${CPU_ARCH}.img'
+ @echo 'qemu-system-${QEMU_ARCH} ${QEMU_ARGS} -net user -net nic,model=e1000 -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${CPU_ARCH}.img'
endif
endif
ifeq ($(ADK_HARDWARE_VBOX),y)
@@ -72,7 +82,7 @@ imageinstall: $(FW_DIR)/$(INITRAMFS)
@echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
ifeq ($(ADK_HARDWARE_QEMU),y)
@echo "Start qemu with following command line:"
- @echo 'qemu-system-i386 ${ADK_QEMU_ARGS} -net user -net nic,model=e1000 -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
+ @echo 'qemu-system-${QEMU_ARCH} ${QEMU_ARGS} -net user -net nic,model=e1000 -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
endif
endif
ifeq ($(ADK_TARGET_FS),initramfs-piggyback)
@@ -81,7 +91,7 @@ imageinstall: createinitramfs
@echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
ifeq ($(ADK_HARDWARE_QEMU),y)
@echo "Start qemu with following command line:"
- @echo 'qemu-system-i386 ${ADK_QEMU_ARGS} -net user -net nic,model=e1000 -kernel $(FW_DIR)/$(TARGET_KERNEL)'
+ @echo 'qemu-system-${QEMU_ARCH} ${QEMU_ARGS} -net user -net nic,model=e1000 -kernel $(FW_DIR)/$(TARGET_KERNEL)'
endif
endif
ifeq (${ADK_TARGET_FS},iso)
diff --git a/target/x86/kernel/qemu-x86_64 b/target/x86/kernel/qemu-x86_64
new file mode 100644
index 000000000..7bf96c74c
--- /dev/null
+++ b/target/x86/kernel/qemu-x86_64
@@ -0,0 +1,20 @@
+CONFIG_X86=y
+CONFIG_64BIT=y
+CONFIG_X86_64=y
+CONFIG_GENERIC_CPU=y
+CONFIG_PROCESSOR_SELECT=y
+CONFIG_CPU_SUP_INTEL=y
+CONFIG_CPU_SUP_AMD=y
+CONFIG_X86_LOCAL_APIC=y
+CONFIG_X86_IO_APIC=y
+CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
+CONFIG_MTRR=y
+CONFIG_X86_PAT=y
+CONFIG_ISA_DMA_API=y
+CONFIG_AMD_NB=y
+CONFIG_IA32_EMULATION=y
+CONFIG_NET_VENDOR_INTEL=y
+CONFIG_E1000=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_PNP=y
+CONFIG_SERIAL_8250_CONSOLE=y
diff --git a/target/x86/sys-available/qemu-x86_64-32 b/target/x86/sys-available/qemu-x86_64-32
new file mode 100644
index 000000000..f96e6ea35
--- /dev/null
+++ b/target/x86/sys-available/qemu-x86_64-32
@@ -0,0 +1,11 @@
+config ADK_TARGET_SYSTEM_QEMU_X86_64_32
+ bool "Qemu Emulator (x86_64) with 32Bit userland"
+ select ADK_x86
+ select ADK_qemu_x86_64_32
+ select ADK_CPU_I686
+ select ADK_HARDWARE_QEMU
+ select ADK_TARGET_KERNEL_BZIMAGE
+ select ADK_TARGET_KERNEL_64
+ help
+ Support for Qemu Emulator (x86_64) with 32 Bit userland.
+
diff --git a/target/x86_64/sys-available/toolchain-x86_64_32 b/target/x86_64/sys-available/toolchain-x86_64_32
deleted file mode 100644
index 9e8297ea4..000000000
--- a/target/x86_64/sys-available/toolchain-x86_64_32
+++ /dev/null
@@ -1,12 +0,0 @@
-config ADK_TARGET_SYSTEM_TOOLCHAIN_X86_64_32
- bool "Toolchain only (32 ABI)"
- select ADK_x86_64
- select ADK_32
- select ADK_toolchain_x86_64
- select ADK_CPU_X86_64
- select ADK_LINUX_64
- select ADK_TOOLCHAIN
- select ADK_TARGET_PACKAGE_TXZ
- help
- Build a x86_64 toolchain.
-
diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile
index 8947ee77e..0a41fc9f3 100644
--- a/toolchain/binutils/Makefile
+++ b/toolchain/binutils/Makefile
@@ -24,11 +24,7 @@ else
CONFOPTS+= --disable-gold
endif
-ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
-CONFOPTS+= --with-arch=armv6
-endif
-
-ifneq ($(ADK_LINUX_64),)
+ifneq ($(ADK_LINUX_64)$(ADK_TARGET_KERNEL_64),)
CONFOPTS+= --enable-64-bit-bfd
endif
diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile
index 63d0237c3..12ad4ebca 100644
--- a/toolchain/gcc/Makefile
+++ b/toolchain/gcc/Makefile
@@ -35,7 +35,7 @@ GCC_CONFOPTS:= --prefix=$(TOOLCHAIN_DIR)/usr \
--disable-nls
GCC_FINAL_CONFOPTS:=
-ifeq ($(ADK_LINUX_SH)$(ADK_LINUX_X86_64),)
+ifeq ($(ADK_LINUX_SH)$(ADK_LINUX_X86_64)$(ADK_LINUX_X86),)
GCC_FINAL_CONFOPTS+= --disable-biarch --disable-multilib
endif
@@ -48,13 +48,18 @@ endif
GCC_FINAL_CONFOPTS+= --enable-multilib --with-multilib-list=m4,m4-nofpu
endif
+ifeq ($(ADK_LINUX_X86),y)
+ifeq ($(ADK_TARGET_KERNEL_64),y)
+GCC_FINAL_CONFOPTS+= --enable-biarch --enable-targets=all --disable-multilib
+else
+GCC_FINAL_CONFOPTS+= --disable-biarch --disable-multilib
+endif
+endif
+
ifeq ($(ADK_LINUX_X86_64),y)
ifeq ($(ADK_x32),y)
GCC_FINAL_CONFOPTS+= --with-abi=x32
endif
-ifeq ($(ADK_32),y)
-GCC_FINAL_CONFOPTS+= --with-abi=32
-endif
ifeq ($(ADK_64),y)
GCC_FINAL_CONFOPTS+= --disable-biarch --disable-multilib
endif
diff --git a/toolchain/gcc/patches/4.8.2/abi32.patch b/toolchain/gcc/patches/4.8.2/abi32.patch
deleted file mode 100644
index 856d608bd..000000000
--- a/toolchain/gcc/patches/4.8.2/abi32.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-diff -Nur gcc-4.8.2.orig/gcc/config/i386/biarch32.h gcc-4.8.2/gcc/config/i386/biarch32.h
---- gcc-4.8.2.orig/gcc/config/i386/biarch32.h 1970-01-01 01:00:00.000000000 +0100
-+++ gcc-4.8.2/gcc/config/i386/biarch32.h 2014-03-23 20:33:52.000000000 +0100
-@@ -0,0 +1,27 @@
-+/* Make configure files to produce biarch compiler defaulting to 32bit mode.
-+ This file must be included very first, while the OS specific file later
-+ to overwrite otherwise wrong defaults.
-+ Copyright (C) 2001-2014 Free Software Foundation, Inc.
-+
-+This file is part of GCC.
-+
-+GCC is free software; you can redistribute it and/or modify
-+it under the terms of the GNU General Public License as published by
-+the Free Software Foundation; either version 3, or (at your option)
-+any later version.
-+
-+GCC is distributed in the hope that it will be useful,
-+but WITHOUT ANY WARRANTY; without even the implied warranty of
-+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+GNU General Public License for more details.
-+
-+Under Section 7 of GPL version 3, you are granted additional
-+permissions described in the GCC Runtime Library Exception, version
-+3.1, as published by the Free Software Foundation.
-+
-+You should have received a copy of the GNU General Public License and
-+a copy of the GCC Runtime Library Exception along with this program;
-+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-+<http://www.gnu.org/licenses/>. */
-+
-+#define TARGET_64BIT_DEFAULT 0
-diff -Nur gcc-4.8.2.orig/gcc/config.gcc gcc-4.8.2/gcc/config.gcc
---- gcc-4.8.2.orig/gcc/config.gcc 2013-10-03 02:47:24.000000000 +0200
-+++ gcc-4.8.2/gcc/config.gcc 2014-03-22 13:15:18.000000000 +0100
-@@ -522,6 +522,9 @@
- 64 | m64)
- tm_file="i386/biarch64.h ${tm_file}"
- ;;
-+ 32 | m32)
-+ tm_file="i386/biarch32.h ${tm_file}"
-+ ;;
- x32 | mx32)
- tm_file="i386/biarchx32.h ${tm_file}"
- ;;
-@@ -1343,6 +1346,9 @@
- x32 | mx32)
- x86_multilibs="mx32"
- ;;
-+ 32 | m32)
-+ x86_multilibs="m32"
-+ ;;
- *)
- x86_multilibs="m64,m32"
- ;;