summaryrefslogtreecommitdiffstats
path: root/meta/classes/linuxloader.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-22 14:49:52 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-23 17:58:59 +0100
commit516697bed676a4567a4ff93022b9ac592648619a (patch)
tree56225b5efd37255636d4180bd18743335d7478a1 /meta/classes/linuxloader.bbclass
parent7b23f6124bf40c8c9beb4a46b1477728c90d65ab (diff)
downloadpoky-516697bed676a4567a4ff93022b9ac592648619a.tar.gz
linuxloader: Convert to python function
We could do with one decent general purpose python function to query the path to the dynamic loader. Convert the shell code into python. Also correct baremetal to return "None", not musl loaders. (From OE-Core rev: 73fab4ede12d8ae31be72b5cb4ab29d7ef7dae17) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/linuxloader.bbclass')
-rw-r--r--meta/classes/linuxloader.bbclass112
1 files changed, 45 insertions, 67 deletions
diff --git a/meta/classes/linuxloader.bbclass b/meta/classes/linuxloader.bbclass
index 8f30eb32e7..e1364a4e55 100644
--- a/meta/classes/linuxloader.bbclass
+++ b/meta/classes/linuxloader.bbclass
@@ -1,70 +1,48 @@
1LDSO_TCLIBC = "glibc" 1def get_linuxloader(d):
2LDSO_TCLIBC_libc-musl = "musl" 2 import re
3LDSO_TCLIBC_libc-baremetal = "musl"
4 3
5linuxloader_glibc () { 4 targetarch = d.getVar("TARGET_ARCH")
6 case ${TARGET_ARCH} in 5 overrides = d.getVar("OVERRIDES").split(":")
7 powerpc | microblaze )
8 dynamic_loader="${base_libdir}/ld.so.1"
9 ;;
10 mipsisa32r6el | mipsisa32r6 | mipsisa64r6el | mipsisa64r6)
11 dynamic_loader="${base_libdir}/ld-linux-mipsn8.so.1"
12 ;;
13 mips* )
14 dynamic_loader="${base_libdir}/ld.so.1"
15 ;;
16 powerpc64)
17 dynamic_loader="${base_libdir}/ld64.so.1"
18 ;;
19 x86_64)
20 dynamic_loader="${base_libdir}/ld-linux-x86-64.so.2"
21 ;;
22 i*86 )
23 dynamic_loader="${base_libdir}/ld-linux.so.2"
24 ;;
25 arm )
26 dynamic_loader="${base_libdir}/ld-linux.so.3"
27 ;;
28 * )
29 dynamic_loader="/unknown_dynamic_linker"
30 ;;
31 esac
32 echo $dynamic_loader
33}
34 6
35linuxloader_musl () { 7 # No loader for baremetal
36 case ${TARGET_ARCH} in 8 if "libc-baremetal" in overrides:
37 microblaze* ) 9 return None
38 dynamic_loader="${base_libdir}/ld-musl-microblaze${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'el' ,d)}.so.1" 10
39 ;; 11 dynamic_loader = None
40 mips* ) 12 if "libc-musl" in overrides:
41 dynamic_loader="${base_libdir}/ld-musl-mips${ABIEXTENSION}${MIPSPKGSFX_BYTE}${MIPSPKGSFX_R6}${MIPSPKGSFX_ENDIAN}${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}.so.1" 13 if targetarch.startswith("microblaze"):
42 ;; 14 dynamic_loader = "${base_libdir}/ld-musl-microblaze${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'el' ,d)}.so.1"
43 powerpc ) 15 elif targetarch.startswith("mips"):
44 dynamic_loader="${base_libdir}/ld-musl-powerpc${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}.so.1" 16 dynamic_loader = "${base_libdir}/ld-musl-mips${ABIEXTENSION}${MIPSPKGSFX_BYTE}${MIPSPKGSFX_R6}${MIPSPKGSFX_ENDIAN}${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}.so.1"
45 ;; 17 elif targetarch == "powerpc":
46 powerpc64 ) 18 dynamic_loader = "${base_libdir}/ld-musl-powerpc${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}.so.1"
47 dynamic_loader="${base_libdir}/ld-musl-powerpc64.so.1" 19 elif targetarch == "powerpc64":
48 ;; 20 dynamic_loader = "${base_libdir}/ld-musl-powerpc64.so.1"
49 x86_64 ) 21 elif targetarch == "x86_64":
50 dynamic_loader="${base_libdir}/ld-musl-x86_64.so.1" 22 dynamic_loader = "${base_libdir}/ld-musl-x86_64.so.1"
51 ;; 23 elif re.search("i.86", targetarch):
52 i*86 ) 24 dynamic_loader = "${base_libdir}/ld-musl-i386.so.1"
53 dynamic_loader="${base_libdir}/ld-musl-i386.so.1" 25 elif targetarch.startswith("arm"):
54 ;; 26 dynamic_loader = "${base_libdir}/ld-musl-arm${ARMPKGSFX_ENDIAN}${ARMPKGSFX_EABI}.so.1"
55 arm* ) 27 elif targetarch.startswith("aarch64"):
56 dynamic_loader="${base_libdir}/ld-musl-arm${ARMPKGSFX_ENDIAN}${ARMPKGSFX_EABI}.so.1" 28 dynamic_loader = "${base_libdir}/ld-musl-aarch64${ARMPKGSFX_ENDIAN_64}.so.1"
57 ;; 29 else:
58 aarch64* ) 30 # glibc
59 dynamic_loader="${base_libdir}/ld-musl-aarch64${ARMPKGSFX_ENDIAN_64}.so.1" 31 if targetarch in ["powerpc", "microblaze"]:
60 ;; 32 dynamic_loader = "${base_libdir}/ld.so.1"
61 * ) 33 elif targetarch in ["mipsisa32r6el", "mipsisa32r6", "mipsisa64r6el", "mipsisa64r6"]:
62 dynamic_loader="/unknown_dynamic_linker" 34 dynamic_loader = "${base_libdir}/ld-linux-mipsn8.so.1"
63 ;; 35 elif targetarch.startswith("mips"):
64 esac 36 dynamic_loader = "${base_libdir}/ld.so.1"
65 echo $dynamic_loader 37 elif targetarch == "powerpc64":
66} 38 dynamic_loader = "${base_libdir}/ld64.so.1"
39 elif targetarch == "x86_64":
40 dynamic_loader = "${base_libdir}/ld-linux-x86-64.so.2"
41 elif re.search("i.86", targetarch):
42 dynamic_loader = "${base_libdir}/ld-linux.so.2"
43 elif targetarch == "arm":
44 dynamic_loader = "${base_libdir}/ld-linux.so.3"
45
46 return dynamic_loader
47get_linuxloader[vardepvalue] = "${@get_linuxloader(d)}"
67 48
68linuxloader () {
69 linuxloader_${LDSO_TCLIBC}
70}