diff options
Diffstat (limited to 'meta/classes/populate_sdk_base.bbclass')
-rw-r--r-- | meta/classes/populate_sdk_base.bbclass | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass new file mode 100644 index 0000000000..a3bf8c2e09 --- /dev/null +++ b/meta/classes/populate_sdk_base.bbclass | |||
@@ -0,0 +1,89 @@ | |||
1 | inherit meta toolchain-scripts | ||
2 | inherit populate_sdk_${IMAGE_PKGTYPE} | ||
3 | |||
4 | SDK_DIR = "${WORKDIR}/sdk" | ||
5 | SDK_OUTPUT = "${SDK_DIR}/image" | ||
6 | SDK_DEPLOY = "${TMPDIR}/deploy/sdk" | ||
7 | |||
8 | SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${MULTIMACH_TARGET_SYS}" | ||
9 | |||
10 | TOOLCHAIN_HOST_TASK ?= "task-sdk-host-nativesdk task-cross-canadian-${TRANSLATED_TARGET_ARCH}" | ||
11 | TOOLCHAIN_TARGET_TASK ?= "task-core-standalone-sdk-target task-core-standalone-sdk-target-dbg" | ||
12 | TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${DISTRO_VERSION}" | ||
13 | |||
14 | RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" | ||
15 | DEPENDS = "virtual/fakeroot-native sed-native" | ||
16 | |||
17 | PID = "${@os.getpid()}" | ||
18 | |||
19 | EXCLUDE_FROM_WORLD = "1" | ||
20 | |||
21 | python () { | ||
22 | # If we don't do this we try and run the mapping hooks while parsing which is slow | ||
23 | # bitbake should really provide something to let us know this... | ||
24 | if bb.data.getVar('BB_WORKERCONTEXT', d, True) is not None: | ||
25 | runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", d) | ||
26 | } | ||
27 | |||
28 | fakeroot do_populate_sdk() { | ||
29 | rm -rf ${SDK_OUTPUT} | ||
30 | mkdir -p ${SDK_OUTPUT} | ||
31 | |||
32 | # populate_sdk_<image> is required to construct two images: | ||
33 | # SDK_ARCH-nativesdk - contains the cross compiler and associated tooling | ||
34 | # target - contains a target rootfs configured for the SDK usage | ||
35 | # | ||
36 | # the output of populate_sdk_<image> should end up in ${SDK_OUTPUT} it is made | ||
37 | # up of: | ||
38 | # ${SDK_OUTPUT}/<sdk_arch-nativesdk pkgs> | ||
39 | # ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/<target pkgs> | ||
40 | |||
41 | populate_sdk_${IMAGE_PKGTYPE} | ||
42 | |||
43 | # Don't ship any libGL in the SDK | ||
44 | rm -rf ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/libGL* | ||
45 | |||
46 | # Can copy pstage files here | ||
47 | # target_pkgs=`cat ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/var/lib/opkg/status | grep Package: | cut -f 2 -d ' '` | ||
48 | |||
49 | # Fix or remove broken .la files | ||
50 | #rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}/lib/*.la | ||
51 | rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/*.la | ||
52 | |||
53 | # Link the ld.so.cache file into the hosts filesystem | ||
54 | ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache | ||
55 | |||
56 | # Setup site file for external use | ||
57 | toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${MULTIMACH_TARGET_SYS} | ||
58 | |||
59 | toolchain_create_sdk_env_script | ||
60 | |||
61 | # Add version information | ||
62 | toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS} | ||
63 | |||
64 | # Package it up | ||
65 | mkdir -p ${SDK_DEPLOY} | ||
66 | cd ${SDK_OUTPUT} | ||
67 | tar --owner=root --group=root -cj --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 . | ||
68 | } | ||
69 | |||
70 | populate_sdk_log_check() { | ||
71 | for target in $* | ||
72 | do | ||
73 | lf_path="`dirname ${BB_LOGFILE}`/log.do_$target.${PID}" | ||
74 | |||
75 | echo "log_check: Using $lf_path as logfile" | ||
76 | |||
77 | if test -e "$lf_path" | ||
78 | then | ||
79 | ${IMAGE_PKGTYPE}_log_check $target $lf_path | ||
80 | else | ||
81 | echo "Cannot find logfile [$lf_path]" | ||
82 | fi | ||
83 | echo "Logfile is clean" | ||
84 | done | ||
85 | } | ||
86 | |||
87 | do_populate_sdk[nostamp] = "1" | ||
88 | do_populate_sdk[recrdeptask] = "do_package_write" | ||
89 | addtask populate_sdk | ||