From 5f63e4ddcc5847aba27e8bea15853835f3468941 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 2 Jun 2007 00:46:02 +0000 Subject: add initial support for the crisarchitecture used on foxboards to openwrt git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7439 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/Config.in | 1 - toolchain/kernel-headers/Makefile | 21 ++- toolchain/uClibc/config/cris | 157 +++++++++++++++++++++++ toolchain/uClibc/patches/200-cris-syscall6.patch | 34 +++++ toolchain/uClibc/patches/230-cris-pagesize.patch | 24 ++++ toolchain/uClibc/patches/240-cris-crt0.patch | 31 +++++ 6 files changed, 265 insertions(+), 3 deletions(-) create mode 100644 toolchain/uClibc/config/cris create mode 100644 toolchain/uClibc/patches/200-cris-syscall6.patch create mode 100644 toolchain/uClibc/patches/230-cris-pagesize.patch create mode 100644 toolchain/uClibc/patches/240-cris-crt0.patch (limited to 'toolchain') diff --git a/toolchain/Config.in b/toolchain/Config.in index 926381c0bd..1f8158286f 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -23,7 +23,6 @@ config GDB config LARGEFILE bool prompt "Enable large file (files > 2 GB) support?" if TOOLCHAINOPTS - depends on !cris default y help Enable large file (files > 2 GB) support diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile index 27dcacd80a..6a60b56097 100644 --- a/toolchain/kernel-headers/Makefile +++ b/toolchain/kernel-headers/Makefile @@ -15,16 +15,33 @@ PKG_SOURCE_URL=$(LINUX_SITE) PKG_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)/linux-$(PKG_VERSION) +LINUX_DIR:=$(PKG_BUILD_DIR)/linux-$(LINUX_VERSION) +KERNEL_BUILD_DIR:=$(PKG_BUILD_DIR) +include $(INCLUDE_DIR)/kernel-defaults.mk + include $(INCLUDE_DIR)/host-build.mk -define Build/Prepare +define Build/Prepare/cris mkdir -p $(TOOLCHAIN_BUILD_DIR) bzcat $(DL_DIR)/$(PKG_SOURCE) | $(HOST_TAR) -C $(TOOLCHAIN_BUILD_DIR) $(TAR_OPTIONS) - $(PATCH) $(PKG_BUILD_DIR) $(TOPDIR)/target/linux/generic-$(KERNEL)/patches + $(PATCH) $(PKG_BUILD_DIR) $(TOPDIR)/target/linux/etrax-2.6/patches/generic_2.6 + $(PATCH) $(PKG_BUILD_DIR) $(TOPDIR)/target/linux/etrax-2.6/patches/cris + ln -sf $(PKG_BUILD_DIR)/include/asm-cris/arch-v10 $(PKG_BUILD_DIR)/include/asm-cris/arch + ln -sf $(PKG_BUILD_DIR)/arch/cris/arch-v10 $(PKG_BUILD_DIR)/arch/cris/arch $(SED) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR)/Makefile ln -sf $(PKG_BUILD_DIR) $(LINUX_HEADERS_DIR) endef +ifdef Build/Prepare/$(ARCH) +define Build/Prepare + $(call Build/Prepare/$(ARCH)) +endef +else +define Build/Prepare + $(call Kernel/Prepare/Default) +endef +endif + define Build/Configure/powerpc $(CP) $(PKG_BUILD_DIR)/include/asm-ppc/* $(PKG_BUILD_DIR)/include/asm-powerpc/ rm -rf $(PKG_BUILD_DIR)/include/asm-ppc diff --git a/toolchain/uClibc/config/cris b/toolchain/uClibc/config/cris new file mode 100644 index 0000000000..32e2610203 --- /dev/null +++ b/toolchain/uClibc/config/cris @@ -0,0 +1,157 @@ +# +# Automatically generated make config: don't edit +# +# TARGET_alpha is not set +# TARGET_arm is not set +# TARGET_bfin is not set +TARGET_cris=y +# TARGET_e1 is not set +# TARGET_frv is not set +# TARGET_h8300 is not set +# TARGET_i386 is not set +# TARGET_i960 is not set +# TARGET_m68k is not set +# TARGET_microblaze is not set +# TARGET_mips is not set +# TARGET_nios is not set +# TARGET_nios2 is not set +# TARGET_powerpc is not set +# TARGET_sh is not set +# TARGET_sh64 is not set +# TARGET_sparc is not set +# TARGET_v850 is not set +# TARGET_x86_64 is not set + +# +# Target Architecture Features and Options +# +HAVE_ELF=y +ARCH_SUPPORTS_LITTLE_ENDIAN=y +TARGET_ARCH="cris" +CONFIG_CRIS=y +ARCH_LITTLE_ENDIAN=y +# ARCH_BIG_ENDIAN is not set +# ARCH_HAS_NO_MMU is not set +ARCH_HAS_MMU=y +UCLIBC_HAS_FLOATS=y +# HAS_FPU is not set +UCLIBC_HAS_SOFT_FLOAT=y +# DO_C99_MATH is not set +KERNEL_SOURCE="/raid/trunk/toolchain_build_cris/linux" +C_SYMBOL_PREFIX="" +HAVE_DOT_CONFIG=y + +# +# General Library Settings +# +# HAVE_NO_PIC is not set +DOPIC=y +# HAVE_NO_SHARED is not set +HAVE_SHARED=y +# ARCH_HAS_NO_LDSO is not set +BUILD_UCLIBC_LDSO=y +# FORCE_SHAREABLE_TEXT_SEGMENTS is not set +LDSO_LDD_SUPPORT=y +LDSO_CACHE_SUPPORT=y +# LDSO_PRELOAD_FILE_SUPPORT is not set +LDSO_BASE_FILENAME="ld.so" +# LDSO_RUNPATH is not set +# DL_FINI_CRT_COMPAT is not set +# UCLIBC_CTOR_DTOR is not set +# HAS_NO_THREADS is not set +UCLIBC_HAS_THREADS=y +# PTHREADS_DEBUG_SUPPORT is not set +UCLIBC_HAS_LFS=y +# UCLIBC_STATIC_LDCONFIG is not set +# MALLOC is not set +# MALLOC_SIMPLE is not set +MALLOC_STANDARD=y +MALLOC_GLIBC_COMPAT=y +UCLIBC_DYNAMIC_ATEXIT=y +HAS_SHADOW=y +# UNIX98PTY_ONLY is not set +ASSUME_DEVPTS=y +UCLIBC_HAS_TM_EXTENSIONS=y +UCLIBC_HAS_TZ_CACHING=y +UCLIBC_HAS_TZ_FILE=y +UCLIBC_HAS_TZ_FILE_READ_MANY=y +UCLIBC_TZ_FILE_PATH="/etc/TZ" + +# +# Networking Support +# +UCLIBC_HAS_IPV6=y +UCLIBC_HAS_RPC=y +UCLIBC_HAS_FULL_RPC=y + +# +# String and Stdio Support +# +UCLIBC_HAS_STRING_GENERIC_OPT=y +UCLIBC_HAS_STRING_ARCH_OPT=y +UCLIBC_HAS_CTYPE_TABLES=y +UCLIBC_HAS_CTYPE_SIGNED=y +# UCLIBC_HAS_CTYPE_UNSAFE is not set +UCLIBC_HAS_CTYPE_CHECKED=y +# UCLIBC_HAS_CTYPE_ENFORCED is not set +UCLIBC_HAS_WCHAR=y +# UCLIBC_HAS_LOCALE is not set +UCLIBC_HAS_HEXADECIMAL_FLOATS=y +UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y +UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9 +UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y +# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set +# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set +# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set +UCLIBC_HAS_STDIO_BUFSIZ_4096=y +# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set +UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y +# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set +# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set +# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set +UCLIBC_HAS_STDIO_GETC_MACRO=y +UCLIBC_HAS_STDIO_PUTC_MACRO=y +UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y +# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set +UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y +UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y +UCLIBC_HAS_PRINTF_M_SPEC=y +UCLIBC_HAS_ERRNO_MESSAGES=y +# UCLIBC_HAS_SYS_ERRLIST is not set +UCLIBC_HAS_SIGNUM_MESSAGES=y +# UCLIBC_HAS_SYS_SIGLIST is not set +UCLIBC_HAS_GNU_GETOPT=y + +# +# Big and Tall +# +UCLIBC_HAS_REGEX=y +UCLIBC_HAS_WORDEXP=y +UCLIBC_HAS_FTW=y +UCLIBC_HAS_GLOB=y + +# +# Library Installation Options +# +SHARED_LIB_LOADER_PREFIX="/lib" +RUNTIME_PREFIX="/" +DEVEL_PREFIX="/usr/" + +# +# uClibc security related options +# +# UCLIBC_SECURITY is not set + +# +# uClibc development/debugging options +# +CROSS_COMPILER_PREFIX="" +# DODEBUG is not set +# DODEBUG_PT is not set +# DOASSERTS is not set +# SUPPORT_LD_DEBUG is not set +# SUPPORT_LD_DEBUG_EARLY is not set +WARNINGS="-Wall" +# UCLIBC_MJN3_ONLY is not set diff --git a/toolchain/uClibc/patches/200-cris-syscall6.patch b/toolchain/uClibc/patches/200-cris-syscall6.patch new file mode 100644 index 0000000000..8ecbab5c33 --- /dev/null +++ b/toolchain/uClibc/patches/200-cris-syscall6.patch @@ -0,0 +1,34 @@ +diff -urN uClibc-0.9.28.2.orig/libc/sysdeps/linux/cris/bits/syscalls.h uClibc-0.9.28.2/libc/sysdeps/linux/cris/bits/syscalls.h +--- uClibc-0.9.28.2.orig/libc/sysdeps/linux/cris/bits/syscalls.h 2007-05-15 19:45:43.000000000 +0200 ++++ uClibc-0.9.28.2/libc/sysdeps/linux/cris/bits/syscalls.h 2007-05-15 19:47:20.000000000 +0200 +@@ -62,6 +62,30 @@ + return (type) (INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5)); \ + } + ++#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ ++ type5,arg5,type6,arg6) \ ++type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ ++{ \ ++ register long __a __asm__ ("r10") = (long) arg1; \ ++ register long __b __asm__ ("r11") = (long) arg2; \ ++ register long __c __asm__ ("r12") = (long) arg3; \ ++ register long __d __asm__ ("r13") = (long) arg4; \ ++ register long __n_ __asm__ ("r9") = (__NR_##name); \ ++ __asm__ __volatile__ (".ifnc %0%1%3%4%5,$r10$r9$r11$r12$r13\n\t" \ ++ ".err\n\t" \ ++ ".endif\n\t" \ ++ "move %6,$mof\n\tmove %7,$srp\n\t" \ ++ "break 13" \ ++ : "=r" (__a) \ ++ : "r" (__n_), "0" (__a), "r" (__b), \ ++ "r" (__c), "r" (__d), "g" (arg5), "g" (arg6)\ ++ : "srp"); \ ++ if (__a >= 0) \ ++ return (type) __a; \ ++ __set_errno ( -__a); \ ++ return (type) -1; \ ++} ++ + #undef INLINE_SYSCALL + #define INLINE_SYSCALL(name, nr, args...) \ + ({ \ diff --git a/toolchain/uClibc/patches/230-cris-pagesize.patch b/toolchain/uClibc/patches/230-cris-pagesize.patch new file mode 100644 index 0000000000..419617b44f --- /dev/null +++ b/toolchain/uClibc/patches/230-cris-pagesize.patch @@ -0,0 +1,24 @@ +diff -urN uClibc-0.9.28.2.orig/ldso/include/dl-syscall.h uClibc-0.9.28.2/ldso/include/dl-syscall.h +--- uClibc-0.9.28.2.orig/ldso/include/dl-syscall.h 2007-05-22 20:39:28.000000000 +0200 ++++ uClibc-0.9.28.2/ldso/include/dl-syscall.h 2007-05-22 20:41:30.000000000 +0200 +@@ -155,8 +155,9 @@ + static inline void * _dl_mmap(void * addr, unsigned long size, int prot, + int flags, int fd, unsigned long offset) + { +- if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) ++ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)){ + return MAP_FAILED; ++ } + return __syscall_mmap2(addr, size, prot, flags, + fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)); + } +diff -urN uClibc-0.9.28.2.orig/libc/sysdeps/linux/cris/bits/uClibc_page.h uClibc-0.9.28.2/libc/sysdeps/linux/cris/bits/uClibc_page.h +--- uClibc-0.9.28.2.orig/libc/sysdeps/linux/cris/bits/uClibc_page.h 2007-05-22 20:39:28.000000000 +0200 ++++ uClibc-0.9.28.2/libc/sysdeps/linux/cris/bits/uClibc_page.h 2007-05-22 20:42:25.000000000 +0200 +@@ -24,5 +24,5 @@ + #define PAGE_SHIFT 13 + #define PAGE_SIZE (1UL << PAGE_SHIFT) + #define PAGE_MASK (~(PAGE_SIZE-1)) +- ++#define MMAP2_PAGE_SHIFT PAGE_SHIFT + #endif /* _UCLIBC_PAGE_H */ diff --git a/toolchain/uClibc/patches/240-cris-crt0.patch b/toolchain/uClibc/patches/240-cris-crt0.patch new file mode 100644 index 0000000000..d0fa7f3b75 --- /dev/null +++ b/toolchain/uClibc/patches/240-cris-crt0.patch @@ -0,0 +1,31 @@ +diff -urN uClibc-0.9.28.2.orig/libc/sysdeps/linux/cris/crt0.c uClibc-0.9.28.2/libc/sysdeps/linux/cris/crt0.c +--- uClibc-0.9.28.2.orig/libc/sysdeps/linux/cris/crt0.c 2007-05-18 00:27:56.000000000 +0200 ++++ uClibc-0.9.28.2/libc/sysdeps/linux/cris/crt0.c 2007-05-18 00:32:08.000000000 +0200 +@@ -31,11 +31,10 @@ + + #include + +-extern void __uClibc_main(int argc, char **argv, char **envp) +- __attribute__ ((__noreturn__)); +-extern void __uClibc_start_main(int argc, char **argv, char **envp, +- void (*app_init)(void), void (*app_fini)(void)) +- __attribute__ ((__noreturn__)); ++extern void __uClibc_main(int (*main)(int, char **, char **), int argc, ++ char **argv, void (*app_init)(void), void (*app_fini)(void), ++ void (*rtld_fini)(void), void *stack_end) __attribute__ ((__noreturn__)); ++ + extern void weak_function _init(void); + extern void weak_function _fini(void); + +@@ -64,10 +63,5 @@ + */ + --environ; + +-#if defined L_crt0 || ! defined __UCLIBC_CTOR_DTOR__ +- /* Leave control to the libc */ +- __uClibc_main(argc, argv, environ); +-#else +- __uClibc_start_main(argc, argv, environ, _init, _fini); +-#endif ++ __uClibc_main(__mainp, argc, argv, 0, 0, 0, 0); + } -- cgit v1.2.3