From bf5b952eb2a92c48e640642f1086db3bf745f21d Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 29 Nov 2018 11:01:55 +0100 Subject: aktualizr: Bump to latest (d00d1a04cc2366d1a5f143b84b9f507f8bd32c44). Some OSTree improvements, reboot detection, retry failed downloads. Signed-off-by: Patrick Vacek --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'recipes-sota') diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 82449f0..d49f28c 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -27,7 +27,7 @@ SRC_URI = " \ file://aktualizr-serialcan.service \ " -SRCREV = "348822d914f422a8d7b34a1e98cfdd1fa3cf816c" +SRCREV = "d00d1a04cc2366d1a5f143b84b9f507f8bd32c44" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 1552d64d7bc59cd6296cc8723b3f95d15a2b26ae Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Mon, 17 Dec 2018 15:28:31 -0200 Subject: ostree: upgrade to v2018.9 Update libostree to the v2018.9 release. Upstream release notes since v2018.7: - https://github.com/ostreedev/ostree/releases/tag/v2018.8 - https://github.com/ostreedev/ostree/releases/tag/v2018.9 Signed-off-by: Ricardo Salveti --- recipes-sota/ostree/ostree_git.bb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'recipes-sota') diff --git a/recipes-sota/ostree/ostree_git.bb b/recipes-sota/ostree/ostree_git.bb index 3e3c951..93ae6e7 100644 --- a/recipes-sota/ostree/ostree_git.bb +++ b/recipes-sota/ostree/ostree_git.bb @@ -7,9 +7,9 @@ inherit autotools pkgconfig systemd bash-completion gobject-introspection SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master" -SRCREV="3e96ec9811b5cfc5481f8b6b06c8d34d9a35408e" +SRCREV = "f3eba6bcec39c163eb831c02c148ffa483292906" -PV = "v2018.7" +PV = "v2018.9" S = "${WORKDIR}/git" @@ -61,6 +61,7 @@ FILES_${PN} = "${bindir} \ ${libdir}/ostree/ostree-remount \ ${libdir}/girepository-1.0/* \ ${@bb.utils.contains('DISTRO_FEATURES','systemd','${libdir}/tmpfiles.d', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES','systemd','${systemd_unitdir}/system/*.path', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES','systemd','${systemd_unitdir}/system-generators', '', d)} \ " FILES_${PN}-dev += " ${datadir}/gir-1.0" -- cgit v1.2.3-54-g00ecf From d49ae8261680ae2cfd4c0179eff013d2def92e1b Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Mon, 14 Jan 2019 14:06:48 +0100 Subject: meta: drop True option to getVar calls Search made with the following regex: getVar ?\((.*), True\), this is to be consistent with OE. Signed-off-by: Ming Liu --- classes/image_types_ostree.bbclass | 2 +- classes/image_types_ota.bbclass | 6 +++--- classes/sota.bbclass | 2 +- classes/sota_sanity.bbclass | 10 +++++----- recipes-sota/aktualizr/aktualizr-auto-prov.bb | 2 +- recipes-sota/aktualizr/aktualizr-ca-implicit-prov.bb | 2 +- recipes-sota/aktualizr/aktualizr-hsm-prov.bb | 2 +- recipes-sota/aktualizr/credentials.inc | 2 +- recipes-sota/aktualizr/garage-sign-version.inc | 4 ++-- 9 files changed, 16 insertions(+), 16 deletions(-) (limited to 'recipes-sota') diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 138e02e..29da78e 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -10,7 +10,7 @@ OSTREE_DEPLOY_DEVICETREE ??= "0" BUILD_OSTREE_TARBALL ??= "1" -SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}" +SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd', 'true', '')}" IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*" CONVERSION_CMD_tar = "touch ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}; ${IMAGE_CMD_TAR} --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.tar -C ${OTA_IMAGE_ROOTFS} . || [ $? -eq 1 ]" diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index fe3d1d8..a31cbd1 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass @@ -42,8 +42,8 @@ OTA_IMAGE_ROOTFS_task-image-ota = "${OTA_SYSROOT}" IMAGE_TYPEDEP_ota = "ostreecommit" do_image_ota[dirs] = "${OTA_SYSROOT}" do_image_ota[cleandirs] = "${OTA_SYSROOT}" -do_image_ota[depends] = "${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER', True) == 'grub' else ''} \ - ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot' else ''}" +do_image_ota[depends] = "${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER') == 'grub' else ''} \ + ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER') == 'u-boot' else ''}" IMAGE_CMD_ota () { ostree admin --sysroot=${OTA_SYSROOT} init-fs ${OTA_SYSROOT} ostree admin --sysroot=${OTA_SYSROOT} os-init ${OSTREE_OSNAME} @@ -110,4 +110,4 @@ IMAGE_CMD_ota-ext4 () { mkfs.ext4 -O ^64bit ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ota-ext4 -L otaroot -d ${OTA_SYSROOT} } -do_image_wic[depends] += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', '%s:do_image_ota_ext4' % d.getVar('IMAGE_BASENAME', True), '', d)}" +do_image_wic[depends] += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', '%s:do_image_ota_ext4' % d.getVar('IMAGE_BASENAME'), '', d)}" diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 93f59eb..ccc4526 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -21,7 +21,7 @@ WKS_FILE_sota ?= "sdimage-sota.wks" EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native" -INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'cpio.gz.u-boot', 'cpio.gz')}" +INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER') == 'u-boot', 'cpio.gz.u-boot', 'cpio.gz')}" # Please redefine OSTREE_REPO in order to have a persistent OSTree repo export OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" diff --git a/classes/sota_sanity.bbclass b/classes/sota_sanity.bbclass index e47de19..8e80acb 100644 --- a/classes/sota_sanity.bbclass +++ b/classes/sota_sanity.bbclass @@ -1,17 +1,17 @@ # Sanity check the sota setup for common misconfigurations def sota_check_overrides(status, d): - for var in (d.getVar('SOTA_OVERRIDES_BLACKLIST', True) or "").split(): - if var in d.getVar('OVERRIDES', True).split(':'): + for var in (d.getVar('SOTA_OVERRIDES_BLACKLIST') or "").split(): + if var in d.getVar('OVERRIDES').split(':'): status.addresult("%s should not be a overrides, because it is a image fstype in updater layer, please check your OVERRIDES setting.\n" % var) def sota_check_required_variables(status, d): - for var in (d.getVar('SOTA_REQUIRED_VARIABLES', True) or "").split(): - if not d.getVar(var, True): + for var in (d.getVar('SOTA_REQUIRED_VARIABLES') or "").split(): + if not d.getVar(var): status.addresult("%s should be set in your local.conf.\n" % var) def sota_raise_sanity_error(msg, d): - if d.getVar("SANITY_USE_EVENTS", True) == "1": + if d.getVar("SANITY_USE_EVENTS") == "1": bb.event.fire(bb.event.SanityCheckFailed(msg), d) return diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb index f506cab..308f552 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb @@ -6,7 +6,7 @@ LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" DEPENDS = "aktualizr-native zip-native" -RDEPENDS_${PN}_append = "${@' aktualizr-auto-prov-creds' if d.getVar('SOTA_DEPLOY_CREDENTIALS', True) == '1' else ''}" +RDEPENDS_${PN}_append = "${@' aktualizr-auto-prov-creds' if d.getVar('SOTA_DEPLOY_CREDENTIALS') == '1' else ''}" PV = "1.0" PR = "6" diff --git a/recipes-sota/aktualizr/aktualizr-ca-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-ca-implicit-prov.bb index 5893ed2..8dcda99 100644 --- a/recipes-sota/aktualizr/aktualizr-ca-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-ca-implicit-prov.bb @@ -10,7 +10,7 @@ LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" DEPENDS = "aktualizr aktualizr-native openssl-native" -RDEPENDS_${PN}_append = "${@' aktualizr-ca-implicit-prov-creds' if d.getVar('SOTA_DEPLOY_CREDENTIALS', True) == '1' else ''}" +RDEPENDS_${PN}_append = "${@' aktualizr-ca-implicit-prov-creds' if d.getVar('SOTA_DEPLOY_CREDENTIALS') == '1' else ''}" PV = "1.0" PR = "1" diff --git a/recipes-sota/aktualizr/aktualizr-hsm-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb index 7947edd..27aba0f 100644 --- a/recipes-sota/aktualizr/aktualizr-hsm-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb @@ -6,7 +6,7 @@ LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" DEPENDS = "aktualizr aktualizr-native" -RDEPENDS_${PN}_append = "${@' aktualizr-ca-implicit-prov-creds softhsm-testtoken' if d.getVar('SOTA_DEPLOY_CREDENTIALS', True) == '1' else ''}" +RDEPENDS_${PN}_append = "${@' aktualizr-ca-implicit-prov-creds softhsm-testtoken' if d.getVar('SOTA_DEPLOY_CREDENTIALS') == '1' else ''}" SRC_URI = "" PV = "1.0" diff --git a/recipes-sota/aktualizr/credentials.inc b/recipes-sota/aktualizr/credentials.inc index 256c8ff..7c44257 100644 --- a/recipes-sota/aktualizr/credentials.inc +++ b/recipes-sota/aktualizr/credentials.inc @@ -1 +1 @@ -SRC_URI_append = "${@('file://' + d.getVar('SOTA_PACKED_CREDENTIALS', True)) if d.getVar('SOTA_PACKED_CREDENTIALS', True) else ''}" +SRC_URI_append = "${@('file://' + d.getVar('SOTA_PACKED_CREDENTIALS')) if d.getVar('SOTA_PACKED_CREDENTIALS') else ''}" diff --git a/recipes-sota/aktualizr/garage-sign-version.inc b/recipes-sota/aktualizr/garage-sign-version.inc index 1b89a3d..2cea6c9 100644 --- a/recipes-sota/aktualizr/garage-sign-version.inc +++ b/recipes-sota/aktualizr/garage-sign-version.inc @@ -1,11 +1,11 @@ python () { - if d.getVar("GARAGE_SIGN_VERSION", True) or not d.getVar("SOTA_PACKED_CREDENTIALS", True): + if d.getVar("GARAGE_SIGN_VERSION") or not d.getVar("SOTA_PACKED_CREDENTIALS"): return import json import urllib.request import zipfile - with zipfile.ZipFile(d.getVar("SOTA_PACKED_CREDENTIALS", True), 'r') as zip_ref: + with zipfile.ZipFile(d.getVar("SOTA_PACKED_CREDENTIALS"), 'r') as zip_ref: try: with zip_ref.open('tufrepo.url', mode='r') as url_file: url = url_file.read().decode().strip(' \t\n') + '/health/version' -- cgit v1.2.3-54-g00ecf From 73e50d717a50616d20faeb5b4cbdf5cb2483aa53 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Mon, 28 Jan 2019 13:53:27 +0100 Subject: aktualizr: bump to latest 1cad6d10286ade64b24021ca0e23de0d3b64f520 - OStree installations are considered complete after a reboot under the new version - image downloads are not parallelized anymore - various enhancements and bug fixes Signed-off-by: Laurent Bonnans --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'recipes-sota') diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index d49f28c..eb65ae0 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -27,7 +27,7 @@ SRC_URI = " \ file://aktualizr-serialcan.service \ " -SRCREV = "d00d1a04cc2366d1a5f143b84b9f507f8bd32c44" +SRCREV = "1cad6d10286ade64b24021ca0e23de0d3b64f520" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 495f5db09da6a1e5b7a16460d9f4bf26fbee2dff Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Tue, 5 Feb 2019 12:39:56 +0100 Subject: Add support for device tree overlays in FIT images Signed-off-by: Anton Gerasimov --- README.adoc | 5 ++++- classes/sota_raspberrypi.bbclass | 15 ++++++++++++++- recipes-sota/fit-conf/fit-conf.bb | 22 ++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 recipes-sota/fit-conf/fit-conf.bb (limited to 'recipes-sota') diff --git a/README.adoc b/README.adoc index ea9bb21..27ecabf 100644 --- a/README.adoc +++ b/README.adoc @@ -81,6 +81,7 @@ Although we have used U-Boot so far, other boot loaders can be configured work w * `OSTREE_COMMIT_BODY` - Message attached to OSTree commit. Empty by default. * `OSTREE_COMMIT_SUBJECT` - Commit subject used by OSTree. Defaults to `Commit-id: ${IMAGE_NAME}` * `OSTREE_UPDATE_SUMMARY` - Set this to '1' to update summary of OSTree repository on each commit. '0' by default. +* `OSTREE_DEPLOY_DEVICETREE` - Set this to '1' to include devicetree(s) to boot * `INITRAMFS_IMAGE` - initramfs/initrd image that is used as a proxy while booting into OSTree deployment. Do not change this setting unless you are sure that your initramfs can serve as such a proxy. * `SOTA_PACKED_CREDENTIALS` - when set, your ostree commit will be pushed to a remote repo as a bitbake step. This should be the path to a zipped credentials file in https://github.com/advancedtelematic/aktualizr/blob/master/docs/credentials.adoc[the format accepted by garage-push]. * `SOTA_DEPLOY_CREDENTIALS` - when set to '1' (default value), deploys credentials to the built image. Override it in `local.conf` to built a generic image that can be provisioned manually after the build. @@ -88,7 +89,9 @@ Although we have used U-Boot so far, other boot loaders can be configured work w * `SOTA_CLIENT_FEATURES` - extensions to aktualizr. The only valid options are `hsm` (to build with HSM support) and `secondary-network` (to set up a simulated 'in-vehicle' network with support for a primary node with a DHCP server and a secondary node with a DHCP client). * `SOTA_SECONDARY_CONFIG_DIR` - a directory containing JSON configuration files for virtual secondaries on the host. These will be installed into `/etc/sota/ecus` on the device and automatically provided to aktualizr. * `SOTA_HARDWARE_ID` - a custom hardware ID that will be written to the aktualizr config. Defaults to MACHINE if not set. -* `OSTREE_DEPLOY_DEVICETREE` - Set this to '1' to include devicetree(s) to boot +* `SOTA_MAIN_DTB` - base device tree to use with the kernel. Used together with FIT images. You can change it, and the device tree will also be changed after the update. +* `SOTA_DT_OVERLAYS` - whitespace-separated list of used device tree overlays for FIT image. This list is OSTree-updateable as well. +* `SOTA_EXTRA_CONF_FRAGS` - extra https://lxr.missinglinkelectronics.com/uboot/doc/uImage.FIT/overlay-fdt-boot.txt[configuration fragments] for FIT image. == Usage diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass index 600f9e9..e1c0054 100644 --- a/classes/sota_raspberrypi.bbclass +++ b/classes/sota_raspberrypi.bbclass @@ -5,6 +5,13 @@ KERNEL_IMAGETYPE_sota = "fitImage" INITRAMFS_FSTYPES = "cpio.gz" OSTREE_KERNEL = "${KERNEL_IMAGETYPE}-${INITRAMFS_IMAGE}-${MACHINE}-${KERNEL_FIT_LINK_NAME}" +# DTB needs to be relocated to apply overlays +UBOOT_DTB_LOADADDRESS = "0x05000000" +UBOOT_DTBO_LOADADDRESS = "0x06000000" + +# Deploy config fragment list to OSTree root fs +IMAGE_INSTALL_append = " fit-conf" + PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" UBOOT_ENTRYPOINT_sota ?= "0x00008000" @@ -18,7 +25,13 @@ IMAGE_BOOT_FILES_sota = "bcm2835-bootfiles/* u-boot.bin;${SDIMG_KERNELIMAGE}" KERNEL_DEVICETREE_raspberrypi2_sota ?= " bcm2709-rpi-2-b.dtb " KERNEL_DEVICETREE_raspberrypi3_sota ?= " bcm2710-rpi-3-b.dtb overlays/vc4-kms-v3d.dtbo overlays/rpi-ft5406.dtbo" +SOTA_MAIN_DTB_raspberrypi2 ?= "bcm2709-rpi-2-b.dtb" +SOTA_MAIN_DTB_raspberrypi3 ?= "bcm2710-rpi-3-b.dtb" + +SOTA_DT_OVERLAYS_raspberrypi3 ?= "vc4-kms-v3d.dtbo rpi-ft5406.dtbo" + # Kernel args normally provided by RPi's internal bootloader. Non-updateable -OSTREE_KERNEL_ARGS_sota ?= " 8250.nr_uarts=1 bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 console=ttyS0,115200 usbhid.mousepoll=0 " +OSTREE_KERNEL_ARGS_sota ?= " 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=614 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 console=ttyS0,115200 usbhid.mousepoll=0 " SOTA_CLIENT_FEATURES_append = " ubootenv" + diff --git a/recipes-sota/fit-conf/fit-conf.bb b/recipes-sota/fit-conf/fit-conf.bb new file mode 100644 index 0000000..c6cecec --- /dev/null +++ b/recipes-sota/fit-conf/fit-conf.bb @@ -0,0 +1,22 @@ +SUMMARY = "FIT image configuration for u-boot to use" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +do_install() { + mkdir -p ${D}${libdir} + echo -n "fit_conf=" >${D}${libdir}/fit_conf + + if [ -n ${SOTA_MAIN_DTB} ]; then + echo -n "#conf@${SOTA_MAIN_DTB}" >> ${D}${libdir}/fit_conf + fi + + for ovrl in ${SOTA_DT_OVERLAYS}; do + echo -n "#conf@overlays_${ovrl}" >> ${D}${libdir}/fit_conf + done + + for conf_frag in ${SOTA_EXTRA_CONF_FRAGS}; do + echo -n "#${conf_frag}" >> ${D}${libdir}/fit_conf + done +} + +FILES_${PN} += "${libdir}/fit_conf" -- cgit v1.2.3-54-g00ecf From 6f086f7c7ccb743003e583b0dbf65ee7f2f54eae Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Thu, 31 Jan 2019 10:26:47 +0100 Subject: aktualizr: drop duplicated file from FILES_${PN} "${bindir}/aktualizr-check-discovery" is being set in both FILES_${PN} and FILES_${PN}-tools, drop it from FILES_${PN}. Signed-off-by: Ming Liu --- recipes-sota/aktualizr/aktualizr_git.bb | 1 - 1 file changed, 1 deletion(-) (limited to 'recipes-sota') diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index eb65ae0..b392de0 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -102,7 +102,6 @@ PACKAGES =+ " ${PN}-examples ${PN}-host-tools ${PN}-tools ${PN}-secondary " FILES_${PN} = " \ ${bindir}/aktualizr \ ${bindir}/aktualizr-info \ - ${bindir}/aktualizr-check-discovery \ ${systemd_unitdir}/system/aktualizr.service \ ${libdir}/sota/conf.d \ ${sysconfdir}/sota/conf.d \ -- cgit v1.2.3-54-g00ecf From 3217e9205c85d91be6a4e2ea13f7a30d4343f69f Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Thu, 31 Jan 2019 17:08:45 +0100 Subject: aktualizr: introduce PACKAGECONFIG There are several flaws in current aktualizr recipe: - It builds with 'BUILD_SYSTEMD=ON' by default but does not set DEPENDS to systemd, this is not leading to compilation errors so far because systemd is deployed into recipe sysroot by ostree if 'systemd' exists in DISTRO_FEATURES, but in other cases, it will cause compilation errors. - GARAGE_SIGN_SHA256 is being passed to EXTRA_OECMAKE even it's not set anythere, this will lead a wrong GARAGE_SIGN_SHA256_ARG to be set in cmake files. - pkgconfig is being called in aktualizr CMakeFile, so it needs inherit pkgconfig.bbclass To fix the above flaws, meanwhile to keep the code cleaner, we introduce PACKAGECONFIG to handle the configurations. Signed-off-by: Ming Liu --- recipes-sota/aktualizr/aktualizr_git.bb | 44 +++++++++++++++------------------ 1 file changed, 20 insertions(+), 24 deletions(-) (limited to 'recipes-sota') diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index b392de0..8bd65da 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -5,16 +5,9 @@ SECTION = "base" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" -DEPENDS = "boost curl openssl libarchive libsodium asn1c-native sqlite3 " -DEPENDS_append_class-target = "ostree ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', ' libp11', '', d)} " -DEPENDS_append_class-native = "glib-2.0-native " - -RDEPENDS_${PN}_class-target = "lshw " -RDEPENDS_${PN}_append_class-target = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', ' slcand-start', '', d)} " -RDEPENDS_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'ubootenv', ' u-boot-fw-utils aktualizr-uboot-env-rollback', '', d)} " - -RDEPENDS_${PN}_append_class-target = " ${PN}-tools " -RDEPENDS_${PN}-secondary_append_class-target = " ${PN}-tools " +DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native" +RDEPENDS_${PN}_class-target = "${PN}-tools lshw" +RDEPENDS_${PN}-secondary_class-target = "${PN}-tools" PV = "1.0+git${SRCPV}" PR = "7" @@ -32,9 +25,7 @@ BRANCH ?= "master" S = "${WORKDIR}/git" -inherit cmake - -inherit systemd +inherit pkgconfig cmake systemd SYSTEMD_PACKAGES = "${PN} ${PN}-secondary" SYSTEMD_SERVICE_${PN} = "aktualizr.service" @@ -44,17 +35,22 @@ BBCLASSEXTEND =+ "native" require garage-sign-version.inc -EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DAKTUALIZR_VERSION=${PV} \ - -DBUILD_LOAD_TESTS=OFF" -EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON \ - ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " -EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON \ - -DBUILD_OSTREE=OFF \ - -DBUILD_SYSTEMD=OFF \ - -DGARAGE_SIGN_VERSION=${GARAGE_SIGN_VERSION} \ - -DGARAGE_SIGN_SHA256=${GARAGE_SIGN_SHA256}" +EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV}" + +GARAGE_SIGN_OPS = "${@ '-DGARAGE_SIGN_VERSION=%s' % d.getVar('GARAGE_SIGN_VERSION') if d.getVar('GARAGE_SIGN_VERSION') is not None else ''} \ + ${@ '-DGARAGE_SIGN_SHA256=%s' % d.getVar('GARAGE_SIGN_SHA256') if d.getVar('GARAGE_SIGN_SHA256') is not None else ''} \ + " + +PACKAGECONFIG ?= "ostree ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} ${@bb.utils.filter('SOTA_CLIENT_FEATURES', 'hsm serialcan ubootenv', d)}" +PACKAGECONFIG_class-native = "sota-tools" +PACKAGECONFIG[warning-as-error] = "-DWARNING_AS_ERROR=ON,-DWARNING_AS_ERROR=OFF," +PACKAGECONFIG[ostree] = "-DBUILD_OSTREE=ON,-DBUILD_OSTREE=OFF,ostree," +PACKAGECONFIG[hsm] = "-DBUILD_P11=ON,-DBUILD_P11=OFF,libp11," +PACKAGECONFIG[sota-tools] = "-DBUILD_SOTA_TOOLS=ON ${GARAGE_SIGN_OPS},-DBUILD_SOTA_TOOLS=OFF,glib-2.0," +PACKAGECONFIG[systemd] = "-DBUILD_SYSTEMD=ON,-DBUILD_SYSTEMD=OFF,systemd," +PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF," +PACKAGECONFIG[serialcan] = ",,,slcand-start" +PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" do_install_append () { install -d ${D}${libdir}/sota -- cgit v1.2.3-54-g00ecf From 7ec1ffc436e8725e40e1853d084054b554929041 Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Sun, 3 Feb 2019 13:12:29 +0100 Subject: aktualizr: split binaries to their own packages This patch mainly aims to fix the following issues: - ${libdir}/sota/conf.d is being put into aktualizr package, but ${libdir}/sota/*.toml is being put into aktualizr-host-tools, this does not make sense, if a end user only install aktualizr-host-tools to a target, he will miss the config files in ${libdir}/sota/conf.d. - A user should be able to install garage-deploy garage-push to a board if he wants to do that by choosing building aktualizr with sota-tools, but now it's not in that case, garage-deploy garage-push are only available for native. - It's not necessary to distinguish native/target when installing systemd services, they will be dropped by sstate from native sysroot any way. - It would be better that all binaries to be put into their own packages, so a end user can choose to install a package only with one binary, rather than having to install the entire aktualizr-host-tools. Introduce per-binary based packages for host tools, and gather all config files to aktualizr-configs, it will be depended by binary packages and main aktualizr package. Signed-off-by: Ming Liu --- recipes-sota/aktualizr/aktualizr_git.bb | 61 ++++++++++++++++----------------- 1 file changed, 29 insertions(+), 32 deletions(-) (limited to 'recipes-sota') diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 8bd65da..fbc1bca 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -5,9 +5,12 @@ SECTION = "base" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" +require garage-sign-version.inc + DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native" -RDEPENDS_${PN}_class-target = "${PN}-tools lshw" -RDEPENDS_${PN}-secondary_class-target = "${PN}-tools" +RDEPENDS_${PN}_class-target = "aktualizr-check-discovery aktualizr-configs lshw" +RDEPENDS_${PN}-secondary = "aktualizr-check-discovery" +RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}" PV = "1.0+git${SRCPV}" PR = "7" @@ -31,10 +34,6 @@ SYSTEMD_PACKAGES = "${PN} ${PN}-secondary" SYSTEMD_SERVICE_${PN} = "aktualizr.service" SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket" -BBCLASSEXTEND =+ "native" - -require garage-sign-version.inc - EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV}" GARAGE_SIGN_OPS = "${@ '-DGARAGE_SIGN_VERSION=%s' % d.getVar('GARAGE_SIGN_VERSION') if d.getVar('GARAGE_SIGN_VERSION') is not None else ''} \ @@ -80,48 +79,45 @@ do_install_append () { fi fi -} - -do_install_append_class-target () { install -m 0755 -d ${D}${systemd_unitdir}/system aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)} install -m 0644 ${aktualizr_service} ${D}${systemd_unitdir}/system/aktualizr.service + + if ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'true', 'false', d)}; then + install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir} + install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} + fi } -do_install_append_class-native () { - install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir} - install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} +PACKAGESPLITFUNCS_prepend = "split_hosttools_packages " + +python split_hosttools_packages () { + bindir = d.getVar('bindir') + + # Split all binaries to their own packages except aktualizr-info, + # aktualizr-info should stay in main package aktualizr. + do_split_packages(d, bindir, r'^((?!(aktualizr-info)).*)$', '%s', 'Aktualizr tool - %s', extra_depends='aktualizr-configs', prepend=False) } -PACKAGES =+ " ${PN}-examples ${PN}-host-tools ${PN}-tools ${PN}-secondary " +PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*" + +PACKAGES =+ "${PN}-examples ${PN}-secondary ${PN}-configs ${PN}-host-tools" + +ALLOW_EMPTY_${PN}-host-tools = "1" FILES_${PN} = " \ ${bindir}/aktualizr \ ${bindir}/aktualizr-info \ ${systemd_unitdir}/system/aktualizr.service \ - ${libdir}/sota/conf.d \ - ${sysconfdir}/sota/conf.d \ - ${sysconfdir}/sota/ecus/* \ " -FILES_${PN}-examples = " \ - ${bindir}/hmi-stub \ +FILES_${PN}-configs = " \ + ${sysconfdir}/sota/* \ + ${libdir}/sota/* \ " -FILES_${PN}-host-tools = " \ - ${bindir}/aktualizr-repo \ - ${bindir}/aktualizr-cert-provider \ - ${bindir}/garage-deploy \ - ${bindir}/garage-push \ - ${libdir}/sota/sota_autoprov.toml \ - ${libdir}/sota/sota_autoprov_primary.toml \ - ${libdir}/sota/sota_hsm_prov.toml \ - ${libdir}/sota/sota_implicit_prov_ca.toml \ - ${libdir}/sota/sota_uboot_env.toml \ - " - -FILES_${PN}-tools = " \ - ${bindir}/aktualizr-check-discovery \ +FILES_${PN}-examples = " \ + ${bindir}/hmi-stub \ " FILES_${PN}-secondary = " \ @@ -130,5 +126,6 @@ FILES_${PN}-secondary = " \ ${systemd_unitdir}/system/aktualizr-secondary.socket \ ${systemd_unitdir}/system/aktualizr-secondary.service \ " +BBCLASSEXTEND = "native" # vim:set ts=4 sw=4 sts=4 expandtab: -- cgit v1.2.3-54-g00ecf