From 08e225b8e66e25003108921c0b05688c7ea6892e Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 8 Jun 2017 17:54:32 +0200 Subject: Set default SOTA_CLIENT directly in sota.bbclass --- classes/sota.bbclass | 1 + conf/distro/sota.conf.inc | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 2761111..dfd3c27 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -5,6 +5,7 @@ python __anonymous() { OVERRIDES .= "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ':sota', '', d)}" +SOTA_CLIENT ??= aktualizr IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT}" IMAGE_CLASSES += " image_types_ostree image_types_ota" IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush otaimg wic', ' ', d)}" diff --git a/conf/distro/sota.conf.inc b/conf/distro/sota.conf.inc index 07844e3..7438424 100644 --- a/conf/distro/sota.conf.inc +++ b/conf/distro/sota.conf.inc @@ -6,6 +6,5 @@ DISTRO_FEATURES_append = " sota" INHERIT += " sota" -SOTA_CLIENT ?= "aktualizr" # Prelinking increases the size of downloads and causes build errors USER_CLASSES_remove = "image-prelink" -- cgit v1.2.3-54-g00ecf From 10fce02ac1dc26921532002f9107b33b8f620b76 Mon Sep 17 00:00:00 2001 From: OYTIS Date: Fri, 9 Jun 2017 13:37:45 +0200 Subject: Fix a typo (missing double quotes) --- classes/sota.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/sota.bbclass b/classes/sota.bbclass index dfd3c27..a96429c 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -5,7 +5,7 @@ python __anonymous() { OVERRIDES .= "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ':sota', '', d)}" -SOTA_CLIENT ??= aktualizr +SOTA_CLIENT ??= "aktualizr" IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT}" IMAGE_CLASSES += " image_types_ostree image_types_ota" IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush otaimg wic', ' ', d)}" -- cgit v1.2.3-54-g00ecf From 266f988344d7abbe1a1921caaa813061fc56aa0e Mon Sep 17 00:00:00 2001 From: Robert Danitz Date: Wed, 14 Jun 2017 11:54:58 +0200 Subject: adds two versions of a random, seeded big file --- recipes-test/big-update/big-update_1.0.bb | 11 +++++++++++ recipes-test/big-update/big-update_2.0.bb | 11 +++++++++++ recipes-test/big-update/files/rand_file.py | 16 ++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 recipes-test/big-update/big-update_1.0.bb create mode 100644 recipes-test/big-update/big-update_2.0.bb create mode 100644 recipes-test/big-update/files/rand_file.py diff --git a/recipes-test/big-update/big-update_1.0.bb b/recipes-test/big-update/big-update_1.0.bb new file mode 100644 index 0000000..78852a9 --- /dev/null +++ b/recipes-test/big-update/big-update_1.0.bb @@ -0,0 +1,11 @@ +DESCRIPTION = "Example Package with 10MB of random, seeded content" +LICENSE = "CLOSED" + +SRC_URI = "file://rand_file.py" + +FILES_${PN} = "/usr/lib/big-update" + +do_install() { + install -d ${D}/usr/lib/big-update + python ${S}/../rand_file.py ${D}/usr/lib/big-update/a-big-file $(numfmt --from=iec 10M) +} diff --git a/recipes-test/big-update/big-update_2.0.bb b/recipes-test/big-update/big-update_2.0.bb new file mode 100644 index 0000000..6d32557 --- /dev/null +++ b/recipes-test/big-update/big-update_2.0.bb @@ -0,0 +1,11 @@ +DESCRIPTION = "Example Package with 12MB of random, seeded content" +LICENSE = "CLOSED" + +SRC_URI = "file://rand_file.py" + +FILES_${PN} = "/usr/lib/big-update" + +do_install() { + install -d ${D}/usr/lib/big-update + python ${S}/../rand_file.py ${D}/usr/lib/big-update/a-big-file $(numfmt --from=iec 12M) +} diff --git a/recipes-test/big-update/files/rand_file.py b/recipes-test/big-update/files/rand_file.py new file mode 100644 index 0000000..0f4f16e --- /dev/null +++ b/recipes-test/big-update/files/rand_file.py @@ -0,0 +1,16 @@ +import sys +from random import seed, randint + +def main(): + n = int(sys.argv[2]) + ba = bytearray(n) + + seed(42) + for i in range(0, n): + ba[i] = randint(0, 255) + + with open(sys.argv[1], 'wb') as f: + f.write(bytes(ba)) + +if __name__ == "__main__": + main() -- cgit v1.2.3-54-g00ecf From cdd7e90cba4d5b697a296a69df7e08341299f688 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Wed, 7 Jun 2017 13:09:00 +0200 Subject: Add uptane-capable aktualizr --- classes/image_types_ota.bbclass | 2 +- recipes-sota/aktualizr/aktualizr_git.bb | 18 +++++++++++------- .../aktualizr/files/aktualizr-autoprovision.service | 14 ++++++++++++++ recipes-sota/aktualizr/files/sota_autoprov.toml | 18 ++++++++++++++++++ recipes-sota/rvi-sota-client/rvi-sota-client_git.bb | 2 -- recipes-support/python-petname/python-petname.bb | 1 + 6 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 recipes-sota/aktualizr/files/aktualizr-autoprovision.service create mode 100644 recipes-sota/aktualizr/files/sota_autoprov.toml diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 8108d51..2dd6846 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass @@ -92,7 +92,7 @@ IMAGE_CMD_otaimg () { kargs_list="${kargs_list} --karg-append=$arg" done - ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_OSNAME}:${OSTREE_BRANCHNAME} + ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_BRANCHNAME} # Copy deployment /home and /var/sota to sysroot HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX` diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index fa71af8..62ee9b0 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -5,35 +5,39 @@ SECTION = "base" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" DEPENDS = "boost curl openssl jansson libsodium ostree" -SRCREV = "4e9344ae375a444f02b964dca52fe808010d17df" -PV = "1.0+git${SRCPV}" SRC_URI = " \ git://github.com/advancedtelematic/aktualizr \ file://aktualizr-manual-provision.service \ + file://aktualizr-autoprovision.service \ + file://sota_autoprov.toml \ " +SRCREV = "2e897310c611e2da46f8af888bb62c09b2a2906a" +PV = "1.0+git${SRCPV}" S = "${WORKDIR}/git" SYSTEMD_SERVICE_${PN} = "aktualizr.service" inherit cmake systemd -EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON" +EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON -DAKTUALIZR_VERSION=${PV}" export SOTA_AUTOPROVISION_CREDENTIALS do_install_append() { - if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" ]; then - bbwarn "Aktualizr recipe currently lacks support for SOTA_AUTOPROVISION_CREDENTIALS. No systemd service will be created" + if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" -o -n "${SOTA_PACKED_CREDENTIALS}" ]; then + install -d ${D}/${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service + install -d ${D}/var/sota + install -m "0644" ${WORKDIR}/sota_autoprov.toml ${D}/var/sota/sota.toml else install -d ${D}/${systemd_unitdir}/system install -m 0644 ${WORKDIR}/aktualizr-manual-provision.service ${D}/${systemd_unitdir}/system/aktualizr.service fi } -RDEPENDS = "" - FILES_${PN} = " \ ${bindir}/aktualizr \ ${systemd_unitdir}/system/aktualizr.service \ + /var/sota/sota.toml \ " diff --git a/recipes-sota/aktualizr/files/aktualizr-autoprovision.service b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service new file mode 100644 index 0000000..a5b92e3 --- /dev/null +++ b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service @@ -0,0 +1,14 @@ +[Unit] +Description=Aktualizr SOTA Client +Wants=network-online.target +After=network.target network-online.target +Requires=network-online.target + +[Service] +RestartSec=10 +Restart=always +EnvironmentFile=/var/sota/sota_provisioning_url.env +ExecStart=/bin/sh -c "/usr/bin/aktualizr --disable-keyid-validation --tls-server ${SOTA_GATEWAY_URI} --primary-ecu-hardware-id `cat /etc/hostname` --config /var/sota/sota.toml" + +[Install] +WantedBy=multi-user.target diff --git a/recipes-sota/aktualizr/files/sota_autoprov.toml b/recipes-sota/aktualizr/files/sota_autoprov.toml new file mode 100644 index 0000000..8799553 --- /dev/null +++ b/recipes-sota/aktualizr/files/sota_autoprov.toml @@ -0,0 +1,18 @@ +[device] +packages_dir = "/tmp/packages_dir" +certificates_directory = "/var/sota" +system_info = "system_info.sh" + +[tls] +ca_file = "root.crt" +client_certificate = "client.pem" +pkey_file = "pkey.pem" + +[uptane] +metadata_path = "/var/sota/metadata" +private_key_path = "ecukey.der" +public_key_path = "ecukey.pub" + +[provision] +p12_path = "sota_provisioning_credentials.p12" + diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb index 52edd26..87fa752 100644 --- a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb +++ b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb @@ -30,8 +30,6 @@ FILES_${PN} = " \ ${bindir}/sota_prov.sh \ ${sysconfdir}/sota_client.version \ ${sysconfdir}/sota_certificates \ - /var/sota/sota_provisioning_credentials.p12 \ - /var/sota/sota_provisioning_url.env \ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client_autoprovision.service', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client.service', '', d)} \ " diff --git a/recipes-support/python-petname/python-petname.bb b/recipes-support/python-petname/python-petname.bb index b8a7b88..9abd5d9 100644 --- a/recipes-support/python-petname/python-petname.bb +++ b/recipes-support/python-petname/python-petname.bb @@ -13,3 +13,4 @@ RDEPENDS_${PN} = " python-setuptools \ python-argparse \ " +FILES_${PN} = "${libdir} ${bindir}/petname" -- cgit v1.2.3-54-g00ecf From 15ae682a2020182552df70726c8352701a1f444c Mon Sep 17 00:00:00 2001 From: Jon Oster Date: Tue, 20 Jun 2017 21:03:05 +0200 Subject: Update docs links --- README.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index e26497c..d625780 100644 --- a/README.adoc +++ b/README.adoc @@ -4,13 +4,13 @@ This layer enables over-the-air updates (OTA) with https://github.com/ostreedev/ https://github.com/ostreedev/ostree[OSTree] is a tool for atomic full file system upgrades with rollback capability. OSTree has several advantages over traditional dual-bank systems, but the most important one is that it minimizes network bandwidth and data storage footprint by sharing files with the same contents across file system deployments. -https://github.com/advancedtelematic/rvi_sota_client[RVI SOTA client] adds authentication and provisioning capabilities to OTA and is integrated with OSTree. It connects to https://github.com/advancedtelematic/rvi_sota_server[RVI SOTA server]. +https://github.com/advancedtelematic/rvi_sota_client[RVI SOTA client] and/or https://github.com/advancedtelematic/aktualizr[aktualizr] add authentication and provisioning capabilities to OTA and are integrated with OSTree. You can connect with the open-source https://github.com/advancedtelematic/rvi_sota_server[RVI SOTA server] or sign up for a free account at https://app.atsgarage.com[ATS Garage] to get started. == Build === Quickstart -If you don't already have a Yocto project that you want to add OTA to, you can use the https://github.com/advancedtelematic/garage-quickstart-rpi[ATS Garage Quickstart] project to rapidly get up and running on a Raspberry Pi. It takes a standard https://www.yoctoproject.org/tools-resources/projects/poky[poky] distribution, and adds OTA and OSTree capabilities. For a detailed getting started tutorial see the https://github.com/advancedtelematic/garage-quickstart-rpi/blob/master/README.adoc[README]. +If you don't already have a Yocto project that you want to add OTA to, you can use the https://docs.atsgarage.com/quickstarts/raspberry-pi.html[ATS Garage Quickstart] project to rapidly get up and running on a Raspberry Pi. It takes a standard https://www.yoctoproject.org/tools-resources/projects/poky[poky] distribution, and adds OTA and OSTree capabilities. === Adding meta-updater capabilities to your build -- cgit v1.2.3-54-g00ecf From 1c5b56dcd6d21528e67c681d973cae3a13045bb9 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Wed, 21 Jun 2017 17:25:27 +0200 Subject: Preserve /var/local Fixes SPEC-761 in AGL --- classes/image_types_ota.bbclass | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 2dd6846..09c30ff 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass @@ -96,8 +96,9 @@ IMAGE_CMD_otaimg () { # Copy deployment /home and /var/sota to sysroot HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX` - tar --xattrs --xattrs-include='*' -C ${HOME_TMP} -xf ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 ./usr/homedirs ./var/sota || true - mv ${HOME_TMP}/var/sota ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true + tar --xattrs --xattrs-include='*' -C ${HOME_TMP} -xf ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 ./usr/homedirs ./var/sota ./var/local || true + mv ${HOME_TMP}/var/sota ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true + mv ${HOME_TMP}/var/local ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true # Create /var/sota if it doesn't exist yet mkdir -p ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota || true mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ || true -- cgit v1.2.3-54-g00ecf From ae8a5db4668b153baa1b4aaf814f2cdd685e6466 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Wed, 31 May 2017 10:21:56 +0300 Subject: sota: Support m3ulcb Support Renesas R Car Starter Kit Generation 3 (m3ulcb). Signed-off-by: Leon Anavi --- classes/sota.bbclass | 1 + classes/sota_m3ulcb.bbclass | 9 +++++++++ conf/include/bblayers/sota_m3ulcb.inc | 2 ++ 3 files changed, 12 insertions(+) create mode 100644 classes/sota_m3ulcb.bbclass create mode 100644 conf/include/bblayers/sota_m3ulcb.inc diff --git a/classes/sota.bbclass b/classes/sota.bbclass index a96429c..5073e29 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -25,6 +25,7 @@ SOTA_MACHINE ??="none" SOTA_MACHINE_raspberrypi2 ?= "raspberrypi" SOTA_MACHINE_raspberrypi3 ?= "raspberrypi" SOTA_MACHINE_porter ?= "porter" +SOTA_MACHINE_m3ulcb = "m3ulcb" SOTA_MACHINE_intel-corei7-64 ?= "minnowboard" SOTA_MACHINE_qemux86-64 ?= "qemux86-64" SOTA_MACHINE_am335x-evm ?= "am335x-evm-wifi" diff --git a/classes/sota_m3ulcb.bbclass b/classes/sota_m3ulcb.bbclass new file mode 100644 index 0000000..21d04ba --- /dev/null +++ b/classes/sota_m3ulcb.bbclass @@ -0,0 +1,9 @@ +# Commit united image to OSTree, not just uImage +OSTREE_KERNEL = "Image" + +EXTRA_IMAGEDEPENDS_append_sota = " m3ulcb-ota-bootfiles" +IMAGE_CLASSES_append_sota = " image_types_uboot " +IMAGE_BOOT_FILES_sota += "m3ulcb-ota-bootfiles/*" + +OSTREE_BOOTLOADER ?= "u-boot" +UBOOT_MACHINE_sota = "m3ulcb_defconfig" diff --git a/conf/include/bblayers/sota_m3ulcb.inc b/conf/include/bblayers/sota_m3ulcb.inc new file mode 100644 index 0000000..04f78e4 --- /dev/null +++ b/conf/include/bblayers/sota_m3ulcb.inc @@ -0,0 +1,2 @@ + +BBLAYERS += " ${METADIR}/meta-renesas ${METADIR}/meta-renesas-rcar-gen3 ${METADIR}/meta-openembedded/meta-multimedia" -- cgit v1.2.3-54-g00ecf From 64e2fb483f6d4df8929af9ada31a72e218121f0e Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Thu, 22 Jun 2017 12:15:21 +0200 Subject: Fix warnings from shellcheck shell linter --- recipes-sota/ostree-initrd/files/init.sh | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/recipes-sota/ostree-initrd/files/init.sh b/recipes-sota/ostree-initrd/files/init.sh index 1814ca3..b88716c 100644 --- a/recipes-sota/ostree-initrd/files/init.sh +++ b/recipes-sota/ostree-initrd/files/init.sh @@ -1,17 +1,13 @@ #!/bin/sh - -# global variables - -SMACK=n -DEBUG=n +set -eu # ------------------------------------------- -log_info() { echo "$0[$$]: $@" >&2; } -log_error() { echo "$0[$$]: ERROR $@" >&2; } +log_info() { echo "$0[$$]: $*" >&2; } +log_error() { echo "$0[$$]: ERROR $*" >&2; } do_mount_fs() { - log_info "mounting FS: $@" + log_info "mounting FS: $*" [[ -e /proc/filesystems ]] && { grep -q "$1" /proc/filesystems || { log_error "Unknown filesystem"; return 1; } } [[ -d "$2" ]] || mkdir -p "$2" [[ -e /proc/mounts ]] && { grep -q -e "^$1 $2 $1" /proc/mounts && { log_info "$2 ($1) already mounted"; return 0; } } @@ -26,10 +22,10 @@ bail_out() { } get_ostree_sysroot() { - for opt in `cat /proc/cmdline`; do - arg=`echo $opt | cut -d'=' -f1` - if [ $arg == "ostree_root" ]; then - echo $opt | cut -d'=' -f2- + for opt in $(cat /proc/cmdline); do + arg=$(echo "$opt" | cut -d'=' -f1) + if [ "$arg" == "ostree_root" ]; then + echo "$opt" | cut -d'=' -f2- return fi done @@ -38,7 +34,7 @@ get_ostree_sysroot() { export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/ostree -log_info "starting initrd script" +log_info "Starting OSTree initrd script" do_mount_fs proc /proc do_mount_fs sysfs /sys @@ -50,8 +46,6 @@ do_mount_fs tmpfs /run # check if smack is active (and if so, mount smackfs) grep -q smackfs /proc/filesystems && { - SMACK=y - do_mount_fs smackfs /sys/fs/smackfs # adjust current label and network label @@ -69,7 +63,7 @@ ostree-prepare-root /sysroot cd /sysroot for x in dev proc; do log_info "Moving /$x to new rootfs" - mount -o move /$x $x + mount -o move "/$x" "$x" done # switch to new rootfs -- cgit v1.2.3-54-g00ecf From 3eda07d8632fe6723418b47dfb3a0bb4b41129b3 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Thu, 22 Jun 2017 12:16:03 +0200 Subject: Retry mounting sysroot Fixes DEM-169 --- recipes-sota/ostree-initrd/files/init.sh | 8 +++++++- recipes-sota/ostree-initrd/ostree-initrd.bb | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/recipes-sota/ostree-initrd/files/init.sh b/recipes-sota/ostree-initrd/files/init.sh index b88716c..0b0693d 100644 --- a/recipes-sota/ostree-initrd/files/init.sh +++ b/recipes-sota/ostree-initrd/files/init.sh @@ -56,7 +56,13 @@ grep -q smackfs /proc/filesystems && { mkdir -p /sysroot ostree_sysroot=$(get_ostree_sysroot) -mount $ostree_sysroot /sysroot || bail_out "Unable to mount $ostree_sysroot as physical sysroot" +mount "$ostree_sysroot" /sysroot || { + # The SD card in the R-Car M3 takes a bit of time to come up + # Retry the mount if it fails the first time + log_info "Mounting $ostree_sysroot failed, waiting 5s for the device to be available..." + sleep 5 + mount "$ostree_sysroot" /sysroot || bail_out "Unable to mount $ostree_sysroot as physical sysroot" +} ostree-prepare-root /sysroot # move mounted devices to new root diff --git a/recipes-sota/ostree-initrd/ostree-initrd.bb b/recipes-sota/ostree-initrd/ostree-initrd.bb index b721405..6046c81 100644 --- a/recipes-sota/ostree-initrd/ostree-initrd.bb +++ b/recipes-sota/ostree-initrd/ostree-initrd.bb @@ -5,7 +5,7 @@ SRC_URI = "file://init.sh" S = "${WORKDIR}" -PV = "2" +PV = "3" do_install() { install -dm 0755 ${D}/etc -- cgit v1.2.3-54-g00ecf From dc234532add69842295902d35981dba886468da0 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Mon, 26 Jun 2017 15:13:44 +0200 Subject: Aktualizr updates, including sync() Perform sync() after provisioning Store sota.toml in updatable /usr directory --- classes/image_types_ostree.bbclass | 2 +- recipes-sota/aktualizr/aktualizr_git.bb | 9 +++++---- recipes-sota/aktualizr/files/aktualizr-autoprovision.service | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 2a74e51..72d7df5 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -203,7 +203,7 @@ IMAGE_CMD_ostree () { IMAGE_TYPEDEP_ostreepush = "ostree" IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot" IMAGE_CMD_ostreepush () { - if [ ${OSTREE_PUSH_CREDENTIALS} ]; then + if [ -n "${OSTREE_PUSH_CREDENTIALS}" ]; then garage-push --repo=${OSTREE_REPO} \ --ref=${OSTREE_BRANCHNAME} \ --credentials=${OSTREE_PUSH_CREDENTIALS} \ diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 62ee9b0..39a8ac8 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -12,7 +12,7 @@ SRC_URI = " \ file://aktualizr-autoprovision.service \ file://sota_autoprov.toml \ " -SRCREV = "2e897310c611e2da46f8af888bb62c09b2a2906a" +SRCREV = "33614fb9fc8f6c9ab5fae20c16d1dca0a330b07f" PV = "1.0+git${SRCPV}" S = "${WORKDIR}/git" @@ -23,13 +23,14 @@ inherit cmake systemd EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON -DAKTUALIZR_VERSION=${PV}" export SOTA_AUTOPROVISION_CREDENTIALS +export SOTA_PACKED_CREDENTIALS do_install_append() { if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" -o -n "${SOTA_PACKED_CREDENTIALS}" ]; then install -d ${D}/${systemd_unitdir}/system install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service - install -d ${D}/var/sota - install -m "0644" ${WORKDIR}/sota_autoprov.toml ${D}/var/sota/sota.toml + install -d ${D}/usr/lib/sota + install -m "0644" ${WORKDIR}/sota_autoprov.toml ${D}/usr/lib/sota/sota.toml else install -d ${D}/${systemd_unitdir}/system install -m 0644 ${WORKDIR}/aktualizr-manual-provision.service ${D}/${systemd_unitdir}/system/aktualizr.service @@ -39,5 +40,5 @@ do_install_append() { FILES_${PN} = " \ ${bindir}/aktualizr \ ${systemd_unitdir}/system/aktualizr.service \ - /var/sota/sota.toml \ + /usr/lib/sota/sota.toml \ " diff --git a/recipes-sota/aktualizr/files/aktualizr-autoprovision.service b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service index a5b92e3..fd0ab09 100644 --- a/recipes-sota/aktualizr/files/aktualizr-autoprovision.service +++ b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service @@ -8,7 +8,7 @@ Requires=network-online.target RestartSec=10 Restart=always EnvironmentFile=/var/sota/sota_provisioning_url.env -ExecStart=/bin/sh -c "/usr/bin/aktualizr --disable-keyid-validation --tls-server ${SOTA_GATEWAY_URI} --primary-ecu-hardware-id `cat /etc/hostname` --config /var/sota/sota.toml" +ExecStart=/usr/bin/aktualizr --disable-keyid-validation --tls-server ${SOTA_GATEWAY_URI} --config /usr/lib/sota/sota.toml [Install] WantedBy=multi-user.target -- cgit v1.2.3-54-g00ecf From fa0129a24d1d91a99f7dc17235177cb680049825 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Mon, 26 Jun 2017 16:06:21 +0200 Subject: Override IMAGE_ROOTFS_EXTRA_SPACE AGL sets this to 500MB to allow extra space in the default image. Set it to 0 in the initramfs. --- recipes-core/images/initramfs-ostree-image.bb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes-core/images/initramfs-ostree-image.bb b/recipes-core/images/initramfs-ostree-image.bb index 509b74d..cd872b8 100644 --- a/recipes-core/images/initramfs-ostree-image.bb +++ b/recipes-core/images/initramfs-ostree-image.bb @@ -21,6 +21,10 @@ inherit core-image IMAGE_ROOTFS_SIZE = "8192" +# Users will often ask for extra space in their rootfs by setting this +# globally. Since this is a initramfs, we don't want to make it bigger +IMAGE_ROOTFS_EXTRA_SPACE = "0" + BAD_RECOMMENDATIONS += "busybox-syslog" -- cgit v1.2.3-54-g00ecf From 30109fe78e93bf2f88ebe866577bd957af35c98b Mon Sep 17 00:00:00 2001 From: Shaun Taheri Date: Thu, 22 Jun 2017 14:05:48 +0200 Subject: Fix script directory in zsh --- scripts/envsetup.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh index 5adf319..7314111 100755 --- a/scripts/envsetup.sh +++ b/scripts/envsetup.sh @@ -1,7 +1,6 @@ -#!/bin/sh +#!/bin/bash SCRIPT="envsetup.sh" - MACHINE=$1 if [ "$#" -lt 1 ]; then @@ -32,8 +31,12 @@ if [ $SOURCED -ne 1 ]; then exit -1 fi -SCRIPTDIR=$(cd $(dirname $BASH_SOURCE) && pwd -P) -METADIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) +if [ -n "$ZSH_VERSION" ]; then + SCRIPTDIR=$(cd $(dirname $0) && pwd -P) +else + SCRIPTDIR=$(cd $(dirname $BASH_SOURCE) && pwd -P) +fi +METADIR="${SCRIPTDIR}/../.." if [ -e ${BUILDDIR}/conf/local.conf ]; then source $METADIR/poky/oe-init-build-env ${BUILDDIR} -- cgit v1.2.3-54-g00ecf From a33124a4592820f4b3c4deaf6853476df2a2f105 Mon Sep 17 00:00:00 2001 From: Shaun Taheri Date: Fri, 23 Jun 2017 14:26:56 +0200 Subject: Quote all bash variables --- scripts/envsetup.sh | 54 ++++++++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh index 7314111..c2f27c5 100755 --- a/scripts/envsetup.sh +++ b/scripts/envsetup.sh @@ -1,51 +1,33 @@ #!/bin/bash SCRIPT="envsetup.sh" -MACHINE=$1 +MACHINE="$1" +BUILDDIR="build" -if [ "$#" -lt 1 ]; then - echo "Usage: ${SCRIPT} [builddir]" - return -1 -elif [ "$#" -eq 2 ]; then - BUILDDIR=$2 -else - BUILDDIR=build -fi -BULDDIR=$2 +[[ "$#" -lt 1 ]] && { echo "Usage: ${SCRIPT} [builddir]"; return 1; } +[[ "$#" -eq 2 ]] && { BUILDDIR="$2"; } # detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594 SOURCED=0 if [ -n "$ZSH_EVAL_CONTEXT" ]; then - [[ $ZSH_EVAL_CONTEXT =~ :file$ ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- $0) && pwd -P); } -elif [ -n "$KSH_VERSION" ]; then - [[ "$(cd $(dirname -- $0) && pwd -P)/$(basename -- $0)" != "$(cd $(dirname -- ${.sh.file}) && pwd -P)/$(basename -- ${.sh.file})" ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- ${.sh.file}) && pwd -P); } + [[ "$ZSH_EVAL_CONTEXT" =~ :file$ ]] && { SOURCED=1; SOURCEDIR=$(cd "$(dirname -- "$0")" && pwd -P); } elif [ -n "$BASH_VERSION" ]; then - [[ $0 != "$BASH_SOURCE" ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- $BASH_SOURCE) && pwd -P); } + [[ "$0" != "${BASH_SOURCE[0]}" ]] && { SOURCED=1; SOURCEDIR=$(cd "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P); } fi -if [ $SOURCED -ne 1 ]; then - unset SOURCED - unset SOURCEDIR - echo "Error: this script needs to be sourced in a supported shell" >&2 - echo "Please check that the current shell is bash, zsh or ksh and run this script as '. $0 '" >&2 - exit -1 +if [[ $SOURCED -ne 1 ]]; then + echo "Error: this script needs to be sourced in a supported shell" >&2 + echo "Please check that the current shell is bash or zsh and run this script as '. $0 '" >&2 + exit 1 fi -if [ -n "$ZSH_VERSION" ]; then - SCRIPTDIR=$(cd $(dirname $0) && pwd -P) -else - SCRIPTDIR=$(cd $(dirname $BASH_SOURCE) && pwd -P) -fi -METADIR="${SCRIPTDIR}/../.." +METADIR="${SOURCEDIR}/../.." +source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" -if [ -e ${BUILDDIR}/conf/local.conf ]; then - source $METADIR/poky/oe-init-build-env ${BUILDDIR} -else - source $METADIR/poky/oe-init-build-env ${BUILDDIR} - echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf - cat ${METADIR}/meta-updater/conf/include/bblayers/sota.inc >> conf/bblayers.conf - cat ${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc >> conf/bblayers.conf - echo "MACHINE = \"${MACHINE}\"" >> conf/local.conf - echo "DISTRO = \"poky-sota-systemd\"" >> conf/local.conf +if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then + echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf + cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf + cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf + echo "MACHINE = \"${MACHINE}\"" >> conf/local.conf + echo "DISTRO = \"poky-sota-systemd\"" >> conf/local.conf fi - -- cgit v1.2.3-54-g00ecf From 0f40a9d48aeffeebccd01124f8e8c43b2e29883c Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Mon, 26 Jun 2017 16:33:56 +0200 Subject: Fix new/existing build directory logic --- scripts/envsetup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh index c2f27c5..ff78681 100755 --- a/scripts/envsetup.sh +++ b/scripts/envsetup.sh @@ -22,12 +22,14 @@ if [[ $SOURCED -ne 1 ]]; then fi METADIR="${SOURCEDIR}/../.." -source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then + source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf echo "MACHINE = \"${MACHINE}\"" >> conf/local.conf echo "DISTRO = \"poky-sota-systemd\"" >> conf/local.conf +else + source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" fi -- cgit v1.2.3-54-g00ecf From f4d02e3f34a441f33b9e6623b39422b9e49b7d84 Mon Sep 17 00:00:00 2001 From: Jon Oster Date: Wed, 28 Jun 2017 14:15:43 +0200 Subject: PRO-3341 PRO-3342 Bump aktualizr version to add sw/hw reporting --- recipes-sota/aktualizr/aktualizr_git.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 39a8ac8..4f9d131 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -5,6 +5,7 @@ SECTION = "base" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" DEPENDS = "boost curl openssl jansson libsodium ostree" +RDEPENDS_${PN} = "lshw" SRC_URI = " \ git://github.com/advancedtelematic/aktualizr \ @@ -12,7 +13,7 @@ SRC_URI = " \ file://aktualizr-autoprovision.service \ file://sota_autoprov.toml \ " -SRCREV = "33614fb9fc8f6c9ab5fae20c16d1dca0a330b07f" +SRCREV = "7ca3af4e2f47ca7a3a67866023de3f8a97425991" PV = "1.0+git${SRCPV}" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 56aab3b8ee886436621158fbab8744c75262d571 Mon Sep 17 00:00:00 2001 From: Jan-Simon Möller Date: Thu, 29 Jun 2017 15:51:10 +0200 Subject: Remove also compressed rpi-sdimg.xz --- classes/sota_raspberrypi.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass index b6cf639..9b103ff 100644 --- a/classes/sota_raspberrypi.bbclass +++ b/classes/sota_raspberrypi.bbclass @@ -1,7 +1,7 @@ IMAGE_CLASSES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'image_types_uboot sdcard_image-rpi-ota', '', d)}" IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'rpi-sdimg-ota', 'rpi-sdimg', d)}" -IMAGE_FSTYPES_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'wic rpi-sdimg', '', d)}" +IMAGE_FSTYPES_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'wic rpi-sdimg rpi-sdimg.xz', '', d)}" KERNEL_IMAGETYPE_sota = "uImage" PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" -- cgit v1.2.3-54-g00ecf From 43163f4ccff4b48cbb28e78e9deebb16b4e29ef5 Mon Sep 17 00:00:00 2001 From: Jan-Simon Möller Date: Thu, 29 Jun 2017 15:54:40 +0200 Subject: Disable noisy warnings ... should only print once. --- classes/sota_none.bbclass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/sota_none.bbclass b/classes/sota_none.bbclass index 86eaf0b..c11b070 100644 --- a/classes/sota_none.bbclass +++ b/classes/sota_none.bbclass @@ -1,4 +1,4 @@ # null machine it's here to make bitbake happy when SOTA_MACHINE is undefined -python __anonymous() { - bb.warn("SOTA functionality is not yet supported for your machine") -} +#python __anonymous() { +# bb.warn("SOTA functionality is not yet supported for your machine") +#} -- cgit v1.2.3-54-g00ecf From 109b534b60eb63dfeb6a43a594fd96870699170b Mon Sep 17 00:00:00 2001 From: Jan-Simon Möller Date: Thu, 29 Jun 2017 15:56:48 +0200 Subject: Use compression on output file to save space We could make that a option to the user ... --- classes/sota_raspberrypi.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass index b6cf639..544537b 100644 --- a/classes/sota_raspberrypi.bbclass +++ b/classes/sota_raspberrypi.bbclass @@ -1,5 +1,5 @@ IMAGE_CLASSES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'image_types_uboot sdcard_image-rpi-ota', '', d)}" -IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'rpi-sdimg-ota', 'rpi-sdimg', d)}" +IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'rpi-sdimg-ota.xz', 'rpi-sdimg.xz', d)}" IMAGE_FSTYPES_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'wic rpi-sdimg', '', d)}" -- cgit v1.2.3-54-g00ecf From 0c35f176862be36bf0f8b91614d97686d7619dd8 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Tue, 4 Jul 2017 17:54:07 +0200 Subject: Fix output directory in sdcard_image-rpi-ota --- classes/sdcard_image-rpi-ota.bbclass | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/classes/sdcard_image-rpi-ota.bbclass b/classes/sdcard_image-rpi-ota.bbclass index 9022aaf..81d71e9 100644 --- a/classes/sdcard_image-rpi-ota.bbclass +++ b/classes/sdcard_image-rpi-ota.bbclass @@ -61,7 +61,7 @@ IMAGE_DEPENDS_rpi-sdimg-ota = " \ IMAGE_TYPEDEP_rpi-sdimg-ota = "otaimg" # SD card image name -SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg-ota" +SDIMG_OTA = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.rpi-sdimg-ota" # Compression method to apply to SDIMG_OTA after it has been created. Supported # compression formats are "gzip", "bzip2" or "xz". The original .rpi-sdimg-ota file @@ -165,9 +165,6 @@ IMAGE_CMD_rpi-sdimg-ota () { dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync fi - rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rpi-sdimg-ota - ln -s ${IMAGE_NAME}.rootfs.rpi-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rpi-sdimg-ota - # Optionally apply compression case "${SDIMG_OTA_COMPRESSION}" in "gzip") @@ -180,9 +177,6 @@ IMAGE_CMD_rpi-sdimg-ota () { xz -k "${SDIMG_OTA}" ;; esac - - rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.rpi-sdimg-ota - ln -s ${IMAGE_NAME}.rootfs.rpi-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.rpi-sdimg-ota } ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; " -- cgit v1.2.3-54-g00ecf