merge of '17cf14623c223d8cb74b50235967b61c1e9945f7'
[openembedded.git] / classes / kernel-arch.bbclass
1 #
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
5 #
6
7 valid_archs = "alpha cris ia64 \
8                x86_64 i386 x86 \
9                m68knommu m68k ppc powerpc ppc64  \
10                sparc sparc64 \
11                arm  arm26 \
12                m32r mips \
13                sh sh64 um h8300   \
14                parisc s390  v850 \
15                avr32 blackfin"
16
17 def map_kernel_arch(a, d):
18         import bb, re
19
20         valid_archs = bb.data.getVar('valid_archs', d, 1).split()
21
22         if   re.match('(i.86|athlon)$', a):     return 'i386'
23         elif re.match('arm26$', a):             return 'arm26'
24         elif re.match('armeb$', a):             return 'arm'
25         elif re.match('mipsel$', a):            return 'mips'
26         elif re.match('sh(3|4)$', a):           return 'sh'
27         elif re.match('bfin', a):               return 'blackfin'
28         elif a in valid_archs:                  return a
29         else:
30                 bb.error("cannot map '%s' to a linux kernel architecture" % a)
31
32 export ARCH = "${@map_kernel_arch(bb.data.getVar('TARGET_ARCH', d, 1), d)}"
33
34 def map_uboot_arch(a, d):
35         if a == "powerpc":
36                 return "ppc"
37         return a
38
39 export UBOOT_ARCH = "${@map_uboot_arch(bb.data.getVar('ARCH', d, 1), d)}"
40