summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/vars.mk6
-rw-r--r--package/elf2flt/Makefile53
-rw-r--r--target/config/Config.in.target3
-rw-r--r--target/linux/patches/3.15.8/qemu-coldfire.patch24
-rw-r--r--target/m68k/kernel/qemu-m68k3
-rw-r--r--target/m68k/systems/qemu-m68k1
6 files changed, 89 insertions, 1 deletions
diff --git a/mk/vars.mk b/mk/vars.mk
index 14d677f40..a3dac0bed 100644
--- a/mk/vars.mk
+++ b/mk/vars.mk
@@ -93,6 +93,12 @@ TARGET_LDFLAGS:= -L$(STAGING_TARGET_DIR)/lib -L$(STAGING_TARGET_DIR)/usr/lib \
-Wl,-O1 -Wl,-rpath -Wl,/usr/lib \
-Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib
+ifeq ($(ADK_TARGET_BINFMT_FLAT),y)
+TARGET_CFLAGS+= -Wl,-elf2flt
+TARGET_CXXFLAGS+= -Wl,-elf2flt
+TARGET_LDFLAGS+= -elf2flt
+endif
+
ifeq ($(ADK_TARGET_LIB_MUSL),y)
# use -static-libgcc by default only for musl
TARGET_CFLAGS+= -static-libgcc
diff --git a/package/elf2flt/Makefile b/package/elf2flt/Makefile
new file mode 100644
index 000000000..3b2ab9374
--- /dev/null
+++ b/package/elf2flt/Makefile
@@ -0,0 +1,53 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(ADK_TOPDIR)/rules.mk
+
+PKG_NAME:= elf2flt
+PKG_VERSION:= 20140814
+PKG_RELEASE:= 1
+PKG_MD5SUM:= be5c918b90a591d3d4037580cda1764a
+PKG_DESCR:= elf2flt utility
+PKG_SECTION:= dev/tools
+PKG_SITES:= http://www.openadk.org/distfiles/
+BINUTILS_VERSION:= 2.24
+
+PKG_CFLINE_ELF2FLT:= depends on ADK_HOST_ONLY
+PKG_DFLT_ELF2FLT:= y if ADK_TARGET_BINFMT_FLAT
+
+include $(ADK_TOPDIR)/mk/host.mk
+include $(ADK_TOPDIR)/mk/package.mk
+
+$(eval $(call HOST_template,ELF2FLT,elf2flt,$(PKG_VERSION)-${PKG_RELEASE}))
+
+HOST_STYLE:= manual
+
+host-configure:
+ (cd $(WRKBUILD); ./configure --prefix=$(STAGING_HOST_DIR)/usr \
+ --target=$(ADK_TARGET_ARCH) \
+ --with-bfd-include-dir=$(TOOLCHAIN_BUILD_DIR)/w-binutils-${BINUTILS_VERSION}-1/binutils-${BINUTILS_VERSION}/bfd \
+ --with-binutils-include-dir=$(TOOLCHAIN_BUILD_DIR)/w-binutils-${BINUTILS_VERSION}-1/binutils-${BINUTILS_VERSION}/include \
+ --with-libbfd=$(TOOLCHAIN_BUILD_DIR)/w-binutils-${BINUTILS_VERSION}-1/binutils-${BINUTILS_VERSION}/bfd/libbfd.a \
+ --with-libiberty=$(TOOLCHAIN_BUILD_DIR)/w-binutils-${BINUTILS_VERSION}-1/binutils-${BINUTILS_VERSION}/libiberty/libiberty.a )
+
+host-build:
+ (cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \
+ ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET}) $(MAKE_TRACE)
+
+elf2flt-hostinstall:
+ ${INSTALL_BIN} ${WRKBUILD}/elf2flt ${TOOLCHAIN_DIR}/usr/$(GNU_TARGET_NAME)/bin
+ ${INSTALL_BIN} ${WRKBUILD}/flthdr ${TOOLCHAIN_DIR}/usr/$(GNU_TARGET_NAME)/bin
+ ${INSTALL_BIN} ${WRKBUILD}/ld-elf2flt ${TOOLCHAIN_DIR}/usr/$(GNU_TARGET_NAME)/bin
+ ${INSTALL_DATA} ${WRKBUILD}/elf2flt.ld ${TOOLCHAIN_DIR}/usr/$(GNU_TARGET_NAME)/lib
+ rm $(TOOLCHAIN_DIR)/usr/bin/$(GNU_TARGET_NAME)-ld
+ (cd ${TOOLCHAIN_DIR}/usr/$(GNU_TARGET_NAME)/bin && \
+ ln -sf ld.bfd ld.real )
+ (cd $(TOOLCHAIN_DIR)/usr/bin && \
+ ln -sf ../$(GNU_TARGET_NAME)/bin/elf2flt $(GNU_TARGET_NAME)-elf2flt && \
+ ln -sf ../$(GNU_TARGET_NAME)/bin/flthdr $(GNU_TARGET_NAME)-flthdr && \
+ ln -sf ../$(GNU_TARGET_NAME)/bin/ld-elf2flt $(GNU_TARGET_NAME)-ld-elf2flt && \
+ ln -sf ../$(GNU_TARGET_NAME)/bin/ld-elf2flt $(GNU_TARGET_NAME)-ld )
+ (cd $(TOOLCHAIN_DIR)/usr/bin/ && ln -sf $(GNU_TARGET_NAME)-ld.bfd $(GNU_TARGET_NAME)-ld.real )
+
+include ${ADK_TOPDIR}/mk/host-bottom.mk
+include ${ADK_TOPDIR}/mk/pkg-bottom.mk
diff --git a/target/config/Config.in.target b/target/config/Config.in.target
index a4a598839..3abb99b9e 100644
--- a/target/config/Config.in.target
+++ b/target/config/Config.in.target
@@ -283,6 +283,9 @@ config ADK_TARGET_PACKAGE_IPKG
endchoice
+config ADK_TARGET_BINFMT_FLAT
+ boolean
+
choice
prompt "Target GPU Memory"
depends on ADK_TARGET_SYSTEM_RASPBERRY_PI
diff --git a/target/linux/patches/3.15.8/qemu-coldfire.patch b/target/linux/patches/3.15.8/qemu-coldfire.patch
new file mode 100644
index 000000000..503fe8ef3
--- /dev/null
+++ b/target/linux/patches/3.15.8/qemu-coldfire.patch
@@ -0,0 +1,24 @@
+m68k: enabled software emulation of separate supervisor/user stack
+
+Recent Coldfires have separate supervisor and user stack pointers, but
+since older Coldfires didn't have that, the Linux kernel has a kind of
+emulation mechanism for those pointers.
+
+Apparently, according to the Kconfig.cpu file, the 5208 is supposed to
+support such separate pointers, but Qemu doesn't implement it. So we
+cheat a bit here and force the usage of emulated separate stack
+pointers.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
+
+diff -Nur linux-3.16.orig/arch/m68k/Kconfig.cpu linux-3.16/arch/m68k/Kconfig.cpu
+--- linux-3.16.orig/arch/m68k/Kconfig.cpu 2014-08-04 00:25:02.000000000 +0200
++++ linux-3.16/arch/m68k/Kconfig.cpu 2014-08-13 16:58:59.568332805 +0200
+@@ -146,6 +146,7 @@
+ depends on !MMU
+ select GENERIC_CLOCKEVENTS
+ select HAVE_CACHE_SPLIT
++ select COLDFIRE_SW_A7
+ help
+ Freescale Coldfire 5207/5208 processor support.
+
diff --git a/target/m68k/kernel/qemu-m68k b/target/m68k/kernel/qemu-m68k
index 2b0e53ad4..613653648 100644
--- a/target/m68k/kernel/qemu-m68k
+++ b/target/m68k/kernel/qemu-m68k
@@ -15,7 +15,8 @@ CONFIG_VECTORBASE=0x40000000
CONFIG_KERNELBASE=0x40010000
CONFIG_RAMAUTOBIT=y
CONFIG_BINFMT_FLAT=y
-CONFIG_SERIAL_COLDFIRE=y
+CONFIG_BINFMT_ZFLAT=y
+CONFIG_BINFMT_SHARED_FLAT=y
CONFIG_SERIAL_MCF=y
CONFIG_SERIAL_MCF_BAUDRATE=19200
CONFIG_SERIAL_MCF_CONSOLE=y
diff --git a/target/m68k/systems/qemu-m68k b/target/m68k/systems/qemu-m68k
index 7e381be99..c32089209 100644
--- a/target/m68k/systems/qemu-m68k
+++ b/target/m68k/systems/qemu-m68k
@@ -5,6 +5,7 @@ config ADK_TARGET_SYSTEM_QEMU_M68K
select ADK_CPU_CF_5208
select ADK_TARGET_QEMU
select ADK_TARGET_UCLINUX
+ select ADK_TARGET_BINFMT_FLAT
select ADK_TARGET_KERNEL_ZIMAGE
help
Support for Qemu Emulator M68K/Coldfire without MMU.