diff options
Diffstat (limited to 'meta/classes/kernel-arch.bbclass')
-rw-r--r-- | meta/classes/kernel-arch.bbclass | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/meta/classes/kernel-arch.bbclass b/meta/classes/kernel-arch.bbclass new file mode 100644 index 0000000000..92a6c982fb --- /dev/null +++ b/meta/classes/kernel-arch.bbclass | |||
@@ -0,0 +1,26 @@ | |||
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 m68knommu ppc sh \ | ||
8 | sparc64 x86_64 arm h8300 m32r mips \ | ||
9 | ppc64 sh64 um arm26 i386 m68k \ | ||
10 | parisc s390 sparc v850" | ||
11 | |||
12 | def map_kernel_arch(a, d): | ||
13 | import bb, re | ||
14 | |||
15 | valid_archs = bb.data.getVar('valid_archs', d, 1).split() | ||
16 | |||
17 | if re.match('(i.86|athlon)$', a): return 'i386' | ||
18 | elif re.match('arm26$', a): return 'arm26' | ||
19 | elif re.match('armeb$', a): return 'arm' | ||
20 | elif re.match('powerpc$', a): return 'ppc' | ||
21 | elif re.match('mipsel$', a): return 'mips' | ||
22 | elif a in valid_archs: return a | ||
23 | else: | ||
24 | bb.error("cannot map '%s' to a linux kernel architecture" % a) | ||
25 | |||
26 | export ARCH = "${@map_kernel_arch(bb.data.getVar('TARGET_ARCH', d, 1), d)}" | ||