Browse Source

add support for 64bit kernels on supporting targets

This is more commonly known as 32bit userland support on 64bit
architectures.

For simplicity's sake though, this implementation works the other way
round: just build a 64bit-able linker and compiler, but no
64bit-libraries at all (i.e., no multilib). This is then just enough to
compile a 64bit kernel, as that doesn't link to anything. The
alternative would have been to build a native 64bit compiler with
multilib-support in order to cross-compile a 32bit userland, resulting
in a multilib system without need for it.

In order to allow compilation of a 64bit kernel for a given target
system, have it select ADK_TARGET_KERNEL_MAY_64BIT. Upon selection of
that target, the symbol ADK_64BIT_KERNEL will occur in the "Global
settings" menu. Since certain aspects of the 64bit kernel .config may
greatly differ from it's 32bit counterpart, it has to be shipped
separately: target/<arch>/kernel64.config is the place to be.

Conflicts:

	target/Makefile
	toolchain/gcc/Makefile

Untested, due to conflicts (original patch conflicts with
multiple kernel version support).
Phil Sutter 12 years ago
parent
commit
2484dc396a
5 changed files with 30 additions and 9 deletions
  1. 13 7
      target/Makefile
  2. 3 0
      target/config/Config.in
  3. 7 0
      target/config/Config.in.adk
  4. 1 1
      toolchain/binutils/Makefile
  5. 6 1
      toolchain/gcc/Makefile

+ 13 - 7
target/Makefile

@@ -6,6 +6,12 @@ include $(TOPDIR)/mk/rootfs.mk
 
 all: install
 
+ifeq (${ADK_64BIT_KERNEL},y)
+KERNEL_CFG:=kernel64.config
+else
+KERNEL_CFG:=kernel.config
+endif
+
 ### Kernel .config Creation
 # The following target combines all kernel-related variables and
 # config files into a single one to be used as the final kernel
@@ -48,15 +54,15 @@ config-prepare: $(TOPDIR)/.config
 	    >${BUILD_DIR}/.kernelconfig.nokernel
 ifeq ($(ADK_NATIVE),y)
 	@if [ -f /etc/adktarget ];then \
-		cp $(TOPDIR)/target/$(ARCH)/kernel.config ${BUILD_DIR}/.kernelconfig.board; \
+		cp $(TOPDIR)/target/$(ARCH)/${KERNEL_CFG} ${BUILD_DIR}/.kernelconfig.board; \
 	else \
 	if [ -f /proc/config.gz ];then zcat /proc/config.gz > ${BUILD_DIR}/.kernelconfig.board; else cp ${ADK_TARGET}/kernel.config.$(ARCH) ${BUILD_DIR}/.kernelconfig.board; fi; \
 	fi
 else
-	if [ -f ${ADK_TARGET_ARCH}/kernel.config.$(ADK_TARGET_SYSTEM) ];then \
-		cp ${ADK_TARGET_ARCH}/kernel.config.$(ADK_TARGET_SYSTEM) ${BUILD_DIR}/.kernelconfig.board; \
+	if [ -f ${ADK_TARGET_ARCH}/${KERNEL_CFG}.$(ADK_TARGET_SYSTEM) ];then \
+		cp ${ADK_TARGET_ARCH}/${KERNEL_CFG}.$(ADK_TARGET_SYSTEM) ${BUILD_DIR}/.kernelconfig.board; \
 	else \
-		cp ${ADK_TARGET_ARCH}/kernel.config ${BUILD_DIR}/.kernelconfig.board; \
+		cp ${ADK_TARGET_ARCH}/${KERNEL_CFG} ${BUILD_DIR}/.kernelconfig.board; \
 	fi
 endif
 	@(cat ${BUILD_DIR}/.kernelconfig.{modules,kernel} | \
@@ -89,10 +95,10 @@ endif
 	@-rm -f ${BUILD_DIR}/.kernelconfig.tmp
 else
 config-prepare: $(TOPDIR)/.config
-	if [ -f ${ADK_TARGET_ARCH}/kernel.config.$(ADK_TARGET_SYSTEM) ];then \
-		cp ${ADK_TARGET_ARCH}/kernel.config.$(ADK_TARGET_SYSTEM) ${BUILD_DIR}/.kernelconfig.board; \
+	if [ -f ${ADK_TARGET_ARCH}/${KERNEL_CFG}.$(ADK_TARGET_SYSTEM) ];then \
+		cp ${ADK_TARGET_ARCH}/${KERNEL_CFG}.$(ADK_TARGET_SYSTEM) ${BUILD_DIR}/.kernelconfig.board; \
 	else \
-		cp ${ADK_TARGET_ARCH}/kernel.config ${BUILD_DIR}/.kernelconfig.board; \
+		cp ${ADK_TARGET_ARCH}/${KERNEL_CFG} ${BUILD_DIR}/.kernelconfig.board; \
 	fi
 endif
 

+ 3 - 0
target/config/Config.in

@@ -204,6 +204,9 @@ config ADK_TARGET_WITH_DSL
 config ADK_TARGET_WITH_USB_BOOT
 	boolean
 
+config ADK_TARGET_KERNEL_MAY_64BIT
+	boolean
+
 # global symbols
 config ADK_TOOLCHAIN_ONLY
 	boolean

+ 7 - 0
target/config/Config.in.adk

@@ -110,4 +110,11 @@ config ADK_HOST_CYGWIN
 	boolean
 
 endchoice
+
+config ADK_64BIT_KERNEL
+	prompt "Build a 64bit Kernel"
+	boolean
+	default n
+	depends on ADK_TARGET_KERNEL_MAY_64BIT
+
 endmenu

+ 1 - 1
toolchain/binutils/Makefile

@@ -12,7 +12,7 @@ else
 CONFOPTS+=		--disable-libssp
 endif
 
-ifeq ($(ADK_LINUX_64),y)
+ifneq ($(strip $(ADK_LINUX_64)$(ADK_64BIT_KERNEL)),)
 CONFOPTS+=		--enable-64-bit-bfd
 endif
 

+ 6 - 1
toolchain/gcc/Makefile

@@ -20,7 +20,6 @@ GCC_CONFOPTS=		--prefix=$(STAGING_HOST_DIR) \
 			--disable-multilib \
 			--disable-libmudflap \
 			--disable-libgomp \
-			--disable-biarch \
 			--disable-decimal-float \
 			--disable-libstdcxx-pch \
 			--disable-ppl-version-check \
@@ -35,6 +34,12 @@ else
 GCC_CONFOPTS+=		--disable-sjlj-exceptions
 endif
 
+ifeq ($(ADK_64BIT_KERNEL),y)
+GCC_CONFOPTS+=		--enable-targets=all
+else
+GCC_CONFOPTS+=		--disable-biarch
+endif
+
 ifeq ($(ADK_TOOLCHAIN_GCC_SSP),y)
 GCC_CONFOPTS+=		--enable-libssp
 else