Browse Source

fr-v: allow to build a uClibc-ng toolchain

Waldemar Brodkorb 8 years ago
parent
commit
6d2e9103d9

+ 53 - 0
target/frv/Makefile

@@ -5,3 +5,56 @@ include $(ADK_TOPDIR)/rules.mk
 include $(ADK_TOPDIR)/mk/kernel-build.mk
 include $(ADK_TOPDIR)/mk/image.mk
 
+KERNEL:=$(LINUX_DIR)/$(ADK_TARGET_KERNEL)
+
+# target helper text
+ifeq ($(ADK_TARGET_FS),archive)
+targethelp:
+	@echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
+endif
+ifeq ($(ADK_TARGET_FS),initramfs)
+targethelp:
+	@echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+	@echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
+endif
+ifeq ($(ADK_TARGET_FS),initramfsarchive)
+targethelp:
+	@echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+	@echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
+endif
+ifeq ($(ADK_TARGET_FS),initramfspiggyback)
+targethelp:
+	@echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
+ifeq ($(ADK_TARGET_SIM),y)
+	@echo "Run the simulator via:"
+	@echo '$(TARGET_CROSS)run --environment operating --model fr400 $(FW_DIR)/$(TARGET_KERNEL)'
+endif
+endif
+ifeq ($(ADK_TARGET_FS),nfsroot)
+targethelp:
+	@echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+	@echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
+endif
+
+kernel-strip:
+	@cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
+
+kernel-install: kernel-strip
+	@cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
+
+# filesystem specific targets
+ifeq ($(ADK_TARGET_FS),archive)
+imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
+endif
+ifeq ($(ADK_TARGET_FS),initramfs)
+imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
+endif
+ifeq ($(ADK_TARGET_FS),initramfsarchive)
+imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
+endif
+ifeq ($(ADK_TARGET_FS),initramfspiggyback)
+imageinstall: createinitramfs targethelp
+endif
+ifeq ($(ADK_TARGET_FS),nfsroot)
+imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
+endif

+ 13 - 0
target/frv/kernel/sim-frv

@@ -0,0 +1,13 @@
+CONFIG_FRV=y
+CONFIG_CPU_FR401=y
+CONFIG_UCPAGE_OFFSET_20000000=y
+CONFIG_BUG=y
+CONFIG_FRV_ONCPU_SERIAL=y
+CONFIG_SERIAL_EARLYCON=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_DMA=y
+CONFIG_SERIAL_8250_PCI=y
+CONFIG_SERIAL_8250_NR_UARTS=32
+CONFIG_SERIAL_8250_RUNTIME_UARTS=4

+ 8 - 0
target/frv/systems/sim-frv

@@ -0,0 +1,8 @@
+config ADK_TARGET_SYSTEM_SIM_FRV
+	bool "GDB simulator"
+	select ADK_CPU_FRV
+	select ADK_TARGET_SIM
+	select ADK_TARGET_PACKAGE_TXZ
+	help
+	  FRV Simulator.
+

+ 30 - 9
target/frv/uclibc-ng.config

@@ -35,10 +35,7 @@ TARGET_frv=y
 TARGET_ARCH="frv"
 FORCE_OPTIONS_FOR_ARCH=y
 TARGET_SUBARCH=""
-# UCLIBC_FORMAT_FDPIC_ELF is not set
-UCLIBC_FORMAT_FLAT=y
-# UCLIBC_FORMAT_FLAT_SEP_DATA is not set
-# UCLIBC_FORMAT_SHARED_FLAT is not set
+UCLIBC_FORMAT_FDPIC_ELF=y
 ARCH_HAS_DEPRECATED_SYSCALLS=y
 ARCH_BIG_ENDIAN=y
 
@@ -63,11 +60,28 @@ HAVE_DOT_CONFIG=y
 # General Library Settings
 #
 DOPIC=y
-ARCH_HAS_NO_SHARED=y
-ARCH_HAS_NO_LDSO=y
+HAVE_SHARED=y
+# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
+LDSO_LDD_SUPPORT=y
+LDSO_CACHE_SUPPORT=y
+LDSO_PRELOAD_ENV_SUPPORT=y
+# LDSO_PRELOAD_FILE_SUPPORT is not set
+LDSO_BASE_FILENAME="ld.so"
+# LDSO_STANDALONE_SUPPORT is not set
+# LDSO_PRELINK_SUPPORT is not set
+UCLIBC_STATIC_LDCONFIG=y
+LDSO_RUNPATH=y
+LDSO_RUNPATH_OF_EXECUTABLE=y
+LDSO_SAFE_RUNPATH=y
+LDSO_SEARCH_INTERP_PATH=y
+LDSO_LD_LIBRARY_PATH=y
+LDSO_NO_CLEANUP=y
 UCLIBC_CTOR_DTOR=y
-HAS_NO_THREADS=y
-# UCLIBC_HAS_LINUXTHREADS is not set
+# LDSO_GNU_HASH_SUPPORT is not set
+# HAS_NO_THREADS is not set
+UCLIBC_HAS_LINUXTHREADS=y
+UCLIBC_HAS_THREADS=y
+PTHREADS_DEBUG_SUPPORT=y
 UCLIBC_HAS_SYSLOG=y
 UCLIBC_HAS_LFS=y
 UCLIBC_HAS_OBSTACK=y
@@ -202,10 +216,13 @@ HARDWIRED_ABSPATH=y
 #
 # Security options
 #
+# UCLIBC_BUILD_PIE is not set
 UCLIBC_HAS_ARC4RANDOM=y
 # ARC4RANDOM_USES_NODEV is not set
 # UCLIBC_HAS_SSP is not set
-UCLIBC_BUILD_NOEXECSTACK=y
+# UCLIBC_BUILD_RELRO is not set
+# UCLIBC_BUILD_NOW is not set
+# UCLIBC_BUILD_NOEXECSTACK is not set
 
 #
 # Development/debugging options
@@ -213,9 +230,13 @@ UCLIBC_BUILD_NOEXECSTACK=y
 CROSS_COMPILER_PREFIX=""
 UCLIBC_EXTRA_CFLAGS=""
 # DODEBUG is not set
+# DODEBUG_PT is not set
 # DOSTRIP is not set
 # DOASSERTS is not set
+# SUPPORT_LD_DEBUG is not set
+# SUPPORT_LD_DEBUG_EARLY is not set
 # UCLIBC_MALLOC_DEBUGGING is not set
+# UCLIBC_HAS_BACKTRACE is not set
 WARNINGS="-Wall"
 # EXTRA_WARNINGS is not set
 # DOMULTI is not set

+ 4 - 0
toolchain/gcc/Makefile

@@ -174,6 +174,10 @@ ifeq ($(ADK_TARGET_ARCH_PPC),y)
 GCC_CONFOPTS+=		--with-long-double-64 --enable-secureplt
 endif
 
+ifeq ($(ADK_TARGET_ARCH_FRV),y)
+GCC_CONFOPTS+=		--enable-sjlj-exceptions
+endif
+
 ifneq ($(ADK_TARGET_MIPS_ABI),)
 GCC_CONFOPTS+=		--with-abi=${ADK_TARGET_MIPS_ABI}
 endif

+ 11 - 0
toolchain/gcc/patches/4.5.4/disable-dwarf.frv

@@ -0,0 +1,11 @@
+diff -Nur gcc-4.5.4.orig/gcc/config/t-linux gcc-4.5.4/gcc/config/t-linux
+--- gcc-4.5.4.orig/gcc/config/t-linux	2009-04-21 21:03:23.000000000 +0200
++++ gcc-4.5.4/gcc/config/t-linux	2015-11-21 17:25:52.720653570 +0100
+@@ -27,6 +27,6 @@
+ SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
+ 
+ # Use unwind-dw2-fde-glibc
+-LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \
++LIB2ADDEH = $(srcdir)/unwind-dw2.c \
+   $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c
+ LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c

+ 12 - 0
toolchain/gcc/patches/4.9.3/disable-dwarf.frv

@@ -0,0 +1,12 @@
+diff -Nur gcc-git.orig/libgcc/config.host gcc-git/libgcc/config.host
+--- gcc-git.orig/libgcc/config.host	2015-10-23 21:12:52.000000000 +0200
++++ gcc-git/libgcc/config.host	2015-11-15 21:17:38.385745887 +0100
+@@ -231,7 +231,7 @@
+   esac
+   ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
+-  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
++  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
+   extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
+   if test x$enable_vtable_verify = xyes; then
+     extra_parts="$extra_parts vtv_start.o vtv_end.o vtv_start_preinit.o vtv_end_preinit.o"

+ 11 - 0
toolchain/gcc/patches/4.9.3/remove-write-macro.frv

@@ -0,0 +1,11 @@
+diff -Nur gcc-4.9.3.orig/gcc/config/frv/linux.h gcc-4.9.3/gcc/config/frv/linux.h
+--- gcc-4.9.3.orig/gcc/config/frv/linux.h	2014-01-02 23:23:26.000000000 +0100
++++ gcc-4.9.3/gcc/config/frv/linux.h	2015-11-22 11:36:17.574727932 +0100
+@@ -69,6 +69,6 @@
+ #undef INVOKE__main
+ 
+ #undef Twrite
+-#define Twrite __write
++#define Twrite write
+ 
+ #endif /* __FRV_LINUX_H__ */

+ 12 - 0
toolchain/gcc/patches/git/disable-dwarf.frv

@@ -0,0 +1,12 @@
+diff -Nur gcc-git.orig/libgcc/config.host gcc-git/libgcc/config.host
+--- gcc-git.orig/libgcc/config.host	2015-10-23 21:12:52.000000000 +0200
++++ gcc-git/libgcc/config.host	2015-11-15 21:17:38.385745887 +0100
+@@ -231,7 +231,7 @@
+   esac
+   ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
+-  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
++  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
+   extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
+   if test x$enable_vtable_verify = xyes; then
+     extra_parts="$extra_parts vtv_start.o vtv_end.o vtv_start_preinit.o vtv_end_preinit.o"

+ 3 - 0
toolchain/gdb/Makefile

@@ -56,6 +56,9 @@ ifeq ($(ADK_TARGET_SIM),y)
 ifeq ($(ADK_TARGET_ARCH_BFIN),y)
 	$(INSTALL_BIN) $(GDB_BUILD_DIR)/sim/bfin/run $(TARGET_CROSS)run
 endif
+ifeq ($(ADK_TARGET_ARCH_FRV),y)
+	$(INSTALL_BIN) $(WRKBUILD)/sim/frv/run $(TARGET_CROSS)run
+endif
 ifeq ($(ADK_TARGET_ARCH_H8300),y)
 	$(INSTALL_BIN) $(GDB_BUILD_DIR)/sim/h8300/run $(TARGET_CROSS)run
 endif