summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/image.bbclass2
-rw-r--r--meta/classes/populate_sdk_ext.bbclass217
-rw-r--r--meta/recipes-core/meta/meta-environment-extsdk.bb12
3 files changed, 230 insertions, 1 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 893eb40898..89eb5f378e 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -1,6 +1,6 @@
1inherit rootfs_${IMAGE_PKGTYPE} 1inherit rootfs_${IMAGE_PKGTYPE}
2 2
3inherit populate_sdk_base 3inherit populate_sdk_ext
4 4
5TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}" 5TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}"
6TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY}" 6TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY}"
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
new file mode 100644
index 0000000000..ec1cff0658
--- /dev/null
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -0,0 +1,217 @@
1# Extensible SDK
2
3inherit populate_sdk_base
4
5# NOTE: normally you cannot use task overrides for this kind of thing - this
6# only works because of get_sdk_ext_rdepends()
7
8TOOLCHAIN_HOST_TASK_task-populate-sdk-ext = " \
9 meta-environment-extsdk-${MACHINE} \
10 "
11
12TOOLCHAIN_TARGET_TASK_task-populate-sdk-ext = ""
13
14SDK_RDEPENDS_append_task-populate-sdk-ext = " ${SDK_TARGETS}"
15
16SDK_RELOCATE_AFTER_INSTALL_task-populate-sdk-ext = "0"
17
18SDK_META_CONF_WHITELIST ?= "MACHINE DISTRO PACKAGE_CLASSES"
19
20SDK_TARGETS ?= "${PN}"
21OE_INIT_ENV_SCRIPT ?= "oe-init-build-env"
22
23# The files from COREBASE that you want preserved in the COREBASE copied
24# into the sdk. This allows someone to have their own setup scripts in
25# COREBASE be preserved as well as untracked files.
26COREBASE_FILES ?= " \
27 oe-init-build-env \
28 oe-init-build-env-memres \
29 scripts \
30 LICENSE \
31 .templateconf \
32"
33
34SDK_DIR_task-populate-sdk-ext = "${WORKDIR}/sdk-ext"
35B_task-populate-sdk-ext = "${SDK_DIR}"
36TOOLCHAIN_OUTPUTNAME_task-populate-sdk-ext = "${SDK_NAME}-toolchain-ext-${SDK_VERSION}"
37
38python copy_buildsystem () {
39 import re
40 import oe.copy_buildsystem
41
42 oe_init_env_script = d.getVar('OE_INIT_ENV_SCRIPT', True)
43
44 conf_bbpath = ''
45 conf_initpath = ''
46 core_meta_subdir = ''
47
48 # Copy in all metadata layers + bitbake (as repositories)
49 buildsystem = oe.copy_buildsystem.BuildSystem(d)
50 baseoutpath = d.getVar('SDK_OUTPUT', True) + '/' + d.getVar('SDKPATH', True)
51 layers_copied = buildsystem.copy_bitbake_and_layers(baseoutpath + '/layers')
52
53 sdkbblayers = []
54 corebase = os.path.basename(d.getVar('COREBASE', True))
55 for layer in layers_copied:
56 if corebase == os.path.basename(layer):
57 conf_bbpath = os.path.join('layers', layer, 'bitbake')
58 else:
59 sdkbblayers.append(layer)
60
61 for path in os.listdir(baseoutpath + '/layers'):
62 relpath = os.path.join('layers', path, oe_init_env_script)
63 if os.path.exists(os.path.join(baseoutpath, relpath)):
64 conf_initpath = relpath
65
66 relpath = os.path.join('layers', path, 'scripts', 'devtool')
67 if os.path.exists(os.path.join(baseoutpath, relpath)):
68 scriptrelpath = os.path.dirname(relpath)
69
70 relpath = os.path.join('layers', path, 'meta')
71 if os.path.exists(os.path.join(baseoutpath, relpath, 'lib', 'oe')):
72 core_meta_subdir = relpath
73
74 d.setVar('oe_init_build_env_path', conf_initpath)
75 d.setVar('scriptrelpath', scriptrelpath)
76
77 # Write out config file for devtool
78 import ConfigParser
79 config = ConfigParser.SafeConfigParser()
80 config.add_section('General')
81 config.set('General', 'bitbake_subdir', conf_bbpath)
82 config.set('General', 'init_path', conf_initpath)
83 config.set('General', 'core_meta_subdir', core_meta_subdir)
84 bb.utils.mkdirhier(os.path.join(baseoutpath, 'conf'))
85 with open(os.path.join(baseoutpath, 'conf', 'devtool.conf'), 'w') as f:
86 config.write(f)
87
88 # Create a layer for new recipes / appends
89 bb.process.run("devtool --basepath %s create-workspace --create-only %s" % (baseoutpath, os.path.join(baseoutpath, 'workspace')))
90
91 # Create bblayers.conf
92 bb.utils.mkdirhier(baseoutpath + '/conf')
93 with open(baseoutpath + '/conf/bblayers.conf', 'w') as f:
94 f.write('LCONF_VERSION = "%s"\n\n' % d.getVar('LCONF_VERSION'))
95 f.write('BBPATH = "$' + '{TOPDIR}"\n')
96 f.write('SDKBASEMETAPATH = "$' + '{TOPDIR}"\n')
97 f.write('BBLAYERS := " \\\n')
98 for layerrelpath in sdkbblayers:
99 f.write(' $' + '{SDKBASEMETAPATH}/layers/%s \\\n' % layerrelpath)
100 f.write(' $' + '{SDKBASEMETAPATH}/workspace \\\n')
101 f.write(' "\n')
102
103 # Create local.conf
104 with open(baseoutpath + '/conf/local.conf', 'w') as f:
105 f.write('INHERIT += "%s"\n\n' % 'uninative')
106 f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION'))
107
108 # This is a bit of a hack, but we really don't want these dependencies
109 # (we're including them in the SDK as nativesdk- versions instead)
110 f.write('POKYQEMUDEPS_forcevariable = ""\n\n')
111 f.write('EXTRA_IMAGEDEPENDS_remove = "qemu-native qemu-helper-native"\n\n')
112
113 # Another hack, but we want the native part of sstate to be kept the same
114 # regardless of the host distro
115 fixedlsbstring = 'SDK-Fixed'
116 f.write('NATIVELSBSTRING_forcevariable = "%s"\n\n' % fixedlsbstring)
117
118 # Ensure locked sstate cache objects are re-used without error
119 f.write('SIGGEN_LOCKEDSIGS_CHECK_LEVEL = "warn"\n\n')
120
121 for varname in d.getVar('SDK_META_CONF_WHITELIST', True).split():
122 f.write('%s = "%s"\n' % (varname, d.getVar(varname, True)))
123 f.write('require conf/locked-sigs.inc\n')
124 f.write('require conf/work-config.inc\n')
125
126 sigfile = d.getVar('WORKDIR', True) + '/locked-sigs.inc'
127 oe.copy_buildsystem.generate_locked_sigs(sigfile, d)
128
129 # Filter the locked signatures file to just the sstate tasks we are interested in
130 allowed_tasks = ['do_populate_lic', 'do_populate_sysroot', 'do_packagedata', 'do_package_write_ipk', 'do_package_write_rpm', 'do_package_write_deb', 'do_package_qa', 'do_deploy']
131 excluded_targets = d.getVar('SDK_TARGETS', True)
132 lockedsigs_pruned = baseoutpath + '/conf/locked-sigs.inc'
133 oe.copy_buildsystem.prune_lockedsigs(allowed_tasks,
134 excluded_targets,
135 sigfile,
136 lockedsigs_pruned)
137
138 sstate_out = baseoutpath + '/sstate-cache'
139 bb.utils.remove(sstate_out, True)
140 oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_pruned,
141 d.getVar('SSTATE_DIR', True),
142 sstate_out, d,
143 fixedlsbstring)
144
145 # Create a dummy config file for additional settings
146 with open(baseoutpath + '/conf/work-config.inc', 'w') as f:
147 pass
148}
149
150install_tools() {
151 install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}
152 ln -sr ${SDK_OUTPUT}/${SDKPATH}/${scriptrelpath}/devtool ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/devtool
153 ln -sr ${SDK_OUTPUT}/${SDKPATH}/${scriptrelpath}/recipetool ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/recipetool
154 touch ${SDK_OUTPUT}/${SDKPATH}/.devtoolbase
155
156 install ${SDK_DEPLOY}/${DISTRO}-${TCLIBC}-${SDK_ARCH}-buildtools-tarball-${TUNE_PKGARCH}-buildtools-nativesdk-standalone-${DISTRO_VERSION}.sh ${SDK_OUTPUT}/${SDKPATH}
157
158 install ${SDK_DEPLOY}/${BUILD_ARCH}-nativesdk-libc.tar.bz2 ${SDK_OUTPUT}/${SDKPATH}
159}
160
161# FIXME this preparation should be done as part of the SDK construction
162sdk_ext_postinst() {
163 printf "\nExtracting buildtools...\n"
164 cd $target_sdk_dir
165 printf "buildtools\ny" | ./*buildtools-tarball* > /dev/null
166
167 # Make sure when the user sets up the environment, they also get
168 # the buildtools-tarball tools in their path.
169 echo ". $target_sdk_dir/buildtools/environment-setup*" >> $target_sdk_dir/environment-setup*
170
171 # Allow bitbake environment setup to be ran as part of this sdk.
172 echo "export OE_SKIP_SDK_CHECK=1" >> $target_sdk_dir/environment-setup*
173
174 # A bit of another hack, but we need this in the path only for devtool
175 # so put it at the end of $PATH.
176 echo "export PATH=\$PATH:$target_sdk_dir/sysroots/${SDK_SYS}/${bindir_nativesdk}" >> $target_sdk_dir/environment-setup*
177
178 # For now this is where uninative.bbclass expects the tarball
179 mv *-nativesdk-libc.tar.* $target_sdk_dir/`dirname ${oe_init_build_env_path}`
180
181 printf "Preparing build system...\n"
182 # dash which is /bin/sh on Ubuntu will not preserve the
183 # current working directory when first ran, nor will it set $1 when
184 # sourcing a script. That is why this has to look so ugly.
185 sh -c ". buildtools/environment-setup* > /dev/null && cd $target_sdk_dir/`dirname ${oe_init_build_env_path}` && set $target_sdk_dir && . $target_sdk_dir/${oe_init_build_env_path} $target_sdk_dir > /dev/null && bitbake ${SDK_TARGETS} > /dev/null" || { echo "SDK preparation failed" ; exit 1 ; }
186 echo done
187}
188
189SDK_POST_INSTALL_COMMAND_task-populate-sdk-ext = "${sdk_ext_postinst}"
190
191SDK_POSTPROCESS_COMMAND_prepend_task-populate-sdk-ext = "copy_buildsystem; install_tools; "
192
193fakeroot python do_populate_sdk_ext() {
194 bb.build.exec_func("do_populate_sdk", d)
195}
196
197def get_sdk_ext_rdepends(d):
198 localdata = d.createCopy()
199 localdata.appendVar('OVERRIDES', ':task-populate-sdk-ext')
200 bb.data.update_data(localdata)
201 return localdata.getVarFlag('do_populate_sdk', 'rdepends', True)
202
203do_populate_sdk_ext[dirs] = "${@d.getVarFlag('do_populate_sdk', 'dirs', False)}"
204do_populate_sdk_ext[depends] += "${@d.getVarFlag('do_populate_sdk', 'depends', False)}"
205do_populate_sdk_ext[rdepends] = "${@get_sdk_ext_rdepends(d)}"
206do_populate_sdk_ext[recrdeptask] += "${@d.getVarFlag('do_populate_sdk', 'recrdeptask', False)}"
207
208
209do_populate_sdk_ext[depends] += "buildtools-tarball:do_populate_sdk uninative-tarball:do_populate_sdk"
210
211do_populate_sdk_ext[rdepends] += "${@' '.join([x + ':do_build' for x in d.getVar('SDK_TARGETS', True).split()])}"
212do_populate_sdk_ext[recrdeptask] += "do_populate_lic do_package_qa do_populate_sysroot do_deploy"
213
214# Make sure codes change in copy_buildsystem can result in rebuilt
215do_populate_sdk_ext[vardeps] += "copy_buildsystem"
216
217addtask populate_sdk_ext
diff --git a/meta/recipes-core/meta/meta-environment-extsdk.bb b/meta/recipes-core/meta/meta-environment-extsdk.bb
new file mode 100644
index 0000000000..d9e596143f
--- /dev/null
+++ b/meta/recipes-core/meta/meta-environment-extsdk.bb
@@ -0,0 +1,12 @@
1# meta-environment for extensible SDK
2
3require meta-environment.bb
4
5PN = "meta-environment-extsdk-${MACHINE}"
6
7create_sdk_files_append() {
8 local sysroot=${SDKPATH}/${@os.path.relpath(d.getVar('STAGING_DIR_TARGET', True), d.getVar('TOPDIR', True))}
9 local sdkpathnative=${SDKPATH}/${@os.path.relpath(d.getVar('STAGING_DIR_NATIVE',True), d.getVar('TOPDIR', True))}
10
11 toolchain_create_sdk_env_script '' '' $sysroot '' ${bindir_native} ${prefix_native} $sdkpathnative
12}