9351187fe182c1d83626d700368b95114189548b
[openembedded.git] / conf / distro / include / sane-toolchain.inc
1 # Originally brought to you by the Angstrom Distribution
2
3 #############################################################################
4 # TOOLCHAIN VERSION SETTINGS
5 #############################################################################
6
7 # Base line versions, good for most things
8 PREFERRED_GCC_VERSION                ?= "4.4.1"
9 PREFERRED_BINUTILS                   ?= "2.19.51"
10
11 # Prefer glibc 2.6 and uclibc 0.9.30, these have had the most testing.
12 PREFERRED_VERSION_glibc             ?= "2.6.1"
13 PREFERRED_VERSION_glibc-initial     ?= "2.6.1"
14 PREFERRED_VERSION_eglibc             ?= "2.10"
15 PREFERRED_VERSION_eglibc-initial     ?= "2.10"
16 PREFERRED_VERSION_uclibc            ?= "0.9.30.1"
17 PREFERRED_VERSION_uclibc-initial    ?= "0.9.30.1"
18
19 # Some systems need a special gcc version
20 PREFERRED_GCC_VERSION_486sx          ?= "4.3.2"
21 PREFERRED_GCC_VERSION_avr32          ?= "4.2.2"
22 PREFERRED_GCC_VERSION_armv7a         ?= "4.4.1" 
23 PREFERRED_GCC_VERSION_bfin           ?= "4.1.2"
24 PREFERRED_GCC_VERSION_ppc405         ?= "4.4.1"
25 PREFERRED_GCC_VERSION_xilinx-ml403   ?= "4.1.1"
26 PREFERRED_GCC_VERSION_xilinx-ml403   ?= "4.1.1"
27
28 # This is unrelated to the kernel version, but userspace apps (e.g. HAL) require a recent version to build against
29 PREFERRED_VERSION_linux-libc-headers ?= "2.6.23"
30
31 # Uncomment this if want need to build an armv7a kernel with CSL toolchain (<2.6.27 don't boot with mainline gcc)
32 #KERNEL_CCSUFFIX_armv7a= "-4.2.1+csl-arm-2007q3-53"
33
34 # Binutils
35 PREFERRED_VERSION_binutils           ?= "${PREFERRED_BINUTILS}"
36 PREFERRED_VERSION_binutils-cross     ?= "${PREFERRED_BINUTILS}"
37 PREFERRED_VERSION_binutils-cross-sdk ?= "${PREFERRED_BINUTILS}"
38
39 # Avr32 only has patches for binutils 2.17 in OE
40 PREFERRED_VERSION_binutils_avr32 =           "2.17"
41 PREFERRED_VERSION_binutils-cross_avr32 =     "2.17"
42 PREFERRED_VERSION_binutils-cross-sdk_avr32 = "2.17"
43
44 # Compiler versions
45 PREFERRED_VERSION_gcc                    ?= "${PREFERRED_GCC_VERSION}"
46 PREFERRED_VERSION_gcc-cross              ?= "${PREFERRED_GCC_VERSION}"
47 PREFERRED_VERSION_gcc-cross-sdk          ?= "${PREFERRED_GCC_VERSION}"
48 PREFERRED_VERSION_gcc-cross-initial      ?= "${PREFERRED_GCC_VERSION}"
49 PREFERRED_VERSION_gcc-cross-intermediate ?= "${PREFERRED_GCC_VERSION}"
50
51 # Compiler selection
52 PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils         = "binutils-cross"
53 PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial      = "gcc-cross-initial"
54 PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-intermediate = "gcc-cross-intermediate"
55 PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc              = "gcc-cross"
56 PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++              = "gcc-cross"
57
58 # Others
59 PREFERRED_PROVIDER_linux-libc-headers = "linux-libc-headers"
60
61 #############################################################################
62 # TOOLCHAIN CUSTOMIZATION
63 #############################################################################
64
65 # Branding
66 TARGET_VENDOR = "-oe"
67
68 # Add FEED_ARCH to the overrides list so that we can override the
69 # ARM_INSTRUCTION_SET like below
70
71 OVERRIDES .= ":${FEED_ARCH}"
72
73 # ARM920T and up can use thumb mode to decrease binary size at the expense of speed
74 # (the complete story is a bit more nuanced due to cache starvation)
75 # Minimal turns on thumb for armv4t machine according to this RFC:
76 # http://lists.linuxtogo.org/pipermail/angstrom-distro-devel/2008-October/002714.html
77
78 # We can't set ARM_INSTRUCTION_SET_<override> directly since that will un-overridable in recipes like gcc
79 PREFERRED_ARM_INSTRUCTION_SET_armv4t   = "thumb"
80 PREFERRED_ARM_INSTRUCTION_SET_armv5te  = "thumb"
81 PREFERRED_ARM_INSTRUCTION_SET_armv5teb = "thumb"
82 PREFERRED_ARM_INSTRUCTION_SET         ?=  "arm"
83 ARM_INSTRUCTION_SET = "${PREFERRED_ARM_INSTRUCTION_SET}"
84 # "arm" "thumb"
85 #    The instruction set the compiler should use when generating application
86 #    code.  The kernel is always compiled with arm code at present.  arm code
87 #    is the original 32 bit ARM instruction set, thumb code is the 16 bit
88 #    encoded RISC sub-set.  Thumb code is smaller (maybe 70% of the ARM size)
89 #    but requires more instructions (140% for 70% smaller code) so may be
90 #    slower.
91
92 THUMB_INTERWORK = "yes"
93 # "yes" "no"
94 #    Whether to compile with code to allow interworking between the two
95 #    instruction sets.  This allows thumb code to be executed on a primarily
96 #    arm system and vice versa.  It is strongly recommended that DISTROs not
97 #    turn this off - the actual cost is very small.
98
99 # We don't want to keep OABI compat
100 ARM_KEEP_OABI = "0"
101
102 # ARM EABI is softfloat by default, but let's make sure :)
103 # make it overridable for platforms with FPU, like ep93xx or i.mx31
104 TARGET_FPU_arm ?= "soft"
105 TARGET_FPU_armeb ?= "soft"
106 TARGET_FPU_ixp4xx ?= "soft"
107 TARGET_FPU_ppc405 ?= "soft"
108
109 TARGET_FPU_armv6 ?= "hard"
110 TARGET_FPU_armv6-novfp ?= "soft"
111 TARGET_FPU_armv7a ?= "hard"
112 TARGET_FPU_ppc603e ?= "hard"
113
114 # webkit-gtk and cairo have alignment issues with double instructions on armv5 so
115 # disable them here. TODO: This knowledge should rather be encoded in the actual
116 # recipes!
117 TARGET_CC_ARCH_pn-webkit-gtk_armv5te = "-march=armv4t"
118 TARGET_CC_ARCH_pn-cairo_armv5te = "-march=armv4t"
119
120 #############################################################################
121 # C LIBRARY SETTINGS
122 #############################################################################
123
124 # Can be "glibc", "eglibc" or "uclibc"
125 LIBC ?= "eglibc"
126 require conf/distro/include/${LIBC}.inc
127 PSTAGE_EXTRAPATH = "${LIBC}"
128 require conf/distro/include/sane-toolchain-${LIBC}.inc
129
130 # Generate locales on the buildsystem instead of on the target. Speeds up first boot, set to "1" to enable
131 PREFERRED_PROVIDER_qemu-native = "qemu-native"
132 ENABLE_BINARY_LOCALE_GENERATION ?= "1"
133
134 # We only want to build UTF8 locales
135 LOCALE_UTF8_ONLY = "1"
136
137 # Qemu doesn't like armv6/eabi/vfp
138 ENABLE_BINARY_LOCALE_GENERATION_armv6 = "0"
139 ENABLE_BINARY_LOCALE_GENERATION_armv6-novfp = "0"
140 ENABLE_BINARY_LOCALE_GENERATION_armv7a = "0"
141
142 #qemu has taken a dislike to armeb as well
143 ENABLE_BINARY_LOCALE_GENERATION_armeb = "0"
144 def detect_arm_abi (d):
145         import bb
146         if bb.data.getVar('DISTRO_FEATURES',d) is None:
147                 if bb.data.getVar('TARGET_ARCH', d, 1) in [ 'arm', 'armeb' ]:
148                         return "oabi"
149                 else:
150                         return ""
151         if bb.data.getVar('TARGET_ARCH', d, 1) in [ 'arm', 'armeb' ]:          
152                 if 'eabi' in bb.data.getVar('DISTRO_FEATURES',d).split():
153                         return "eabi"
154                 return "oabi"
155         return ""
156
157 def compute_os_portion_of_target_triplet (d):
158         import bb
159         arm_eabi_supporting_arches = "armv6 armv6-novfp \
160         armv5te iwmmxt armv7a armv7 armv6 armv5teb armv4t"
161         ppc_spe_supporting_arches = "ppce500v2 ppce500"
162
163         if bb.data.getVar("LIBC", d, 1) == "uclibc":
164                 libc_suffix = "uclibc"
165         else:
166                 libc_suffix = "gnu"
167         
168         if bb.data.getVar('TARGET_ARCH',d,1) in ['bfin']:
169                 if libc_suffix == "gnu":
170                         bb.fatal("bfin is not supported on glibc/eglibc. Please choose uclibc")
171                 else:
172                         os_suffix = "uclinux"
173         else:
174                 os_suffix = "linux"
175         bparch = bb.data.getVar('BASE_PACKAGE_ARCH', d,1)
176
177         if bb.data.getVar('DISTRO_FEATURES',d,1) is not None and \
178         bparch is not None:
179                 if 'eabi' in bb.data.getVar('DISTRO_FEATURES',d,1).split() and \
180                 bb.data.getVar('TARGET_ARCH', d, 1) in [ 'arm', 'armeb' ]:
181                         if bparch not in arm_eabi_supporting_arches.split():
182                                 bb.fatal("DISTRO requested EABI but selected machine does not support EABI")
183                                 abi_suffix = ""
184                         else:
185                                 abi_suffix = "eabi"
186                 elif bparch in ppc_spe_supporting_arches.split():
187                         abi_suffix = "spe"
188                 else:
189                         abi_suffix = ""
190         else:
191                 bb.note("DISTRO_FEATURES is not set abi suffix not set")
192                 abi_suffix = ""
193         return os_suffix + "-" + libc_suffix + abi_suffix
194
195 # This is needed to get a correct PACKAGE_ARCH for packages that have PACKAGE_ARCH = ${MACHINE_ARCH}
196 ARM_ABI = "${@detect_arm_abi(d)}"
197 TARGET_OS = "${@compute_os_portion_of_target_triplet(d)}"
198 include conf/distro/include/sane-toolchain-${ARM_ABI}.inc