diff options
author | cajun-rat <p@beta16.co.uk> | 2017-07-05 14:50:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-05 14:50:37 +0200 |
commit | 00dc1fef0667ab640ad6bd688e4737309b000358 (patch) | |
tree | c9e4c89bce12a81ddd364b2676c8a005fff725dd | |
parent | b0d9d7018502a29f062895f853efd41e7b760d5a (diff) | |
parent | 69a0db9291725b1ddfa643dc00d6d2f1bf6c5caf (diff) | |
download | meta-updater-00dc1fef0667ab640ad6bd688e4737309b000358.tar.gz |
Merge pull request #101 from advancedtelematic/feat/mergemorty
Merge current progress from morty to pyro
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 | ||
5 | 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. | 5 | 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. |
6 | 6 | ||
7 | 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]. | 7 | 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. |
8 | 8 | ||
9 | == Build | 9 | == Build |
10 | 10 | ||
11 | === Quickstart | 11 | === Quickstart |
12 | 12 | ||
13 | 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]. | 13 | 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. |
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 () { | |||
203 | IMAGE_TYPEDEP_ostreepush = "ostree" | 203 | IMAGE_TYPEDEP_ostreepush = "ostree" |
204 | IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot" | 204 | IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot" |
205 | IMAGE_CMD_ostreepush () { | 205 | IMAGE_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 = " \ | |||
61 | IMAGE_TYPEDEP_rpi-sdimg-ota = "otaimg" | 61 | IMAGE_TYPEDEP_rpi-sdimg-ota = "otaimg" |
62 | 62 | ||
63 | # SD card image name | 63 | # SD card image name |
64 | SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg-ota" | 64 | SDIMG_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 | ||
188 | ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; " | 182 | ROOTFS_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 | ||
6 | OVERRIDES .= "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ':sota', '', d)}" | 6 | OVERRIDES .= "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ':sota', '', d)}" |
7 | 7 | ||
8 | SOTA_CLIENT ??= "aktualizr" | ||
8 | IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT}" | 9 | IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT}" |
9 | IMAGE_CLASSES += " image_types_ostree image_types_ota" | 10 | IMAGE_CLASSES += " image_types_ostree image_types_ota" |
10 | IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush otaimg wic', ' ', d)}" | 11 | IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush otaimg wic', ' ', d)}" |
@@ -24,6 +25,7 @@ SOTA_MACHINE ??="none" | |||
24 | SOTA_MACHINE_raspberrypi2 ?= "raspberrypi" | 25 | SOTA_MACHINE_raspberrypi2 ?= "raspberrypi" |
25 | SOTA_MACHINE_raspberrypi3 ?= "raspberrypi" | 26 | SOTA_MACHINE_raspberrypi3 ?= "raspberrypi" |
26 | SOTA_MACHINE_porter ?= "porter" | 27 | SOTA_MACHINE_porter ?= "porter" |
28 | SOTA_MACHINE_m3ulcb = "m3ulcb" | ||
27 | SOTA_MACHINE_intel-corei7-64 ?= "minnowboard" | 29 | SOTA_MACHINE_intel-corei7-64 ?= "minnowboard" |
28 | SOTA_MACHINE_qemux86-64 ?= "qemux86-64" | 30 | SOTA_MACHINE_qemux86-64 ?= "qemux86-64" |
29 | SOTA_MACHINE_am335x-evm ?= "am335x-evm-wifi" | 31 | 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 @@ | |||
1 | # Commit united image to OSTree, not just uImage | ||
2 | OSTREE_KERNEL = "Image" | ||
3 | |||
4 | EXTRA_IMAGEDEPENDS_append_sota = " m3ulcb-ota-bootfiles" | ||
5 | IMAGE_CLASSES_append_sota = " image_types_uboot " | ||
6 | IMAGE_BOOT_FILES_sota += "m3ulcb-ota-bootfiles/*" | ||
7 | |||
8 | OSTREE_BOOTLOADER ?= "u-boot" | ||
9 | UBOOT_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 @@ | |||
1 | IMAGE_CLASSES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'image_types_uboot sdcard_image-rpi-ota', '', d)}" | 1 | IMAGE_CLASSES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'image_types_uboot sdcard_image-rpi-ota', '', d)}" |
2 | IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'rpi-sdimg-ota', 'rpi-sdimg', d)}" | 2 | IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'rpi-sdimg-ota.xz', 'rpi-sdimg.xz', d)}" |
3 | 3 | ||
4 | IMAGE_FSTYPES_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'wic rpi-sdimg rpi-sdimg.xz', '', d)}" | 4 | IMAGE_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 @@ | |||
7 | DISTRO_FEATURES_append = " sota" | 7 | DISTRO_FEATURES_append = " sota" |
8 | DISTRO_FEATURES_NATIVE_append = " sota" | 8 | DISTRO_FEATURES_NATIVE_append = " sota" |
9 | INHERIT += " sota" | 9 | INHERIT += " sota" |
10 | SOTA_CLIENT ?= "aktualizr" | ||
11 | # Prelinking increases the size of downloads and causes build errors | 10 | # Prelinking increases the size of downloads and causes build errors |
12 | USER_CLASSES_remove = "image-prelink" | 11 | USER_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 | |||
2 | BBLAYERS += " ${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 | ||
22 | IMAGE_ROOTFS_SIZE = "8192" | 22 | IMAGE_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 | ||
26 | IMAGE_ROOTFS_EXTRA_SPACE = "0" | ||
27 | |||
24 | BAD_RECOMMENDATIONS += "busybox-syslog" | 28 | BAD_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" | |||
5 | LICENSE = "MPL-2.0" | 5 | LICENSE = "MPL-2.0" |
6 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" | 6 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" |
7 | DEPENDS = "boost curl openssl jansson libsodium ostree" | 7 | DEPENDS = "boost curl openssl jansson libsodium ostree" |
8 | SRCREV = "4e9344ae375a444f02b964dca52fe808010d17df" | 8 | RDEPENDS_${PN} = "lshw" |
9 | PV = "1.0+git${SRCPV}" | ||
10 | 9 | ||
11 | SRC_URI = " \ | 10 | SRC_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 | " |
16 | SRCREV = "7ca3af4e2f47ca7a3a67866023de3f8a97425991" | ||
17 | PV = "1.0+git${SRCPV}" | ||
15 | 18 | ||
16 | S = "${WORKDIR}/git" | 19 | S = "${WORKDIR}/git" |
17 | SYSTEMD_SERVICE_${PN} = "aktualizr.service" | 20 | SYSTEMD_SERVICE_${PN} = "aktualizr.service" |
18 | 21 | ||
19 | inherit cmake systemd | 22 | inherit cmake systemd |
20 | 23 | ||
21 | EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON" | 24 | EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON -DAKTUALIZR_VERSION=${PV}" |
22 | 25 | ||
23 | export SOTA_AUTOPROVISION_CREDENTIALS | 26 | export SOTA_AUTOPROVISION_CREDENTIALS |
27 | export SOTA_PACKED_CREDENTIALS | ||
24 | 28 | ||
25 | do_install_append() { | 29 | do_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 | ||
34 | RDEPENDS = "" | ||
35 | |||
36 | FILES_${PN} = " \ | 41 | FILES_${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] | ||
2 | Description=Aktualizr SOTA Client | ||
3 | Wants=network-online.target | ||
4 | After=network.target network-online.target | ||
5 | Requires=network-online.target | ||
6 | |||
7 | [Service] | ||
8 | RestartSec=10 | ||
9 | Restart=always | ||
10 | EnvironmentFile=/var/sota/sota_provisioning_url.env | ||
11 | ExecStart=/usr/bin/aktualizr --disable-keyid-validation --tls-server ${SOTA_GATEWAY_URI} --config /usr/lib/sota/sota.toml | ||
12 | |||
13 | [Install] | ||
14 | 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 @@ | |||
1 | [device] | ||
2 | packages_dir = "/tmp/packages_dir" | ||
3 | certificates_directory = "/var/sota" | ||
4 | system_info = "system_info.sh" | ||
5 | |||
6 | [tls] | ||
7 | ca_file = "root.crt" | ||
8 | client_certificate = "client.pem" | ||
9 | pkey_file = "pkey.pem" | ||
10 | |||
11 | [uptane] | ||
12 | metadata_path = "/var/sota/metadata" | ||
13 | private_key_path = "ecukey.der" | ||
14 | public_key_path = "ecukey.pub" | ||
15 | |||
16 | [provision] | ||
17 | p12_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 | 2 | set -eu | |
3 | # global variables | ||
4 | |||
5 | SMACK=n | ||
6 | DEBUG=n | ||
7 | 3 | ||
8 | # ------------------------------------------- | 4 | # ------------------------------------------- |
9 | 5 | ||
10 | log_info() { echo "$0[$$]: $@" >&2; } | 6 | log_info() { echo "$0[$$]: $*" >&2; } |
11 | log_error() { echo "$0[$$]: ERROR $@" >&2; } | 7 | log_error() { echo "$0[$$]: ERROR $*" >&2; } |
12 | 8 | ||
13 | do_mount_fs() { | 9 | do_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 | ||
28 | get_ostree_sysroot() { | 24 | get_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 | ||
39 | export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/ostree | 35 | export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/ostree |
40 | 36 | ||
41 | log_info "starting initrd script" | 37 | log_info "Starting OSTree initrd script" |
42 | 38 | ||
43 | do_mount_fs proc /proc | 39 | do_mount_fs proc /proc |
44 | do_mount_fs sysfs /sys | 40 | do_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) |
52 | grep -q smackfs /proc/filesystems && { | 48 | grep -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 && { | |||
62 | mkdir -p /sysroot | 56 | mkdir -p /sysroot |
63 | ostree_sysroot=$(get_ostree_sysroot) | 57 | ostree_sysroot=$(get_ostree_sysroot) |
64 | 58 | ||
65 | mount $ostree_sysroot /sysroot || bail_out "Unable to mount $ostree_sysroot as physical sysroot" | 59 | mount "$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 | } | ||
66 | ostree-prepare-root /sysroot | 66 | ostree-prepare-root /sysroot |
67 | 67 | ||
68 | # move mounted devices to new root | 68 | # move mounted devices to new root |
69 | cd /sysroot | 69 | cd /sysroot |
70 | for x in dev proc; do | 70 | for 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" |
73 | done | 73 | done |
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 | ||
6 | S = "${WORKDIR}" | 6 | S = "${WORKDIR}" |
7 | 7 | ||
8 | PV = "2" | 8 | PV = "3" |
9 | 9 | ||
10 | do_install() { | 10 | do_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 | ||
16 | FILES_${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 @@ | |||
1 | DESCRIPTION = "Example Package with 10MB of random, seeded content" | ||
2 | LICENSE = "CLOSED" | ||
3 | |||
4 | SRC_URI = "file://rand_file.py" | ||
5 | |||
6 | FILES_${PN} = "/usr/lib/big-update" | ||
7 | |||
8 | do_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 @@ | |||
1 | DESCRIPTION = "Example Package with 12MB of random, seeded content" | ||
2 | LICENSE = "CLOSED" | ||
3 | |||
4 | SRC_URI = "file://rand_file.py" | ||
5 | |||
6 | FILES_${PN} = "/usr/lib/big-update" | ||
7 | |||
8 | do_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 @@ | |||
1 | import sys | ||
2 | from random import seed, randint | ||
3 | |||
4 | def 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 | |||
15 | if __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 | ||
3 | SCRIPT="envsetup.sh" | 3 | SCRIPT="envsetup.sh" |
4 | MACHINE="$1" | ||
5 | BUILDDIR="build" | ||
4 | 6 | ||
5 | MACHINE=$1 | 7 | [[ "$#" -lt 1 ]] && { echo "Usage: ${SCRIPT} <machine> [builddir]"; return 1; } |
6 | 8 | [[ "$#" -eq 2 ]] && { BUILDDIR="$2"; } | |
7 | if [ "$#" -lt 1 ]; then | ||
8 | echo "Usage: ${SCRIPT} <machine> [builddir]" | ||
9 | return -1 | ||
10 | elif [ "$#" -eq 2 ]; then | ||
11 | BUILDDIR=$2 | ||
12 | else | ||
13 | BUILDDIR=build | ||
14 | fi | ||
15 | BULDDIR=$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 |
18 | SOURCED=0 | 11 | SOURCED=0 |
19 | if [ -n "$ZSH_EVAL_CONTEXT" ]; then | 12 | if [ -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); } |
21 | elif [ -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); } | ||
23 | elif [ -n "$BASH_VERSION" ]; then | 14 | elif [ -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); } |
25 | fi | 16 | fi |
26 | 17 | ||
27 | if [ $SOURCED -ne 1 ]; then | 18 | if [[ $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 | ||
33 | fi | 22 | fi |
34 | 23 | ||
35 | SCRIPTDIR=$(cd $(dirname $BASH_SOURCE) && pwd -P) | 24 | METADIR="${SOURCEDIR}/../.." |
36 | METADIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) | ||
37 | 25 | ||
38 | if [ -e ${BUILDDIR}/conf/local.conf ]; then | 26 | if [[ ! -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 | ||
40 | else | 33 | else |
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 | ||
47 | fi | 35 | fi |
48 | |||