Add basic support for the Blackfin architecture
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed Apr 07 09:18:20 2010 +0200 (2010-04-07)
changeset 1910207ad430c254
parent 1909 5921089b34bd
child 1911 9ecf17cbe9fb
Add basic support for the Blackfin architecture

For uClibc, the name of the Blackfin architecture is 'bfin'. Actually,
the naming of the architecture is quite messy: for toolchain tuples
and uClibc, it's bfin, but for the kernel, it's blackfin. We've
arbitraly choosen to name it "blackfin" in Crosstool-NG.

Add Blackfin-related uClibc patch to fix a build failure related to
fork() being used in unistd/daemon.c.

Yann E. MORIN:
Apply the patch to the kernel/linux build script to use 'linux'
in the noMMU tuples. See:
http://sourceware.org/ml/crossgcc/2010-04/msg00010.html
config/arch/blackfin.in
patches/uClibc/0.9.30.2/290-blackfin-nommu-fork-stub.patch
scripts/build/arch/blackfin.sh
scripts/build/kernel/linux.sh
scripts/build/libc/uClibc.sh
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/config/arch/blackfin.in	Wed Apr 07 09:18:20 2010 +0200
     1.3 @@ -0,0 +1,12 @@
     1.4 +# Blackfin specific configuration file
     1.5 +
     1.6 +config ARCH_blackfin
     1.7 +    select ARCH_SUPPORTS_32
     1.8 +    select ARCH_DEFAULT_32
     1.9 +    select ARCH_DEFAULT_LE
    1.10 +    select ARCH_SUPPORT_ARCH
    1.11 +    select ARCH_SUPPORT_CPU
    1.12 +    select ARCH_SUPPORT_TUNE
    1.13 +    select ARCH_SUPPORT_FPU
    1.14 +     help
    1.15 +      The Blackfin architecture
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/uClibc/0.9.30.2/290-blackfin-nommu-fork-stub.patch	Wed Apr 07 09:18:20 2010 +0200
     2.3 @@ -0,0 +1,32 @@
     2.4 +From: Jie Zhang <jie.zhang@analog.com>
     2.5 +Date: Mon, 1 Jun 2009 07:25:42 +0000 (+0000)
     2.6 +Subject: Backport UCLIBC_HAS_STUBS config option from the upstream. This option makes uClibc... 
     2.7 +X-Git-Url: http://blackfin.uclinux.org/git/?p=readonly-mirrors%2Ftoolchain.git;a=commitdiff_plain;h=cacea6b12bae6f6cfd08e2bbec536e9b23b342f5
     2.8 +
     2.9 +Backport UCLIBC_HAS_STUBS config option from the upstream. This option makes uClibc provide fork() stub on NOMMU targets. It's default off.
    2.10 +
    2.11 +
    2.12 +git-svn-id: svn://localhost/svn/toolchain/trunk@3417 2adf4935-75e9-4407-93b2-34b21a1880a4
    2.13 +---
    2.14 +
    2.15 +Index: uClibc-0.9.30.2/libc/unistd/daemon.c
    2.16 +===================================================================
    2.17 +--- uClibc-0.9.30.2.orig/libc/unistd/daemon.c	2010-01-13 22:22:31.000000000 +0100
    2.18 ++++ uClibc-0.9.30.2/libc/unistd/daemon.c	2010-04-06 22:04:11.000000000 +0200
    2.19 +@@ -55,7 +55,6 @@
    2.20 + libc_hidden_proto(dup2)
    2.21 + libc_hidden_proto(setsid)
    2.22 + libc_hidden_proto(chdir)
    2.23 +-libc_hidden_proto(fork)
    2.24 + 
    2.25 + #ifndef __ARCH_USE_MMU__
    2.26 + #include <sys/syscall.h>
    2.27 +@@ -85,6 +84,8 @@
    2.28 + 	return ret;
    2.29 + }
    2.30 + #else
    2.31 ++libc_hidden_proto(fork)
    2.32 ++
    2.33 + static inline pid_t fork_parent(void)
    2.34 + {
    2.35 + 	switch (fork()) {
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/scripts/build/arch/blackfin.sh	Wed Apr 07 09:18:20 2010 +0200
     3.3 @@ -0,0 +1,14 @@
     3.4 +# Compute Blackfin-specific values
     3.5 +
     3.6 +CT_DoArchTupleValues() {
     3.7 +    # The architecture part of the tuple:
     3.8 +    CT_TARGET_ARCH="bfin"
     3.9 +
    3.10 +    # gcc ./configure flags
    3.11 +    CT_ARCH_WITH_ARCH=
    3.12 +    CT_ARCH_WITH_ABI=
    3.13 +    CT_ARCH_WITH_CPU=
    3.14 +    CT_ARCH_WITH_TUNE=
    3.15 +    CT_ARCH_WITH_FPU=
    3.16 +    CT_ARCH_WITH_FLOAT=
    3.17 +}
     4.1 --- a/scripts/build/kernel/linux.sh	Tue Apr 13 22:54:57 2010 +0200
     4.2 +++ b/scripts/build/kernel/linux.sh	Wed Apr 07 09:18:20 2010 +0200
     4.3 @@ -6,7 +6,12 @@
     4.4      if [ "${CT_ARCH_USE_MMU}" = "y" ]; then
     4.5          CT_TARGET_KERNEL="linux"
     4.6      else
     4.7 -        CT_TARGET_KERNEL="uclinux"
     4.8 +    # Sometime, noMMU linux targets have a -uclinux tuple, while
     4.9 +    # sometime it's -linux. We currently have only one noMMU linux
    4.10 +    # target, and it uses -linux, so let's just use that. Time
    4.11 +    # to fix that later...
    4.12 +    #    CT_TARGET_KERNEL="uclinux"
    4.13 +        CT_TARGET_KERNEL="linux"
    4.14      fi
    4.15  }
    4.16  
     5.1 --- a/scripts/build/libc/uClibc.sh	Tue Apr 13 22:54:57 2010 +0200
     5.2 +++ b/scripts/build/libc/uClibc.sh	Wed Apr 07 09:18:20 2010 +0200
     5.3 @@ -190,11 +190,12 @@
     5.4  
     5.5      # Hack our target in the config file.
     5.6      case "${CT_ARCH}:${CT_ARCH_BITNESS}" in
     5.7 -        x86:32)     arch=i386;;
     5.8 -        x86:64)     arch=x86_64;;
     5.9 -        sh:32)      arch="sh";;
    5.10 -        sh:64)      arch="sh64";;
    5.11 -        *)          arch="${CT_ARCH}";;
    5.12 +        x86:32)      arch=i386;;
    5.13 +        x86:64)      arch=x86_64;;
    5.14 +        sh:32)       arch="sh";;
    5.15 +        sh:64)       arch="sh64";;
    5.16 +        blackfin:32) arch="bfin";;
    5.17 +        *)           arch="${CT_ARCH}";;
    5.18      esac
    5.19      # Also remove stripping: its the responsibility of the
    5.20      # firmware builder to strip or not.