Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit ea2108d

Browse files
authored
Merge pull request #195 from mythi/esdk
esdk: build and test eSDK installers
2 parents ce11d12 + e846f89 commit ea2108d

12 files changed

Lines changed: 134 additions & 17 deletions

File tree

doc/howtos/image-configuration.rst

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
Configuring IoT Refkit images
2+
#############################
3+
4+
Many packages in IoT Refkit come with a default set of configuration
5+
files. This document gives guidance for configuring a Refkit image with
6+
custom package configuration files.
7+
8+
Using .bbappend files to override package configuration
9+
=======================================================
10+
11+
If you have only a limited set of packages which you need to configure,
12+
you can create ``.bbappend`` files which append the recipes for each
13+
package which you want to modify. A usual way to change the
14+
configuration is to change the install phase to replace or remove the
15+
default configuration files.
16+
17+
You can add the ``.bbappend`` files to your own customization layer and
18+
use ``do_install_append()`` for modifying package configuration.
19+
20+
.. code::
21+
22+
do_install_append () {
23+
install -d ${D}${sysconfdir}
24+
echo "some configuration" > ${D}${sysconfdir}/config_file
25+
...
26+
}
27+
28+
Using virtual packages
29+
======================
30+
31+
Some recipes in IoT Refkit and other Yocto layers have the configuration
32+
split into separate configuration packages. For example, see
33+
`nftables-settings-default recipe
34+
<../../meta-refkit-core/recipes-security/nftables-settings-default/nftables-settings-default_0.1.bb>`_.
35+
In these cases, if you want to replace the configuration fully, you can
36+
create your own configuration package (say ``nftables-settings-custom``)
37+
and just use it in place of the default configuration package.
38+
39+
Other recipes, where having a configuration package is mandatory, take
40+
this further and use ``VIRTUAL_RUNTIME`` convention to enforce that a
41+
configuration package will be installed to the target. For example,
42+
consider `groupcheck recipe
43+
<../../meta-refkit-core/recipes-security/groupcheck/groupcheck_git.bb>`_,
44+
which has the following lines:
45+
46+
.. code::
47+
48+
VIRTUAL-RUNTIME_groupcheck-settings ?= "groupcheck-settings-default"
49+
RDEPENDS_${PN} += "${VIRTUAL-RUNTIME_groupcheck-settings}"
50+
51+
If a configuration package (say ``groupcheck-settings-custom``) is made,
52+
it needs to be set to be the required configuration package. This is
53+
done by changing ``local.conf`` or other distro configuration file to
54+
override the particular ``VIRTUAL_RUNTIME`` variable:
55+
56+
.. code::
57+
58+
VIRTUAL-RUNTIME_groupcheck-settings = "groupcheck-settings-custom"
59+
60+
Image configuration during root filesystem creation
61+
===================================================
62+
63+
An alternative to configuring individual packages is the configuration
64+
of the entire image during rootfs creation. The image recipes can be
65+
appended as any other recipe. This is the correct approach if you have
66+
several files in different packges which you need to change or if you
67+
just want to keep the configuration changes in one place.
68+
69+
One practical way for implementing a certain configuration would be to
70+
add it as a ``.bbclass`` file, which would then be inherited by all
71+
images which require that configuration. For example, you can create
72+
``custom-config.bbclass`` file and add a Python task function to do the
73+
necessary configuration changes there:
74+
75+
.. code::
76+
77+
python change_image_configuration () {
78+
etcdir = oe.path.join(d.getVar("IMAGE_ROOTFS"), d.getVar("sysconfdir"))
79+
...
80+
}
81+
82+
ROOTFS_POSTPROCESS_COMMAND_prepend = "change_image_configuration;"
83+
84+
You can then inherit the class directly into your own image recipes.
85+
86+
A drawback of this method is that the image is changed after the
87+
packages are installed. This means that you can't use package-based
88+
methods for updating devices, but should instead use `an atomic update
89+
mechanism which treats the entire modified rootfs as a single entity
90+
<https://wiki.yoctoproject.org/wiki/System_Update>`_. Supported system
91+
update mechanisms IoT Refkit are documented in `system-update.rst
92+
<../system-update.rst>`_.

doc/introduction.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ By default the Reference Kit runs on Intel's `meta-intel BSP`_ platforms.
2727
.. _`meta-intel BSP`: https://www.yoctoproject.org/product/meta-intel-bsp-layer
2828

2929

30+
The `Yocto Project extensible software development kit`_ (eSDK) is comes
31+
pre-configured and pre-tested in Reference Kit repository but the users of
32+
it must build the SDK installer themselves. By default, the eSDK type is
33+
"minimal" which implies at least the ``SSTATE_MIRROR`` setting must be adjusted
34+
when building distributable eSDKs. For more documentation on how to customize and
35+
re-configure the eSDK, see the "Appendig B. Customizing the Extensible SDK"
36+
in the `Yocto Project extensible software development kit`_ manual.
37+
38+
.. _`Yocto Project extensive software development kit`: http://www.yoctoproject.org/docs/latest/sdk-manual/sdk-manual.html
3039
.. _`Yocto Project release cadence`: https://wiki.yoctoproject.org/wiki/Planning#Roadmaps_and_Schedules
3140
.. _`Yocto Project Bugzilla`: https://bugzilla.yoctoproject.org/
3241
.. _`Yocto Project git`: http://git.yoctoproject.org/

docker/build-common-util.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,9 @@ INHERIT += "buildhistory-extra"
6363
BUILDHISTORY_DIR ?= "${BUILDHISTORY_TMP}"
6464
EOF
6565
}
66+
67+
auto_conf_testsdk() {
68+
cat >> conf/auto.conf << EOF
69+
INHERIT += "testsdk"
70+
EOF
71+
}

docker/post-build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ set -u
2828
# create auto.conf using functions in build-common-util.sh
2929
auto_conf_common
3030

31+
auto_conf_testsdk
32+
3133
# post-build testing builds images but only .wic is sufficient
3234
# (default in IMAGE_FSTYPES). We skip compression and bmap formats
3335
# to optimize testing time
@@ -52,6 +54,12 @@ for target in linux-intel ${_images}; do
5254
fi
5355
done
5456

57+
_esdks=""
58+
for esdk in `grep REFKIT_CI_ESDK_TEST_TARGETS ${WORKSPACE}/refkit_ci_vars | perl -pe 's/.+="(.*)"/\1/g; s/[^ a-zA-Z0-9_-]//g'`; do
59+
_esdks="$_esdks ${esdk}:do_testsdkext"
60+
done
61+
bitbake ${_esdks}
62+
5563
_tests=`grep REFKIT_CI_POSTBUILD_SELFTESTS ${WORKSPACE}/refkit_ci_vars | perl -pe 's/.+="(.*)"/\1/g; s/[^ .a-zA-Z0-9_-]//g'`
5664
if [ -n "$_tests" ]; then
5765
oe-selftest --run-tests ${_tests}

docker/publish-project.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ if [ -d ${_DEPL}/swupd/${TARGET_MACHINE} ]; then
8282
fi
8383

8484
if [ -d ${_DEPL}/sdk ]; then
85-
# run eSDK publish script with destination set to sdk-data/TARGET_MACHINE/
86-
# script name is dynamic, used via wildard. NB! works while there is only one sdk/*-toolchain-ext*.sh
87-
${WORKSPACE}/openembedded-core/scripts/oe-publish-sdk ${_DEPL}/sdk/*-toolchain-ext*.sh ${_DEPL}/sdk-data/${TARGET_MACHINE}/
8885
# publish installer .sh file to sdk/
8986
create_remote_dirs ${_RSYNC_DEST} sdk/${TARGET_MACHINE}
9087
rsync -av ${_DEPL}/sdk/*.sh ${_RSYNC_DEST}/sdk/${TARGET_MACHINE}/

meta-intel

Submodule meta-intel updated from 86c55b1 to cebe15d

meta-refkit-core/bbappends/openembedded-core/meta/recipes-devtools/python/python3_%.bbappend

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ require refkit-python.inc
22

33
# This is a temporary solution until OE-core upstream supports alternatives for python
44
inherit ${@bb.utils.contains('DISTRO_FEATURES', 'refkit-config', 'update-alternatives', '', d)}
5-
ALTERNATIVE_PRIORITY_df-refkit-config = "80"
6-
ALTERNATIVE_${PN}-core_df-refkit-config = "python python_config"
5+
ALTERNATIVE_PRIORITY_df-refkit-config_class-target = "80"
6+
ALTERNATIVE_${PN}-core_df-refkit-config_class-target = "python python_config"
77

88
python () {
9-
if bb.utils.contains('DISTRO_FEATURES', 'refkit-config', True, False, d):
9+
if bb.utils.contains('DISTRO_FEATURES', 'refkit-config', True, False, d) and not d.getVar('PN').startswith('nativesdk-'):
1010
d.setVarFlag('ALTERNATIVE_LINK_NAME', 'python', d.getVar('bindir') + '/python')
1111
d.setVarFlag('ALTERNATIVE_LINK_NAME', 'python_config', d.getVar('bindir') + '/python-config')
1212
d.setVarFlag('ALTERNATIVE_TARGET', 'python', d.getVar('bindir') + '/python3')

meta-refkit-core/bbappends/openembedded-core/meta/recipes-devtools/python/python_%.bbappend

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ require refkit-python.inc
22

33
# This is a temporary solution until OE-core upstream supports alternatives for python
44
inherit ${@bb.utils.contains('DISTRO_FEATURES', 'refkit-config', 'update-alternatives', '', d)}
5-
ALTERNATIVE_PRIORITY_df-refkit-config = "100"
6-
ALTERNATIVE_${PN}-core_df-refkit-config = "python python_config"
5+
ALTERNATIVE_PRIORITY_df-refkit-config_class-target = "100"
6+
ALTERNATIVE_${PN}-core_df-refkit-config_class-target = "python python_config"
77

88
python () {
9-
if bb.utils.contains('DISTRO_FEATURES', 'refkit-config', True, False, d):
9+
if bb.utils.contains('DISTRO_FEATURES', 'refkit-config', True, False, d) and not d.getVar('PN').startswith('nativesdk-'):
1010
d.setVarFlag('ALTERNATIVE_LINK_NAME', 'python', d.getVar('bindir') + '/python')
1111
d.setVarFlag('ALTERNATIVE_LINK_NAME', 'python_config', d.getVar('bindir') + '/python-config')
1212
}

meta-refkit-core/bbappends/openembedded-core/meta/recipes-devtools/python/refkit-python.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# have this configurable, here it only depends on the "refkit-config"
44
# distro feature.
55
DEPENDS_remove_df-refkit-config = "readline gdbm db"
6+
DEPENDS_append_df-refkit-config = "ncurses"
67
PACKAGES_remove_df-refkit-config = "${PN}-readline ${PN}-gdbm ${PN}-db"
78
PROVIDES_remove_df-refkit-config = "${PN}-readline ${PN}-gdbm ${PN}-db"
89
RRECOMMENDS_${PN}-core_remove_df-refkit-config = "${PN}-readline"

meta-refkit-core/conf/distro/include/usrmerge.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ export base_libdir = "${base_prefix}/usr/${baselib}"
88
export nonarch_base_libdir = "${base_prefix}/usr/lib"
99

1010
#nativesdk
11-
base_bindir_nativesdk = "${bindir_nativesdk}"
12-
base_sbindir_nativesdk = "${sbindir_nativesdk}"
13-
base_libdir_nativesdk = "${libdir_nativesdk}"
11+
base_bindir_class-nativesdk = "${SDKPATHNATIVE}${base_bindir_nativesdk}"
12+
base_sbindir_class-nativesdk = "${SDKPATHNATIVE}${base_sbindir_nativesdk}"
13+
base_libdir_class-nativesdk = "${SDKPATHNATIVE}${base_libdir_nativesdk}"
1414

1515
target_base_libdir_class-cross = "${target_base_prefix}/usr/lib"
1616

0 commit comments

Comments
 (0)