diff options
-rw-r--r-- | classes/sota.bbclass | 14 | ||||
-rw-r--r-- | classes/sota_sanity.bbclass | 47 | ||||
-rw-r--r-- | lib/oeqa/selftest/cases/testutils.py | 1 | ||||
-rw-r--r-- | recipes-sota/aktualizr/aktualizr-device-prov-hsm.bb | 2 | ||||
-rw-r--r-- | recipes-sota/aktualizr/aktualizr_git.bb | 11 | ||||
-rw-r--r-- | scripts/qemucommand.py | 2 | ||||
-rwxr-xr-x | scripts/run-qemu-ota | 1 |
7 files changed, 58 insertions, 20 deletions
diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 5b06397..4422741 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass | |||
@@ -7,20 +7,6 @@ SOTA_CLIENT_PROV ??= "aktualizr-shared-prov" | |||
7 | SOTA_DEPLOY_CREDENTIALS ?= "1" | 7 | SOTA_DEPLOY_CREDENTIALS ?= "1" |
8 | SOTA_HARDWARE_ID ??= "${MACHINE}" | 8 | SOTA_HARDWARE_ID ??= "${MACHINE}" |
9 | 9 | ||
10 | # Translate old provisioning recipe names into the new versions. | ||
11 | python () { | ||
12 | prov = d.getVar("SOTA_CLIENT_PROV") | ||
13 | if prov == "aktualizr-auto-prov": | ||
14 | bb.warn('aktualizr-auto-prov is deprecated. Please use aktualizr-shared-prov instead.') | ||
15 | d.setVar("SOTA_CLIENT_PROV", "aktualizr-shared-prov") | ||
16 | elif prov == "aktualizr-ca-implicit-prov": | ||
17 | bb.warn('aktualizr-ca-implicit-prov is deprecated. Please use aktualizr-device-prov instead.') | ||
18 | d.setVar("SOTA_CLIENT_PROV", "aktualizr-device-prov") | ||
19 | elif prov == "aktualizr-hsm-prov": | ||
20 | bb.warn('aktualizr-hsm-prov is deprecated. Please use aktualizr-device-prov-hsm instead.') | ||
21 | d.setVar("SOTA_CLIENT_PROV", "aktualizr-device-prov-hsm") | ||
22 | } | ||
23 | |||
24 | IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" | 10 | IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" |
25 | IMAGE_CLASSES += " image_types_ostree image_types_ota" | 11 | IMAGE_CLASSES += " image_types_ostree image_types_ota" |
26 | 12 | ||
diff --git a/classes/sota_sanity.bbclass b/classes/sota_sanity.bbclass index 8e80acb..1339fb3 100644 --- a/classes/sota_sanity.bbclass +++ b/classes/sota_sanity.bbclass | |||
@@ -10,6 +10,52 @@ def sota_check_required_variables(status, d): | |||
10 | if not d.getVar(var): | 10 | if not d.getVar(var): |
11 | status.addresult("%s should be set in your local.conf.\n" % var) | 11 | status.addresult("%s should be set in your local.conf.\n" % var) |
12 | 12 | ||
13 | def sota_check_variables_validity(status, d): | ||
14 | import re | ||
15 | import os.path | ||
16 | |||
17 | if d.getVar("OSTREE_BRANCHNAME") and re.match("^[a-zA-Z0-9_-]*$", d.getVar("OSTREE_BRANCHNAME")) is None: | ||
18 | status.addresult("OSTREE_BRANCHNAME Should only contain characters from the character set [a-zA-Z0-9_-].\n") | ||
19 | if d.getVar("SOTA_HARDWARE_ID") and re.match("^[a-zA-Z0-9_-]*$", d.getVar("SOTA_HARDWARE_ID")) is None: | ||
20 | status.addresult("SOTA_HARDWARE_ID Should only contain characters from the character set [a-zA-Z0-9_-].\n") | ||
21 | if d.getVar("SOTA_CLIENT_FEATURES") is not None: | ||
22 | for feat in d.getVar("SOTA_CLIENT_FEATURES").split(' '): | ||
23 | if feat not in ("hsm", "serialcan", "ubootenv", ""): | ||
24 | status.addresult("SOTA_CLIENT_FEATURES should only include hsm, serialcan and bootenv.\n") | ||
25 | break | ||
26 | if d.getVar("SOTA_CLIENT_PROV") is not None: | ||
27 | prov = d.getVar("SOTA_CLIENT_PROV").strip() | ||
28 | if prov not in ("aktualizr-shared-prov", "aktualizr-device-prov", "aktualizr-device-prov-hsm", ""): | ||
29 | status.addresult("Valid options for SOTA_CLIENT_PROV are aktualizr-shared-prov, aktualizr-device-prov and aktualizr-device-prov-hsm.\n") | ||
30 | if prov == "aktualizr-auto-prov": | ||
31 | bb.warn('aktualizr-auto-prov is deprecated. Please use aktualizr-shared-prov instead.') | ||
32 | elif prov == "aktualizr-ca-implicit-prov": | ||
33 | bb.warn('aktualizr-ca-implicit-prov is deprecated. Please use aktualizr-device-prov instead.') | ||
34 | elif prov == "aktualizr-hsm-prov": | ||
35 | bb.warn('aktualizr-hsm-prov is deprecated. Please use aktualizr-device-prov-hsm instead.') | ||
36 | if d.getVar("GARAGE_TARGET_URL") and re.match("^(https?|ftp|file)://.+$", d.getVar("GARAGE_TARGET_URL")) is None: | ||
37 | status.addresult("GARAGE_TARGET_URL is set to a bad url.\n") | ||
38 | if d.getVar("SOTA_POLLING_SEC") and re.match("^[1-9]\d*|0$", d.getVar("SOTA_POLLING_SEC")) is None: | ||
39 | status.addresult("SOTA_POLLING_SEC should be an integer.\n") | ||
40 | config = d.getVar("SOTA_SECONDARY_CONFIG") | ||
41 | if config is not None and config != "": | ||
42 | path = os.path.abspath(config) | ||
43 | if not os.path.exists(path): | ||
44 | status.addresult("SOTA_SECONDARY_CONFIG is not set correctly. The file containing JSON configuration for secondaries does not exist.\n") | ||
45 | credentials = d.getVar("SOTA_PACKED_CREDENTIALS") | ||
46 | if credentials is not None and credentials != "": | ||
47 | path = os.path.abspath(credentials) | ||
48 | if not os.path.exists(path): | ||
49 | status.addresult("SOTA_PACKED_CREDENTIALS is not set correctly. The zipped credentials file does not exist.\n") | ||
50 | if d.getVar("OSTREE_UPDATE_SUMMARY") and d.getVar("OSTREE_UPDATE_SUMMARY") not in ("0", "1", ""): | ||
51 | status.addresult("OSTREE_UPDATE_SUMMARY should be set to 0 or 1.\n") | ||
52 | if d.getVar("OSTREE_DEPLOY_DEVICETREE") and d.getVar("OSTREE_DEPLOY_DEVICETREE") not in ("0", "1", ""): | ||
53 | status.addresult("OSTREE_DEPLOY_DEVICETREE should be set to 0 or 1.\n") | ||
54 | if d.getVar("GARAGE_SIGN_AUTOVERSION") and d.getVar("GARAGE_SIGN_AUTOVERSION") not in ("0", "1", ""): | ||
55 | status.addresult("GARAGE_SIGN_AUTOVERSION should be set to 0 or 1.\n") | ||
56 | if d.getVar("SOTA_DEPLOY_CREDENTIALS") and d.getVar("SOTA_DEPLOY_CREDENTIALS") not in ("0", "1", ""): | ||
57 | status.addresult("SOTA_DEPLOY_CREDENTIALS should be set to 0 or 1.\n") | ||
58 | |||
13 | def sota_raise_sanity_error(msg, d): | 59 | def sota_raise_sanity_error(msg, d): |
14 | if d.getVar("SANITY_USE_EVENTS") == "1": | 60 | if d.getVar("SANITY_USE_EVENTS") == "1": |
15 | bb.event.fire(bb.event.SanityCheckFailed(msg), d) | 61 | bb.event.fire(bb.event.SanityCheckFailed(msg), d) |
@@ -34,6 +80,7 @@ def sota_check_sanity(sanity_data): | |||
34 | 80 | ||
35 | sota_check_overrides(status, sanity_data) | 81 | sota_check_overrides(status, sanity_data) |
36 | sota_check_required_variables(status, sanity_data) | 82 | sota_check_required_variables(status, sanity_data) |
83 | sota_check_variables_validity(status, sanity_data) | ||
37 | 84 | ||
38 | if status.messages != "": | 85 | if status.messages != "": |
39 | sota_raise_sanity_error(sanity_data.expand(status.messages), sanity_data) | 86 | sota_raise_sanity_error(sanity_data.expand(status.messages), sanity_data) |
diff --git a/lib/oeqa/selftest/cases/testutils.py b/lib/oeqa/selftest/cases/testutils.py index 802d665..ea7781b 100644 --- a/lib/oeqa/selftest/cases/testutils.py +++ b/lib/oeqa/selftest/cases/testutils.py | |||
@@ -33,6 +33,7 @@ def qemu_boot_image(imagename, **kwargs): | |||
33 | # subdirectory. | 33 | # subdirectory. |
34 | args.dir = 'tmp/deploy/images' | 34 | args.dir = 'tmp/deploy/images' |
35 | args.efi = kwargs.get('efi', False) | 35 | args.efi = kwargs.get('efi', False) |
36 | args.bootloader = kwargs.get('bootloader', None) | ||
36 | args.machine = kwargs.get('machine', None) | 37 | args.machine = kwargs.get('machine', None) |
37 | args.mem = kwargs.get('mem', '128M') | 38 | args.mem = kwargs.get('mem', '128M') |
38 | qemu_use_kvm = get_bb_var("QEMU_USE_KVM") | 39 | qemu_use_kvm = get_bb_var("QEMU_USE_KVM") |
diff --git a/recipes-sota/aktualizr/aktualizr-device-prov-hsm.bb b/recipes-sota/aktualizr/aktualizr-device-prov-hsm.bb index 4eadb77..8f28c03 100644 --- a/recipes-sota/aktualizr/aktualizr-device-prov-hsm.bb +++ b/recipes-sota/aktualizr/aktualizr-device-prov-hsm.bb | |||
@@ -14,7 +14,7 @@ DEPENDS = "aktualizr" | |||
14 | # If the config file from aktualizr used here is changed, you will need to bump | 14 | # If the config file from aktualizr used here is changed, you will need to bump |
15 | # the version here because of SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS! | 15 | # the version here because of SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS! |
16 | PV = "1.0" | 16 | PV = "1.0" |
17 | PR = "6" | 17 | PR = "7" |
18 | 18 | ||
19 | SRC_URI = "" | 19 | SRC_URI = "" |
20 | 20 | ||
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 211db89..bd9c3f8 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
@@ -15,7 +15,7 @@ RDEPENDS_${PN}-ptest += "bash cmake curl net-tools python3-core python3-misc pyt | |||
15 | PV = "1.0+git${SRCPV}" | 15 | PV = "1.0+git${SRCPV}" |
16 | PR = "7" | 16 | PR = "7" |
17 | 17 | ||
18 | GARAGE_SIGN_PV = "0.7.0-59-gf6013d6" | 18 | GARAGE_SIGN_PV = "0.7.0-61-g909b804" |
19 | 19 | ||
20 | SRC_URI = " \ | 20 | SRC_URI = " \ |
21 | gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH};name=aktualizr \ | 21 | gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH};name=aktualizr \ |
@@ -27,10 +27,10 @@ SRC_URI = " \ | |||
27 | ${@ d.expand("https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${GARAGE_SIGN_PV}.tgz;unpack=0;name=garagesign") if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''} \ | 27 | ${@ d.expand("https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${GARAGE_SIGN_PV}.tgz;unpack=0;name=garagesign") if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''} \ |
28 | " | 28 | " |
29 | 29 | ||
30 | SRC_URI[garagesign.md5sum] = "3d38908f9b536a02cc73778b11bbc32e" | 30 | SRC_URI[garagesign.md5sum] = "3e1ae6d49cc66fda37cef47f849d9609" |
31 | SRC_URI[garagesign.sha256sum] = "eceeb16a781e0e8d1f554defbcd5bbcea86d448ebd350fc6a2529372bf867dba" | 31 | SRC_URI[garagesign.sha256sum] = "8d49b83efa222db2f092ee14348459ee1bfd048552b57c3cb5ab48db8e347d82" |
32 | 32 | ||
33 | SRCREV = "662aa23f0b9c97a2c93a428438dacae72333c751" | 33 | SRCREV = "6633d0d0e6353fdf8970001dc8da70e6a28203cd" |
34 | BRANCH ?= "master" | 34 | BRANCH ?= "master" |
35 | 35 | ||
36 | S = "${WORKDIR}/git" | 36 | S = "${WORKDIR}/git" |
@@ -48,12 +48,13 @@ SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.service" | |||
48 | EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release ${@bb.utils.contains('PTEST_ENABLED', '1', '-DTESTSUITE_VALGRIND=on', '', d)}" | 48 | EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release ${@bb.utils.contains('PTEST_ENABLED', '1', '-DTESTSUITE_VALGRIND=on', '', d)}" |
49 | 49 | ||
50 | GARAGE_SIGN_OPS = "${@ d.expand('-DGARAGE_SIGN_ARCHIVE=${WORKDIR}/cli-${GARAGE_SIGN_PV}.tgz') if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''}" | 50 | GARAGE_SIGN_OPS = "${@ d.expand('-DGARAGE_SIGN_ARCHIVE=${WORKDIR}/cli-${GARAGE_SIGN_PV}.tgz') if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''}" |
51 | PKCS11_ENGINE_PATH = "${libdir}/engines-1.1/pkcs11.so" | ||
51 | 52 | ||
52 | PACKAGECONFIG ?= "ostree ${@bb.utils.filter('SOTA_CLIENT_FEATURES', 'hsm serialcan ubootenv', d)}" | 53 | PACKAGECONFIG ?= "ostree ${@bb.utils.filter('SOTA_CLIENT_FEATURES', 'hsm serialcan ubootenv', d)}" |
53 | PACKAGECONFIG_class-native = "sota-tools" | 54 | PACKAGECONFIG_class-native = "sota-tools" |
54 | PACKAGECONFIG[warning-as-error] = "-DWARNING_AS_ERROR=ON,-DWARNING_AS_ERROR=OFF," | 55 | PACKAGECONFIG[warning-as-error] = "-DWARNING_AS_ERROR=ON,-DWARNING_AS_ERROR=OFF," |
55 | PACKAGECONFIG[ostree] = "-DBUILD_OSTREE=ON,-DBUILD_OSTREE=OFF,ostree," | 56 | PACKAGECONFIG[ostree] = "-DBUILD_OSTREE=ON,-DBUILD_OSTREE=OFF,ostree," |
56 | PACKAGECONFIG[hsm] = "-DBUILD_P11=ON,-DBUILD_P11=OFF,libp11," | 57 | PACKAGECONFIG[hsm] = "-DBUILD_P11=ON -DPKCS11_ENGINE_PATH=${PKCS11_ENGINE_PATH},-DBUILD_P11=OFF,libp11," |
57 | PACKAGECONFIG[sota-tools] = "-DBUILD_SOTA_TOOLS=ON ${GARAGE_SIGN_OPS},-DBUILD_SOTA_TOOLS=OFF,glib-2.0," | 58 | PACKAGECONFIG[sota-tools] = "-DBUILD_SOTA_TOOLS=ON ${GARAGE_SIGN_OPS},-DBUILD_SOTA_TOOLS=OFF,glib-2.0," |
58 | PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF," | 59 | PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF," |
59 | PACKAGECONFIG[serialcan] = ",,,slcand-start" | 60 | PACKAGECONFIG[serialcan] = ",,,slcand-start" |
diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index 9b23c54..cef434d 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py | |||
@@ -58,6 +58,8 @@ class QemuCommand(object): | |||
58 | if args.efi: | 58 | if args.efi: |
59 | self.bios = 'OVMF.fd' | 59 | self.bios = 'OVMF.fd' |
60 | else: | 60 | else: |
61 | if args.bootloader: | ||
62 | uboot_path = args.bootloader | ||
61 | uboot_path = abspath(join(args.dir, self.machine, 'u-boot-qemux86-64.rom')) | 63 | uboot_path = abspath(join(args.dir, self.machine, 'u-boot-qemux86-64.rom')) |
62 | if self.overlay: | 64 | if self.overlay: |
63 | new_uboot_path = self.overlay + '.u-boot.rom' | 65 | new_uboot_path = self.overlay + '.u-boot.rom' |
diff --git a/scripts/run-qemu-ota b/scripts/run-qemu-ota index 232ee11..e2a4103 100755 --- a/scripts/run-qemu-ota +++ b/scripts/run-qemu-ota | |||
@@ -20,6 +20,7 @@ def main(): | |||
20 | help='Boot using UEFI rather than U-Boot. This requires the image to be built with ' + | 20 | help='Boot using UEFI rather than U-Boot. This requires the image to be built with ' + |
21 | '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")', |
22 | action='store_true') | 22 | action='store_true') |
23 | parser.add_argument('--bootloader', default=None, help="Path to bootloader, e.g. a u-boot ROM") | ||
23 | parser.add_argument('--machine', default=None, help="Target MACHINE") | 24 | parser.add_argument('--machine', default=None, help="Target MACHINE") |
24 | kvm_group = parser.add_argument_group() | 25 | kvm_group = parser.add_argument_group() |
25 | kvm_group.add_argument('--force-kvm', help='Force use of KVM (default is to autodetect)', | 26 | kvm_group.add_argument('--force-kvm', help='Force use of KVM (default is to autodetect)', |