angstrom: prefer the git version of tslib
[openembedded.git] / classes / kernel-arch.bbclass
blobaefb5dbb2577f0ddbbd34fffb1053a662800e574
2 # set the ARCH environment variable for kernel compilation (including
3 # modules). return value must match one of the architecture directories
4 # in the kernel source "arch" directory
7 valid_archs = "alpha cris ia64 \
8                x86_64 i386 x86 \
9                m68knommu m68k ppc powerpc ppc64 powerpc64 \
10                sparc sparc64 \
11                arm  arm26 \
12                m32r mips \
13                nios2 \
14                sh sh64 um h8300   \
15                parisc s390  v850 \
16                avr32 blackfin"
18 def map_kernel_arch(a, d):
19         import re
21         valid_archs = bb.data.getVar('valid_archs', d, 1).split()
23         if   re.match('(i.86|athlon)$', a):     return 'i386'
24         elif re.match('arm26$', a):             return 'arm26'
25         elif re.match('armeb$', a):             return 'arm'
26         elif re.match('mips(el|64|64el)$', a):  return 'mips'
27         elif re.match('sh(3|4)$', a):           return 'sh'
28         elif re.match('bfin', a):               return 'blackfin'
29         elif re.match('(p|owerpc)64$', a):      return 'powerpc'
30         elif a in valid_archs:                  return a
31         else:
32                 bb.error("cannot map '%s' to a linux kernel architecture" % a)
34 export ARCH = "${@map_kernel_arch(bb.data.getVar('TARGET_ARCH', d, 1), d)}"
36 def map_uboot_arch(a, d):
37         import re
39         if   re.match('(powerpc|ppc)(|64)$', a): return 'ppc'
40         elif re.match('i.86$', a): return 'x86'
41         return a
43 export UBOOT_ARCH = "${@map_uboot_arch(bb.data.getVar('ARCH', d, 1), d)}"