diff options
| author | Ben Luck <ben+qa@advancedtelematic.com> | 2019-02-27 13:51:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-27 13:51:33 +0100 |
| commit | a512fd6e0d519058fe0448098d064aa7e45dc7db (patch) | |
| tree | 81f3be27ea0eb5f442e0b82af428c346a0af806f | |
| parent | 6162cb3507ea6416396cbb700485629d7d3128e3 (diff) | |
| parent | cfd16dc98ad78a724372b42056b3a94583743d36 (diff) | |
| download | meta-updater-a512fd6e0d519058fe0448098d064aa7e45dc7db.tar.gz | |
Merge pull request #495 from advancedtelematic/backport/rocko/auto-reboot-etc
Backport/rocko/auto reboot etc
| -rw-r--r-- | README.adoc | 1 | ||||
| -rw-r--r-- | classes/image_types_ostree.bbclass | 12 | ||||
| -rw-r--r-- | classes/image_types_ota.bbclass | 2 | ||||
| -rw-r--r-- | conf/include/bblayers/sota_am335x-evm.inc | 3 | ||||
| -rw-r--r-- | conf/include/bblayers/sota_intel-corei7-64.inc | 4 | ||||
| -rw-r--r-- | conf/include/bblayers/sota_m3ulcb.inc | 5 | ||||
| -rw-r--r-- | conf/include/bblayers/sota_porter.inc | 6 | ||||
| -rw-r--r-- | conf/include/bblayers/sota_qemux86-64.inc | 2 | ||||
| -rw-r--r-- | conf/include/bblayers/sota_raspberrypi2.inc | 6 | ||||
| -rw-r--r-- | conf/include/bblayers/sota_raspberrypi3.inc | 6 | ||||
| -rw-r--r-- | lib/oeqa/selftest/cases/updater.py | 29 | ||||
| -rw-r--r-- | recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb | 7 | ||||
| -rwxr-xr-x | recipes-sota/aktualizr/aktualizr_git.bb | 2 | ||||
| -rw-r--r-- | recipes-sota/config/aktualizr-auto-reboot.bb | 21 | ||||
| -rw-r--r-- | recipes-sota/config/files/35-enable-auto-reboot.toml | 2 |
15 files changed, 59 insertions, 49 deletions
diff --git a/README.adoc b/README.adoc index 6ca20d8..9f7d485 100644 --- a/README.adoc +++ b/README.adoc | |||
| @@ -147,6 +147,7 @@ First, you can set `SOTA_CLIENT_PROV` to control which provisioning recipe is us | |||
| 147 | 147 | ||
| 148 | Second, you can write recipes to install additional config files with customized options. A few recipes already exist to address common needs and provide an example: | 148 | Second, you can write recipes to install additional config files with customized options. A few recipes already exist to address common needs and provide an example: |
| 149 | 149 | ||
| 150 | * link:recipes-sota/config/aktualizr-auto-reboot.bb[aktualizr-auto-reboot.bb] configures aktualizr to automatically reboot after new updates are installed in order to apply the updates immediately. This is only relevant for package managers (such as OSTree) that require a reboot to complete the installation process. If this is not enabled, you will need to reboot the system through other means. | ||
| 150 | * link:recipes-sota/config/aktualizr-disable-send-ip.bb[aktualizr-disable-send-ip.bb] disables the reporting of networking information to the server. This is enabled by default and supported by https://connect.ota.here.com/[HERE OTA Connect]. However, if you are using a different server that does not support this feature, you may want to disable it in aktualizr. | 151 | * link:recipes-sota/config/aktualizr-disable-send-ip.bb[aktualizr-disable-send-ip.bb] disables the reporting of networking information to the server. This is enabled by default and supported by https://connect.ota.here.com/[HERE OTA Connect]. However, if you are using a different server that does not support this feature, you may want to disable it in aktualizr. |
| 151 | * link:recipes-sota/config/aktualizr-log-debug.bb[aktualizr-log-debug.bb] sets the log level of aktualizr to 0 (trace). The default is 2 (info). This recipe is intended for development and debugging purposes. | 152 | * link:recipes-sota/config/aktualizr-log-debug.bb[aktualizr-log-debug.bb] sets the log level of aktualizr to 0 (trace). The default is 2 (info). This recipe is intended for development and debugging purposes. |
| 152 | 153 | ||
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 97290ac..f3b1b33 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
| @@ -159,6 +159,13 @@ IMAGE_CMD_ostree () { | |||
| 159 | ostree --repo=${OSTREE_REPO} summary -u | 159 | ostree --repo=${OSTREE_REPO} summary -u |
| 160 | fi | 160 | fi |
| 161 | 161 | ||
| 162 | # To enable simultaneous bitbaking of two images with the same branch name, | ||
| 163 | # create a new ref in the repo using the basename of the image. (This first | ||
| 164 | # requires deleting it if it already exists.) Fixes OTA-2211. | ||
| 165 | ostree --repo=${OSTREE_REPO} refs --delete ${OSTREE_BRANCHNAME}-${IMAGE_BASENAME} | ||
| 166 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | ||
| 167 | ostree --repo=${OSTREE_REPO} refs --create=${OSTREE_BRANCHNAME}-${IMAGE_BASENAME} ${ostree_target_hash} | ||
| 168 | |||
| 162 | rm -rf ${OSTREE_ROOTFS} | 169 | rm -rf ${OSTREE_ROOTFS} |
| 163 | } | 170 | } |
| 164 | 171 | ||
| @@ -202,7 +209,7 @@ IMAGE_CMD_garagesign () { | |||
| 202 | --home-dir ${GARAGE_SIGN_REPO} \ | 209 | --home-dir ${GARAGE_SIGN_REPO} \ |
| 203 | --credentials ${SOTA_PACKED_CREDENTIALS} | 210 | --credentials ${SOTA_PACKED_CREDENTIALS} |
| 204 | 211 | ||
| 205 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | 212 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}-${IMAGE_BASENAME}) |
| 206 | 213 | ||
| 207 | # Use OSTree target hash as version if none was provided by the user | 214 | # Use OSTree target hash as version if none was provided by the user |
| 208 | target_version=${ostree_target_hash} | 215 | target_version=${ostree_target_hash} |
| @@ -255,7 +262,8 @@ IMAGE_CMD_garagecheck () { | |||
| 255 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 262 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
| 256 | # if credentials are issued by a server that doesn't support offline signing, exit silently | 263 | # if credentials are issued by a server that doesn't support offline signing, exit silently |
| 257 | unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 | 264 | unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 |
| 258 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | 265 | |
| 266 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}-${IMAGE_BASENAME}) | ||
| 259 | 267 | ||
| 260 | garage-check --ref=${ostree_target_hash} \ | 268 | garage-check --ref=${ostree_target_hash} \ |
| 261 | --credentials=${SOTA_PACKED_CREDENTIALS} \ | 269 | --credentials=${SOTA_PACKED_CREDENTIALS} \ |
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 88f5b2c..068d43e 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass | |||
| @@ -77,7 +77,7 @@ IMAGE_CMD_otaimg () { | |||
| 77 | bbfatal "Invalid bootloader: ${OSTREE_BOOTLOADER}" | 77 | bbfatal "Invalid bootloader: ${OSTREE_BOOTLOADER}" |
| 78 | fi | 78 | fi |
| 79 | 79 | ||
| 80 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | 80 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}-${IMAGE_BASENAME}) |
| 81 | 81 | ||
| 82 | ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash} | 82 | ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash} |
| 83 | kargs_list="" | 83 | kargs_list="" |
diff --git a/conf/include/bblayers/sota_am335x-evm.inc b/conf/include/bblayers/sota_am335x-evm.inc index f2d485d..909a7a4 100644 --- a/conf/include/bblayers/sota_am335x-evm.inc +++ b/conf/include/bblayers/sota_am335x-evm.inc | |||
| @@ -1,2 +1 @@ | |||
| 1 | BBLAYERS += "${METADIR}/meta-ti" | ||
| 2 | BBLAYERS += " ${METADIR}/meta-ti " | ||
diff --git a/conf/include/bblayers/sota_intel-corei7-64.inc b/conf/include/bblayers/sota_intel-corei7-64.inc index 1771e6c..8e85a6c 100644 --- a/conf/include/bblayers/sota_intel-corei7-64.inc +++ b/conf/include/bblayers/sota_intel-corei7-64.inc | |||
| @@ -1,2 +1,2 @@ | |||
| 1 | 1 | BBLAYERS += "${METADIR}/meta-updater-minnowboard" | |
| 2 | BBLAYERS += " ${METADIR}/meta-updater-minnowboard ${METADIR}/meta-intel " | 2 | BBLAYERS += "${METADIR}/meta-intel" |
diff --git a/conf/include/bblayers/sota_m3ulcb.inc b/conf/include/bblayers/sota_m3ulcb.inc index 04f78e4..4f2e0a9 100644 --- a/conf/include/bblayers/sota_m3ulcb.inc +++ b/conf/include/bblayers/sota_m3ulcb.inc | |||
| @@ -1,2 +1,3 @@ | |||
| 1 | 1 | BBLAYERS += "${METADIR}/meta-renesas" | |
| 2 | BBLAYERS += " ${METADIR}/meta-renesas ${METADIR}/meta-renesas-rcar-gen3 ${METADIR}/meta-openembedded/meta-multimedia" | 2 | BBLAYERS += "${METADIR}/meta-renesas-rcar-gen3" |
| 3 | BBLAYERS += "${METADIR}/meta-openembedded/meta-multimedia" | ||
diff --git a/conf/include/bblayers/sota_porter.inc b/conf/include/bblayers/sota_porter.inc index 6964ef0..a50b71c 100644 --- a/conf/include/bblayers/sota_porter.inc +++ b/conf/include/bblayers/sota_porter.inc | |||
| @@ -1,2 +1,4 @@ | |||
| 1 | 1 | BBLAYERS += "${METADIR}/meta-renesas" | |
| 2 | BBLAYERS += " ${METADIR}/meta-renesas ${METADIR}/meta-renesas/meta-rcar-gen2 ${METADIR}/meta-openembedded/meta-multimedia ${METADIR}/meta-updater-porter" | 2 | BBLAYERS += "${METADIR}/meta-renesas/meta-rcar-gen2" |
| 3 | BBLAYERS += "${METADIR}/meta-openembedded/meta-multimedia" | ||
| 4 | BBLAYERS += "${METADIR}/meta-updater-porter" | ||
diff --git a/conf/include/bblayers/sota_qemux86-64.inc b/conf/include/bblayers/sota_qemux86-64.inc index 12d32ff..9ccbfa6 100644 --- a/conf/include/bblayers/sota_qemux86-64.inc +++ b/conf/include/bblayers/sota_qemux86-64.inc | |||
| @@ -1 +1 @@ | |||
| BBLAYERS += " ${METADIR}/meta-updater-qemux86-64 " | BBLAYERS += "${METADIR}/meta-updater-qemux86-64" | ||
diff --git a/conf/include/bblayers/sota_raspberrypi2.inc b/conf/include/bblayers/sota_raspberrypi2.inc index cc26679..03f8f44 100644 --- a/conf/include/bblayers/sota_raspberrypi2.inc +++ b/conf/include/bblayers/sota_raspberrypi2.inc | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | BBLAYERS += " ${METADIR}/meta-openembedded/meta-python " | 1 | BBLAYERS += "${METADIR}/meta-openembedded/meta-python" |
| 2 | 2 | BBLAYERS += "${METADIR}/meta-updater-raspberrypi" | |
| 3 | BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi " | 3 | BBLAYERS += "${METADIR}/meta-raspberrypi" |
diff --git a/conf/include/bblayers/sota_raspberrypi3.inc b/conf/include/bblayers/sota_raspberrypi3.inc index cc26679..03f8f44 100644 --- a/conf/include/bblayers/sota_raspberrypi3.inc +++ b/conf/include/bblayers/sota_raspberrypi3.inc | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | BBLAYERS += " ${METADIR}/meta-openembedded/meta-python " | 1 | BBLAYERS += "${METADIR}/meta-openembedded/meta-python" |
| 2 | 2 | BBLAYERS += "${METADIR}/meta-updater-raspberrypi" | |
| 3 | BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi " | 3 | BBLAYERS += "${METADIR}/meta-raspberrypi" |
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py index 4813b2e..07232d7 100644 --- a/lib/oeqa/selftest/cases/updater.py +++ b/lib/oeqa/selftest/cases/updater.py | |||
| @@ -63,35 +63,6 @@ class GeneralTests(OESelftestTestCase): | |||
| 63 | self.assertEqual(result.status, 0, | 63 | self.assertEqual(result.status, 0, |
| 64 | "Java not found. Do you have a JDK installed on your host machine?") | 64 | "Java not found. Do you have a JDK installed on your host machine?") |
| 65 | 65 | ||
| 66 | def test_add_package(self): | ||
| 67 | deploydir = get_bb_var('DEPLOY_DIR_IMAGE') | ||
| 68 | imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal') | ||
| 69 | image_path = deploydir + '/' + imagename + '.otaimg' | ||
| 70 | logger = logging.getLogger("selftest") | ||
| 71 | |||
| 72 | logger.info('Running bitbake with man in the image package list') | ||
| 73 | self.append_config('IMAGE_INSTALL_append = " man "') | ||
| 74 | bitbake('-c cleanall man') | ||
| 75 | bitbake('core-image-minimal') | ||
| 76 | result = runCmd('oe-pkgdata-util find-path /usr/bin/man') | ||
| 77 | self.assertEqual(result.output, 'man: /usr/bin/man') | ||
| 78 | path1 = os.path.realpath(image_path) | ||
| 79 | size1 = os.path.getsize(path1) | ||
| 80 | logger.info('First image %s has size %i' % (path1, size1)) | ||
| 81 | |||
| 82 | logger.info('Running bitbake without man in the image package list') | ||
| 83 | self.append_config('IMAGE_INSTALL_remove = " man "') | ||
| 84 | bitbake('-c cleanall man') | ||
| 85 | bitbake('core-image-minimal') | ||
| 86 | result = runCmd('oe-pkgdata-util find-path /usr/bin/man', ignore_status=True) | ||
| 87 | self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output) | ||
| 88 | self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /usr/bin/man') | ||
| 89 | path2 = os.path.realpath(image_path) | ||
| 90 | size2 = os.path.getsize(path2) | ||
| 91 | logger.info('Second image %s has size %i', path2, size2) | ||
| 92 | self.assertNotEqual(path1, path2, "Image paths are identical; image was not rebuilt.") | ||
| 93 | self.assertNotEqual(size1, size2, "Image sizes are identical; image was not rebuilt.") | ||
| 94 | |||
| 95 | 66 | ||
| 96 | class AktualizrToolsTests(OESelftestTestCase): | 67 | class AktualizrToolsTests(OESelftestTestCase): |
| 97 | 68 | ||
diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb b/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb index 34460af..0628a61 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb | |||
| @@ -11,9 +11,14 @@ require credentials.inc | |||
| 11 | do_install() { | 11 | do_install() { |
| 12 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 12 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
| 13 | install -m 0700 -d ${D}${localstatedir}/sota | 13 | install -m 0700 -d ${D}${localstatedir}/sota |
| 14 | cp ${SOTA_PACKED_CREDENTIALS} ${D}${localstatedir}/sota/sota_provisioning_credentials.zip | 14 | cp "${SOTA_PACKED_CREDENTIALS}" ${D}${localstatedir}/sota/sota_provisioning_credentials.zip |
| 15 | # Device should not be able to push data to treehub | 15 | # Device should not be able to push data to treehub |
| 16 | zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip treehub.json | 16 | zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip treehub.json |
| 17 | # Device has no use for the API Gateway. Remove if present. See: | ||
| 18 | # https://github.com/advancedtelematic/ota-plus-server/pull/1913/ | ||
| 19 | if unzip -l ${D}${localstatedir}/sota/sota_provisioning_credentials.zip api_gateway.url > /dev/null; then | ||
| 20 | zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip api_gateway.url | ||
| 21 | fi | ||
| 17 | fi | 22 | fi |
| 18 | } | 23 | } |
| 19 | 24 | ||
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index ed6a760..fef12b8 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
| @@ -23,7 +23,7 @@ SRC_URI = " \ | |||
| 23 | file://aktualizr-serialcan.service \ | 23 | file://aktualizr-serialcan.service \ |
| 24 | " | 24 | " |
| 25 | 25 | ||
| 26 | SRCREV = "2aa9d93ccea09ec327789eecf858de561ef632da" | 26 | SRCREV = "c71ec0a320d85a3e75ba37bff7dc40ad02e9d655" |
| 27 | BRANCH ?= "master" | 27 | BRANCH ?= "master" |
| 28 | 28 | ||
| 29 | S = "${WORKDIR}/git" | 29 | S = "${WORKDIR}/git" |
diff --git a/recipes-sota/config/aktualizr-auto-reboot.bb b/recipes-sota/config/aktualizr-auto-reboot.bb new file mode 100644 index 0000000..ad4d17c --- /dev/null +++ b/recipes-sota/config/aktualizr-auto-reboot.bb | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | SUMMARY = "Enable auto reboot to apply updates" | ||
| 2 | DESCRIPTION = "Configures aktualizr to automatically reboot after new updates are installed in order to apply the updates immediately" | ||
| 3 | HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" | ||
| 4 | SECTION = "base" | ||
| 5 | LICENSE = "MPL-2.0" | ||
| 6 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" | ||
| 7 | |||
| 8 | SRC_URI = " \ | ||
| 9 | file://35-enable-auto-reboot.toml \ | ||
| 10 | " | ||
| 11 | |||
| 12 | do_install_append () { | ||
| 13 | install -m 0700 -d ${D}${libdir}/sota/conf.d | ||
| 14 | install -m 0644 ${WORKDIR}/35-enable-auto-reboot.toml ${D}${libdir}/sota/conf.d/35-enable-auto-reboot.toml | ||
| 15 | } | ||
| 16 | |||
| 17 | FILES_${PN} = " \ | ||
| 18 | ${libdir}/sota/conf.d/35-enable-auto-reboot.toml \ | ||
| 19 | " | ||
| 20 | |||
| 21 | # vim:set ts=4 sw=4 sts=4 expandtab: | ||
diff --git a/recipes-sota/config/files/35-enable-auto-reboot.toml b/recipes-sota/config/files/35-enable-auto-reboot.toml new file mode 100644 index 0000000..f83810e --- /dev/null +++ b/recipes-sota/config/files/35-enable-auto-reboot.toml | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | [uptane] | ||
| 2 | force_install_completion = true | ||
