Browse Source

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.
Waldemar Brodkorb 10 years ago
parent
commit
96b68fb704

+ 2 - 0
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

+ 1 - 1
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

+ 14 - 4
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)

+ 20 - 0
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

+ 11 - 0
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.
+

+ 0 - 12
target/x86_64/sys-available/toolchain-x86_64_32

@@ -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.
-

+ 1 - 5
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
 

+ 9 - 4
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

+ 0 - 54
toolchain/gcc/patches/4.8.2/abi32.patch

@@ -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"
- 			;;