summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcajun-rat <p@beta16.co.uk>2017-07-05 14:50:37 +0200
committerGitHub <noreply@github.com>2017-07-05 14:50:37 +0200
commit00dc1fef0667ab640ad6bd688e4737309b000358 (patch)
treec9e4c89bce12a81ddd364b2676c8a005fff725dd
parentb0d9d7018502a29f062895f853efd41e7b760d5a (diff)
parent69a0db9291725b1ddfa643dc00d6d2f1bf6c5caf (diff)
downloadmeta-updater-00dc1fef0667ab640ad6bd688e4737309b000358.tar.gz
Merge pull request #101 from advancedtelematic/feat/mergemorty
Merge current progress from morty to pyro
-rw-r--r--README.adoc4
-rw-r--r--classes/image_types_ostree.bbclass2
-rw-r--r--classes/image_types_ota.bbclass7
-rw-r--r--classes/sdcard_image-rpi-ota.bbclass8
-rw-r--r--classes/sota.bbclass2
-rw-r--r--classes/sota_m3ulcb.bbclass9
-rw-r--r--classes/sota_raspberrypi.bbclass2
-rw-r--r--conf/distro/sota.conf.inc1
-rw-r--r--conf/include/bblayers/sota_m3ulcb.inc2
-rw-r--r--recipes-core/images/initramfs-ostree-image.bb4
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb20
-rw-r--r--recipes-sota/aktualizr/files/aktualizr-autoprovision.service14
-rw-r--r--recipes-sota/aktualizr/files/sota_autoprov.toml18
-rw-r--r--recipes-sota/ostree-initrd/files/init.sh34
-rw-r--r--recipes-sota/ostree-initrd/ostree-initrd.bb2
-rw-r--r--recipes-sota/rvi-sota-client/rvi-sota-client_git.bb2
-rw-r--r--recipes-support/python-petname/python-petname.bb1
-rw-r--r--recipes-test/big-update/big-update_1.0.bb11
-rw-r--r--recipes-test/big-update/big-update_2.0.bb11
-rw-r--r--recipes-test/big-update/files/rand_file.py16
-rwxr-xr-xscripts/envsetup.sh53
21 files changed, 148 insertions, 75 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/
4 4
5https://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. 5https://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.
6 6
7https://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]. 7https://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.
8 8
9== Build 9== Build
10 10
11=== Quickstart 11=== Quickstart
12 12
13If 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]. 13If 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.
14 14
15=== Adding meta-updater capabilities to your build 15=== Adding meta-updater capabilities to your build
16 16
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 () {
203IMAGE_TYPEDEP_ostreepush = "ostree" 203IMAGE_TYPEDEP_ostreepush = "ostree"
204IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot" 204IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot"
205IMAGE_CMD_ostreepush () { 205IMAGE_CMD_ostreepush () {
206 if [ ${OSTREE_PUSH_CREDENTIALS} ]; then 206 if [ -n "${OSTREE_PUSH_CREDENTIALS}" ]; then
207 garage-push --repo=${OSTREE_REPO} \ 207 garage-push --repo=${OSTREE_REPO} \
208 --ref=${OSTREE_BRANCHNAME} \ 208 --ref=${OSTREE_BRANCHNAME} \
209 --credentials=${OSTREE_PUSH_CREDENTIALS} \ 209 --credentials=${OSTREE_PUSH_CREDENTIALS} \
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass
index 8108d51..09c30ff 100644
--- a/classes/image_types_ota.bbclass
+++ b/classes/image_types_ota.bbclass
@@ -92,12 +92,13 @@ IMAGE_CMD_otaimg () {
92 kargs_list="${kargs_list} --karg-append=$arg" 92 kargs_list="${kargs_list} --karg-append=$arg"
93 done 93 done
94 94
95 ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_OSNAME}:${OSTREE_BRANCHNAME} 95 ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_BRANCHNAME}
96 96
97 # Copy deployment /home and /var/sota to sysroot 97 # Copy deployment /home and /var/sota to sysroot
98 HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX` 98 HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX`
99 tar --xattrs --xattrs-include='*' -C ${HOME_TMP} -xf ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 ./usr/homedirs ./var/sota || true 99 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
100 mv ${HOME_TMP}/var/sota ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true 100 mv ${HOME_TMP}/var/sota ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true
101 mv ${HOME_TMP}/var/local ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true
101 # Create /var/sota if it doesn't exist yet 102 # Create /var/sota if it doesn't exist yet
102 mkdir -p ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota || true 103 mkdir -p ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota || true
103 mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ || true 104 mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ || true
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 = " \
61IMAGE_TYPEDEP_rpi-sdimg-ota = "otaimg" 61IMAGE_TYPEDEP_rpi-sdimg-ota = "otaimg"
62 62
63# SD card image name 63# SD card image name
64SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg-ota" 64SDIMG_OTA = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.rpi-sdimg-ota"
65 65
66# Compression method to apply to SDIMG_OTA after it has been created. Supported 66# Compression method to apply to SDIMG_OTA after it has been created. Supported
67# compression formats are "gzip", "bzip2" or "xz". The original .rpi-sdimg-ota file 67# compression formats are "gzip", "bzip2" or "xz". The original .rpi-sdimg-ota file
@@ -165,9 +165,6 @@ IMAGE_CMD_rpi-sdimg-ota () {
165 dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync 165 dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
166 fi 166 fi
167 167
168 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rpi-sdimg-ota
169 ln -s ${IMAGE_NAME}.rootfs.rpi-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rpi-sdimg-ota
170
171 # Optionally apply compression 168 # Optionally apply compression
172 case "${SDIMG_OTA_COMPRESSION}" in 169 case "${SDIMG_OTA_COMPRESSION}" in
173 "gzip") 170 "gzip")
@@ -180,9 +177,6 @@ IMAGE_CMD_rpi-sdimg-ota () {
180 xz -k "${SDIMG_OTA}" 177 xz -k "${SDIMG_OTA}"
181 ;; 178 ;;
182 esac 179 esac
183
184 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.rpi-sdimg-ota
185 ln -s ${IMAGE_NAME}.rootfs.rpi-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.rpi-sdimg-ota
186} 180}
187 181
188ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; " 182ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; "
diff --git a/classes/sota.bbclass b/classes/sota.bbclass
index 2761111..5073e29 100644
--- a/classes/sota.bbclass
+++ b/classes/sota.bbclass
@@ -5,6 +5,7 @@ python __anonymous() {
5 5
6OVERRIDES .= "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ':sota', '', d)}" 6OVERRIDES .= "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ':sota', '', d)}"
7 7
8SOTA_CLIENT ??= "aktualizr"
8IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT}" 9IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT}"
9IMAGE_CLASSES += " image_types_ostree image_types_ota" 10IMAGE_CLASSES += " image_types_ostree image_types_ota"
10IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush otaimg wic', ' ', d)}" 11IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush otaimg wic', ' ', d)}"
@@ -24,6 +25,7 @@ SOTA_MACHINE ??="none"
24SOTA_MACHINE_raspberrypi2 ?= "raspberrypi" 25SOTA_MACHINE_raspberrypi2 ?= "raspberrypi"
25SOTA_MACHINE_raspberrypi3 ?= "raspberrypi" 26SOTA_MACHINE_raspberrypi3 ?= "raspberrypi"
26SOTA_MACHINE_porter ?= "porter" 27SOTA_MACHINE_porter ?= "porter"
28SOTA_MACHINE_m3ulcb = "m3ulcb"
27SOTA_MACHINE_intel-corei7-64 ?= "minnowboard" 29SOTA_MACHINE_intel-corei7-64 ?= "minnowboard"
28SOTA_MACHINE_qemux86-64 ?= "qemux86-64" 30SOTA_MACHINE_qemux86-64 ?= "qemux86-64"
29SOTA_MACHINE_am335x-evm ?= "am335x-evm-wifi" 31SOTA_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 @@
1# Commit united image to OSTree, not just uImage
2OSTREE_KERNEL = "Image"
3
4EXTRA_IMAGEDEPENDS_append_sota = " m3ulcb-ota-bootfiles"
5IMAGE_CLASSES_append_sota = " image_types_uboot "
6IMAGE_BOOT_FILES_sota += "m3ulcb-ota-bootfiles/*"
7
8OSTREE_BOOTLOADER ?= "u-boot"
9UBOOT_MACHINE_sota = "m3ulcb_defconfig"
diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass
index 9b103ff..cc6b666 100644
--- a/classes/sota_raspberrypi.bbclass
+++ b/classes/sota_raspberrypi.bbclass
@@ -1,5 +1,5 @@
1IMAGE_CLASSES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'image_types_uboot sdcard_image-rpi-ota', '', d)}" 1IMAGE_CLASSES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'image_types_uboot sdcard_image-rpi-ota', '', d)}"
2IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'rpi-sdimg-ota', 'rpi-sdimg', d)}" 2IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'rpi-sdimg-ota.xz', 'rpi-sdimg.xz', d)}"
3 3
4IMAGE_FSTYPES_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'wic rpi-sdimg rpi-sdimg.xz', '', d)}" 4IMAGE_FSTYPES_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'wic rpi-sdimg rpi-sdimg.xz', '', d)}"
5 5
diff --git a/conf/distro/sota.conf.inc b/conf/distro/sota.conf.inc
index 1775d92..ea1ca95 100644
--- a/conf/distro/sota.conf.inc
+++ b/conf/distro/sota.conf.inc
@@ -7,7 +7,6 @@
7DISTRO_FEATURES_append = " sota" 7DISTRO_FEATURES_append = " sota"
8DISTRO_FEATURES_NATIVE_append = " sota" 8DISTRO_FEATURES_NATIVE_append = " sota"
9INHERIT += " sota" 9INHERIT += " sota"
10SOTA_CLIENT ?= "aktualizr"
11# Prelinking increases the size of downloads and causes build errors 10# Prelinking increases the size of downloads and causes build errors
12USER_CLASSES_remove = "image-prelink" 11USER_CLASSES_remove = "image-prelink"
13 12
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 @@
1
2BBLAYERS += " ${METADIR}/meta-renesas ${METADIR}/meta-renesas-rcar-gen3 ${METADIR}/meta-openembedded/meta-multimedia"
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
21 21
22IMAGE_ROOTFS_SIZE = "8192" 22IMAGE_ROOTFS_SIZE = "8192"
23 23
24# Users will often ask for extra space in their rootfs by setting this
25# globally. Since this is a initramfs, we don't want to make it bigger
26IMAGE_ROOTFS_EXTRA_SPACE = "0"
27
24BAD_RECOMMENDATIONS += "busybox-syslog" 28BAD_RECOMMENDATIONS += "busybox-syslog"
25 29
26 30
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index fa71af8..4f9d131 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -5,35 +5,41 @@ 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"
7DEPENDS = "boost curl openssl jansson libsodium ostree" 7DEPENDS = "boost curl openssl jansson libsodium ostree"
8SRCREV = "4e9344ae375a444f02b964dca52fe808010d17df" 8RDEPENDS_${PN} = "lshw"
9PV = "1.0+git${SRCPV}"
10 9
11SRC_URI = " \ 10SRC_URI = " \
12 git://github.com/advancedtelematic/aktualizr \ 11 git://github.com/advancedtelematic/aktualizr \
13 file://aktualizr-manual-provision.service \ 12 file://aktualizr-manual-provision.service \
13 file://aktualizr-autoprovision.service \
14 file://sota_autoprov.toml \
14 " 15 "
16SRCREV = "7ca3af4e2f47ca7a3a67866023de3f8a97425991"
17PV = "1.0+git${SRCPV}"
15 18
16S = "${WORKDIR}/git" 19S = "${WORKDIR}/git"
17SYSTEMD_SERVICE_${PN} = "aktualizr.service" 20SYSTEMD_SERVICE_${PN} = "aktualizr.service"
18 21
19inherit cmake systemd 22inherit cmake systemd
20 23
21EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON" 24EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON -DAKTUALIZR_VERSION=${PV}"
22 25
23export SOTA_AUTOPROVISION_CREDENTIALS 26export SOTA_AUTOPROVISION_CREDENTIALS
27export SOTA_PACKED_CREDENTIALS
24 28
25do_install_append() { 29do_install_append() {
26 if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" ]; then 30 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" -o -n "${SOTA_PACKED_CREDENTIALS}" ]; then
27 bbwarn "Aktualizr recipe currently lacks support for SOTA_AUTOPROVISION_CREDENTIALS. No systemd service will be created" 31 install -d ${D}/${systemd_unitdir}/system
32 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service
33 install -d ${D}/usr/lib/sota
34 install -m "0644" ${WORKDIR}/sota_autoprov.toml ${D}/usr/lib/sota/sota.toml
28 else 35 else
29 install -d ${D}/${systemd_unitdir}/system 36 install -d ${D}/${systemd_unitdir}/system
30 install -m 0644 ${WORKDIR}/aktualizr-manual-provision.service ${D}/${systemd_unitdir}/system/aktualizr.service 37 install -m 0644 ${WORKDIR}/aktualizr-manual-provision.service ${D}/${systemd_unitdir}/system/aktualizr.service
31 fi 38 fi
32} 39}
33 40
34RDEPENDS = ""
35
36FILES_${PN} = " \ 41FILES_${PN} = " \
37 ${bindir}/aktualizr \ 42 ${bindir}/aktualizr \
38 ${systemd_unitdir}/system/aktualizr.service \ 43 ${systemd_unitdir}/system/aktualizr.service \
44 /usr/lib/sota/sota.toml \
39 " 45 "
diff --git a/recipes-sota/aktualizr/files/aktualizr-autoprovision.service b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service
new file mode 100644
index 0000000..fd0ab09
--- /dev/null
+++ b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service
@@ -0,0 +1,14 @@
1[Unit]
2Description=Aktualizr SOTA Client
3Wants=network-online.target
4After=network.target network-online.target
5Requires=network-online.target
6
7[Service]
8RestartSec=10
9Restart=always
10EnvironmentFile=/var/sota/sota_provisioning_url.env
11ExecStart=/usr/bin/aktualizr --disable-keyid-validation --tls-server ${SOTA_GATEWAY_URI} --config /usr/lib/sota/sota.toml
12
13[Install]
14WantedBy=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 @@
1[device]
2packages_dir = "/tmp/packages_dir"
3certificates_directory = "/var/sota"
4system_info = "system_info.sh"
5
6[tls]
7ca_file = "root.crt"
8client_certificate = "client.pem"
9pkey_file = "pkey.pem"
10
11[uptane]
12metadata_path = "/var/sota/metadata"
13private_key_path = "ecukey.der"
14public_key_path = "ecukey.pub"
15
16[provision]
17p12_path = "sota_provisioning_credentials.p12"
18
diff --git a/recipes-sota/ostree-initrd/files/init.sh b/recipes-sota/ostree-initrd/files/init.sh
index 1814ca3..0b0693d 100644
--- a/recipes-sota/ostree-initrd/files/init.sh
+++ b/recipes-sota/ostree-initrd/files/init.sh
@@ -1,17 +1,13 @@
1#!/bin/sh 1#!/bin/sh
2 2set -eu
3# global variables
4
5SMACK=n
6DEBUG=n
7 3
8# ------------------------------------------- 4# -------------------------------------------
9 5
10log_info() { echo "$0[$$]: $@" >&2; } 6log_info() { echo "$0[$$]: $*" >&2; }
11log_error() { echo "$0[$$]: ERROR $@" >&2; } 7log_error() { echo "$0[$$]: ERROR $*" >&2; }
12 8
13do_mount_fs() { 9do_mount_fs() {
14 log_info "mounting FS: $@" 10 log_info "mounting FS: $*"
15 [[ -e /proc/filesystems ]] && { grep -q "$1" /proc/filesystems || { log_error "Unknown filesystem"; return 1; } } 11 [[ -e /proc/filesystems ]] && { grep -q "$1" /proc/filesystems || { log_error "Unknown filesystem"; return 1; } }
16 [[ -d "$2" ]] || mkdir -p "$2" 12 [[ -d "$2" ]] || mkdir -p "$2"
17 [[ -e /proc/mounts ]] && { grep -q -e "^$1 $2 $1" /proc/mounts && { log_info "$2 ($1) already mounted"; return 0; } } 13 [[ -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() {
26} 22}
27 23
28get_ostree_sysroot() { 24get_ostree_sysroot() {
29 for opt in `cat /proc/cmdline`; do 25 for opt in $(cat /proc/cmdline); do
30 arg=`echo $opt | cut -d'=' -f1` 26 arg=$(echo "$opt" | cut -d'=' -f1)
31 if [ $arg == "ostree_root" ]; then 27 if [ "$arg" == "ostree_root" ]; then
32 echo $opt | cut -d'=' -f2- 28 echo "$opt" | cut -d'=' -f2-
33 return 29 return
34 fi 30 fi
35 done 31 done
@@ -38,7 +34,7 @@ get_ostree_sysroot() {
38 34
39export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/ostree 35export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/ostree
40 36
41log_info "starting initrd script" 37log_info "Starting OSTree initrd script"
42 38
43do_mount_fs proc /proc 39do_mount_fs proc /proc
44do_mount_fs sysfs /sys 40do_mount_fs sysfs /sys
@@ -50,8 +46,6 @@ do_mount_fs tmpfs /run
50 46
51# check if smack is active (and if so, mount smackfs) 47# check if smack is active (and if so, mount smackfs)
52grep -q smackfs /proc/filesystems && { 48grep -q smackfs /proc/filesystems && {
53 SMACK=y
54
55 do_mount_fs smackfs /sys/fs/smackfs 49 do_mount_fs smackfs /sys/fs/smackfs
56 50
57 # adjust current label and network label 51 # adjust current label and network label
@@ -62,14 +56,20 @@ grep -q smackfs /proc/filesystems && {
62mkdir -p /sysroot 56mkdir -p /sysroot
63ostree_sysroot=$(get_ostree_sysroot) 57ostree_sysroot=$(get_ostree_sysroot)
64 58
65mount $ostree_sysroot /sysroot || bail_out "Unable to mount $ostree_sysroot as physical sysroot" 59mount "$ostree_sysroot" /sysroot || {
60 # The SD card in the R-Car M3 takes a bit of time to come up
61 # Retry the mount if it fails the first time
62 log_info "Mounting $ostree_sysroot failed, waiting 5s for the device to be available..."
63 sleep 5
64 mount "$ostree_sysroot" /sysroot || bail_out "Unable to mount $ostree_sysroot as physical sysroot"
65}
66ostree-prepare-root /sysroot 66ostree-prepare-root /sysroot
67 67
68# move mounted devices to new root 68# move mounted devices to new root
69cd /sysroot 69cd /sysroot
70for x in dev proc; do 70for x in dev proc; do
71 log_info "Moving /$x to new rootfs" 71 log_info "Moving /$x to new rootfs"
72 mount -o move /$x $x 72 mount -o move "/$x" "$x"
73done 73done
74 74
75# switch to new rootfs 75# switch to new rootfs
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"
5 5
6S = "${WORKDIR}" 6S = "${WORKDIR}"
7 7
8PV = "2" 8PV = "3"
9 9
10do_install() { 10do_install() {
11 install -dm 0755 ${D}/etc 11 install -dm 0755 ${D}/etc
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 b0d91eb..5a08670 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} = " \
30 ${bindir}/sota_prov.sh \ 30 ${bindir}/sota_prov.sh \
31 ${sysconfdir}/sota_client.version \ 31 ${sysconfdir}/sota_client.version \
32 ${sysconfdir}/sota_certificates \ 32 ${sysconfdir}/sota_certificates \
33 /var/sota/sota_provisioning_credentials.p12 \
34 /var/sota/sota_provisioning_url.env \
35 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client_autoprovision.service', '', d)} \ 33 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client_autoprovision.service', '', d)} \
36 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client.service', '', d)} \ 34 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client.service', '', d)} \
37 " 35 "
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 \
13 python-argparse \ 13 python-argparse \
14 " 14 "
15 15
16FILES_${PN} = "${libdir} ${bindir}/petname"
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 @@
1DESCRIPTION = "Example Package with 10MB of random, seeded content"
2LICENSE = "CLOSED"
3
4SRC_URI = "file://rand_file.py"
5
6FILES_${PN} = "/usr/lib/big-update"
7
8do_install() {
9 install -d ${D}/usr/lib/big-update
10 python ${S}/../rand_file.py ${D}/usr/lib/big-update/a-big-file $(numfmt --from=iec 10M)
11}
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 @@
1DESCRIPTION = "Example Package with 12MB of random, seeded content"
2LICENSE = "CLOSED"
3
4SRC_URI = "file://rand_file.py"
5
6FILES_${PN} = "/usr/lib/big-update"
7
8do_install() {
9 install -d ${D}/usr/lib/big-update
10 python ${S}/../rand_file.py ${D}/usr/lib/big-update/a-big-file $(numfmt --from=iec 12M)
11}
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 @@
1import sys
2from random import seed, randint
3
4def main():
5 n = int(sys.argv[2])
6 ba = bytearray(n)
7
8 seed(42)
9 for i in range(0, n):
10 ba[i] = randint(0, 255)
11
12 with open(sys.argv[1], 'wb') as f:
13 f.write(bytes(ba))
14
15if __name__ == "__main__":
16 main()
diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh
index 5adf319..ff78681 100755
--- a/scripts/envsetup.sh
+++ b/scripts/envsetup.sh
@@ -1,48 +1,35 @@
1#!/bin/sh 1#!/bin/bash
2 2
3SCRIPT="envsetup.sh" 3SCRIPT="envsetup.sh"
4MACHINE="$1"
5BUILDDIR="build"
4 6
5MACHINE=$1 7[[ "$#" -lt 1 ]] && { echo "Usage: ${SCRIPT} <machine> [builddir]"; return 1; }
6 8[[ "$#" -eq 2 ]] && { BUILDDIR="$2"; }
7if [ "$#" -lt 1 ]; then
8 echo "Usage: ${SCRIPT} <machine> [builddir]"
9 return -1
10elif [ "$#" -eq 2 ]; then
11 BUILDDIR=$2
12else
13 BUILDDIR=build
14fi
15BULDDIR=$2
16 9
17# detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594 10# detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594
18SOURCED=0 11SOURCED=0
19if [ -n "$ZSH_EVAL_CONTEXT" ]; then 12if [ -n "$ZSH_EVAL_CONTEXT" ]; then
20 [[ $ZSH_EVAL_CONTEXT =~ :file$ ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- $0) && pwd -P); } 13 [[ "$ZSH_EVAL_CONTEXT" =~ :file$ ]] && { SOURCED=1; SOURCEDIR=$(cd "$(dirname -- "$0")" && pwd -P); }
21elif [ -n "$KSH_VERSION" ]; then
22 [[ "$(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); }
23elif [ -n "$BASH_VERSION" ]; then 14elif [ -n "$BASH_VERSION" ]; then
24 [[ $0 != "$BASH_SOURCE" ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- $BASH_SOURCE) && pwd -P); } 15 [[ "$0" != "${BASH_SOURCE[0]}" ]] && { SOURCED=1; SOURCEDIR=$(cd "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P); }
25fi 16fi
26 17
27if [ $SOURCED -ne 1 ]; then 18if [[ $SOURCED -ne 1 ]]; then
28 unset SOURCED 19 echo "Error: this script needs to be sourced in a supported shell" >&2
29 unset SOURCEDIR 20 echo "Please check that the current shell is bash or zsh and run this script as '. $0 <args>'" >&2
30 echo "Error: this script needs to be sourced in a supported shell" >&2 21 exit 1
31 echo "Please check that the current shell is bash, zsh or ksh and run this script as '. $0 <args>'" >&2
32 exit -1
33fi 22fi
34 23
35SCRIPTDIR=$(cd $(dirname $BASH_SOURCE) && pwd -P) 24METADIR="${SOURCEDIR}/../.."
36METADIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)
37 25
38if [ -e ${BUILDDIR}/conf/local.conf ]; then 26if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then
39 source $METADIR/poky/oe-init-build-env ${BUILDDIR} 27 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
28 echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf
29 cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf
30 cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf
31 echo "MACHINE = \"${MACHINE}\"" >> conf/local.conf
32 echo "DISTRO = \"poky-sota-systemd\"" >> conf/local.conf
40else 33else
41 source $METADIR/poky/oe-init-build-env ${BUILDDIR} 34 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
42 echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf
43 cat ${METADIR}/meta-updater/conf/include/bblayers/sota.inc >> conf/bblayers.conf
44 cat ${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc >> conf/bblayers.conf
45 echo "MACHINE = \"${MACHINE}\"" >> conf/local.conf
46 echo "DISTRO = \"poky-sota-systemd\"" >> conf/local.conf
47fi 35fi
48