summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--COPYING.MIT17
-rw-r--r--README.adoc52
-rw-r--r--classes/image_repo_manifest.bbclass4
-rw-r--r--classes/image_types_ostree.bbclass44
-rw-r--r--classes/image_types_ota.bbclass17
-rw-r--r--classes/sota.bbclass6
-rw-r--r--classes/sota_minnowboard.bbclass3
-rw-r--r--classes/sota_qemux86-64.bbclass4
-rw-r--r--classes/sota_raspberrypi.bbclass2
-rw-r--r--conf/include/bblayers/sota.inc2
-rw-r--r--conf/include/bblayers/sota_qemux86-64.inc1
-rw-r--r--conf/include/bblayers/sota_raspberrypi2.inc1
-rw-r--r--conf/include/bblayers/sota_raspberrypi3.inc1
l---------lib/oeqa/selftest/cases/qemucommand.py1
-rw-r--r--lib/oeqa/selftest/cases/updater.py236
-rw-r--r--lib/oeqa/selftest/garage_push.py42
-rw-r--r--recipes-bsp/u-boot/u-boot_2016.11.bb22
-rw-r--r--recipes-sota/aktualizr/aktualizr-auto-prov.bb45
-rw-r--r--recipes-sota/aktualizr/aktualizr-hsm-prov.bb32
-rw-r--r--recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb34
-rw-r--r--recipes-sota/aktualizr/aktualizr-implicit-prov.bb25
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb45
-rw-r--r--recipes-sota/aktualizr/credentials.inc1
-rw-r--r--recipes-sota/aktualizr/environment.inc17
-rw-r--r--recipes-sota/aktualizr/files/aktualizr-autoprovision.service13
-rw-r--r--recipes-sota/aktualizr/files/aktualizr-serialcan.service15
-rw-r--r--recipes-sota/aktualizr/files/aktualizr.service (renamed from recipes-sota/aktualizr/files/aktualizr-manual-provision.service)3
-rw-r--r--recipes-sota/aktualizr/files/sota_autoprov.toml14
-rw-r--r--recipes-sota/aktualizr/files/sota_hsm_test.toml18
-rw-r--r--recipes-sota/aktualizr/files/sota_implicit_prov.toml11
-rw-r--r--recipes-sota/asn1c/asn1c.bb17
-rw-r--r--recipes-sota/asn1c/files/skeletons_dir_fix.patch44
-rw-r--r--recipes-sota/garage-sign/garage-sign.bb34
-rw-r--r--recipes-sota/ostree/ostree_git.bb7
-rw-r--r--recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service15
-rw-r--r--recipes-sota/rvi-sota-client/files/sota-client-ostree.service13
-rw-r--r--recipes-sota/rvi-sota-client/files/sota-client-uptane.service15
-rw-r--r--recipes-sota/rvi-sota-client/files/sota-installer.service12
-rw-r--r--recipes-sota/rvi-sota-client/rvi-sota-client.inc173
-rw-r--r--recipes-sota/rvi-sota-client/rvi-sota-client_git.bb59
-rw-r--r--recipes-sota/rvi-sota-client/sota-installer_git.bb25
-rw-r--r--recipes-sota/rvi-sota-client/sota-launcher_git.bb15
-rw-r--r--recipes-support/ca-certificates/ca-certificates_%.bbappend2
-rw-r--r--recipes-support/glib-networking/glib-networking_%.bbappend8
-rw-r--r--recipes-support/libp11/files/0001-Workaround-for-a-buggy-version-of-openssl-1.0.2m.patch42
-rw-r--r--recipes-support/libp11/libp11_0.4.7.bb3
-rw-r--r--recipes-support/libsoup/libsoup-2.4_%.bbappend3
-rw-r--r--recipes-support/slcand-start/files/slcand@.service8
-rw-r--r--recipes-support/slcand-start/slcand-start.bb21
-rw-r--r--recipes-support/util-linux/util-linux_%.bbappend3
-rwxr-xr-xscripts/envsetup.sh10
-rw-r--r--scripts/lib/wic/plugins/source/otaimage.py2
-rw-r--r--scripts/qemucommand.py126
-rwxr-xr-xscripts/run-qemu-ota129
55 files changed, 755 insertions, 760 deletions
diff --git a/.gitignore b/.gitignore
index bee8a64..8d35cb3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
1__pycache__ 1__pycache__
2*.pyc
diff --git a/COPYING.MIT b/COPYING.MIT
new file mode 100644
index 0000000..fb950dc
--- /dev/null
+++ b/COPYING.MIT
@@ -0,0 +1,17 @@
1Permission is hereby granted, free of charge, to any person obtaining a copy
2of this software and associated documentation files (the "Software"), to deal
3in the Software without restriction, including without limitation the rights
4to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5copies of the Software, and to permit persons to whom the Software is
6furnished to do so, subject to the following conditions:
7
8The above copyright notice and this permission notice shall be included in
9all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17THE SOFTWARE.
diff --git a/README.adoc b/README.adoc
index 0097670..403e0f8 100644
--- a/README.adoc
+++ b/README.adoc
@@ -1,10 +1,10 @@
1= meta-updater 1= meta-updater
2 2
3This layer enables over-the-air updates (OTA) with https://github.com/ostreedev/ostree[OSTree] and https://github.com/advancedtelematic/rvi_sota_client[RVI SOTA client]. 3This layer enables over-the-air updates (OTA) with https://github.com/ostreedev/ostree[OSTree] and https://github.com/advancedtelematic/aktualizr[Aktualizr].
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] 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. 7https://github.com/advancedtelematic/aktualizr[Aktualizr] (and https://github.com/advancedtelematic/rvi_sota_client[RVI SOTA client]) 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
@@ -22,8 +22,6 @@ If you already have a Yocto-based project and you want to add atomic filesystem
22 22
23You can then build your image as usual, with bitbake. After building the root file system, bitbake will then create an https://ostree.readthedocs.io/en/latest/manual/adapting-existing/[OSTree-enabled version] of it, commit it to your local OSTree repo and (optionally) push it to a remote server. Additionally, a live disk image will be created (normally named $\{IMAGE_NAME}.-sdimg-ota e.g. core-image-raspberrypi3.rpi-sdimg-ota). You can control this behaviour through <<variables in your local.conf,OSTree-related variables in your local.conf>>. 23You can then build your image as usual, with bitbake. After building the root file system, bitbake will then create an https://ostree.readthedocs.io/en/latest/manual/adapting-existing/[OSTree-enabled version] of it, commit it to your local OSTree repo and (optionally) push it to a remote server. Additionally, a live disk image will be created (normally named $\{IMAGE_NAME}.-sdimg-ota e.g. core-image-raspberrypi3.rpi-sdimg-ota). You can control this behaviour through <<variables in your local.conf,OSTree-related variables in your local.conf>>.
24 24
25=== Build with OpenIVI
26
27=== Build in AGL 25=== Build in AGL
28 26
29With AGL you can just add agl-sota feature while configuring your build environment: 27With AGL you can just add agl-sota feature while configuring your build environment:
@@ -46,6 +44,16 @@ and get as a result an "ostree_repo" folder in your images directory (tmp/deploy
46 44
47Although aglsetup.sh hooks provide reasonable defaults for SOTA-related variables, you may want to tune some of them. 45Although aglsetup.sh hooks provide reasonable defaults for SOTA-related variables, you may want to tune some of them.
48 46
47=== Build problems
48
49Multilib systems may require adding this line to `local.conf`:
50
51....
52HOSTTOOLS += "x86_64-linux-gnu-gcc"
53....
54
55Ubuntu users that encounter an error due to missing `Python.h` should install `libpython2.7-dev` on their host machine.
56
49== Supported boards 57== Supported boards
50 58
51Currently supported platforms are 59Currently supported platforms are
@@ -67,35 +75,39 @@ Although we have used U-Boot so far, other boot loaders can be configured work w
67 75
68== SOTA-related variables in local.conf 76== SOTA-related variables in local.conf
69 77
70* OSTREE_REPO - path to your OSTree repository. Defaults to "$\{DEPLOY_DIR_IMAGE}/ostree_repo" 78* `OSTREE_REPO` - path to your OSTree repository. Defaults to `$\{DEPLOY_DIR_IMAGE}/ostree_repo`
71* OSTREE_BRANCHNAME - the branch your rootfs will be committed to. Defaults to "ota" 79* `OSTREE_OSNAME` - OS deployment name on your target device. For more information about deployments and osnames see the https://ostree.readthedocs.io/en/latest/manual/deployment/[OSTree documentation]. Defaults to "poky".
72* OSTREE_OSNAME - OS deployment name on your target device. For more information about deployments and osnames see the https://ostree.readthedocs.io/en/latest/manual/deployment/[OSTree documentation]. Defaults to "poky". 80* `OSTREE_INITRAMFS_IMAGE` - initramfs/initrd image that is used as a proxy while booting into OSTree deployment. Do not change this setting unless you are sure that your initramfs can serve as such a proxy.
73* OSTREE_INITRAMFS_IMAGE - initramfs/initrd image that is used as a proxy while booting into OSTree deployment. Do not change this setting unless you are sure that your initramfs can serve as such a proxy. 81* `SOTA_PACKED_CREDENTIALS` - when set, your ostree commit will be pushed to a remote repo as a bitbake step. This should be the path to a zipped credentials file in https://github.com/advancedtelematic/aktualizr/blob/master/docs/credentials.adoc[the format accepted by garage-push].
74* SOTA_PACKED_CREDENTIALS - when set, your ostree commit will be pushed to a remote repo as a bitbake step. This should be the path to a JSON credentials file in https://github.com/advancedtelematic/sota-tools#credentials[the format accepted by garage-push]. 82* `SOTA_CLIENT_PROV` - which provisioning method to use. Valid options are https://github.com/advancedtelematic/aktualizr/blob/master/docs/automatic-provisioning.adoc[`aktualizr-auto-prov`], https://github.com/advancedtelematic/aktualizr/blob/master/docs/implicit-provisioning.adoc[`aktualizr-implicit-prov`], and `aktualizr-hsm-prov`. The default is `aktualizr-auto-prov`. This can also be set to an empty string to avoid using a provisioning recipe.
83* `SOTA_CLIENT_FEATURES` - extensions to aktualizr. Multiple can be specified if separated by spaces. Valid options are `hsm` (to build with HSM support) and `secondary-example` (to install an example https://github.com/advancedtelematic/aktualizr/blob/master/docs/legacysecondary.adoc[legacy secondary interface] in the image).
84* `SOTA_LEGACY_SECONDARY_INTERFACE` - path to a legacy secondary interface installed on the device. To use the example interface from the Aktualizr repo, use `/usr/bin/example-interface` and make sure `SOTA_CLIENT_FEATURES = "secondary-example"`.
85* `SOTA_SECONDARY_ECUS` - a list of paths separated by spaces of JSON configuration files for virtual secondaries on the host. These will be installed into `/var/sota/ecus` on the device.
86* `SOTA_VIRTUAL_SECONDARIES` - a list of paths separated by spaces of JSON configuration files for virtual secondaries installed on the device. If `SOTA_SECONDARY_ECUS` is used to install them, then you can expect them to be installed in `/var/sota/ecus`.
75 87
76== Usage 88== Usage
77 89
78=== OSTree 90=== OSTree
79 91
80OSTree includes its own simple http server. It just exposes the whole OSTree repository to the network so that any remote device can pull data from it to device's local repository. To use the OSTree http server, you will need OSTree installed on your build machine. (Alternatively, you could run version built inside Yocto using bitbake's http://www.openembedded.org/wiki/Devshell[devshell].) 92OSTree used to include a simple HTTP server as part of the ostree binary, but this has been removed in more recent versions. However, OSTree repositories are self-contained directories, and can be trivially served over the network using any HTTP server. For example, you could use Python's SimpleHTTPServer:
81
82To expose your repo, run ostree trivial-httpd using any free port:
83 93
84.... 94....
85ostree trivial-httpd tmp/deploy/images/qemux86-64/ostree_repo -P 57556 95cd tmp/deploy/images/qemux86-64/ostree_repo
96python -m SimpleHTTPServer <port> # port defaults to 8000
86.... 97....
87 98
88You can then run ostree from inside your device by adding your repo: 99You can then run ostree from inside your device by adding your repo:
89 100
90.... 101....
91# agl-remote identifies the remote server in your local repo 102# This behaves like adding a Git remote; you can name it anything
92ostree remote add --no-gpg-verify my-remote http://192.168.7.1:57556 ota 103ostree remote add --no-gpg-verify my-remote http://<your-ip>:<port>
93 104
94# ota is a branch name in the remote repo, set in OSTREE_BRANCHNAME 105# If OSTREE_BRANCHNAME is set in local.conf, that will be the name of the
95ostree pull my-remote ota 106# branch. If not set, it defaults to the value of MACHINE (e.g. qemux86-64).
107ostree pull my-remote <branch>
96 108
97# poky is OS name as set in OSTREE_OSNAME 109# poky is the OS name as set in OSTREE_OSNAME
98ostree admin deploy --os=poky my-remote:ota 110ostree admin deploy --os=poky my-remote:<branch>
99.... 111....
100 112
101After restarting, you will boot into the newly deployed OS image. 113After restarting, you will boot into the newly deployed OS image.
@@ -136,5 +148,5 @@ SANITY_TESTED_DISTROS=""
136* Run oe-selftest: 148* Run oe-selftest:
137 149
138``` 150```
139oe-selftest --run-tests garage_push 151oe-selftest --run-tests updater
140``` 152```
diff --git a/classes/image_repo_manifest.bbclass b/classes/image_repo_manifest.bbclass
index d508574..467fd9a 100644
--- a/classes/image_repo_manifest.bbclass
+++ b/classes/image_repo_manifest.bbclass
@@ -14,9 +14,9 @@ HOSTTOOLS_NONFATAL += " repo "
14# Write build information to target filesystem 14# Write build information to target filesystem
15buildinfo () { 15buildinfo () {
16 if [ $(which repo) ]; then 16 if [ $(which repo) ]; then
17 repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml 17 repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml || bbwarn "Android repo tool failed to run; manifest not copied"
18 else 18 else
19 echo "Android repo tool not food; manifest not copied." 19 bbwarn "Android repo tool not found; manifest not copied."
20 fi 20 fi
21} 21}
22 22
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index dc8474c..904db96 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -1,6 +1,6 @@
1# OSTree deployment 1# OSTree deployment
2 2
3IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \ 3do_image_ostree[depends] += "ostree-native:do_populate_sysroot \
4 openssl-native:do_populate_sysroot \ 4 openssl-native:do_populate_sysroot \
5 coreutils-native:do_populate_sysroot \ 5 coreutils-native:do_populate_sysroot \
6 unzip-native:do_populate_sysroot \ 6 unzip-native:do_populate_sysroot \
@@ -11,6 +11,7 @@ export OSTREE_REPO
11export OSTREE_BRANCHNAME 11export OSTREE_BRANCHNAME
12 12
13RAMDISK_EXT ?= ".${INITRAMFS_FSTYPES}" 13RAMDISK_EXT ?= ".${INITRAMFS_FSTYPES}"
14export GARAGE_TARGET_NAME
14 15
15OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" 16OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}"
16 17
@@ -116,6 +117,7 @@ IMAGE_CMD_ostree () {
116 fi 117 fi
117 118
118 if [ -n "${SOTA_SECONDARY_ECUS}" ]; then 119 if [ -n "${SOTA_SECONDARY_ECUS}" ]; then
120 mkdir -p var/sota/ecus
119 cp ${SOTA_SECONDARY_ECUS} var/sota/ecus 121 cp ${SOTA_SECONDARY_ECUS} var/sota/ecus
120 fi 122 fi
121 123
@@ -158,7 +160,7 @@ IMAGE_CMD_ostree () {
158} 160}
159 161
160IMAGE_TYPEDEP_ostreepush = "ostree" 162IMAGE_TYPEDEP_ostreepush = "ostree"
161IMAGE_DEPENDS_ostreepush = "aktualizr-native:do_populate_sysroot ca-certificates-native:do_populate_sysroot " 163do_image_ostreepush[depends] += "aktualizr-native:do_populate_sysroot ca-certificates-native:do_populate_sysroot"
162IMAGE_CMD_ostreepush () { 164IMAGE_CMD_ostreepush () {
163 # Print warnings if credetials are not set or if the file has not been found. 165 # Print warnings if credetials are not set or if the file has not been found.
164 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then 166 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
@@ -176,11 +178,11 @@ IMAGE_CMD_ostreepush () {
176} 178}
177 179
178IMAGE_TYPEDEP_garagesign = "ostreepush" 180IMAGE_TYPEDEP_garagesign = "ostreepush"
179IMAGE_DEPENDS_garagesign = "garage-sign-native:do_populate_sysroot" 181do_image_garage_sign[depends] += "aktualizr-native:do_populate_sysroot"
180IMAGE_CMD_garagesign () { 182IMAGE_CMD_garagesign () {
181 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then 183 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
182 # if credentials are issued by a server that doesn't support offline signing, exit silently 184 # if credentials are issued by a server that doesn't support offline signing, exit silently
183 unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec 2>&1 >/dev/null || exit 0 185 unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0
184 186
185 java_version=$( java -version 2>&1 | awk -F '"' '/version/ {print $2}' ) 187 java_version=$( java -version 2>&1 | awk -F '"' '/version/ {print $2}' )
186 if [ "${java_version}" = "" ]; then 188 if [ "${java_version}" = "" ]; then
@@ -191,15 +193,8 @@ IMAGE_CMD_garagesign () {
191 exit 1 193 exit 1
192 fi 194 fi
193 195
194 if [ ! -d "${GARAGE_SIGN_REPO}" ]; then 196 rm -rf ${GARAGE_SIGN_REPO}
195 garage-sign init --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --credentials ${SOTA_PACKED_CREDENTIALS} 197 garage-sign init --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --credentials ${SOTA_PACKED_CREDENTIALS}
196 fi
197
198 if [ -n "${GARAGE_SIGN_REPOSERVER}" ]; then
199 reposerver_args="--reposerver ${GARAGE_SIGN_REPOSERVER}"
200 else
201 reposerver_args=""
202 fi
203 198
204 ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) 199 ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME})
205 200
@@ -207,11 +202,11 @@ IMAGE_CMD_garagesign () {
207 # in which case targets.json should be pulled again and the whole procedure repeated 202 # in which case targets.json should be pulled again and the whole procedure repeated
208 push_success=0 203 push_success=0
209 for push_retries in $( seq 3 ); do 204 for push_retries in $( seq 3 ); do
210 garage-sign targets pull --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} ${reposerver_args} 205 garage-sign targets pull --repo tufrepo --home-dir ${GARAGE_SIGN_REPO}
211 garage-sign targets add --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --name ${OSTREE_BRANCHNAME} --format OSTREE --version ${OSTREE_BRANCHNAME} --length 0 --url "https://example.com/" --sha256 ${ostree_target_hash} --hardwareids ${MACHINE} 206 garage-sign targets add --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --name ${GARAGE_TARGET_NAME} --format OSTREE --version ${ostree_target_hash} --length 0 --url "https://example.com/" --sha256 ${ostree_target_hash} --hardwareids ${MACHINE}
212 garage-sign targets sign --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --key-name=targets 207 garage-sign targets sign --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --key-name=targets
213 errcode=0 208 errcode=0
214 garage-sign targets push --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} ${reposerver_args} || errcode=$? 209 garage-sign targets push --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} || errcode=$?
215 if [ "$errcode" -eq "0" ]; then 210 if [ "$errcode" -eq "0" ]; then
216 push_success=1 211 push_success=1
217 break 212 break
@@ -224,9 +219,20 @@ IMAGE_CMD_garagesign () {
224 bberror "Couldn't push to garage repository" 219 bberror "Couldn't push to garage repository"
225 exit 1 220 exit 1
226 fi 221 fi
227 else
228 bbwarn "SOTA_PACKED_CREDENTIALS not set. Please add SOTA_PACKED_CREDENTIALS."
229 fi 222 fi
230} 223}
231 224
225IMAGE_TYPEDEP_garagecheck = "ostreepush garagesign"
226do_image_garagecheck[depends] += "aktualizr-native:do_populate_sysroot"
227IMAGE_CMD_garagecheck () {
228 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
229 # if credentials are issued by a server that doesn't support offline signing, exit silently
230 unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0
231 ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME})
232
233 garage-check --ref=${ostree_target_hash} \
234 --credentials=${SOTA_PACKED_CREDENTIALS} \
235 --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt
236 fi
237}
232# vim:set ts=4 sw=4 sts=4 expandtab: 238# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass
index 1b487e7..84095a6 100644
--- a/classes/image_types_ota.bbclass
+++ b/classes/image_types_ota.bbclass
@@ -7,9 +7,11 @@
7# boot scripts, kernel and initramfs images 7# boot scripts, kernel and initramfs images
8# 8#
9 9
10OSTREE_BOOTLOADER ??= 'u-boot'
11
10do_image_otaimg[depends] += "e2fsprogs-native:do_populate_sysroot \ 12do_image_otaimg[depends] += "e2fsprogs-native:do_populate_sysroot \
11 ${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER', True) == 'grub' else ''} \ 13 ${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER', True) == 'grub' else ''} \
12 ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot' else ''}" 14 ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot' else ''}"
13 15
14calculate_size () { 16calculate_size () {
15 BASE=$1 17 BASE=$1
@@ -49,6 +51,8 @@ export OSTREE_BRANCHNAME
49export OSTREE_REPO 51export OSTREE_REPO
50export OSTREE_BOOTLOADER 52export OSTREE_BOOTLOADER
51 53
54export GARAGE_TARGET_NAME
55
52IMAGE_CMD_otaimg () { 56IMAGE_CMD_otaimg () {
53 if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then 57 if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then
54 if [ -z "$OSTREE_REPO" ]; then 58 if [ -z "$OSTREE_REPO" ]; then
@@ -81,14 +85,16 @@ IMAGE_CMD_otaimg () {
81 bberror "Invalid bootloader: ${OSTREE_BOOTLOADER}" 85 bberror "Invalid bootloader: ${OSTREE_BOOTLOADER}"
82 fi; 86 fi;
83 87
84 ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${OSTREE_BRANCHNAME} 88 ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME})
89
90 ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash}
85 export OSTREE_BOOT_PARTITION="/boot" 91 export OSTREE_BOOT_PARTITION="/boot"
86 kargs_list="" 92 kargs_list=""
87 for arg in ${OSTREE_KERNEL_ARGS}; do 93 for arg in ${OSTREE_KERNEL_ARGS}; do
88 kargs_list="${kargs_list} --karg-append=$arg" 94 kargs_list="${kargs_list} --karg-append=$arg"
89 done 95 done
90 96
91 ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_BRANCHNAME} 97 ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${ostree_target_hash}
92 98
93 # Copy deployment /home and /var/sota to sysroot 99 # Copy deployment /home and /var/sota to sysroot
94 HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX` 100 HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX`
@@ -100,6 +106,9 @@ IMAGE_CMD_otaimg () {
100 mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ || true 106 mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ || true
101 # Ensure that /var/local exists (AGL symlinks /usr/local to /var/local) 107 # Ensure that /var/local exists (AGL symlinks /usr/local to /var/local)
102 install -d ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/local 108 install -d ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/local
109 # Set package version for the first deployment
110 echo "{\"${ostree_target_hash}\":\"${GARAGE_TARGET_NAME}-${ostree_target_hash}\"}" > ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/installed_versions
111
103 rm -rf ${HOME_TMP} 112 rm -rf ${HOME_TMP}
104 113
105 # Calculate image type 114 # Calculate image type
diff --git a/classes/sota.bbclass b/classes/sota.bbclass
index 7e9adca..2a12e8f 100644
--- a/classes/sota.bbclass
+++ b/classes/sota.bbclass
@@ -11,10 +11,10 @@ SOTA_CLIENT ??= "aktualizr"
11SOTA_CLIENT_PROV ??= "aktualizr-auto-prov" 11SOTA_CLIENT_PROV ??= "aktualizr-auto-prov"
12IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" 12IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}"
13IMAGE_CLASSES += " image_types_ostree image_types_ota" 13IMAGE_CLASSES += " image_types_ostree image_types_ota"
14IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign otaimg wic', ' ', d)}" 14IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign garagecheck otaimg wic', ' ', d)}"
15 15
16PACKAGECONFIG_append_pn-curl = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', " ssl", " ", d)}" 16PACKAGECONFIG_append_pn-curl = " ssl"
17PACKAGECONFIG_remove_pn-curl = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', " gnutls", " ", d)}" 17PACKAGECONFIG_remove_pn-curl = "gnutls"
18 18
19WKS_FILE_sota ?= "sdimage-sota.wks" 19WKS_FILE_sota ?= "sdimage-sota.wks"
20 20
diff --git a/classes/sota_minnowboard.bbclass b/classes/sota_minnowboard.bbclass
index 8417348..63510e3 100644
--- a/classes/sota_minnowboard.bbclass
+++ b/classes/sota_minnowboard.bbclass
@@ -4,4 +4,7 @@ EFI_PROVIDER_sota = "grub-efi"
4WKS_FILE_sota = "efiimage-sota.wks" 4WKS_FILE_sota = "efiimage-sota.wks"
5IMAGE_BOOT_FILES_sota = "" 5IMAGE_BOOT_FILES_sota = ""
6 6
7IMAGE_FSTYPES_remove_sota = "live hddimg"
7OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 console=ttyS0,115200 console=tty0" 8OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 console=ttyS0,115200 console=tty0"
9
10IMAGE_INSTALL_append = " minnowboard-efi-startup"
diff --git a/classes/sota_qemux86-64.bbclass b/classes/sota_qemux86-64.bbclass
index 5ec4f69..666ad6b 100644
--- a/classes/sota_qemux86-64.bbclass
+++ b/classes/sota_qemux86-64.bbclass
@@ -4,8 +4,10 @@ PREFERRED_VERSION_linux-yocto_qemux86-64_sota = "4.4%"
4IMAGE_FSTYPES_remove = "wic" 4IMAGE_FSTYPES_remove = "wic"
5 5
6# U-Boot support for SOTA 6# U-Boot support for SOTA
7PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot-ota" 7PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot"
8UBOOT_MACHINE_sota = "qemu-x86_defconfig" 8UBOOT_MACHINE_sota = "qemu-x86_defconfig"
9OSTREE_BOOTLOADER ?= "u-boot" 9OSTREE_BOOTLOADER ?= "u-boot"
10 10
11OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 ostree_root=/dev/hda" 11OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 ostree_root=/dev/hda"
12
13IMAGE_ROOTFS_EXTRA_SPACE = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', '65536', '', d)}"
diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass
index 51d07b2..2c69ea0 100644
--- a/classes/sota_raspberrypi.bbclass
+++ b/classes/sota_raspberrypi.bbclass
@@ -1,8 +1,10 @@
1RPI_USE_U_BOOT_sota = "1"
1KERNEL_IMAGETYPE_sota = "uImage" 2KERNEL_IMAGETYPE_sota = "uImage"
2PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" 3PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot"
3UBOOT_MACHINE_raspberrypi2_sota ?= "rpi_2_defconfig" 4UBOOT_MACHINE_raspberrypi2_sota ?= "rpi_2_defconfig"
4UBOOT_MACHINE_raspberrypi3_sota ?= "rpi_3_32b_defconfig" 5UBOOT_MACHINE_raspberrypi3_sota ?= "rpi_3_32b_defconfig"
5 6
7IMAGE_FSTYPES_remove_sota = "rpi-sdimg"
6OSTREE_BOOTLOADER ?= "u-boot" 8OSTREE_BOOTLOADER ?= "u-boot"
7 9
8# OSTree puts its own boot.scr to bcm2835-bootfiles 10# OSTree puts its own boot.scr to bcm2835-bootfiles
diff --git a/conf/include/bblayers/sota.inc b/conf/include/bblayers/sota.inc
index 97edecb..26eea22 100644
--- a/conf/include/bblayers/sota.inc
+++ b/conf/include/bblayers/sota.inc
@@ -1,5 +1,3 @@
1
2BBLAYERS += "${METADIR}/meta-updater" 1BBLAYERS += "${METADIR}/meta-updater"
3BBLAYERS += "${METADIR}/meta-openembedded/meta-filesystems" 2BBLAYERS += "${METADIR}/meta-openembedded/meta-filesystems"
4BBLAYERS += "${METADIR}/meta-openembedded/meta-oe" 3BBLAYERS += "${METADIR}/meta-openembedded/meta-oe"
5BBLAYERS += "${METADIR}/meta-rust"
diff --git a/conf/include/bblayers/sota_qemux86-64.inc b/conf/include/bblayers/sota_qemux86-64.inc
index 22ace81..12d32ff 100644
--- a/conf/include/bblayers/sota_qemux86-64.inc
+++ b/conf/include/bblayers/sota_qemux86-64.inc
@@ -1,2 +1 @@
1
2BBLAYERS += " ${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 11ede20..cc26679 100644
--- a/conf/include/bblayers/sota_raspberrypi2.inc
+++ b/conf/include/bblayers/sota_raspberrypi2.inc
@@ -1,2 +1,3 @@
1BBLAYERS += " ${METADIR}/meta-openembedded/meta-python "
1 2
2BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi " 3BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi "
diff --git a/conf/include/bblayers/sota_raspberrypi3.inc b/conf/include/bblayers/sota_raspberrypi3.inc
index 11ede20..cc26679 100644
--- a/conf/include/bblayers/sota_raspberrypi3.inc
+++ b/conf/include/bblayers/sota_raspberrypi3.inc
@@ -1,2 +1,3 @@
1BBLAYERS += " ${METADIR}/meta-openembedded/meta-python "
1 2
2BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi " 3BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi "
diff --git a/lib/oeqa/selftest/cases/qemucommand.py b/lib/oeqa/selftest/cases/qemucommand.py
new file mode 120000
index 0000000..075cdb8
--- /dev/null
+++ b/lib/oeqa/selftest/cases/qemucommand.py
@@ -0,0 +1 @@
../../../../scripts/qemucommand.py \ No newline at end of file
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
new file mode 100644
index 0000000..91ac9fc
--- /dev/null
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -0,0 +1,236 @@
1# pylint: disable=C0111,C0325
2import os
3import logging
4import subprocess
5import unittest
6from time import sleep
7
8from oeqa.selftest.case import OESelftestTestCase
9from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
10from qemucommand import QemuCommand
11
12
13class SotaToolsTests(OESelftestTestCase):
14
15 @classmethod
16 def setUpClass(cls):
17 super(SotaToolsTests, cls).setUpClass()
18 logger = logging.getLogger("selftest")
19 logger.info('Running bitbake to build aktualizr-native tools')
20 bitbake('aktualizr-native')
21
22 def test_push_help(self):
23 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native')
24 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-push"
25 self.assertTrue(os.path.isfile(p), msg = "No garage-push found (%s)" % p)
26 result = runCmd('%s --help' % p, ignore_status=True)
27 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
28
29 def test_deploy_help(self):
30 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native')
31 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-deploy"
32 self.assertTrue(os.path.isfile(p), msg = "No garage-deploy found (%s)" % p)
33 result = runCmd('%s --help' % p, ignore_status=True)
34 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
35
36 def test_garagesign_help(self):
37 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native')
38 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-sign"
39 self.assertTrue(os.path.isfile(p), msg = "No garage-sign found (%s)" % p)
40 result = runCmd('%s --help' % p, ignore_status=True)
41 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
42
43
44class HsmTests(OESelftestTestCase):
45
46 def test_hsm(self):
47 self.write_config('SOTA_CLIENT_FEATURES="hsm"')
48 bitbake('core-image-minimal')
49
50
51class GeneralTests(OESelftestTestCase):
52
53 def test_feature_sota(self):
54 result = get_bb_var('DISTRO_FEATURES').find('sota')
55 self.assertNotEqual(result, -1, 'Feature "sota" not set at DISTRO_FEATURES')
56
57 def test_feature_systemd(self):
58 result = get_bb_var('DISTRO_FEATURES').find('systemd')
59 self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES')
60
61 def test_credentials(self):
62 bitbake('core-image-minimal')
63 credentials = get_bb_var('SOTA_PACKED_CREDENTIALS')
64 # skip the test if the variable SOTA_PACKED_CREDENTIALS is not set
65 if credentials is None:
66 raise unittest.SkipTest("Variable 'SOTA_PACKED_CREDENTIALS' not set.")
67 # Check if the file exists
68 self.assertTrue(os.path.isfile(credentials), "File %s does not exist" % credentials)
69 deploydir = get_bb_var('DEPLOY_DIR_IMAGE')
70 imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal')
71 # Check if the credentials are included in the output image
72 result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' %
73 (deploydir, imagename), ignore_status=True)
74 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
75
76 def test_java(self):
77 result = runCmd('which java', ignore_status=True)
78 self.assertEqual(result.status, 0, "Java not found.")
79
80 def test_add_package(self):
81 print('')
82 deploydir = get_bb_var('DEPLOY_DIR_IMAGE')
83 imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal')
84 image_path = deploydir + '/' + imagename + '.otaimg'
85 logger = logging.getLogger("selftest")
86
87 logger.info('Running bitbake with man in the image package list')
88 self.write_config('IMAGE_INSTALL_append = " man "')
89 bitbake('-c cleanall man')
90 bitbake('core-image-minimal')
91 result = runCmd('oe-pkgdata-util find-path /usr/bin/man')
92 self.assertEqual(result.output, 'man: /usr/bin/man')
93 path1 = os.path.realpath(image_path)
94 size1 = os.path.getsize(path1)
95 logger.info('First image %s has size %i' % (path1, size1))
96
97 logger.info('Running bitbake without man in the image package list')
98 self.write_config('IMAGE_INSTALL_remove = " man "')
99 bitbake('-c cleanall man')
100 bitbake('core-image-minimal')
101 result = runCmd('oe-pkgdata-util find-path /usr/bin/man', ignore_status=True)
102 self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
103 self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /usr/bin/man')
104 path2 = os.path.realpath(image_path)
105 size2 = os.path.getsize(path2)
106 logger.info('Second image %s has size %i', path2, size2)
107 self.assertNotEqual(path1, path2, "Image paths are identical; image was not rebuilt.")
108 self.assertNotEqual(size1, size2, "Image sizes are identical; image was not rebuilt.")
109
110
111class QemuTests(OESelftestTestCase):
112
113 @classmethod
114 def setUpClass(cls):
115 super(QemuTests, cls).setUpClass()
116 cls.qemu, cls.s = qemu_launch(machine='qemux86-64')
117
118 @classmethod
119 def tearDownClass(cls):
120 qemu_terminate(cls.s)
121
122 def run_command(self, command):
123 return qemu_send_command(self.qemu.ssh_port, command)
124
125 def test_hostname(self):
126 print('')
127 print('Checking machine name (hostname) of device:')
128 stdout, stderr, retcode = self.run_command('hostname')
129 machine = get_bb_var('MACHINE', 'core-image-minimal')
130 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
131 # Strip off line ending.
132 value_str = stdout.decode()[:-1]
133 self.assertEqual(value_str, machine,
134 'MACHINE does not match hostname: ' + machine + ', ' + value_str)
135 print(value_str)
136
137 def test_var_sota(self):
138 print('')
139 print('Checking contents of /var/sota:')
140 stdout, stderr, retcode = self.run_command('ls /var/sota')
141 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
142 self.assertEqual(retcode, 0)
143 print(stdout.decode())
144
145 def test_aktualizr_info(self):
146 print('Checking output of aktualizr-info:')
147 ran_ok = False
148 for delay in [0, 1, 2, 5, 10, 15]:
149 sleep(delay)
150 try:
151 stdout, stderr, retcode = self.run_command('aktualizr-info')
152 if retcode == 0 and stderr == b'':
153 ran_ok = True
154 break
155 except IOError as e:
156 print(e)
157 if not ran_ok:
158 print(stdout.decode())
159 print(stderr.decode())
160
161
162class GrubTests(OESelftestTestCase):
163
164 def setUpLocal(self):
165 # This is a bit of a hack but I can't see a better option.
166 path = os.path.abspath(os.path.dirname(__file__))
167 metadir = path + "/../../../../../"
168 grub_config = 'OSTREE_BOOTLOADER = "grub"\nMACHINE = "intel-corei7-64"'
169 self.append_config(grub_config)
170 self.meta_intel = metadir + "meta-intel"
171 self.meta_minnow = metadir + "meta-updater-minnowboard"
172 runCmd('bitbake-layers add-layer "%s"' % self.meta_intel)
173 runCmd('bitbake-layers add-layer "%s"' % self.meta_minnow)
174 self.qemu, self.s = qemu_launch(efi=True, machine='intel-corei7-64')
175
176 def tearDownLocal(self):
177 qemu_terminate(self.s)
178 runCmd('bitbake-layers remove-layer "%s"' % self.meta_intel, ignore_status=True)
179 runCmd('bitbake-layers remove-layer "%s"' % self.meta_minnow, ignore_status=True)
180
181 def test_grub(self):
182 print('')
183 print('Checking machine name (hostname) of device:')
184 value, err, retcode = qemu_send_command(self.qemu.ssh_port, 'hostname')
185 machine = get_bb_var('MACHINE', 'core-image-minimal')
186 self.assertEqual(err, b'', 'Error: ' + err.decode())
187 self.assertEqual(retcode, 0)
188 # Strip off line ending.
189 value_str = value.decode()[:-1]
190 self.assertEqual(value_str, machine,
191 'MACHINE does not match hostname: ' + machine + ', ' + value_str +
192 '\nIs tianocore ovmf installed?')
193 print(value_str)
194
195
196def qemu_launch(efi=False, machine=None):
197 logger = logging.getLogger("selftest")
198 logger.info('Running bitbake to build core-image-minimal')
199 bitbake('core-image-minimal')
200 # Create empty object.
201 args = type('', (), {})()
202 args.imagename = 'core-image-minimal'
203 args.mac = None
204 # Could use DEPLOY_DIR_IMAGE here but it's already in the machine
205 # subdirectory.
206 args.dir = 'tmp/deploy/images'
207 args.efi = efi
208 args.machine = machine
209 args.kvm = None # Autodetect
210 args.no_gui = True
211 args.gdb = False
212 args.pcap = None
213 args.overlay = None
214 args.dry_run = False
215
216 qemu = QemuCommand(args)
217 cmdline = qemu.command_line()
218 print('Booting image with run-qemu-ota...')
219 s = subprocess.Popen(cmdline)
220 sleep(10)
221 return qemu, s
222
223def qemu_terminate(s):
224 try:
225 s.terminate()
226 except KeyboardInterrupt:
227 pass
228
229def qemu_send_command(port, command):
230 command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' +
231 str(port) + ' "' + command + '"']
232 s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
233 stdout, stderr = s2.communicate()
234 return stdout, stderr, s2.returncode
235
236# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/lib/oeqa/selftest/garage_push.py b/lib/oeqa/selftest/garage_push.py
deleted file mode 100644
index 21bd1c1..0000000
--- a/lib/oeqa/selftest/garage_push.py
+++ /dev/null
@@ -1,42 +0,0 @@
1import unittest
2import os
3import logging
4
5from oeqa.selftest.base import oeSelfTest
6from oeqa.utils.commands import runCmd, bitbake, get_bb_var
7
8class GaragePushTests(oeSelfTest):
9
10 @classmethod
11 def setUpClass(cls):
12 # Ensure we have the right data in pkgdata
13 logger = logging.getLogger("selftest")
14 logger.info('Running bitbake to build aktualizr-native tools')
15 bitbake('aktualizr-native garage-sign-native')
16
17 def test_help(self):
18 image_dir = get_bb_var("D", "aktualizr-native")
19 bin_dir = get_bb_var("bindir", "aktualizr-native")
20 gp_path = os.path.join(image_dir, bin_dir[1:], 'garage-push')
21 result = runCmd('%s --help' % gp_path, ignore_status=True)
22 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
23
24 def test_java(self):
25 result = runCmd('which java', ignore_status=True)
26 self.assertEqual(result.status, 0, "Java not found.")
27
28 def test_sign(self):
29 image_dir = get_bb_var("D", "garage-sign-native")
30 bin_dir = get_bb_var("bindir", "garage-sign-native")
31 gs_path = os.path.join(image_dir, bin_dir[1:], 'garage-sign')
32 result = runCmd('%s --help' % gs_path, ignore_status=True)
33 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
34
35 def test_push(self):
36 bitbake('core-image-minimal')
37 self.write_config('IMAGE_INSTALL_append = " man "')
38 bitbake('core-image-minimal')
39
40 def test_hsm(self):
41 self.write_config('SOTA_CLIENT_FEATURES="hsm hsm-test"')
42 bitbake('core-image-minimal')
diff --git a/recipes-bsp/u-boot/u-boot_2016.11.bb b/recipes-bsp/u-boot/u-boot_2016.11.bb
deleted file mode 100644
index acd4bb8..0000000
--- a/recipes-bsp/u-boot/u-boot_2016.11.bb
+++ /dev/null
@@ -1,22 +0,0 @@
1require recipes-bsp/u-boot/u-boot.inc
2
3HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
4SECTION = "bootloaders"
5
6LICENSE = "GPLv2+"
7LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6"
8PE = "1"
9
10DEPENDS += "dtc-native"
11
12SRCREV = "5ea3e51fc481613a8dee8c02848d1b42c81ad892"
13SRC_URI = "git://git.denx.de/u-boot.git"
14S = "${WORKDIR}/git"
15
16PV = "v2016.11+git${SRCPV}"
17
18#This patch is not compliant with u-boot 2016.11
19#Version of u-boot from yocto 2.2 Morty is 2016.03 from:
20# meta/recipes-bsp/u-boot/u-boot_2016.03.bb
21SRC_URI_remove_raspberrypi3 = "file://0003-Include-lowlevel_init.o-for-rpi2.patch"
22SRC_URI_remove_raspberrypi2 = "file://0003-Include-lowlevel_init.o-for-rpi2.patch"
diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb
index 4f9fe4f..2190512 100644
--- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb
+++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb
@@ -1,28 +1,24 @@
1SUMMARY = "Aktualizr systemd service and configurations" 1SUMMARY = "Aktualizr configuration for autoprovisioning"
2DESCRIPTION = "Systemd service and configurations for autoprovisioning Aktualizr, the SOTA Client application written in C++" 2DESCRIPTION = "Systemd service and configurations for autoprovisioning Aktualizr, the SOTA Client application written in C++"
3HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" 3HOMEPAGE = "https://github.com/advancedtelematic/aktualizr"
4SECTION = "base" 4SECTION = "base"
5LICENSE = "MPL-2.0" 5LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" 6LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
7DEPENDS = "zip-native" 7DEPENDS = "aktualizr-native zip-native"
8RDEPENDS_${PN} = "aktualizr" 8RDEPENDS_${PN} = "aktualizr"
9PV = "1.0" 9PV = "1.0"
10PR = "6" 10PR = "6"
11 11
12SRC_URI = " \ 12SRC_URI = " \
13 file://LICENSE \ 13 file://LICENSE \
14 file://aktualizr-manual-provision.service \
15 file://aktualizr-autoprovision.service \
16 file://sota_autoprov.toml \
17 " 14 "
18 15
19SYSTEMD_SERVICE_${PN} = "aktualizr.service" 16require environment.inc
20 17require credentials.inc
21inherit systemd
22 18
23export SOTA_PACKED_CREDENTIALS 19export SOTA_PACKED_CREDENTIALS
24 20
25do_install_append() { 21do_install() {
26 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then 22 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then
27 bbwarn "SOTA_AUTOPROVISION_CREDENTIALS are ignored. Please use SOTA_PACKED_CREDENTIALS" 23 bbwarn "SOTA_AUTOPROVISION_CREDENTIALS are ignored. Please use SOTA_PACKED_CREDENTIALS"
28 fi 24 fi
@@ -36,27 +32,24 @@ do_install_append() {
36 bbwarn "OSTREE_PUSH_CREDENTIALS is ignored. Please use SOTA_PACKED_CREDENTIALS" 32 bbwarn "OSTREE_PUSH_CREDENTIALS is ignored. Please use SOTA_PACKED_CREDENTIALS"
37 fi 33 fi
38 34
35 install -d ${D}${libdir}/sota
36 install -d ${D}${localstatedir}/sota
39 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then 37 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
40 install -d ${D}/${systemd_unitdir}/system 38 install -m 0644 ${STAGING_DIR_NATIVE}${libdir}/sota/sota_autoprov.toml ${D}${libdir}/sota/sota.toml
41 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service 39
42 install -d ${D}${libdir}/sota 40 # deploy SOTA credentials
43 install -m "0644" ${WORKDIR}/sota_autoprov.toml ${D}${libdir}/sota/sota.toml 41 if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then
44 42 cp ${SOTA_PACKED_CREDENTIALS} ${D}${localstatedir}/sota/sota_provisioning_credentials.zip
45 # deploy SOTA credentials 43 # Device should not be able to push data to treehub
46 if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then 44 zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip treehub.json
47 mkdir -p ${D}/var/sota 45 fi
48 cp ${SOTA_PACKED_CREDENTIALS} ${D}/var/sota/sota_provisioning_credentials.zip
49 # Device should not be able to push data to treehub
50 zip -d ${D}/var/sota/sota_provisioning_credentials.zip treehub.json
51 fi
52 else
53 install -d ${D}/${systemd_unitdir}/system
54 install -m 0644 ${WORKDIR}/aktualizr-manual-provision.service ${D}/${systemd_unitdir}/system/aktualizr.service
55 fi 46 fi
56} 47}
57 48
58FILES_${PN} = " \ 49FILES_${PN} = " \
59 ${systemd_unitdir}/system/aktualizr.service \
60 ${libdir}/sota/sota.toml \ 50 ${libdir}/sota/sota.toml \
61 /var/sota/sota_provisioning_credentials.zip \ 51 ${localstatedir}/sota \
52 ${localstatedir}/sota/sota_provisioning_credentials.zip \
62 " 53 "
54
55# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-sota/aktualizr/aktualizr-hsm-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb
new file mode 100644
index 0000000..5f8da3c
--- /dev/null
+++ b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb
@@ -0,0 +1,32 @@
1SUMMARY = "Aktualizr configuration with HSM support"
2DESCRIPTION = "Systemd service and configurations for HSM provisioning with Aktualizr, the SOTA Client application written in C++"
3HOMEPAGE = "https://github.com/advancedtelematic/aktualizr"
4SECTION = "base"
5LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
7
8DEPENDS = "aktualizr-native"
9RDEPENDS_${PN} = "aktualizr softhsm softhsm-testtoken"
10
11SRC_URI = " \
12 file://LICENSE \
13 "
14PV = "1.0"
15PR = "6"
16
17require environment.inc
18require credentials.inc
19
20do_install() {
21 install -d ${D}${libdir}/sota
22 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
23 aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \
24 -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_hsm_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D}
25 fi
26}
27
28FILES_${PN} = " \
29 ${libdir}/sota/sota.toml \
30 "
31
32# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb
deleted file mode 100644
index b14dc29..0000000
--- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb
+++ /dev/null
@@ -1,34 +0,0 @@
1SUMMARY = "Aktualizr systemd service and configuration with HSM support"
2DESCRIPTION = "Systemd service and configurations for Aktualizr, the SOTA Client application written in C++"
3HOMEPAGE = "https://github.com/advancedtelematic/aktualizr"
4SECTION = "base"
5LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
7
8DEPENDS = "aktualizr-native"
9RDEPENDS_${PN} = "aktualizr"
10
11SRC_URI = " \
12 file://LICENSE \
13 file://aktualizr-autoprovision.service \
14 file://sota_hsm_test.toml \
15 "
16PV = "1.0"
17PR = "6"
18
19SYSTEMD_SERVICE_${PN} = "aktualizr.service"
20
21inherit systemd
22
23do_install() {
24 install -d ${D}/${systemd_unitdir}/system
25 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service
26 install -d ${D}${libdir}/sota
27 aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \
28 -i ${WORKDIR}/sota_hsm_test.toml -o ${D}${libdir}/sota/sota.toml -p ${D}
29}
30
31FILES_${PN} = " \
32 ${systemd_unitdir}/system/aktualizr.service \
33 ${libdir}/sota/sota.toml \
34 "
diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb
index 21e38c9..cf3d22c 100644
--- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb
+++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb
@@ -1,34 +1,33 @@
1SUMMARY = "Aktualizr systemd service and configurations" 1SUMMARY = "Aktualizr configuration for implicit provisioning"
2DESCRIPTION = "Systemd service and configurations for implicitly provisioning Aktualizr, the SOTA Client application written in C++" 2DESCRIPTION = "Systemd service and configurations for implicitly provisioning Aktualizr, the SOTA Client application written in C++"
3HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" 3HOMEPAGE = "https://github.com/advancedtelematic/aktualizr"
4SECTION = "base" 4SECTION = "base"
5LICENSE = "MPL-2.0" 5LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" 6LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
7
7DEPENDS = "aktualizr-native" 8DEPENDS = "aktualizr-native"
8RDEPENDS_${PN} = "aktualizr" 9RDEPENDS_${PN} = "aktualizr"
9PV = "1.0"
10PR = "1"
11 10
12SRC_URI = " \ 11SRC_URI = " \
13 file://LICENSE \ 12 file://LICENSE \
14 file://aktualizr-autoprovision.service \
15 file://sota_implicit_prov.toml \
16 " 13 "
14PV = "1.0"
15PR = "1"
17 16
18SYSTEMD_SERVICE_${PN} = "aktualizr.service" 17require environment.inc
19 18require credentials.inc
20inherit systemd
21 19
22do_install() { 20do_install() {
23 install -d ${D}/${systemd_unitdir}/system
24 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service
25 install -d ${D}${libdir}/sota 21 install -d ${D}${libdir}/sota
26 aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} \ 22 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
27 -i ${WORKDIR}/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} 23 aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} \
24 -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D}
25 fi
28} 26}
29 27
30FILES_${PN} = " \ 28FILES_${PN} = " \
31 ${systemd_unitdir}/system/aktualizr.service \
32 ${libdir}/sota/sota.toml \ 29 ${libdir}/sota/sota.toml \
33 ${libdir}/sota/root.crt \ 30 ${libdir}/sota/root.crt \
34 " 31 "
32
33# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index c98027d..beaf893 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -5,47 +5,80 @@ 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"
7 7
8DEPENDS = "boost curl openssl libarchive libsodium " 8DEPENDS = "boost curl openssl libarchive libsodium asn1c-native "
9DEPENDS_append_class-target = "jansson ostree ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', ' libp11', '', d)} " 9DEPENDS_append_class-target = "jansson ostree ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', ' libp11', '', d)} "
10DEPENDS_append_class-native = "glib-2.0-native " 10DEPENDS_append_class-native = "glib-2.0-native "
11 11
12RDEPENDS_${PN}_class-target = "lshw " 12RDEPENDS_${PN}_class-target = "lshw "
13RDEPENDS_${PN}_append_class-target = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', ' engine-pkcs11', '', d)} " 13RDEPENDS_${PN}_append_class-target = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', ' engine-pkcs11', '', d)} "
14RDEPENDS_${PN}_append_class-target = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm-test', ' softhsm softhsm-testtoken', '', d)} " 14RDEPENDS_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', ' slcand-start', '', d)} "
15 15
16PV = "1.0+git${SRCPV}" 16PV = "1.0+git${SRCPV}"
17PR = "7" 17PR = "7"
18 18
19SRC_URI = " \ 19SRC_URI = " \
20 git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ 20 gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \
21 file://aktualizr.service \
22 file://aktualizr-serialcan.service \
21 " 23 "
22SRCREV = "f043191ae622a96cf2f4d48f9073d5cfa9f16e3f" 24SRCREV = "07d73645231681848bd943074498581e930d8582"
23BRANCH ?= "master" 25BRANCH ?= "master"
24 26
25S = "${WORKDIR}/git" 27S = "${WORKDIR}/git"
26 28
27inherit cmake 29inherit cmake
28 30
31inherit systemd
32SYSTEMD_SERVICE_${PN} = "aktualizr.service"
33
29BBCLASSEXTEND =+ "native" 34BBCLASSEXTEND =+ "native"
30 35
31EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} " 36EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} "
32EXTRA_OECMAKE_append_class-target = "-DBUILD_OSTREE=ON ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " 37EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON -DBUILD_ISOTP=ON ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} "
33EXTRA_OECMAKE_append_class-native = "-DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF " 38EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF "
34 39
35do_install_append () { 40do_install_append () {
36 rm -f ${D}${bindir}/aktualizr_cert_provider 41 rm -f ${D}${bindir}/aktualizr_cert_provider
37} 42}
38do_install_append_class-target () { 43do_install_append_class-target () {
39 rm -f ${D}${bindir}/aktualizr_implicit_writer 44 rm -f ${D}${bindir}/aktualizr_implicit_writer
45 rm -f ${D}${libdir}/sota/sota.toml
46 ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', '', 'rm -f ${D}${bindir}/example-interface', d)}
47 ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-isotp-example', '', 'rm -f ${D}${bindir}/isotp-test-interface', d)}
48
49 install -d ${D}${systemd_unitdir}/system
50 aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)}
51 install -m 0644 ${aktualizr_service} ${D}${systemd_unitdir}/system/aktualizr.service
52
53 install -d ${D}${libdir}/sota/schemas
54 install -m 0755 ${S}/config/storage/* ${D}${libdir}/sota/schemas
40} 55}
41do_install_append_class-native () { 56do_install_append_class-native () {
42 rm -f ${D}${bindir}/aktualizr 57 rm -f ${D}${bindir}/aktualizr
58 rm -f ${D}${bindir}/aktualizr-info
59 rm -f ${D}${bindir}/example-interface
60 install -d ${D}${libdir}/sota
61 install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml
62 install -m 0644 ${S}/config/sota_hsm_prov.toml ${D}/${libdir}/sota/sota_hsm_prov.toml
63 install -m 0644 ${S}/config/sota_implicit_prov.toml ${D}/${libdir}/sota/sota_implicit_prov.toml
64
65 install -m 0755 ${B}/src/sota_tools/garage-sign-prefix/src/garage-sign/bin/* ${D}${bindir}
66 install -m 0644 ${B}/src/sota_tools/garage-sign-prefix/src/garage-sign/lib/* ${D}${libdir}
43} 67}
44 68
45FILES_${PN}_class-target = " \ 69FILES_${PN}_class-target = " \
46 ${bindir}/aktualizr \ 70 ${bindir}/aktualizr \
71 ${bindir}/aktualizr-info \
72 ${systemd_unitdir}/system/aktualizr.service \
73 ${libdir}/sota/schemas \
47 " 74 "
75FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', ' ${bindir}/example-interface', '', d)} "
76FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-isotp-example', ' ${bindir}/isotp-test-interface', '', d)} "
48FILES_${PN}_class-native = " \ 77FILES_${PN}_class-native = " \
49 ${bindir}/aktualizr_implicit_writer \ 78 ${bindir}/aktualizr_implicit_writer \
79 ${bindir}/garage-deploy \
50 ${bindir}/garage-push \ 80 ${bindir}/garage-push \
81 ${libdir}/sota/* \
51 " 82 "
83
84# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-sota/aktualizr/credentials.inc b/recipes-sota/aktualizr/credentials.inc
new file mode 100644
index 0000000..256c8ff
--- /dev/null
+++ b/recipes-sota/aktualizr/credentials.inc
@@ -0,0 +1 @@
SRC_URI_append = "${@('file://' + d.getVar('SOTA_PACKED_CREDENTIALS', True)) if d.getVar('SOTA_PACKED_CREDENTIALS', True) else ''}"
diff --git a/recipes-sota/aktualizr/environment.inc b/recipes-sota/aktualizr/environment.inc
new file mode 100644
index 0000000..cba77e7
--- /dev/null
+++ b/recipes-sota/aktualizr/environment.inc
@@ -0,0 +1,17 @@
1export SOTA_LEGACY_SECONDARY_INTERFACE
2export SOTA_VIRTUAL_SECONDARIES
3
4do_install_append() {
5 if [ -n "${SOTA_LEGACY_SECONDARY_INTERFACE}" ]; then
6 AKTUALIZR_PARAMETERS_LEGACYSEC="--legacy-interface ${SOTA_LEGACY_SECONDARY_INTERFACE}";
7 fi
8
9 AKTUALIZR_PARAMETERS_CONFIGFILE="--config /usr/lib/sota/sota.toml"
10 for sec in ${SOTA_VIRTUAL_SECONDARIES}; do
11 AKTUALIZR_PARAMETERS_VIRTUALSECS="${AKTUALIZR_PARAMETERS_VIRTUALSECS} --secondary-config $sec"
12 done
13
14 echo "AKTUALIZR_CMDLINE_PARAMETERS=${AKTUALIZR_PARAMETERS_CONFIGFILE} ${AKTUALIZR_PARAMETERS_LEGACYSEC} ${AKTUALIZR_PARAMETERS_VIRTUALSECS}" > ${D}${libdir}/sota/sota.env
15}
16
17FILES_${PN}_append = " ${libdir}/sota/sota.env"
diff --git a/recipes-sota/aktualizr/files/aktualizr-autoprovision.service b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service
deleted file mode 100644
index 8cb8d78..0000000
--- a/recipes-sota/aktualizr/files/aktualizr-autoprovision.service
+++ /dev/null
@@ -1,13 +0,0 @@
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
10ExecStart=/usr/bin/aktualizr --config /usr/lib/sota/sota.toml
11
12[Install]
13WantedBy=multi-user.target
diff --git a/recipes-sota/aktualizr/files/aktualizr-serialcan.service b/recipes-sota/aktualizr/files/aktualizr-serialcan.service
new file mode 100644
index 0000000..b42f348
--- /dev/null
+++ b/recipes-sota/aktualizr/files/aktualizr-serialcan.service
@@ -0,0 +1,15 @@
1[Unit]
2Description=Aktualizr SOTA Client
3Wants=network-online.target slcand@ttyACM0.service
4After=network.target network-online.target slcand@ttyACM0.service
5
6Requires=network-online.target
7
8[Service]
9RestartSec=10
10Restart=always
11EnvironmentFile=/usr/lib/sota/sota.env
12ExecStart=/bin/sh -c "(ip addr | grep can0) && /usr/bin/aktualizr $AKTUALIZR_CMDLINE_PARAMETERS"
13
14[Install]
15WantedBy=multi-user.target
diff --git a/recipes-sota/aktualizr/files/aktualizr-manual-provision.service b/recipes-sota/aktualizr/files/aktualizr.service
index a70f2f9..b6df9d7 100644
--- a/recipes-sota/aktualizr/files/aktualizr-manual-provision.service
+++ b/recipes-sota/aktualizr/files/aktualizr.service
@@ -7,7 +7,8 @@ Requires=network-online.target
7[Service] 7[Service]
8RestartSec=10 8RestartSec=10
9Restart=always 9Restart=always
10ExecStart=/usr/bin/aktualizr --config /sysroot/boot/sota.toml --loglevel 2 10EnvironmentFile=/usr/lib/sota/sota.env
11ExecStart=/usr/bin/aktualizr $AKTUALIZR_CMDLINE_PARAMETERS
11 12
12[Install] 13[Install]
13WantedBy=multi-user.target 14WantedBy=multi-user.target
diff --git a/recipes-sota/aktualizr/files/sota_autoprov.toml b/recipes-sota/aktualizr/files/sota_autoprov.toml
deleted file mode 100644
index 9fbb093..0000000
--- a/recipes-sota/aktualizr/files/sota_autoprov.toml
+++ /dev/null
@@ -1,14 +0,0 @@
1[tls]
2certificates_directory = "/var/sota/"
3ca_file = "root.crt"
4client_certificate = "client.pem"
5pkey_file = "pkey.pem"
6
7[uptane]
8metadata_path = "/var/sota/metadata"
9private_key_path = "ecukey.der"
10public_key_path = "ecukey.pub"
11
12[provision]
13provision_path = "/var/sota/sota_provisioning_credentials.zip"
14
diff --git a/recipes-sota/aktualizr/files/sota_hsm_test.toml b/recipes-sota/aktualizr/files/sota_hsm_test.toml
deleted file mode 100644
index 28aefc2..0000000
--- a/recipes-sota/aktualizr/files/sota_hsm_test.toml
+++ /dev/null
@@ -1,18 +0,0 @@
1[tls]
2certificates_directory = "/var/sota/"
3ca_file = "/var/sota/token/root.crt"
4client_certificate = "01"
5cert_source = "pkcs11"
6pkey_file = "02"
7pkey_source = "pkcs11"
8
9[p11]
10module = "/usr/lib/softhsm/libsofthsm2.so"
11pass = "1234"
12
13[uptane]
14metadata_path = "/var/sota/metadata"
15key_source = "pkcs11"
16private_key_path = "03"
17public_key_path = "03"
18
diff --git a/recipes-sota/aktualizr/files/sota_implicit_prov.toml b/recipes-sota/aktualizr/files/sota_implicit_prov.toml
deleted file mode 100644
index 756c868..0000000
--- a/recipes-sota/aktualizr/files/sota_implicit_prov.toml
+++ /dev/null
@@ -1,11 +0,0 @@
1[tls]
2certificates_directory = "/var/sota/"
3ca_file = "/usr/lib/sota/root.crt"
4client_certificate = "client.pem"
5pkey_file = "pkey.pem"
6
7[uptane]
8metadata_path = "/var/sota/metadata"
9private_key_path = "ecukey.der"
10public_key_path = "ecukey.pub"
11
diff --git a/recipes-sota/asn1c/asn1c.bb b/recipes-sota/asn1c/asn1c.bb
new file mode 100644
index 0000000..9d1517d
--- /dev/null
+++ b/recipes-sota/asn1c/asn1c.bb
@@ -0,0 +1,17 @@
1SUMMARY = "ASN.1 to C compiler"
2DESCRIPTION = "Generates serialization routines from ASN.1 schemas"
3HOMEPAGE = "http://lionet.info/asn1c"
4SECTION = "base"
5LICENSE = "BSD"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=ee8bfaaa7d71cf3edb079475e6716d4b"
7
8inherit autotools native
9
10PV = "0.9.28"
11SRC_URI = "https://github.com/vlm/asn1c/releases/download/v${PV}/asn1c-${PV}.tar.gz \
12 file://skeletons_dir_fix.patch"
13SRC_URI[sha256sum] = "8007440b647ef2dd9fb73d931c33ac11764e6afb2437dbe638bb4e5fc82386b9"
14
15BBCLASSEXTEND = "native nativesdk"
16
17# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-sota/asn1c/files/skeletons_dir_fix.patch b/recipes-sota/asn1c/files/skeletons_dir_fix.patch
new file mode 100644
index 0000000..f1caa2f
--- /dev/null
+++ b/recipes-sota/asn1c/files/skeletons_dir_fix.patch
@@ -0,0 +1,44 @@
1From 1a1c2c94f700cf0f4dc5dba863950b16477fdc6d Mon Sep 17 00:00:00 2001
2From: Laurent Bonnans <laurent.bonnans@here.com>
3Date: Thu, 25 Jan 2018 09:49:41 +0100
4Subject: [PATCH] Patch the skeletons directory detection
5
6Detect `share/asn1c` from `bin/` if it exists
7---
8 asn1c/asn1c.c | 9 ++++-----
9 1 file changed, 4 insertions(+), 5 deletions(-)
10
11diff --git a/asn1c/asn1c.c b/asn1c/asn1c.c
12index eb1eff7c..dd9fc832 100644
13--- a/asn1c/asn1c.c
14+++ b/asn1c/asn1c.c
15@@ -226,22 +226,21 @@ main(int ac, char **av) {
16 if(skeletons_dir == NULL) {
17 struct stat sb;
18 skeletons_dir = DATADIR;
19- if((av[-optind][0] == '.' || av[-optind][1] == '/')
20- && stat(skeletons_dir, &sb)) {
21+ if(stat(skeletons_dir, &sb)) {
22 /*
23 * The default skeletons directory does not exist,
24 * compute it from my file name:
25- * ./asn1c/asn1c -> ./skeletons
26+ * ./asn1c/asn1c -> ./share/asn1c
27 */
28 char *p;
29 size_t len;
30
31 p = a1c_dirname(av[-optind]);
32
33- len = strlen(p) + sizeof("/../skeletons");
34+ len = strlen(p) + sizeof("/../share/asn1c");
35 skeletons_dir = malloc(len);
36 assert(skeletons_dir);
37- snprintf(skeletons_dir, len, "%s/../skeletons", p);
38+ snprintf(skeletons_dir, len, "%s/../share/asn1c", p);
39 if(stat(skeletons_dir, &sb)) {
40 fprintf(stderr,
41 "WARNING: skeletons are neither in "
42--
432.15.1
44
diff --git a/recipes-sota/garage-sign/garage-sign.bb b/recipes-sota/garage-sign/garage-sign.bb
deleted file mode 100644
index d5388bc..0000000
--- a/recipes-sota/garage-sign/garage-sign.bb
+++ /dev/null
@@ -1,34 +0,0 @@
1SUMMARY = "garage-sign"
2DESCRIPTION = "Metadata signing tool for ATS Garage"
3HOMEPAGE = "https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/index.html"
4SECTION = "base"
5LICENSE = "CLOSED"
6LIC_FILES_CHKSUM = "file://${S}/docs/LICENSE;md5=3025e77db7bd3f1d616b3ffd11d54c94"
7DEPENDS = ""
8
9PV = "0.2.0-35-g0544c33"
10
11SRC_URI = " \
12 https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${PV}.tgz \
13 "
14
15SRC_URI[md5sum] = "1546e06d1e747f67aee5ed7096bf1c74"
16SRC_URI[sha256sum] = "1432348bca8ca5ad75df1218f348f480d429d7509d6454deb6e16ff31c5e08fc"
17
18S = "${WORKDIR}/${BPN}"
19
20BBCLASSEXTEND =+ "native"
21
22do_install() {
23 install -d ${D}${bindir}
24 install -m "0755" -t ${D}${bindir} ${S}/bin/*
25 install -d ${D}${libdir}
26 install -m "0644" -t ${D}${libdir} ${S}/lib/*
27}
28
29FILES_${PN} = " \
30 /usr/bin \
31 /usr/bin/garage-sign.bat \
32 /usr/bin/garage-sign \
33 /usr/lib/* \
34 "
diff --git a/recipes-sota/ostree/ostree_git.bb b/recipes-sota/ostree/ostree_git.bb
index 724976a..ad85775 100644
--- a/recipes-sota/ostree/ostree_git.bb
+++ b/recipes-sota/ostree/ostree_git.bb
@@ -8,22 +8,23 @@ INHERIT_remove_class-native = "systemd"
8 8
9SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master" 9SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master"
10 10
11SRCREV="ae61321046ad7f4148a5884c8c6c8b2594ff840e" 11SRCREV="854a823e05d6fe8b610c02c2a71eaeb2bf1e98a6"
12 12
13PV = "v2017.13" 13PV = "v2017.13"
14PR = "1"
14 15
15S = "${WORKDIR}/git" 16S = "${WORKDIR}/git"
16 17
17BBCLASSEXTEND = "native" 18BBCLASSEXTEND = "native"
18 19
19DEPENDS += "attr libarchive glib-2.0 pkgconfig gpgme libgsystem fuse libsoup-2.4 e2fsprogs gtk-doc-native curl xz" 20DEPENDS += "attr libarchive glib-2.0 pkgconfig gpgme libgsystem fuse e2fsprogs gtk-doc-native curl xz"
20DEPENDS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd', '', d)}" 21DEPENDS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd', '', d)}"
21DEPENDS_remove_class-native = "systemd-native" 22DEPENDS_remove_class-native = "systemd-native"
22 23
23RDEPENDS_${PN} = "python util-linux-libuuid util-linux-libblkid util-linux-libmount libcap bash" 24RDEPENDS_${PN} = "python util-linux-libuuid util-linux-libblkid util-linux-libmount libcap bash"
24RDEPENDS_${PN}_remove_class-native = "python-native" 25RDEPENDS_${PN}_remove_class-native = "python-native"
25 26
26EXTRA_OECONF = "--with-libarchive --disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf --disable-man --with-smack --with-builtin-grub2-mkconfig --with-curl" 27EXTRA_OECONF = "CFLAGS='-Wno-error=missing-prototypes' --with-libarchive --disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf --disable-man --with-smack --with-builtin-grub2-mkconfig --with-curl --without-soup"
27EXTRA_OECONF_append_class-native = " --enable-wrpseudo-compat" 28EXTRA_OECONF_append_class-native = " --enable-wrpseudo-compat"
28 29
29# Path to ${prefix}/lib/ostree/ostree-grub-generator is hardcoded on the 30# Path to ${prefix}/lib/ostree/ostree-grub-generator is hardcoded on the
diff --git a/recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service b/recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service
deleted file mode 100644
index 11b1354..0000000
--- a/recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service
+++ /dev/null
@@ -1,15 +0,0 @@
1[Unit]
2Description=SOTA Client Autoprovisioning
3Requires=network-online.target
4After=network-online.target
5
6[Service]
7Type=oneshot
8WorkingDirectory=/var/sota
9Environment=SOTA_CERT_DIR=/var/sota
10ExecStart=/usr/bin/sota_provision.sh sota_provisioning_credentials
11RemainAfterExit=true
12StandardOutput=journal
13
14[Install]
15WantedBy=multi-user.target
diff --git a/recipes-sota/rvi-sota-client/files/sota-client-ostree.service b/recipes-sota/rvi-sota-client/files/sota-client-ostree.service
deleted file mode 100644
index 093a994..0000000
--- a/recipes-sota/rvi-sota-client/files/sota-client-ostree.service
+++ /dev/null
@@ -1,13 +0,0 @@
1[Unit]
2Description=SOTA Client
3Requires=network-online.target
4After=network.target network-online.target
5
6[Service]
7RestartSec=5
8Restart=on-failure
9Environment="RUST_LOG=debug"
10ExecStart=/usr/bin/sota_client --config /sysroot/boot/sota.toml --device-package-manager ostree
11
12[Install]
13WantedBy=multi-user.target
diff --git a/recipes-sota/rvi-sota-client/files/sota-client-uptane.service b/recipes-sota/rvi-sota-client/files/sota-client-uptane.service
deleted file mode 100644
index a2d80ce..0000000
--- a/recipes-sota/rvi-sota-client/files/sota-client-uptane.service
+++ /dev/null
@@ -1,15 +0,0 @@
1[Unit]
2Description=SOTA Client
3Requires=network-online.target
4After=network.target network-online.target
5Requires=sota-client-autoprovision
6After=sota-client-autoprovision
7
8[Service]
9RestartSec=5
10Restart=on-failure
11Environment="RUST_LOG=debug"
12ExecStart=/usr/bin/sota_client --config /var/sota/sota.toml --device-package-manager uptane
13
14[Install]
15WantedBy=multi-user.target
diff --git a/recipes-sota/rvi-sota-client/files/sota-installer.service b/recipes-sota/rvi-sota-client/files/sota-installer.service
deleted file mode 100644
index a4fd99e..0000000
--- a/recipes-sota/rvi-sota-client/files/sota-installer.service
+++ /dev/null
@@ -1,12 +0,0 @@
1[Unit]
2Description=SOTA Secondary ECU Installer
3Requires=network-online.target
4After=network-online.target
5
6[Service]
7RestartSec=10
8Restart=always
9ExecStart=/usr/bin/sota-installer --level debug --oneshot --config /var/sota/installer.toml
10
11[Install]
12WantedBy=multi-user.target
diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client.inc b/recipes-sota/rvi-sota-client/rvi-sota-client.inc
deleted file mode 100644
index 712b9b3..0000000
--- a/recipes-sota/rvi-sota-client/rvi-sota-client.inc
+++ /dev/null
@@ -1,173 +0,0 @@
1inherit cargo systemd
2
3DESCRIPTION = "rvi-sota-client recipe"
4HOMEPAGE = "https://github.com/advancedtelematic/rvi_sota_client"
5LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea"
7
8BBCLASSEXTEND = "native"
9
10S = "${WORKDIR}/git"
11
12SRC_URI[index.md5sum] = "6a635e8a081b4d4ba4cebffd721c2d7d"
13SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2"
14
15# also update PV and SRC_URI crates when updating SRCREV
16SRCREV = "be8ec83af2051a2b2499ce8878242771c65f0f1c"
17
18PR = "1"
19
20# generate with: `make package-version`
21PV = "0.2.34-8-gbe8ec83"
22
23# generate with: `make yocto-version`
24SRC_URI = " \
25git://github.com/advancedtelematic/rvi_sota_client \
26file://sota-client-autoprovision.service \
27file://sota-client-ostree.service \
28file://sota-client-uptane.service \
29file://sota-installer.service \
30crate://crates.io/adler32/1.0.2 \
31crate://crates.io/advapi32-sys/0.2.0 \
32crate://crates.io/aho-corasick/0.6.3 \
33crate://crates.io/ansi_term/0.9.0 \
34crate://crates.io/antidote/1.0.0 \
35crate://crates.io/atty/0.2.3 \
36crate://crates.io/backtrace/0.3.3 \
37crate://crates.io/backtrace-sys/0.1.15 \
38crate://crates.io/base64/0.6.0 \
39crate://crates.io/bincode/0.9.0 \
40crate://crates.io/bit-set/0.4.0 \
41crate://crates.io/bit-vec/0.4.4 \
42crate://crates.io/bitflags/0.7.0 \
43crate://crates.io/bitflags/0.9.1 \
44crate://crates.io/block-buffer/0.2.0 \
45crate://crates.io/byte-tools/0.2.0 \
46crate://crates.io/byteorder/1.1.0 \
47crate://crates.io/bytes/0.4.5 \
48crate://crates.io/cc/1.0.1 \
49crate://crates.io/cfg-if/0.1.2 \
50crate://crates.io/chan/0.1.19 \
51crate://crates.io/chan-signal/0.3.1 \
52crate://crates.io/chrono/0.4.0 \
53crate://crates.io/clap/2.26.2 \
54crate://crates.io/coco/0.1.1 \
55crate://crates.io/constant_time_eq/0.1.3 \
56crate://crates.io/core-foundation/0.2.3 \
57crate://crates.io/core-foundation-sys/0.2.3 \
58crate://crates.io/crossbeam/0.3.0 \
59crate://crates.io/crypt32-sys/0.2.0 \
60crate://crates.io/crypto-mac/0.4.0 \
61crate://crates.io/dbghelp-sys/0.2.0 \
62crate://crates.io/dbus/0.5.4 \
63crate://crates.io/digest/0.6.2 \
64crate://crates.io/dtoa/0.4.2 \
65crate://crates.io/either/1.2.0 \
66crate://crates.io/env_logger/0.4.3 \
67crate://crates.io/error-chain/0.10.0 \
68crate://crates.io/fake-simd/0.1.2 \
69crate://crates.io/filetime/0.1.14 \
70crate://crates.io/foreign-types/0.2.0 \
71crate://crates.io/fuchsia-zircon/0.2.1 \
72crate://crates.io/fuchsia-zircon-sys/0.2.0 \
73crate://crates.io/futures/0.1.16 \
74crate://crates.io/gcc/0.3.54 \
75crate://crates.io/generic-array/0.8.3 \
76crate://crates.io/getopts/0.2.15 \
77crate://crates.io/hex/0.2.0 \
78crate://crates.io/hmac/0.4.2 \
79crate://crates.io/httparse/1.2.3 \
80crate://crates.io/hyper/0.10.13 \
81crate://crates.io/hyper-native-tls/0.2.4 \
82crate://crates.io/idna/0.1.4 \
83crate://crates.io/iovec/0.1.1 \
84crate://crates.io/itoa/0.3.4 \
85crate://crates.io/kernel32-sys/0.2.2 \
86crate://crates.io/language-tags/0.2.2 \
87crate://crates.io/lazy_static/0.2.9 \
88crate://crates.io/libc/0.2.32 \
89crate://crates.io/libdbus-sys/0.1.1 \
90crate://crates.io/libflate/0.1.11 \
91crate://crates.io/log/0.3.8 \
92crate://crates.io/maplit/0.1.5 \
93crate://crates.io/matches/0.1.6 \
94crate://crates.io/memchr/1.0.1 \
95crate://crates.io/metadeps/1.1.2 \
96crate://crates.io/mime/0.2.6 \
97crate://crates.io/native-tls/0.1.4 \
98crate://crates.io/net2/0.2.31 \
99crate://crates.io/nodrop/0.1.9 \
100crate://crates.io/num/0.1.40 \
101crate://crates.io/num-integer/0.1.35 \
102crate://crates.io/num-iter/0.1.34 \
103crate://crates.io/num-traits/0.1.40 \
104crate://crates.io/num_cpus/1.7.0 \
105crate://crates.io/odds/0.2.25 \
106crate://crates.io/openssl/0.9.19 \
107crate://crates.io/openssl-sys/0.9.19 \
108crate://crates.io/pem/0.4.1 \
109crate://crates.io/percent-encoding/1.0.0 \
110crate://crates.io/pkg-config/0.3.9 \
111crate://crates.io/quote/0.3.15 \
112crate://crates.io/rand/0.3.17 \
113crate://crates.io/rayon/0.8.2 \
114crate://crates.io/rayon-core/1.2.1 \
115crate://crates.io/redox_syscall/0.1.31 \
116crate://crates.io/redox_termios/0.1.1 \
117crate://crates.io/regex/0.2.2 \
118crate://crates.io/regex-syntax/0.4.1 \
119crate://crates.io/reqwest/0.6.2 \
120crate://crates.io/ring/0.12.1 \
121crate://crates.io/rust-crypto/0.2.36 \
122crate://crates.io/rustc-demangle/0.1.5 \
123crate://crates.io/rustc-serialize/0.3.24 \
124crate://crates.io/safemem/0.2.0 \
125crate://crates.io/schannel/0.1.8 \
126crate://crates.io/scopeguard/0.3.2 \
127crate://crates.io/secur32-sys/0.2.0 \
128crate://crates.io/security-framework/0.1.16 \
129crate://crates.io/security-framework-sys/0.1.16 \
130crate://crates.io/serde/1.0.15 \
131crate://crates.io/serde_derive/1.0.15 \
132crate://crates.io/serde_derive_internals/0.16.0 \
133crate://crates.io/serde_json/1.0.3 \
134crate://crates.io/serde_urlencoded/0.5.1 \
135crate://crates.io/sha1/0.2.0 \
136crate://crates.io/sha2/0.6.0 \
137crate://crates.io/strsim/0.6.0 \
138crate://crates.io/syn/0.11.11 \
139crate://crates.io/synom/0.11.3 \
140crate://crates.io/tar/0.4.13 \
141crate://crates.io/tempdir/0.3.5 \
142crate://crates.io/term_size/0.3.0 \
143crate://crates.io/termion/1.5.1 \
144crate://crates.io/textwrap/0.8.0 \
145crate://crates.io/thread_local/0.3.4 \
146crate://crates.io/time/0.1.38 \
147crate://crates.io/toml/0.2.1 \
148crate://crates.io/toml/0.4.5 \
149crate://crates.io/traitobject/0.1.0 \
150crate://crates.io/tungstenite/0.5.0 \
151crate://crates.io/typeable/0.1.2 \
152crate://crates.io/typenum/1.9.0 \
153crate://crates.io/unicase/1.4.2 \
154crate://crates.io/unicode-bidi/0.3.4 \
155crate://crates.io/unicode-normalization/0.1.5 \
156crate://crates.io/unicode-width/0.1.4 \
157crate://crates.io/unicode-xid/0.0.4 \
158crate://crates.io/unix_socket/0.5.0 \
159crate://crates.io/unreachable/1.0.0 \
160crate://crates.io/untrusted/0.5.1 \
161crate://crates.io/url/1.5.1 \
162crate://crates.io/utf-8/0.7.1 \
163crate://crates.io/utf8-ranges/1.0.0 \
164crate://crates.io/uuid/0.5.1 \
165crate://crates.io/vcpkg/0.2.2 \
166crate://crates.io/vec_map/0.8.0 \
167crate://crates.io/version_check/0.1.3 \
168crate://crates.io/void/1.0.2 \
169crate://crates.io/winapi/0.2.8 \
170crate://crates.io/winapi-build/0.1.1 \
171crate://crates.io/ws2_32-sys/0.2.1 \
172crate://crates.io/xattr/0.1.11 \
173"
diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb
deleted file mode 100644
index e286598..0000000
--- a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb
+++ /dev/null
@@ -1,59 +0,0 @@
1require rvi-sota-client.inc
2
3
4SYSTEMD_SERVICE_${PN} = "sota-client.service sota-client-autoprovision.service"
5
6FILES_${PN} = " \
7/lib64 \
8${bindir}/sota_client \
9${bindir}/sota_sysinfo.sh \
10${bindir}/sota_provision.sh \
11${sysconfdir}/sota_client.version \
12${sysconfdir}/sota_certificates \
13${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client.service', '', d)} \
14${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client-autoprovision.service', '', d)} \
15"
16
17DEPENDS += " openssl openssl-native dbus "
18RDEPENDS_${PN} = " \
19bash \
20curl \
21libcrypto \
22libssl \
23lshw \
24jq \
25python-petname \
26sota-launcher \
27zip \
28"
29
30export SOTA_PACKED_CREDENTIALS
31
32do_compile_prepend() {
33 export SOTA_VERSION=$(make sota-version)
34 cd sota-client
35}
36
37do_install() {
38 ln -fs /lib ${D}/lib64
39
40 install -d ${D}${bindir}
41 install -d ${D}${sysconfdir}
42
43 echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version
44 install -c ${S}/sota-client/docker/sota_certificates ${D}${sysconfdir}
45
46 install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir}
47 install -m 0755 ${S}/sota-client/docker/sota_provision.sh ${D}${bindir}
48 install -m 0755 ${S}/sota-client/docker/sota_sysinfo.sh ${D}${bindir}
49
50 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
51 install -d ${D}/${systemd_unitdir}/system
52 if [ -n "$SOTA_PACKED_CREDENTIALS" ]; then
53 install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service
54 else
55 install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service
56 fi
57 install -m 0644 ${WORKDIR}/sota-client-autoprovision.service ${D}/${systemd_unitdir}/system/sota-client-autoprovision.service
58 fi
59}
diff --git a/recipes-sota/rvi-sota-client/sota-installer_git.bb b/recipes-sota/rvi-sota-client/sota-installer_git.bb
deleted file mode 100644
index 09f6e5d..0000000
--- a/recipes-sota/rvi-sota-client/sota-installer_git.bb
+++ /dev/null
@@ -1,25 +0,0 @@
1require rvi-sota-client.inc
2
3
4SYSTEMD_SERVICE_${PN} = "sota-installer.service"
5
6DEPENDS += " rvi-sota-client "
7
8FILES_${PN} = " \
9${bindir}/sota-installer \
10${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-installer.service', '', d)} \
11"
12
13do_compile_prepend() {
14 cd sota-installer
15}
16
17do_install() {
18 install -d ${D}${bindir}
19 install -m 0755 target/${TARGET_SYS}/release/sota-installer ${D}${bindir}
20
21 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
22 install -d ${D}/${systemd_unitdir}/system
23 install -m 0644 ${WORKDIR}/sota-installer.service ${D}/${systemd_unitdir}/system/sota-installer.service
24 fi
25}
diff --git a/recipes-sota/rvi-sota-client/sota-launcher_git.bb b/recipes-sota/rvi-sota-client/sota-launcher_git.bb
deleted file mode 100644
index e9874e7..0000000
--- a/recipes-sota/rvi-sota-client/sota-launcher_git.bb
+++ /dev/null
@@ -1,15 +0,0 @@
1require rvi-sota-client.inc
2
3
4DEPENDS += " rvi-sota-client "
5FILES_${PN} = "${bindir}/sota-launcher"
6
7
8do_compile_prepend() {
9 cd sota-launcher
10}
11
12do_install() {
13 install -d ${D}${bindir}
14 install -m 0755 target/${TARGET_SYS}/release/sota-launcher ${D}${bindir}
15}
diff --git a/recipes-support/ca-certificates/ca-certificates_%.bbappend b/recipes-support/ca-certificates/ca-certificates_%.bbappend
index afaadfd..cc95a68 100644
--- a/recipes-support/ca-certificates/ca-certificates_%.bbappend
+++ b/recipes-support/ca-certificates/ca-certificates_%.bbappend
@@ -1 +1 @@
SYSROOT_DIRS += "/etc" SYSROOT_DIRS += "${sysconfdir}"
diff --git a/recipes-support/glib-networking/glib-networking_%.bbappend b/recipes-support/glib-networking/glib-networking_%.bbappend
deleted file mode 100644
index 22e6f05..0000000
--- a/recipes-support/glib-networking/glib-networking_%.bbappend
+++ /dev/null
@@ -1,8 +0,0 @@
1BBCLASSEXTEND_append_sota = " native nativesdk"
2
3# Hackery to prevent relocatable_native_pcfiles from crashing
4do_install_append_class-native () {
5 if [ -d ${D}${libdir}/pkgconfig ]; then
6 rmdir ${D}${libdir}/pkgconfig
7 fi
8}
diff --git a/recipes-support/libp11/files/0001-Workaround-for-a-buggy-version-of-openssl-1.0.2m.patch b/recipes-support/libp11/files/0001-Workaround-for-a-buggy-version-of-openssl-1.0.2m.patch
new file mode 100644
index 0000000..0538eff
--- /dev/null
+++ b/recipes-support/libp11/files/0001-Workaround-for-a-buggy-version-of-openssl-1.0.2m.patch
@@ -0,0 +1,42 @@
1From ccab5ce63dd5d3dbb4bd02998d21d34407e550f2 Mon Sep 17 00:00:00 2001
2From: Anton Gerasimov <anton.gerasimov@here.com>
3Date: Fri, 19 Jan 2018 12:44:27 +0100
4Subject: [PATCH] Workaround for a buggy version of openssl (1.0.2m)
5
6---
7 src/p11_pkey.c | 12 +++++++++---
8 1 file changed, 9 insertions(+), 3 deletions(-)
9
10diff --git a/src/p11_pkey.c b/src/p11_pkey.c
11index 45d5ad3..75625e6 100644
12--- a/src/p11_pkey.c
13+++ b/src/p11_pkey.c
14@@ -139,8 +139,14 @@ static void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src)
15
16 #endif
17
18-#if OPENSSL_VERSION_NUMBER < 0x100020d0L || defined(LIBRESSL_VERSION_NUMBER)
19-static void EVP_PKEY_meth_get_sign(EVP_PKEY_METHOD *pmeth,
20+#if OPENSSL_VERSION_NUMBER <= 0x100020e0L || defined(LIBRESSL_VERSION_NUMBER)
21+
22+# if (OPENSSL_VERSION_NUMBER & 0xFFFFFFF0) == 0x100020d0L
23+# undef EVP_PKEY_meth_get_sign
24+# undef EVP_PKEY_meth_get_decrypt
25+# endif
26+
27+void EVP_PKEY_meth_get_sign(EVP_PKEY_METHOD *pmeth,
28 int (**psign_init) (EVP_PKEY_CTX *ctx),
29 int (**psign) (EVP_PKEY_CTX *ctx,
30 unsigned char *sig, size_t *siglen,
31@@ -152,7 +158,7 @@ static void EVP_PKEY_meth_get_sign(EVP_PKEY_METHOD *pmeth,
32 *psign = pmeth->sign;
33 }
34
35-static void EVP_PKEY_meth_get_decrypt(EVP_PKEY_METHOD *pmeth,
36+void EVP_PKEY_meth_get_decrypt(EVP_PKEY_METHOD *pmeth,
37 int (**pdecrypt_init) (EVP_PKEY_CTX *ctx),
38 int (**pdecrypt) (EVP_PKEY_CTX *ctx,
39 unsigned char *out,
40--
412.15.1
42
diff --git a/recipes-support/libp11/libp11_0.4.7.bb b/recipes-support/libp11/libp11_0.4.7.bb
index 7d77e90..7a93102 100644
--- a/recipes-support/libp11/libp11_0.4.7.bb
+++ b/recipes-support/libp11/libp11_0.4.7.bb
@@ -8,7 +8,8 @@ LICENSE = "LGPLv2+"
8LIC_FILES_CHKSUM = "file://COPYING;md5=fad9b3332be894bab9bc501572864b29" 8LIC_FILES_CHKSUM = "file://COPYING;md5=fad9b3332be894bab9bc501572864b29"
9DEPENDS = "libtool openssl" 9DEPENDS = "libtool openssl"
10 10
11SRC_URI = "git://github.com/OpenSC/libp11.git" 11SRC_URI = "git://github.com/OpenSC/libp11.git \
12 file://0001-Workaround-for-a-buggy-version-of-openssl-1.0.2m.patch"
12SRCREV = "da725ab727342083478150a203a3c80c4551feb4" 13SRCREV = "da725ab727342083478150a203a3c80c4551feb4"
13 14
14S = "${WORKDIR}/git" 15S = "${WORKDIR}/git"
diff --git a/recipes-support/libsoup/libsoup-2.4_%.bbappend b/recipes-support/libsoup/libsoup-2.4_%.bbappend
deleted file mode 100644
index 18383f1..0000000
--- a/recipes-support/libsoup/libsoup-2.4_%.bbappend
+++ /dev/null
@@ -1,3 +0,0 @@
1BBCLASSEXTEND_append_sota = " native nativesdk"
2
3DEPENDS_append_class-native = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ' glib-networking-native', ' ', d)}"
diff --git a/recipes-support/slcand-start/files/slcand@.service b/recipes-support/slcand-start/files/slcand@.service
new file mode 100644
index 0000000..c539568
--- /dev/null
+++ b/recipes-support/slcand-start/files/slcand@.service
@@ -0,0 +1,8 @@
1[Unit]
2Description=Serial CAN daemon (can-utils)
3
4[Service]
5Type=forking
6ExecStart=/usr/bin/slcand -o -c -s4 %I can0
7ExecStartPost=/bin/sh -c '/bin/sleep 3; /sbin/ip link set can0 up'
8
diff --git a/recipes-support/slcand-start/slcand-start.bb b/recipes-support/slcand-start/slcand-start.bb
new file mode 100644
index 0000000..dfefaea
--- /dev/null
+++ b/recipes-support/slcand-start/slcand-start.bb
@@ -0,0 +1,21 @@
1SUMMARY = "Mock smartcard for aktualizr"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
4 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
5
6
7inherit systemd
8
9RDEPENDS_${PN} = "can-utils"
10
11SRC_URI = "file://slcand@.service"
12
13SYSTEMD_SERVICE_${PN} = "slcand@.service"
14
15do_install() {
16 install -d ${D}${systemd_unitdir}/system
17 install -m 0644 ${WORKDIR}/slcand@.service ${D}${systemd_unitdir}/system/slcand@.service
18}
19
20FILES_${PN} = "${systemd_unitdir}/system/createtoken.service"
21
diff --git a/recipes-support/util-linux/util-linux_%.bbappend b/recipes-support/util-linux/util-linux_%.bbappend
deleted file mode 100644
index d653bb2..0000000
--- a/recipes-support/util-linux/util-linux_%.bbappend
+++ /dev/null
@@ -1,3 +0,0 @@
1PACKAGES_append_class-native = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ' util-linux-agetty-native util-linux-fdisk-native util-linux-cfdisk-native util-linux-sfdisk-native util-linux-swaponoff-native util-linux-losetup-native util-linux-umount-native util-linux-mount-native util-linux-readprofile-native util-linux-uuidd-native util-linux-uuidgen-native util-linux-lscpu-native util-linux-fsck-native util-linux-blkid util-linux-mkfs-native util-linux-mcookie-native util-linux-reset-native util-linux-mkfs.cramfs-native util-linux-fsck.cramfs-native util-linux-fstrim-native util-linux-partx-native ${PN}-bash-completion-native util-linux-hwclock util-linux-findfs-native util-linux-getopt-native util-linux-sulogin-native', ' ', d)}"
2
3PACKAGES_append_class-native = "${@' util-linux-pylibmount-native' if bb.utils.contains('DISTRO_FEATURES', 'sota', True, False, d) and bb.utils.contains('PACKAGECONFIG', 'pylibmount', True, False, d) else ' '}"
diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh
index 260b048..ff78681 100755
--- a/scripts/envsetup.sh
+++ b/scripts/envsetup.sh
@@ -24,15 +24,7 @@ fi
24METADIR="${SOURCEDIR}/../.." 24METADIR="${SOURCEDIR}/../.."
25 25
26if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then 26if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then
27 if [ -z "$TEMPLATECONF" ] && [ -d ${METADIR}/meta-updater-${MACHINE}/conf ]; then 27 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
28 # Use the template configurations for the specified machine
29 TEMPLATECONF=${METADIR}/meta-updater-${MACHINE}/conf
30 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
31 unset TEMPLATECONF
32 else
33 # Use the default configurations or TEMPLATECONF set by the user
34 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
35 fi
36 echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf 28 echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf
37 cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf 29 cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf
38 cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf 30 cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf
diff --git a/scripts/lib/wic/plugins/source/otaimage.py b/scripts/lib/wic/plugins/source/otaimage.py
index 26cfb10..ee8088b 100644
--- a/scripts/lib/wic/plugins/source/otaimage.py
+++ b/scripts/lib/wic/plugins/source/otaimage.py
@@ -20,7 +20,7 @@ import os
20import sys 20import sys
21 21
22from wic.plugins.source.rawcopy import RawCopyPlugin 22from wic.plugins.source.rawcopy import RawCopyPlugin
23from wic.utils.misc import get_bitbake_var 23from wic.misc import get_bitbake_var
24 24
25logger = logging.getLogger('wic') 25logger = logging.getLogger('wic')
26 26
diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py
new file mode 100644
index 0000000..6b1106d
--- /dev/null
+++ b/scripts/qemucommand.py
@@ -0,0 +1,126 @@
1from os.path import exists, join, realpath, abspath
2from os import listdir
3import random
4import socket
5from subprocess import check_output, CalledProcessError
6
7EXTENSIONS = {
8 'intel-corei7-64': 'wic',
9 'qemux86-64': 'otaimg'
10}
11
12
13def find_local_port(start_port):
14 """"
15 Find the next free TCP port after 'start_port'.
16 """
17
18 for port in range(start_port, start_port + 10):
19 try:
20 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
21 s.bind(('', port))
22 return port
23 except socket.error:
24 print("Skipping port %d" % port)
25 finally:
26 s.close()
27 raise Exception("Could not find a free TCP port")
28
29
30def random_mac():
31 """Return a random Ethernet MAC address
32 @link https://www.iana.org/assignments/ethernet-numbers/ethernet-numbers.xhtml#ethernet-numbers-2
33 """
34 head = "ca:fe:"
35 hex_digits = '0123456789abcdef'
36 tail = ':'.join([random.choice(hex_digits) + random.choice(hex_digits) for _ in range(4)])
37 return head + tail
38
39
40class QemuCommand(object):
41 def __init__(self, args):
42 if args.machine:
43 self.machine = args.machine
44 else:
45 machines = listdir(args.dir)
46 if len(machines) == 1:
47 self.machine = machines[0]
48 else:
49 raise ValueError("Could not autodetect machine type. More than one entry in %s. Maybe --machine qemux86-64?" % args.dir)
50 if args.efi:
51 self.bios = 'OVMF.fd'
52 else:
53 uboot = abspath(join(args.dir, self.machine, 'u-boot-qemux86-64.rom'))
54 if not exists(uboot):
55 raise ValueError("U-Boot image %s does not exist" % uboot)
56 self.bios = uboot
57 if exists(args.imagename):
58 image = args.imagename
59 else:
60 ext = EXTENSIONS.get(self.machine, 'wic')
61 image = join(args.dir, self.machine, '%s-%s.%s' % (args.imagename, self.machine, ext))
62 self.image = realpath(image)
63 if not exists(self.image):
64 raise ValueError("OS image %s does not exist" % self.image)
65 if args.mac:
66 self.mac_address = args.mac
67 else:
68 self.mac_address = random_mac()
69 self.serial_port = find_local_port(8990)
70 self.ssh_port = find_local_port(2222)
71 if args.kvm is None:
72 # Autodetect KVM using 'kvm-ok'
73 try:
74 check_output(['kvm-ok'])
75 self.kvm = True
76 except Exception:
77 self.kvm = False
78 else:
79 self.kvm = args.kvm
80 self.gui = not args.no_gui
81 self.gdb = args.gdb
82 self.pcap = args.pcap
83 self.overlay = args.overlay
84
85 def command_line(self):
86 netuser = 'user,hostfwd=tcp:0.0.0.0:%d-:22,restrict=off' % self.ssh_port
87 if self.gdb:
88 netuser += ',hostfwd=tcp:0.0.0.0:2159-:2159'
89 cmdline = [
90 "qemu-system-x86_64",
91 "-bios", self.bios
92 ]
93 if not self.overlay:
94 cmdline += ["-drive", "file=%s,if=ide,format=raw,snapshot=on" % self.image]
95 cmdline += [
96 "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port,
97 "-m", "1G",
98 "-usb",
99 "-device", "usb-tablet",
100 "-show-cursor",
101 "-vga", "std",
102 "-net", netuser,
103 "-net", "nic,macaddr=%s" % self.mac_address
104 ]
105 if self.pcap:
106 cmdline += ['-net', 'dump,file=' + self.pcap]
107 if self.gui:
108 cmdline += ["-serial", "stdio"]
109 else:
110 cmdline.append('-nographic')
111 if self.kvm:
112 cmdline.append('-enable-kvm')
113 else:
114 cmdline += ['-cpu', 'Haswell']
115 if self.overlay:
116 cmdline.append(self.overlay)
117 return cmdline
118
119 def img_command_line(self):
120 cmdline = [
121 "qemu-img", "create",
122 "-o", "backing_file=%s" % self.image,
123 "-f", "qcow2",
124 self.overlay]
125 return cmdline
126
diff --git a/scripts/run-qemu-ota b/scripts/run-qemu-ota
index 641296c..56e4fbc 100755
--- a/scripts/run-qemu-ota
+++ b/scripts/run-qemu-ota
@@ -2,126 +2,12 @@
2 2
3from argparse import ArgumentParser 3from argparse import ArgumentParser
4from subprocess import Popen 4from subprocess import Popen
5from os.path import exists, join, realpath 5from os.path import exists
6from os import listdir
7import random
8import sys 6import sys
9import socket 7from qemucommand import QemuCommand
10 8
11DEFAULT_DIR = 'tmp/deploy/images' 9DEFAULT_DIR = 'tmp/deploy/images'
12 10
13EXTENSIONS = {
14 'intel-corei7-64': 'wic',
15 'qemux86-64': 'otaimg'
16}
17
18
19def find_local_port(start_port):
20 """"
21 Find the next free TCP port after 'start_port'.
22 """
23
24 for port in range(start_port, start_port + 10):
25 try:
26 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
27 s.bind(('', port))
28 return port
29 except socket.error:
30 print("Skipping port %d" % port)
31 finally:
32 s.close()
33 raise Exception("Could not find a free TCP port")
34
35
36def random_mac():
37 """Return a random Ethernet MAC address
38 @link https://www.iana.org/assignments/ethernet-numbers/ethernet-numbers.xhtml#ethernet-numbers-2
39 """
40 head = "ca:fe:"
41 hex_digits = '0123456789abcdef'
42 tail = ':'.join([random.choice(hex_digits) + random.choice(hex_digits) for _ in range(4)])
43 return head + tail
44
45
46class QemuCommand(object):
47 def __init__(self, args):
48 if args.machine:
49 self.machine = args.machine
50 else:
51 machines = listdir(args.dir)
52 if len(machines) == 1:
53 self.machine = machines[0]
54 else:
55 raise ValueError("Could not autodetect machine type from %s" % args.dir)
56 if args.efi:
57 self.bios = 'OVMF.fd'
58 else:
59 uboot = join(args.dir, self.machine, 'u-boot-qemux86-64.rom')
60 if not exists(uboot):
61 raise ValueError("U-Boot image %s does not exist" % uboot)
62 self.bios = uboot
63 if exists(args.imagename):
64 image = args.imagename
65 else:
66 ext = EXTENSIONS.get(self.machine, 'wic')
67 image = join(args.dir, self.machine, '%s-%s.%s' % (args.imagename, self.machine, ext))
68 self.image = realpath(image)
69 if not exists(self.image):
70 raise ValueError("OS image %s does not exist" % self.image)
71 if args.mac:
72 self.mac_address = args.mac
73 else:
74 self.mac_address = random_mac()
75 self.serial_port = find_local_port(8990)
76 self.ssh_port = find_local_port(2222)
77 self.kvm = not args.no_kvm
78 self.gui = not args.no_gui
79 self.gdb = args.gdb
80 self.pcap = args.pcap
81 self.overlay = args.overlay
82
83 def command_line(self):
84 netuser = 'user,hostfwd=tcp:0.0.0.0:%d-:22,restrict=off' % self.ssh_port
85 if self.gdb:
86 netuser += ',hostfwd=tcp:0.0.0.0:2159-:2159'
87 cmdline = [
88 "qemu-system-x86_64",
89 "-bios", self.bios
90 ]
91 if not self.overlay:
92 cmdline += ["-drive", "file=%s,if=ide,format=raw,snapshot=on" % self.image]
93 cmdline += [
94 "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port,
95 "-m", "1G",
96 "-usb",
97 "-usbdevice", "tablet",
98 "-show-cursor",
99 "-vga", "std",
100 "-net", netuser,
101 "-net", "nic,macaddr=%s" % self.mac_address
102 ]
103 if self.pcap:
104 cmdline += ['-net', 'dump,file=' + self.pcap]
105 if self.gui:
106 cmdline += ["-serial", "stdio"]
107 else:
108 cmdline.append('-nographic')
109 if self.kvm:
110 cmdline.append('-enable-kvm')
111 else:
112 cmdline += ['-cpu', 'Haswell']
113 if self.overlay:
114 cmdline.append(self.overlay)
115 return cmdline
116
117 def img_command_line(self):
118 cmdline = [
119 "qemu-img", "create",
120 "-o", "backing_file=%s" % self.image,
121 "-f", "qcow2",
122 self.overlay]
123 return cmdline
124
125 11
126def main(): 12def main():
127 parser = ArgumentParser(description='Run meta-updater image in qemu') 13 parser = ArgumentParser(description='Run meta-updater image in qemu')
@@ -135,11 +21,18 @@ def main():
135 'OSTREE_BOOTLOADER = "grub" and OVMF.fd firmware to be installed (try "apt install ovmf")', 21 'OSTREE_BOOTLOADER = "grub" and OVMF.fd firmware to be installed (try "apt install ovmf")',
136 action='store_true') 22 action='store_true')
137 parser.add_argument('--machine', default=None, help="Target MACHINE") 23 parser.add_argument('--machine', default=None, help="Target MACHINE")
138 parser.add_argument('--no-kvm', help='Disable KVM in QEMU', action='store_true') 24 kvm_group = parser.add_argument_group()
25 kvm_group.add_argument('--force-kvm', help='Force use of KVM (default is to autodetect)',
26 dest='kvm', action='store_true', default=None)
27 kvm_group.add_argument('--no-kvm', help='Disable KVM in QEMU',
28 dest='kvm', action='store_false')
139 parser.add_argument('--no-gui', help='Disable GUI', action='store_true') 29 parser.add_argument('--no-gui', help='Disable GUI', action='store_true')
140 parser.add_argument('--gdb', help='Export gdbserver port 2159 from the image', action='store_true') 30 parser.add_argument('--gdb', help='Export gdbserver port 2159 from the image', action='store_true')
141 parser.add_argument('--pcap', default=None, help='Dump all network traffic') 31 parser.add_argument('--pcap', default=None, help='Dump all network traffic')
142 parser.add_argument('-o', '--overlay', type=str, metavar='file.cow', help='Use an overlay storage image file. Will be created if it does not exist. This option lets you have a persistent image without modifying the underlying image file, permitting multiple different persistent machines.') 32 parser.add_argument('-o', '--overlay', type=str, metavar='file.cow',
33 help='Use an overlay storage image file. Will be created if it does not exist. ' +
34 'This option lets you have a persistent image without modifying the underlying image ' +
35 'file, permitting multiple different persistent machines.')
143 parser.add_argument('-n', '--dry-run', help='Print qemu command line rather then run it', action='store_true') 36 parser.add_argument('-n', '--dry-run', help='Print qemu command line rather then run it', action='store_true')
144 args = parser.parse_args() 37 args = parser.parse_args()
145 try: 38 try: