summaryrefslogtreecommitdiffstats
path: root/recipes-sota/aktualizr/aktualizr_git.bb
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-sota/aktualizr/aktualizr_git.bb')
-rwxr-xr-xrecipes-sota/aktualizr/aktualizr_git.bb80
1 files changed, 67 insertions, 13 deletions
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index a8f40d6..c0e275d 100755
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -5,40 +5,51 @@ SECTION = "base"
5LICENSE = "MPL-2.0" 5LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" 6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
7 7
8require garage-sign-version.inc
9
10DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native" 8DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native"
11RDEPENDS_${PN}_class-target = "aktualizr-check-discovery aktualizr-configs lshw" 9DEPENDS_append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' coreutils-native ostree-native aktualizr-native ', '', d)}"
12RDEPENDS_${PN}-secondary = "aktualizr-check-discovery" 10RDEPENDS_${PN}_class-target = "aktualizr-configs lshw"
13RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}" 11RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}"
14 12
13RDEPENDS_${PN}-ptest += "bash cmake curl python3-modules openssl-bin sqlite3 valgrind"
14
15PV = "1.0+git${SRCPV}" 15PV = "1.0+git${SRCPV}"
16PR = "7" 16PR = "7"
17 17
18GARAGE_SIGN_PV = "0.6.0-18-g5b8b259"
19
18SRC_URI = " \ 20SRC_URI = " \
19 gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ 21 gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \
22 file://run-ptest \
20 file://aktualizr.service \ 23 file://aktualizr.service \
21 file://aktualizr-secondary.service \ 24 file://aktualizr-secondary.service \
22 file://aktualizr-secondary.socket \ 25 file://aktualizr-secondary.socket \
23 file://aktualizr-serialcan.service \ 26 file://aktualizr-serialcan.service \
27 file://10-resource-control.conf \
28 ${@ d.expand("https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${GARAGE_SIGN_PV}.tgz;unpack=0") if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''} \
24 " 29 "
25 30
26SRCREV = "c71ec0a320d85a3e75ba37bff7dc40ad02e9d655" 31# for garage-sign archive
32SRC_URI[md5sum] = "c5e9968dfe78a7264ab9a8338c11725d"
33SRC_URI[sha256sum] = "3a19258d7a1825a308aca0da82f7a337985bec05e8951355c4c95f0fcf2444f4"
34
35SRCREV = "c50feb37034eceb1254429d3e3ed38e5b8a0dc60"
27BRANCH ?= "master" 36BRANCH ?= "master"
28 37
29S = "${WORKDIR}/git" 38S = "${WORKDIR}/git"
30 39
31inherit pkgconfig cmake systemd 40inherit cmake pkgconfig ptest systemd
41
42# disable ptest by default as it slows down builds quite a lot
43# can be enabled manually by setting 'PTEST_ENABLED_pn-aktualizr' to '1' in local.conf
44PTEST_ENABLED = "0"
32 45
33SYSTEMD_PACKAGES = "${PN} ${PN}-secondary" 46SYSTEMD_PACKAGES = "${PN} ${PN}-secondary"
34SYSTEMD_SERVICE_${PN} = "aktualizr.service" 47SYSTEMD_SERVICE_${PN} = "aktualizr.service"
35SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket" 48SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket"
36 49
37EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV}" 50EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} ${@bb.utils.contains('PTEST_ENABLED', '1', '-DTESTSUITE_VALGRIND=on', '', d)}"
38 51
39GARAGE_SIGN_OPS = "${@ '-DGARAGE_SIGN_VERSION=%s' % d.getVar('GARAGE_SIGN_VERSION') if d.getVar('GARAGE_SIGN_VERSION') is not None else ''} \ 52GARAGE_SIGN_OPS = "${@ d.expand('-DGARAGE_SIGN_ARCHIVE=${WORKDIR}/cli-${GARAGE_SIGN_PV}.tgz') if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''}"
40 ${@ '-DGARAGE_SIGN_SHA256=%s' % d.getVar('GARAGE_SIGN_SHA256') if d.getVar('GARAGE_SIGN_SHA256') is not None else ''} \
41 "
42 53
43PACKAGECONFIG ?= "ostree ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} ${@bb.utils.filter('SOTA_CLIENT_FEATURES', 'hsm serialcan ubootenv', d)}" 54PACKAGECONFIG ?= "ostree ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} ${@bb.utils.filter('SOTA_CLIENT_FEATURES', 'hsm serialcan ubootenv', d)}"
44PACKAGECONFIG_class-native = "sota-tools" 55PACKAGECONFIG_class-native = "sota-tools"
@@ -51,6 +62,35 @@ PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF,"
51PACKAGECONFIG[serialcan] = ",,,slcand-start" 62PACKAGECONFIG[serialcan] = ",,,slcand-start"
52PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" 63PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback"
53 64
65# can be overriden in configuration with `RESOURCE_xxx_pn-aktualizr`
66# see `man systemd.resource-control` for details
67
68# can be used to lower aktualizr priority, default is 100
69RESOURCE_CPU_WEIGHT = "100"
70# will be slowed down when it reaches 'high', killed when it reaches 'max'
71RESOURCE_MEMORY_HIGH = "100M"
72RESOURCE_MEMORY_MAX = "80%"
73
74do_compile_ptest() {
75 cmake_runcmake_build --target build_tests "${PARALLEL_MAKE}"
76}
77
78do_install_ptest() {
79 # copy the complete source directory (contains build)
80 cp -r ${B}/ ${D}/${PTEST_PATH}/build
81 cp -r ${S}/ ${D}/${PTEST_PATH}/src
82
83 # remove huge external unused repository
84 rm -rf ${D}/${PTEST_PATH}/src/partial/extern/RIOT
85
86 # remove huge build artifacts
87 find ${D}/${PTEST_PATH}/build/src -name "*.a" -delete
88
89 # fix the absolute paths
90 find ${D}/${PTEST_PATH}/build -name "CMakeFiles" | xargs rm -rf
91 find ${D}/${PTEST_PATH}/build -name "*.cmake" -or -name "DartConfiguration.tcl" -or -name "run-valgrind" | xargs sed -e "s|${S}|${PTEST_PATH}/src|g" -e "s|${B}|${PTEST_PATH}/build|g" -e "s|\"--gtest_output[^\"]*\"||g" -i
92}
93
54do_install_append () { 94do_install_append () {
55 install -d ${D}${libdir}/sota 95 install -d ${D}${libdir}/sota
56 install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml 96 install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml
@@ -66,14 +106,14 @@ do_install_append () {
66 install -m 0700 -d ${D}${sysconfdir}/sota/conf.d 106 install -m 0700 -d ${D}${sysconfdir}/sota/conf.d
67 107
68 if [ -n "${SOTA_HARDWARE_ID}" ]; then 108 if [ -n "${SOTA_HARDWARE_ID}" ]; then
69 echo "[provision]\nprimary_ecu_hardware_id = ${SOTA_HARDWARE_ID}\n" > ${D}${libdir}/sota/conf.d/40-hardware-id.toml 109 printf "[provision]\nprimary_ecu_hardware_id = ${SOTA_HARDWARE_ID}\n" > ${D}${libdir}/sota/conf.d/40-hardware-id.toml
70 fi 110 fi
71 111
72 if [ -n "${SOTA_SECONDARY_CONFIG_DIR}" ]; then 112 if [ -n "${SOTA_SECONDARY_CONFIG_DIR}" ]; then
73 if [ -d "${SOTA_SECONDARY_CONFIG_DIR}" ]; then 113 if [ -d "${SOTA_SECONDARY_CONFIG_DIR}" ]; then
74 install -m 0700 -d ${D}${sysconfdir}/sota/ecus 114 install -m 0700 -d ${D}${sysconfdir}/sota/ecus
75 install -m 0644 "${SOTA_SECONDARY_CONFIG_DIR}"/* ${D}${sysconfdir}/sota/ecus/ 115 install -m 0644 "${SOTA_SECONDARY_CONFIG_DIR}"/* ${D}${sysconfdir}/sota/ecus/
76 echo "[uptane]\nsecondary_configs_dir = /etc/sota/ecus/\n" > ${D}${libdir}/sota/conf.d/30-secondary-configs-dir.toml 116 printf "[uptane]\nsecondary_configs_dir = /etc/sota/ecus/\n" > ${D}${libdir}/sota/conf.d/30-secondary-configs-dir.toml
77 else 117 else
78 bbwarn "SOTA_SECONDARY_CONFIG_DIR is set to an invalid directory (${SOTA_SECONDARY_CONFIG_DIR})" 118 bbwarn "SOTA_SECONDARY_CONFIG_DIR is set to an invalid directory (${SOTA_SECONDARY_CONFIG_DIR})"
79 fi 119 fi
@@ -87,6 +127,15 @@ do_install_append () {
87 install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir} 127 install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir}
88 install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} 128 install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir}
89 fi 129 fi
130
131 # resource control
132 install -d ${D}/${systemd_system_unitdir}/aktualizr.service.d
133 install -m 0644 ${WORKDIR}/10-resource-control.conf ${D}/${systemd_system_unitdir}/aktualizr.service.d
134
135 sed -i -e 's|@CPU_WEIGHT@|${RESOURCE_CPU_WEIGHT}|g' \
136 -e 's|@MEMORY_HIGH@|${RESOURCE_MEMORY_HIGH}|g' \
137 -e 's|@MEMORY_MAX@|${RESOURCE_MEMORY_MAX}|g' \
138 ${D}${systemd_system_unitdir}/aktualizr.service.d/10-resource-control.conf
90} 139}
91 140
92PACKAGESPLITFUNCS_prepend = "split_hosttools_packages " 141PACKAGESPLITFUNCS_prepend = "split_hosttools_packages "
@@ -101,7 +150,7 @@ python split_hosttools_packages () {
101 150
102PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*" 151PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*"
103 152
104PACKAGES =+ "${PN}-examples ${PN}-secondary ${PN}-configs ${PN}-host-tools" 153PACKAGES =+ "${PN}-resource-control ${PN}-examples ${PN}-secondary ${PN}-configs ${PN}-host-tools"
105 154
106ALLOW_EMPTY_${PN}-host-tools = "1" 155ALLOW_EMPTY_${PN}-host-tools = "1"
107 156
@@ -111,6 +160,10 @@ FILES_${PN} = " \
111 ${systemd_unitdir}/system/aktualizr.service \ 160 ${systemd_unitdir}/system/aktualizr.service \
112 " 161 "
113 162
163FILES_${PN}-resource-control = " \
164 ${systemd_system_unitdir}/aktualizr.service.d/10-resource-control.conf \
165 "
166
114FILES_${PN}-configs = " \ 167FILES_${PN}-configs = " \
115 ${sysconfdir}/sota/* \ 168 ${sysconfdir}/sota/* \
116 ${libdir}/sota/* \ 169 ${libdir}/sota/* \
@@ -126,6 +179,7 @@ FILES_${PN}-secondary = " \
126 ${systemd_unitdir}/system/aktualizr-secondary.socket \ 179 ${systemd_unitdir}/system/aktualizr-secondary.socket \
127 ${systemd_unitdir}/system/aktualizr-secondary.service \ 180 ${systemd_unitdir}/system/aktualizr-secondary.service \
128 " 181 "
182
129BBCLASSEXTEND = "native" 183BBCLASSEXTEND = "native"
130 184
131# vim:set ts=4 sw=4 sts=4 expandtab: 185# vim:set ts=4 sw=4 sts=4 expandtab: