From 06711c8543a3af13203b4352b25b1875c29c16f2 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 7 Nov 2017 15:20:53 +0100 Subject: Refactor QemuCommand class into its own file/module. --- scripts/qemucommand.py | 118 +++++++++++++++++++++++++++++++++++++++++++++++++ scripts/run-qemu-ota | 118 +------------------------------------------------ 2 files changed, 120 insertions(+), 116 deletions(-) create mode 100644 scripts/qemucommand.py diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py new file mode 100644 index 0000000..ed14d9b --- /dev/null +++ b/scripts/qemucommand.py @@ -0,0 +1,118 @@ +from os.path import exists, join, realpath +from os import listdir +import random +import socket + +EXTENSIONS = { + 'intel-corei7-64': 'wic', + 'qemux86-64': 'otaimg' +} + + +def find_local_port(start_port): + """" + Find the next free TCP port after 'start_port'. + """ + + for port in range(start_port, start_port + 10): + try: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.bind(('', port)) + return port + except socket.error: + print("Skipping port %d" % port) + finally: + s.close() + raise Exception("Could not find a free TCP port") + + +def random_mac(): + """Return a random Ethernet MAC address + @link https://www.iana.org/assignments/ethernet-numbers/ethernet-numbers.xhtml#ethernet-numbers-2 + """ + head = "ca:fe:" + hex_digits = '0123456789abcdef' + tail = ':'.join([random.choice(hex_digits) + random.choice(hex_digits) for _ in range(4)]) + return head + tail + + +class QemuCommand(object): + def __init__(self, args): + if args.machine: + self.machine = args.machine + else: + machines = listdir(args.dir) + if len(machines) == 1: + self.machine = machines[0] + else: + raise ValueError("Could not autodetect machine type from %s" % args.dir) + if args.efi: + self.bios = 'OVMF.fd' + else: + uboot = join(args.dir, self.machine, 'u-boot-qemux86-64.rom') + if not exists(uboot): + raise ValueError("U-Boot image %s does not exist" % uboot) + self.bios = uboot + if exists(args.imagename): + image = args.imagename + else: + ext = EXTENSIONS.get(self.machine, 'wic') + image = join(args.dir, self.machine, '%s-%s.%s' % (args.imagename, self.machine, ext)) + self.image = realpath(image) + if not exists(self.image): + raise ValueError("OS image %s does not exist" % self.image) + if args.mac: + self.mac_address = args.mac + else: + self.mac_address = random_mac() + self.serial_port = find_local_port(8990) + self.ssh_port = find_local_port(2222) + self.kvm = not args.no_kvm + self.gui = not args.no_gui + self.gdb = args.gdb + self.pcap = args.pcap + self.overlay = args.overlay + + def command_line(self): + netuser = 'user,hostfwd=tcp:0.0.0.0:%d-:22,restrict=off' % self.ssh_port + if self.gdb: + netuser += ',hostfwd=tcp:0.0.0.0:2159-:2159' + cmdline = [ + "qemu-system-x86_64", + "-bios", self.bios + ] + if not self.overlay: + cmdline += ["-drive", "file=%s,if=ide,format=raw,snapshot=on" % self.image] + cmdline += [ + "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port, + "-m", "1G", + "-usb", + "-usbdevice", "tablet", + "-show-cursor", + "-vga", "std", + "-net", netuser, + "-net", "nic,macaddr=%s" % self.mac_address + ] + if self.pcap: + cmdline += ['-net', 'dump,file=' + self.pcap] + if self.gui: + cmdline += ["-serial", "stdio"] + else: + cmdline.append('-nographic') + if self.kvm: + cmdline.append('-enable-kvm') + else: + cmdline += ['-cpu', 'Haswell'] + if self.overlay: + cmdline.append(self.overlay) + return cmdline + + def img_command_line(self): + cmdline = [ + "qemu-img", "create", + "-o", "backing_file=%s" % self.image, + "-f", "qcow2", + self.overlay] + return cmdline + + diff --git a/scripts/run-qemu-ota b/scripts/run-qemu-ota index 641296c..5f9cebe 100755 --- a/scripts/run-qemu-ota +++ b/scripts/run-qemu-ota @@ -2,126 +2,12 @@ from argparse import ArgumentParser from subprocess import Popen -from os.path import exists, join, realpath -from os import listdir -import random +from os.path import exists, join import sys -import socket +from qemucommand import QemuCommand DEFAULT_DIR = 'tmp/deploy/images' -EXTENSIONS = { - 'intel-corei7-64': 'wic', - 'qemux86-64': 'otaimg' -} - - -def find_local_port(start_port): - """" - Find the next free TCP port after 'start_port'. - """ - - for port in range(start_port, start_port + 10): - try: - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.bind(('', port)) - return port - except socket.error: - print("Skipping port %d" % port) - finally: - s.close() - raise Exception("Could not find a free TCP port") - - -def random_mac(): - """Return a random Ethernet MAC address - @link https://www.iana.org/assignments/ethernet-numbers/ethernet-numbers.xhtml#ethernet-numbers-2 - """ - head = "ca:fe:" - hex_digits = '0123456789abcdef' - tail = ':'.join([random.choice(hex_digits) + random.choice(hex_digits) for _ in range(4)]) - return head + tail - - -class QemuCommand(object): - def __init__(self, args): - if args.machine: - self.machine = args.machine - else: - machines = listdir(args.dir) - if len(machines) == 1: - self.machine = machines[0] - else: - raise ValueError("Could not autodetect machine type from %s" % args.dir) - if args.efi: - self.bios = 'OVMF.fd' - else: - uboot = join(args.dir, self.machine, 'u-boot-qemux86-64.rom') - if not exists(uboot): - raise ValueError("U-Boot image %s does not exist" % uboot) - self.bios = uboot - if exists(args.imagename): - image = args.imagename - else: - ext = EXTENSIONS.get(self.machine, 'wic') - image = join(args.dir, self.machine, '%s-%s.%s' % (args.imagename, self.machine, ext)) - self.image = realpath(image) - if not exists(self.image): - raise ValueError("OS image %s does not exist" % self.image) - if args.mac: - self.mac_address = args.mac - else: - self.mac_address = random_mac() - self.serial_port = find_local_port(8990) - self.ssh_port = find_local_port(2222) - self.kvm = not args.no_kvm - self.gui = not args.no_gui - self.gdb = args.gdb - self.pcap = args.pcap - self.overlay = args.overlay - - def command_line(self): - netuser = 'user,hostfwd=tcp:0.0.0.0:%d-:22,restrict=off' % self.ssh_port - if self.gdb: - netuser += ',hostfwd=tcp:0.0.0.0:2159-:2159' - cmdline = [ - "qemu-system-x86_64", - "-bios", self.bios - ] - if not self.overlay: - cmdline += ["-drive", "file=%s,if=ide,format=raw,snapshot=on" % self.image] - cmdline += [ - "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port, - "-m", "1G", - "-usb", - "-usbdevice", "tablet", - "-show-cursor", - "-vga", "std", - "-net", netuser, - "-net", "nic,macaddr=%s" % self.mac_address - ] - if self.pcap: - cmdline += ['-net', 'dump,file=' + self.pcap] - if self.gui: - cmdline += ["-serial", "stdio"] - else: - cmdline.append('-nographic') - if self.kvm: - cmdline.append('-enable-kvm') - else: - cmdline += ['-cpu', 'Haswell'] - if self.overlay: - cmdline.append(self.overlay) - return cmdline - - def img_command_line(self): - cmdline = [ - "qemu-img", "create", - "-o", "backing_file=%s" % self.image, - "-f", "qcow2", - self.overlay] - return cmdline - def main(): parser = ArgumentParser(description='Run meta-updater image in qemu') -- cgit v1.2.3-54-g00ecf From 95e2f81a149142b67076a3132e1b00d9f64bd031 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 7 Nov 2017 15:25:21 +0100 Subject: Rename for accuracy. --- README.adoc | 2 +- lib/oeqa/selftest/garage_push.py | 42 ---------------------------------------- lib/oeqa/selftest/updater.py | 41 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 43 deletions(-) delete mode 100644 lib/oeqa/selftest/garage_push.py create mode 100644 lib/oeqa/selftest/updater.py diff --git a/README.adoc b/README.adoc index 0097670..b4608d5 100644 --- a/README.adoc +++ b/README.adoc @@ -136,5 +136,5 @@ SANITY_TESTED_DISTROS="" * Run oe-selftest: ``` -oe-selftest --run-tests garage_push +oe-selftest --run-tests updater ``` 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 @@ -import unittest -import os -import logging - -from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var - -class GaragePushTests(oeSelfTest): - - @classmethod - def setUpClass(cls): - # Ensure we have the right data in pkgdata - logger = logging.getLogger("selftest") - logger.info('Running bitbake to build aktualizr-native tools') - bitbake('aktualizr-native garage-sign-native') - - def test_help(self): - image_dir = get_bb_var("D", "aktualizr-native") - bin_dir = get_bb_var("bindir", "aktualizr-native") - gp_path = os.path.join(image_dir, bin_dir[1:], 'garage-push') - result = runCmd('%s --help' % gp_path, ignore_status=True) - self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - - def test_java(self): - result = runCmd('which java', ignore_status=True) - self.assertEqual(result.status, 0, "Java not found.") - - def test_sign(self): - image_dir = get_bb_var("D", "garage-sign-native") - bin_dir = get_bb_var("bindir", "garage-sign-native") - gs_path = os.path.join(image_dir, bin_dir[1:], 'garage-sign') - result = runCmd('%s --help' % gs_path, ignore_status=True) - self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - - def test_push(self): - bitbake('core-image-minimal') - self.write_config('IMAGE_INSTALL_append = " man "') - bitbake('core-image-minimal') - - def test_hsm(self): - self.write_config('SOTA_CLIENT_FEATURES="hsm hsm-test"') - bitbake('core-image-minimal') diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py new file mode 100644 index 0000000..e9048fd --- /dev/null +++ b/lib/oeqa/selftest/updater.py @@ -0,0 +1,41 @@ +import unittest +import os +import logging + +from oeqa.selftest.base import oeSelfTest +from oeqa.utils.commands import runCmd, bitbake, get_bb_var + +class UpdaterTests(oeSelfTest): + + @classmethod + def setUpClass(cls): + logger = logging.getLogger("selftest") + logger.info('Running bitbake to build aktualizr-native tools and garage-sign-native') + bitbake('aktualizr-native garage-sign-native') + + def test_help(self): + image_dir = get_bb_var("D", "aktualizr-native") + bin_dir = get_bb_var("bindir", "aktualizr-native") + gp_path = os.path.join(image_dir, bin_dir[1:], 'garage-push') + result = runCmd('%s --help' % gp_path, ignore_status=True) + self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) + + def test_java(self): + result = runCmd('which java', ignore_status=True) + self.assertEqual(result.status, 0, "Java not found.") + + def test_sign(self): + image_dir = get_bb_var("D", "garage-sign-native") + bin_dir = get_bb_var("bindir", "garage-sign-native") + gs_path = os.path.join(image_dir, bin_dir[1:], 'garage-sign') + result = runCmd('%s --help' % gs_path, ignore_status=True) + self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) + + def test_push(self): + bitbake('core-image-minimal') + self.write_config('IMAGE_INSTALL_append = " man "') + bitbake('core-image-minimal') + + def test_hsm(self): + self.write_config('SOTA_CLIENT_FEATURES="hsm hsm-test"') + bitbake('core-image-minimal') -- cgit v1.2.3-54-g00ecf From 9d5ad230a7558ae9adea42ea69d633d489c6dec0 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 7 Nov 2017 17:34:13 +0100 Subject: Rough draft of a run-qemu-ota test. Not very useful yet. Could be made into a function for the purpose of running arbitrary commands via SSH, for example. However, I had plenty of trouble even getting this far. Note that I created a softlink to qemucommand to get around the Python path issues in oe-selftest. I'm not sure if there's a better way to handle that, since manipulating the path is seemingly impossible. --- .gitignore | 1 + lib/oeqa/selftest/qemucommand.py | 1 + lib/oeqa/selftest/updater.py | 33 +++++++++++++++++++++++++++++++++ scripts/qemucommand.py | 4 ++-- 4 files changed, 37 insertions(+), 2 deletions(-) create mode 120000 lib/oeqa/selftest/qemucommand.py diff --git a/.gitignore b/.gitignore index bee8a64..8d35cb3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ __pycache__ +*.pyc diff --git a/lib/oeqa/selftest/qemucommand.py b/lib/oeqa/selftest/qemucommand.py new file mode 120000 index 0000000..bc06dde --- /dev/null +++ b/lib/oeqa/selftest/qemucommand.py @@ -0,0 +1 @@ +../../../scripts/qemucommand.py \ No newline at end of file diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index e9048fd..4cdd1a2 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -4,6 +4,9 @@ import logging from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var +import subprocess +from oeqa.selftest.qemucommand import QemuCommand +import time class UpdaterTests(oeSelfTest): @@ -39,3 +42,33 @@ class UpdaterTests(oeSelfTest): def test_hsm(self): self.write_config('SOTA_CLIENT_FEATURES="hsm hsm-test"') bitbake('core-image-minimal') + + def test_qemu(self): + print('') + # Create empty object. + args = type('', (), {})() + args.imagename = 'core-image-minimal' + args.mac = None + args.dir = 'tmp/deploy/images' + args.efi = False + args.machine = None + args.no_kvm = False + args.no_gui = True + args.gdb = False + args.pcap = None + args.overlay = None + args.dry_run = False + + qemu_command = QemuCommand(args) + cmdline = qemu_command.command_line() + print('Booting image with run-qemu-ota...') + s = subprocess.Popen(cmdline) + time.sleep(10) + print('Machine name (hostname) of device is:') + ssh_cmd = ['ssh', '-q', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', 'root@localhost', '-p', str(qemu_command.ssh_port), 'hostname'] + s2 = subprocess.Popen(ssh_cmd) + time.sleep(5) + try: + s.terminate() + except KeyboardInterrupt: + pass diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index ed14d9b..a75ffb6 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py @@ -1,4 +1,4 @@ -from os.path import exists, join, realpath +from os.path import exists, join, realpath, abspath from os import listdir import random import socket @@ -49,7 +49,7 @@ class QemuCommand(object): if args.efi: self.bios = 'OVMF.fd' else: - uboot = join(args.dir, self.machine, 'u-boot-qemux86-64.rom') + uboot = abspath(join(args.dir, self.machine, 'u-boot-qemux86-64.rom')) if not exists(uboot): raise ValueError("U-Boot image %s does not exist" % uboot) self.bios = uboot -- cgit v1.2.3-54-g00ecf From d05ef2141f0f707c75e6cafa8f8c49076c141376 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Mon, 13 Nov 2017 13:39:38 +0100 Subject: Fix paths to be more reliable. --- lib/oeqa/selftest/updater.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index 4cdd1a2..e3542be 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -3,7 +3,7 @@ import os import logging from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars import subprocess from oeqa.selftest.qemucommand import QemuCommand import time @@ -17,10 +17,10 @@ class UpdaterTests(oeSelfTest): bitbake('aktualizr-native garage-sign-native') def test_help(self): - image_dir = get_bb_var("D", "aktualizr-native") - bin_dir = get_bb_var("bindir", "aktualizr-native") - gp_path = os.path.join(image_dir, bin_dir[1:], 'garage-push') - result = runCmd('%s --help' % gp_path, ignore_status=True) + bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') + p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-push" + self.assertTrue(os.path.isfile(p), msg = "No garage-push found (%s)" % p) + result = runCmd('%s --help' % p, ignore_status=True) self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) def test_java(self): @@ -28,10 +28,10 @@ class UpdaterTests(oeSelfTest): self.assertEqual(result.status, 0, "Java not found.") def test_sign(self): - image_dir = get_bb_var("D", "garage-sign-native") - bin_dir = get_bb_var("bindir", "garage-sign-native") - gs_path = os.path.join(image_dir, bin_dir[1:], 'garage-sign') - result = runCmd('%s --help' % gs_path, ignore_status=True) + bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'garage-sign-native') + p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-sign" + self.assertTrue(os.path.isfile(p), msg = "No garage-sign found (%s)" % p) + result = runCmd('%s --help' % p, ignore_status=True) self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) def test_push(self): -- cgit v1.2.3-54-g00ecf From 7e1b40307aa780102796638e06a1284b6e318087 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Mon, 13 Nov 2017 13:57:49 +0100 Subject: Split tests into independent classes. This reduces unnecessary time spent on setUpClass calls that may not be necessary for individual tests. It also organizes things a bit better. --- lib/oeqa/selftest/updater.py | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index e3542be..ea57f9d 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -8,13 +8,13 @@ import subprocess from oeqa.selftest.qemucommand import QemuCommand import time -class UpdaterTests(oeSelfTest): +class SotaToolsTests(oeSelfTest): @classmethod def setUpClass(cls): logger = logging.getLogger("selftest") - logger.info('Running bitbake to build aktualizr-native tools and garage-sign-native') - bitbake('aktualizr-native garage-sign-native') + logger.info('Running bitbake to build aktualizr-native tools') + bitbake('aktualizr-native') def test_help(self): bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') @@ -23,26 +23,41 @@ class UpdaterTests(oeSelfTest): result = runCmd('%s --help' % p, ignore_status=True) self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - def test_java(self): - result = runCmd('which java', ignore_status=True) - self.assertEqual(result.status, 0, "Java not found.") + def test_push(self): + bitbake('core-image-minimal') + self.write_config('IMAGE_INSTALL_append = " man "') + bitbake('core-image-minimal') + + +class GarageSignTests(oeSelfTest): + + @classmethod + def setUpClass(cls): + logger = logging.getLogger("selftest") + logger.info('Running bitbake to build garage-sign-native') + bitbake('garage-sign-native') - def test_sign(self): + def test_help(self): bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'garage-sign-native') p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-sign" self.assertTrue(os.path.isfile(p), msg = "No garage-sign found (%s)" % p) result = runCmd('%s --help' % p, ignore_status=True) self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - def test_push(self): - bitbake('core-image-minimal') - self.write_config('IMAGE_INSTALL_append = " man "') - bitbake('core-image-minimal') + +class HsmTests(oeSelfTest): def test_hsm(self): self.write_config('SOTA_CLIENT_FEATURES="hsm hsm-test"') bitbake('core-image-minimal') + +class GeneralTests(oeSelfTest): + + def test_java(self): + result = runCmd('which java', ignore_status=True) + self.assertEqual(result.status, 0, "Java not found.") + def test_qemu(self): print('') # Create empty object. @@ -72,3 +87,4 @@ class UpdaterTests(oeSelfTest): s.terminate() except KeyboardInterrupt: pass + -- cgit v1.2.3-54-g00ecf From 9178f7116aad6722121d3170ed76cf47c4d22cc4 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Mon, 13 Nov 2017 15:12:14 +0100 Subject: Make double-bitbake test actually useful. * Make sure to remove man package before bitbaking. * Test that the package exists or not. * Check the image name and size to make sure it changes. * Move to appropriate class and rename. --- lib/oeqa/selftest/updater.py | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index ea57f9d..adae081 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -1,12 +1,15 @@ import unittest import os import logging +import subprocess +import time from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars -import subprocess from oeqa.selftest.qemucommand import QemuCommand -import time + +DEFAULT_DIR = 'tmp/deploy/images' + class SotaToolsTests(oeSelfTest): @@ -23,11 +26,6 @@ class SotaToolsTests(oeSelfTest): result = runCmd('%s --help' % p, ignore_status=True) self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - def test_push(self): - bitbake('core-image-minimal') - self.write_config('IMAGE_INSTALL_append = " man "') - bitbake('core-image-minimal') - class GarageSignTests(oeSelfTest): @@ -58,13 +56,42 @@ class GeneralTests(oeSelfTest): result = runCmd('which java', ignore_status=True) self.assertEqual(result.status, 0, "Java not found.") + def test_add_package(self): + print('') + machine = get_bb_var('MACHINE', 'core-image-minimal') + image_path = DEFAULT_DIR + '/' + machine + '/core-image-minimal-' + machine + '.otaimg' + logger = logging.getLogger("selftest") + + logger.info('Running bitbake with man in the image package list') + self.write_config('IMAGE_INSTALL_append = " man "') + bitbake('-c cleanall man') + bitbake('core-image-minimal') + result = runCmd('oe-pkgdata-util find-path /usr/bin/man') + self.assertEqual(result.output, 'man: /usr/bin/man') + path1 = os.path.realpath(image_path) + size1 = os.path.getsize(path1) + logger.info('First image %s has size %i' % (path1, size1)) + + logger.info('Running bitbake without man in the image package list') + self.write_config('IMAGE_INSTALL_remove = " man "') + bitbake('-c cleanall man') + bitbake('core-image-minimal') + result = runCmd('oe-pkgdata-util find-path /usr/bin/man', ignore_status=True) + self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output) + self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /usr/bin/man') + path2 = os.path.realpath(image_path) + size2 = os.path.getsize(path2) + logger.info('Second image %s has size %i' % (path2, size2)) + self.assertNotEqual(path1, path2, "Image paths are identical; image was not rebuilt.") + self.assertNotEqual(size1, size2, "Image sizes are identical; image was not rebuilt.") + def test_qemu(self): print('') # Create empty object. args = type('', (), {})() args.imagename = 'core-image-minimal' args.mac = None - args.dir = 'tmp/deploy/images' + args.dir = DEFAULT_DIR args.efi = False args.machine = None args.no_kvm = False -- cgit v1.2.3-54-g00ecf From 714f33c1d057db2058aaeadb9dec123199edf41e Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Mon, 13 Nov 2017 16:40:43 +0100 Subject: Basic garage-deploy test. --- lib/oeqa/selftest/updater.py | 9 ++++++++- recipes-sota/aktualizr/aktualizr_git.bb | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index adae081..13e1c21 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -19,13 +19,20 @@ class SotaToolsTests(oeSelfTest): logger.info('Running bitbake to build aktualizr-native tools') bitbake('aktualizr-native') - def test_help(self): + def test_push_help(self): bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-push" self.assertTrue(os.path.isfile(p), msg = "No garage-push found (%s)" % p) result = runCmd('%s --help' % p, ignore_status=True) self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) + def test_deploy_help(self): + bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') + p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-deploy" + self.assertTrue(os.path.isfile(p), msg = "No garage-deploy found (%s)" % p) + result = runCmd('%s --help' % p, ignore_status=True) + self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) + class GarageSignTests(oeSelfTest): diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index c98027d..7af7c60 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -47,5 +47,6 @@ FILES_${PN}_class-target = " \ " FILES_${PN}_class-native = " \ ${bindir}/aktualizr_implicit_writer \ + ${bindir}/garage-deploy \ ${bindir}/garage-push \ " -- cgit v1.2.3-54-g00ecf From 9411b6039661f50832779d021f3d47b2d8516634 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Wed, 15 Nov 2017 15:50:32 +0100 Subject: Fix some paths based on Leon's techniques. --- lib/oeqa/selftest/updater.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index 13e1c21..6339e6e 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -8,8 +8,6 @@ from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars from oeqa.selftest.qemucommand import QemuCommand -DEFAULT_DIR = 'tmp/deploy/images' - class SotaToolsTests(oeSelfTest): @@ -65,8 +63,9 @@ class GeneralTests(oeSelfTest): def test_add_package(self): print('') - machine = get_bb_var('MACHINE', 'core-image-minimal') - image_path = DEFAULT_DIR + '/' + machine + '/core-image-minimal-' + machine + '.otaimg' + deploydir = get_bb_var('DEPLOY_DIR_IMAGE') + imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal') + image_path = deploydir + '/' + imagename + '.otaimg' logger = logging.getLogger("selftest") logger.info('Running bitbake with man in the image package list') @@ -98,7 +97,9 @@ class GeneralTests(oeSelfTest): args = type('', (), {})() args.imagename = 'core-image-minimal' args.mac = None - args.dir = DEFAULT_DIR + # Could use DEPLOY_DIR_IMAGE her but it's already in the machine + # subdirectory. + args.dir = 'tmp/deploy/images' args.efi = False args.machine = None args.no_kvm = False -- cgit v1.2.3-54-g00ecf From de48c402e207cde0c723ebb8ff5c2992101cfc27 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Mon, 13 Nov 2017 15:48:11 +0200 Subject: garage_push.py: Check distro features Ensure that systemd and sota are among the distro features. Signed-off-by: Leon Anavi --- lib/oeqa/selftest/updater.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index 6339e6e..9945b40 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -57,6 +57,14 @@ class HsmTests(oeSelfTest): class GeneralTests(oeSelfTest): + def test_feature_sota(self): + result = get_bb_var('DISTRO_FEATURES').find('sota') + self.assertNotEqual(result, -1, 'Feature "sota" not set at DISTRO_FEATURES'); + + def test_feature_systemd(self): + result = get_bb_var('DISTRO_FEATURES').find('systemd') + self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES'); + def test_java(self): result = runCmd('which java', ignore_status=True) self.assertEqual(result.status, 0, "Java not found.") -- cgit v1.2.3-54-g00ecf From 50d8ea5e540f1d2f423db77e8a93b0f5bcc1d1ca Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Tue, 14 Nov 2017 19:11:32 +0200 Subject: garage_push.py: Test SOTA_PACKED_CREDENTIALS Add test to verify that the file specified at SOTA_PACKED_CREDENTIALS exists and is included in the image. If SOTA_PACKED_CREDENTIALS is not set this test case will be skipped. Signed-off-by: Leon Anavi --- lib/oeqa/selftest/updater.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index 9945b40..b59eefc 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -65,6 +65,20 @@ class GeneralTests(oeSelfTest): result = get_bb_var('DISTRO_FEATURES').find('systemd') self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES'); + def test_credentials(self): + bitbake('core-image-minimal') + credentials = get_bb_var('SOTA_PACKED_CREDENTIALS') + # skip the test if the variable SOTA_PACKED_CREDENTIALS is not set + if credentials is None: + raise unittest.SkipTest("Variable 'SOTA_PACKED_CREDENTIALS' not set.") + # Check if the file exists + self.assertTrue(os.path.isfile(credentials), "File %s does not exist" % credentials) + deploydir = get_bb_var('DEPLOY_DIR_IMAGE') + imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal') + # Check if the credentials are included in the output image + result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' % (deploydir, imagename), ignore_status=True) + self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) + def test_java(self): result = runCmd('which java', ignore_status=True) self.assertEqual(result.status, 0, "Java not found.") -- cgit v1.2.3-54-g00ecf From 0b1fd4b3c456a64e40a7ff1125f005c0b72eafd8 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Thu, 16 Nov 2017 11:00:22 +0100 Subject: Remove unused import, break long lines --- scripts/run-qemu-ota | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/run-qemu-ota b/scripts/run-qemu-ota index 5f9cebe..8e25197 100755 --- a/scripts/run-qemu-ota +++ b/scripts/run-qemu-ota @@ -2,7 +2,7 @@ from argparse import ArgumentParser from subprocess import Popen -from os.path import exists, join +from os.path import exists import sys from qemucommand import QemuCommand @@ -25,7 +25,10 @@ def main(): parser.add_argument('--no-gui', help='Disable GUI', action='store_true') parser.add_argument('--gdb', help='Export gdbserver port 2159 from the image', action='store_true') parser.add_argument('--pcap', default=None, help='Dump all network traffic') - 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.') + 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.') parser.add_argument('-n', '--dry-run', help='Print qemu command line rather then run it', action='store_true') args = parser.parse_args() try: -- cgit v1.2.3-54-g00ecf From 24e5a6d45886365cecce74c2c9aa1cfd8c0da69a Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Thu, 16 Nov 2017 11:01:25 +0100 Subject: Autodetect KVM Autodetect KVM by using the 'kvm-ok' command line tool. This has two benefits: Firstly, it improves the UX of run-qemu-ota when working on machines without KVM (e.g. AWS). Previously, people had to use the --no-kvm option in these cases. Secondary, it makes oe-selftest usable on machines without KVM. Our tests call run-qemu-ota, and we want to able to run them on machines without KVM. --- lib/oeqa/selftest/updater.py | 4 ++-- scripts/qemucommand.py | 11 ++++++++++- scripts/run-qemu-ota | 6 +++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index 6339e6e..eb09302 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -97,12 +97,12 @@ class GeneralTests(oeSelfTest): args = type('', (), {})() args.imagename = 'core-image-minimal' args.mac = None - # Could use DEPLOY_DIR_IMAGE her but it's already in the machine + # Could use DEPLOY_DIR_IMAGE here but it's already in the machine # subdirectory. args.dir = 'tmp/deploy/images' args.efi = False args.machine = None - args.no_kvm = False + args.kvm = None # Autodetect args.no_gui = True args.gdb = False args.pcap = None diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index a75ffb6..82a9540 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py @@ -2,6 +2,7 @@ from os.path import exists, join, realpath, abspath from os import listdir import random import socket +from subprocess import check_output, CalledProcessError EXTENSIONS = { 'intel-corei7-64': 'wic', @@ -67,7 +68,15 @@ class QemuCommand(object): self.mac_address = random_mac() self.serial_port = find_local_port(8990) self.ssh_port = find_local_port(2222) - self.kvm = not args.no_kvm + if args.kvm is None: + # Autodetect KVM using 'kvm-ok' + try: + check_output(['kvm-ok']) + self.kvm = True + except CalledProcessError: + self.kvm = False + else: + self.kvm = args.kvm self.gui = not args.no_gui self.gdb = args.gdb self.pcap = args.pcap diff --git a/scripts/run-qemu-ota b/scripts/run-qemu-ota index 8e25197..56e4fbc 100755 --- a/scripts/run-qemu-ota +++ b/scripts/run-qemu-ota @@ -21,7 +21,11 @@ def main(): 'OSTREE_BOOTLOADER = "grub" and OVMF.fd firmware to be installed (try "apt install ovmf")', action='store_true') parser.add_argument('--machine', default=None, help="Target MACHINE") - parser.add_argument('--no-kvm', help='Disable KVM in QEMU', action='store_true') + kvm_group = parser.add_argument_group() + kvm_group.add_argument('--force-kvm', help='Force use of KVM (default is to autodetect)', + dest='kvm', action='store_true', default=None) + kvm_group.add_argument('--no-kvm', help='Disable KVM in QEMU', + dest='kvm', action='store_false') parser.add_argument('--no-gui', help='Disable GUI', action='store_true') parser.add_argument('--gdb', help='Export gdbserver port 2159 from the image', action='store_true') parser.add_argument('--pcap', default=None, help='Dump all network traffic') -- cgit v1.2.3-54-g00ecf From 7a3258934b2c53f7c29c212c695805da1893ba3f Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 16 Nov 2017 16:04:36 +0100 Subject: Move oe-selftest qemu logic to its own function. This means we can call it from any number of tests and run arbitrary commands. I finally figured out how to get commands with arguments working, too. --- lib/oeqa/selftest/updater.py | 91 +++++++++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 31 deletions(-) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index 2723b4a..8ee3c69 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -113,35 +113,64 @@ class GeneralTests(oeSelfTest): self.assertNotEqual(path1, path2, "Image paths are identical; image was not rebuilt.") self.assertNotEqual(size1, size2, "Image sizes are identical; image was not rebuilt.") - def test_qemu(self): - print('') - # Create empty object. - args = type('', (), {})() - args.imagename = 'core-image-minimal' - args.mac = None - # Could use DEPLOY_DIR_IMAGE here but it's already in the machine - # subdirectory. - args.dir = 'tmp/deploy/images' - args.efi = False - args.machine = None - args.kvm = None # Autodetect - args.no_gui = True - args.gdb = False - args.pcap = None - args.overlay = None - args.dry_run = False - - qemu_command = QemuCommand(args) - cmdline = qemu_command.command_line() - print('Booting image with run-qemu-ota...') - s = subprocess.Popen(cmdline) - time.sleep(10) - print('Machine name (hostname) of device is:') - ssh_cmd = ['ssh', '-q', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', 'root@localhost', '-p', str(qemu_command.ssh_port), 'hostname'] - s2 = subprocess.Popen(ssh_cmd) - time.sleep(5) - try: - s.terminate() - except KeyboardInterrupt: - pass + +class QemuTests(oeSelfTest): + + @classmethod + def setUpClass(cls): + logger = logging.getLogger("selftest") + logger.info('Running bitbake to build core-image-minimal') + bitbake('core-image-minimal') + + def test_hostname(self): + value, err = run_test_qemu('hostname', False, 'Checking machine name (hostname) of device:') + machine = get_bb_var('MACHINE', 'core-image-minimal') + self.assertEqual(err, b'', 'Error: ' + err.decode()) + # Strip off line ending. + value_str = value.decode()[:-1] + self.assertEqual(value_str, machine, 'MACHINE does not match hostname: ' + machine + ', ' + value_str) + print('hostname: ' + value_str) + + def test_var_sota(self): + value, err = run_test_qemu('ls /var/sota', True, 'Checking contents of /var/sota:') + self.assertEqual(err, b'', 'Error: ' + err.decode()) + print(value.decode()) + + +def run_test_qemu(command, use_shell, message): + print('') + # Create empty object. + args = type('', (), {})() + args.imagename = 'core-image-minimal' + args.mac = None + # Could use DEPLOY_DIR_IMAGE here but it's already in the machine + # subdirectory. + args.dir = 'tmp/deploy/images' + args.efi = False + args.machine = None + args.kvm = None # Autodetect + args.no_gui = True + args.gdb = False + args.pcap = None + args.overlay = None + args.dry_run = False + + qemu_command = QemuCommand(args) + cmdline = qemu_command.command_line() + print('Booting image with run-qemu-ota...') + s = subprocess.Popen(cmdline) + time.sleep(10) + print(message) + if not use_shell: + command = ['ssh', '-q', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', 'root@localhost', '-p', str(qemu_command.ssh_port), '"' + command + '"'] + else: + command = 'ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + str(qemu_command.ssh_port) + ' "' + command + '"' + s2 = subprocess.Popen(command, shell=use_shell, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + value, err = s2.communicate() + time.sleep(5) + try: + s.terminate() + except KeyboardInterrupt: + pass + return value, err -- cgit v1.2.3-54-g00ecf From c687237422dc7f22b85d9718d112fe0b674007c3 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 16 Nov 2017 16:57:57 +0100 Subject: Make launching qemu part of setUpClass. And terminating part of tearDownClass. This cleans things up nicely and means we only have to boot once for multiple tests. If we do want to boot multiple times (e.g. with different configs), we can move most of the qemu code to non-class functions and use multiple classes that each call those functions in setUpClass and tearDownClass. --- lib/oeqa/selftest/updater.py | 85 +++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index 8ee3c69..ad99964 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -121,56 +121,59 @@ class QemuTests(oeSelfTest): logger = logging.getLogger("selftest") logger.info('Running bitbake to build core-image-minimal') bitbake('core-image-minimal') + # Create empty object. + args = type('', (), {})() + args.imagename = 'core-image-minimal' + args.mac = None + # Could use DEPLOY_DIR_IMAGE here but it's already in the machine + # subdirectory. + args.dir = 'tmp/deploy/images' + args.efi = False + args.machine = None + args.kvm = None # Autodetect + args.no_gui = True + args.gdb = False + args.pcap = None + args.overlay = None + args.dry_run = False + + cls.qemu = QemuCommand(args) + cmdline = cls.qemu.command_line() + print('Booting image with run-qemu-ota...') + cls.s = subprocess.Popen(cmdline) + time.sleep(10) + + @classmethod + def tearDownClass(cls): + try: + cls.s.terminate() + except KeyboardInterrupt: + pass + + def run_test_qemu(self, command): + command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + + str(self.qemu.ssh_port) + ' "' + command + '"'] + s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + value, err = s2.communicate() + return value, err def test_hostname(self): - value, err = run_test_qemu('hostname', False, 'Checking machine name (hostname) of device:') + print('') + print('Checking machine name (hostname) of device:') + value, err = self.run_test_qemu('hostname') machine = get_bb_var('MACHINE', 'core-image-minimal') self.assertEqual(err, b'', 'Error: ' + err.decode()) # Strip off line ending. value_str = value.decode()[:-1] - self.assertEqual(value_str, machine, 'MACHINE does not match hostname: ' + machine + ', ' + value_str) - print('hostname: ' + value_str) + self.assertEqual(value_str, machine, + 'MACHINE does not match hostname: ' + machine + ', ' + value_str) + print(value_str) def test_var_sota(self): - value, err = run_test_qemu('ls /var/sota', True, 'Checking contents of /var/sota:') + print('') + print('Checking contents of /var/sota:') + value, err = self.run_test_qemu('ls /var/sota') self.assertEqual(err, b'', 'Error: ' + err.decode()) print(value.decode()) -def run_test_qemu(command, use_shell, message): - print('') - # Create empty object. - args = type('', (), {})() - args.imagename = 'core-image-minimal' - args.mac = None - # Could use DEPLOY_DIR_IMAGE here but it's already in the machine - # subdirectory. - args.dir = 'tmp/deploy/images' - args.efi = False - args.machine = None - args.kvm = None # Autodetect - args.no_gui = True - args.gdb = False - args.pcap = None - args.overlay = None - args.dry_run = False - - qemu_command = QemuCommand(args) - cmdline = qemu_command.command_line() - print('Booting image with run-qemu-ota...') - s = subprocess.Popen(cmdline) - time.sleep(10) - print(message) - if not use_shell: - command = ['ssh', '-q', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', 'root@localhost', '-p', str(qemu_command.ssh_port), '"' + command + '"'] - else: - command = 'ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + str(qemu_command.ssh_port) + ' "' + command + '"' - s2 = subprocess.Popen(command, shell=use_shell, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - value, err = s2.communicate() - time.sleep(5) - try: - s.terminate() - except KeyboardInterrupt: - pass - return value, err - -- cgit v1.2.3-54-g00ecf From b1aa5d1c0c27b4026251749e6a7df790df5e49f1 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 16 Nov 2017 17:38:17 +0100 Subject: Delete hsm-test SOTA_CLIENT_FEATURE as redundant and provoking mistakes 'SOTA_CLIENT_PROV = "aktualizr-hsm-test-prov"' should set in local.conf in order to build with softhsm --- recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb | 2 +- recipes-sota/aktualizr/aktualizr_git.bb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb index c77a5bc..276c17e 100644 --- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb @@ -6,7 +6,7 @@ LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" DEPENDS = "aktualizr-native" -RDEPENDS_${PN} = "aktualizr" +RDEPENDS_${PN} = "aktualizr softhsm softhsm-testtoken" SRC_URI = " \ file://LICENSE \ diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 470c9bf..9a1a7a6 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -11,7 +11,6 @@ DEPENDS_append_class-native = "glib-2.0-native " RDEPENDS_${PN}_class-target = "lshw " RDEPENDS_${PN}_append_class-target = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', ' engine-pkcs11', '', d)} " -RDEPENDS_${PN}_append_class-target = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm-test', ' softhsm softhsm-testtoken', '', d)} " PV = "1.0+git${SRCPV}" PR = "7" -- cgit v1.2.3-54-g00ecf From e31b5428a4dff2b5d68daf34f079c4789c0c5d4b Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 16 Nov 2017 18:03:36 +0100 Subject: Ignore configuration templates to avoid duplicate inclusion of stuff Also add IMAGE_ROOTFS_EXTRA_SPACE to qemu configuration which was the original motivation for returning TEMPLATECONF processing (see https://github.com/advancedtelematic/meta-updater-qemux86-64/pull/9 ) --- classes/sota_qemux86-64.bbclass | 2 ++ scripts/envsetup.sh | 10 +--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/classes/sota_qemux86-64.bbclass b/classes/sota_qemux86-64.bbclass index 5ec4f69..53e0026 100644 --- a/classes/sota_qemux86-64.bbclass +++ b/classes/sota_qemux86-64.bbclass @@ -9,3 +9,5 @@ UBOOT_MACHINE_sota = "qemu-x86_defconfig" OSTREE_BOOTLOADER ?= "u-boot" OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 ostree_root=/dev/hda" + +IMAGE_ROOTFS_EXTRA_SPACE = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', '65536', '', d)}" 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 METADIR="${SOURCEDIR}/../.." if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then - if [ -z "$TEMPLATECONF" ] && [ -d ${METADIR}/meta-updater-${MACHINE}/conf ]; then - # Use the template configurations for the specified machine - TEMPLATECONF=${METADIR}/meta-updater-${MACHINE}/conf - source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" - unset TEMPLATECONF - else - # Use the default configurations or TEMPLATECONF set by the user - source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" - fi + source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf -- cgit v1.2.3-54-g00ecf From 8da7de18c9b5a84bd594220121d9ab324427d057 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Fri, 17 Nov 2017 12:11:38 +0100 Subject: Refactor Qemu interaction into seperate functions. This should make it easy to make new test classes that launch independent qemu instances with different configurations. --- lib/oeqa/selftest/updater.py | 81 ++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index ad99964..408f2c3 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -118,49 +118,16 @@ class QemuTests(oeSelfTest): @classmethod def setUpClass(cls): - logger = logging.getLogger("selftest") - logger.info('Running bitbake to build core-image-minimal') - bitbake('core-image-minimal') - # Create empty object. - args = type('', (), {})() - args.imagename = 'core-image-minimal' - args.mac = None - # Could use DEPLOY_DIR_IMAGE here but it's already in the machine - # subdirectory. - args.dir = 'tmp/deploy/images' - args.efi = False - args.machine = None - args.kvm = None # Autodetect - args.no_gui = True - args.gdb = False - args.pcap = None - args.overlay = None - args.dry_run = False - - cls.qemu = QemuCommand(args) - cmdline = cls.qemu.command_line() - print('Booting image with run-qemu-ota...') - cls.s = subprocess.Popen(cmdline) - time.sleep(10) + cls.qemu, cls.s = qemu_launch() @classmethod def tearDownClass(cls): - try: - cls.s.terminate() - except KeyboardInterrupt: - pass - - def run_test_qemu(self, command): - command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + - str(self.qemu.ssh_port) + ' "' + command + '"'] - s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - value, err = s2.communicate() - return value, err + qemu_terminate(cls.s) def test_hostname(self): print('') print('Checking machine name (hostname) of device:') - value, err = self.run_test_qemu('hostname') + value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') machine = get_bb_var('MACHINE', 'core-image-minimal') self.assertEqual(err, b'', 'Error: ' + err.decode()) # Strip off line ending. @@ -172,8 +139,48 @@ class QemuTests(oeSelfTest): def test_var_sota(self): print('') print('Checking contents of /var/sota:') - value, err = self.run_test_qemu('ls /var/sota') + value, err = qemu_send_command(self.qemu.ssh_port, 'ls /var/sota') self.assertEqual(err, b'', 'Error: ' + err.decode()) print(value.decode()) +def qemu_launch(): + logger = logging.getLogger("selftest") + logger.info('Running bitbake to build core-image-minimal') + bitbake('core-image-minimal') + # Create empty object. + args = type('', (), {})() + args.imagename = 'core-image-minimal' + args.mac = None + # Could use DEPLOY_DIR_IMAGE here but it's already in the machine + # subdirectory. + args.dir = 'tmp/deploy/images' + args.efi = False + args.machine = None + args.kvm = None # Autodetect + args.no_gui = True + args.gdb = False + args.pcap = None + args.overlay = None + args.dry_run = False + + qemu = QemuCommand(args) + cmdline = qemu.command_line() + print('Booting image with run-qemu-ota...') + s = subprocess.Popen(cmdline) + time.sleep(10) + return qemu, s + +def qemu_terminate(s): + try: + s.terminate() + except KeyboardInterrupt: + pass + +def qemu_send_command(port, command): + command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + + str(port) + ' "' + command + '"'] + s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + value, err = s2.communicate() + return value, err + -- cgit v1.2.3-54-g00ecf From 495a4a4ec6d540e1045852bc92ef46aa6a6bd9d9 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Fri, 17 Nov 2017 14:11:10 +0100 Subject: Test booting with grub. --- lib/oeqa/selftest/updater.py | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index 408f2c3..e3d4fc3 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -118,7 +118,7 @@ class QemuTests(oeSelfTest): @classmethod def setUpClass(cls): - cls.qemu, cls.s = qemu_launch() + cls.qemu, cls.s = qemu_launch(machine='qemux86-64') @classmethod def tearDownClass(cls): @@ -143,8 +143,39 @@ class QemuTests(oeSelfTest): self.assertEqual(err, b'', 'Error: ' + err.decode()) print(value.decode()) +class GrubTests(oeSelfTest): + + def setUpLocal(self): + # This is a bit of a hack but I can't see a better option. + path = os.path.abspath(os.path.dirname(__file__)) + metadir = path + "/../../../../" + grub_config = 'OSTREE_BOOTLOADER = "grub"\nMACHINE = "intel-corei7-64"' + self.append_config(grub_config) + self.meta_intel = metadir + "meta-intel" + self.meta_minnow = metadir + "meta-updater-minnowboard" + runCmd('bitbake-layers add-layer "%s"' % self.meta_intel) + runCmd('bitbake-layers add-layer "%s"' % self.meta_minnow) + self.qemu, self.s = qemu_launch(efi=True, machine='intel-corei7-64') + + def tearDownLocal(self): + qemu_terminate(self.s) + runCmd('bitbake-layers remove-layer "%s"' % self.meta_intel, ignore_status=True) + runCmd('bitbake-layers remove-layer "%s"' % self.meta_minnow, ignore_status=True) + + def test_grub(self): + print('') + print('Checking machine name (hostname) of device:') + value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') + machine = get_bb_var('MACHINE', 'core-image-minimal') + self.assertEqual(err, b'', 'Error: ' + err.decode()) + # Strip off line ending. + value_str = value.decode()[:-1] + self.assertEqual(value_str, machine, + 'MACHINE does not match hostname: ' + machine + ', ' + value_str) + print(value_str) + -def qemu_launch(): +def qemu_launch(efi=False, machine=None): logger = logging.getLogger("selftest") logger.info('Running bitbake to build core-image-minimal') bitbake('core-image-minimal') @@ -155,8 +186,8 @@ def qemu_launch(): # Could use DEPLOY_DIR_IMAGE here but it's already in the machine # subdirectory. args.dir = 'tmp/deploy/images' - args.efi = False - args.machine = None + args.efi = efi + args.machine = machine args.kvm = None # Autodetect args.no_gui = True args.gdb = False -- cgit v1.2.3-54-g00ecf From eab456117ad96a43104cef95c68d9bddf4c65872 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Tue, 14 Nov 2017 10:00:21 +0100 Subject: Add fixes for compatibility with Rocko --- classes/image_types_ostree.bbclass | 6 +++--- classes/image_types_ota.bbclass | 2 +- classes/sota_qemux86-64.bbclass | 2 +- conf/include/bblayers/sota.inc | 1 - conf/include/bblayers/sota_qemux86-64.inc | 1 - recipes-bsp/u-boot/u-boot_2016.11.bb | 22 ---------------------- recipes-support/util-linux/util-linux_%.bbappend | 3 --- scripts/lib/wic/plugins/source/otaimage.py | 2 +- 8 files changed, 6 insertions(+), 33 deletions(-) delete mode 100644 recipes-bsp/u-boot/u-boot_2016.11.bb delete mode 100644 recipes-support/util-linux/util-linux_%.bbappend diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 172f2c8..e6bea76 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -2,7 +2,7 @@ inherit image -IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \ +do_image_ostree[depends] += "ostree-native:do_populate_sysroot \ openssl-native:do_populate_sysroot \ coreutils-native:do_populate_sysroot \ unzip-native:do_populate_sysroot \ @@ -161,7 +161,7 @@ IMAGE_CMD_ostree () { } IMAGE_TYPEDEP_ostreepush = "ostree" -IMAGE_DEPENDS_ostreepush = "aktualizr-native:do_populate_sysroot ca-certificates-native:do_populate_sysroot " +do_image_ostreepush[depends] += "aktualizr-native:do_populate_sysroot ca-certificates-native:do_populate_sysroot" IMAGE_CMD_ostreepush () { # Print warnings if credetials are not set or if the file has not been found. if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then @@ -179,7 +179,7 @@ IMAGE_CMD_ostreepush () { } IMAGE_TYPEDEP_garagesign = "ostreepush" -IMAGE_DEPENDS_garagesign = "garage-sign-native:do_populate_sysroot" +do_image_ostreepush[depends] += "garage-sign-native:do_populate_sysroot" IMAGE_CMD_garagesign () { if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then # if credentials are issued by a server that doesn't support offline signing, exit silently diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 09c30ff..b15178a 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass @@ -11,7 +11,7 @@ inherit image OSTREE_BOOTLOADER ??= 'u-boot' -IMAGE_DEPENDS_otaimg = "e2fsprogs-native:do_populate_sysroot \ +do_image_otaimg[depends] += "e2fsprogs-native:do_populate_sysroot \ ${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER', True) == 'grub' else ''} \ ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot' else ''}" diff --git a/classes/sota_qemux86-64.bbclass b/classes/sota_qemux86-64.bbclass index 53e0026..666ad6b 100644 --- a/classes/sota_qemux86-64.bbclass +++ b/classes/sota_qemux86-64.bbclass @@ -4,7 +4,7 @@ PREFERRED_VERSION_linux-yocto_qemux86-64_sota = "4.4%" IMAGE_FSTYPES_remove = "wic" # U-Boot support for SOTA -PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot-ota" +PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot" UBOOT_MACHINE_sota = "qemu-x86_defconfig" OSTREE_BOOTLOADER ?= "u-boot" diff --git a/conf/include/bblayers/sota.inc b/conf/include/bblayers/sota.inc index 97edecb..b1fd28a 100644 --- a/conf/include/bblayers/sota.inc +++ b/conf/include/bblayers/sota.inc @@ -1,4 +1,3 @@ - BBLAYERS += "${METADIR}/meta-updater" BBLAYERS += "${METADIR}/meta-openembedded/meta-filesystems" BBLAYERS += "${METADIR}/meta-openembedded/meta-oe" 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 @@ - BBLAYERS += " ${METADIR}/meta-updater-qemux86-64 " 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 @@ -require recipes-bsp/u-boot/u-boot.inc - -HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome" -SECTION = "bootloaders" - -LICENSE = "GPLv2+" -LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6" -PE = "1" - -DEPENDS += "dtc-native" - -SRCREV = "5ea3e51fc481613a8dee8c02848d1b42c81ad892" -SRC_URI = "git://git.denx.de/u-boot.git" -S = "${WORKDIR}/git" - -PV = "v2016.11+git${SRCPV}" - -#This patch is not compliant with u-boot 2016.11 -#Version of u-boot from yocto 2.2 Morty is 2016.03 from: -# meta/recipes-bsp/u-boot/u-boot_2016.03.bb -SRC_URI_remove_raspberrypi3 = "file://0003-Include-lowlevel_init.o-for-rpi2.patch" -SRC_URI_remove_raspberrypi2 = "file://0003-Include-lowlevel_init.o-for-rpi2.patch" 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 @@ -PACKAGES_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)}" - -PACKAGES_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/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 import sys from wic.plugins.source.rawcopy import RawCopyPlugin -from wic.utils.misc import get_bitbake_var +from wic.misc import get_bitbake_var logger = logging.getLogger('wic') -- cgit v1.2.3-54-g00ecf From 2ca5e74b17a01f5b0697382157241c595539b44f Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Tue, 21 Nov 2017 11:26:53 +0100 Subject: Check if the package and UPTANE target got to the backend --- classes/image_types_ostree.bbclass | 17 ++++++++++++++--- classes/sota.bbclass | 2 +- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 172f2c8..db8cae6 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -183,7 +183,7 @@ IMAGE_DEPENDS_garagesign = "garage-sign-native:do_populate_sysroot" IMAGE_CMD_garagesign () { if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then # if credentials are issued by a server that doesn't support offline signing, exit silently - unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec 2>&1 >/dev/null || exit 0 + unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec repo.url 2>&1 >/dev/null || exit 0 java_version=$( java -version 2>&1 | awk -F '"' '/version/ {print $2}' ) if [ "${java_version}" = "" ]; then @@ -227,9 +227,20 @@ IMAGE_CMD_garagesign () { bberror "Couldn't push to garage repository" exit 1 fi - else - bbwarn "SOTA_PACKED_CREDENTIALS not set. Please add SOTA_PACKED_CREDENTIALS." fi } +IMAGE_TYPEDEP_garagecheck = "ostreepush garagesign" +IMAGE_DEPENDS_garagecheck = "aktualizr-native:do_populate_sysroot" +IMAGE_CMD_garagecheck () { + if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then + # if credentials are issued by a server that doesn't support offline signing, exit silently + unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec repo.url 2>&1 >/dev/null || exit 0 + ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) + + garage-check --ref=${ostree_target_hash} \ + --credentials=${SOTA_PACKED_CREDENTIALS} \ + --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt + fi +} # vim:set ts=4 sw=4 sts=4 expandtab: diff --git a/classes/sota.bbclass b/classes/sota.bbclass index f5a42c1..0f42332 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -11,7 +11,7 @@ SOTA_CLIENT ??= "aktualizr" SOTA_CLIENT_PROV ??= "aktualizr-auto-prov" IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" IMAGE_CLASSES += " image_types_ostree image_types_ota" -IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign otaimg wic', ' ', d)}" +IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign garagecheck otaimg wic', ' ', d)}" PACKAGECONFIG_append_pn-curl = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', " ssl", " ", d)}" PACKAGECONFIG_remove_pn-curl = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', " gnutls", " ", d)}" diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 162065e..3cd8a64 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -18,7 +18,7 @@ PR = "7" SRC_URI = " \ git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ " -SRCREV = "f043191ae622a96cf2f4d48f9073d5cfa9f16e3f" +SRCREV = "612da8cae6e72ce7250de2fb5333af0d7041de7b" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 253ba5f803615dd0c9213a68886ba4250cc4e3e1 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Wed, 22 Nov 2017 14:50:37 +0100 Subject: Rename repo.url -> tufrepo.url Also pass this URL to garage-sign --- classes/image_types_ostree.bbclass | 10 +++------- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index db8cae6..ea3c7a2 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -183,7 +183,7 @@ IMAGE_DEPENDS_garagesign = "garage-sign-native:do_populate_sysroot" IMAGE_CMD_garagesign () { if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then # if credentials are issued by a server that doesn't support offline signing, exit silently - unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec repo.url 2>&1 >/dev/null || exit 0 + unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 java_version=$( java -version 2>&1 | awk -F '"' '/version/ {print $2}' ) if [ "${java_version}" = "" ]; then @@ -198,11 +198,7 @@ IMAGE_CMD_garagesign () { garage-sign init --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --credentials ${SOTA_PACKED_CREDENTIALS} fi - if [ -n "${GARAGE_SIGN_REPOSERVER}" ]; then - reposerver_args="--reposerver ${GARAGE_SIGN_REPOSERVER}" - else - reposerver_args="" - fi + reposerver_args="--reposerver $( unzip -p ${SOTA_PACKED_CREDENTIALS} tufrepo.url )" ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) @@ -235,7 +231,7 @@ IMAGE_DEPENDS_garagecheck = "aktualizr-native:do_populate_sysroot" IMAGE_CMD_garagecheck () { if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then # if credentials are issued by a server that doesn't support offline signing, exit silently - unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec repo.url 2>&1 >/dev/null || exit 0 + unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) garage-check --ref=${ostree_target_hash} \ diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 3cd8a64..6c4b57c 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -18,7 +18,7 @@ PR = "7" SRC_URI = " \ git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ " -SRCREV = "612da8cae6e72ce7250de2fb5333af0d7041de7b" +SRCREV = "5c871180bc3c1f845d0e95e6f4876a581ed0f919" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From d3d3460abd0bbe67cd17db88f2c529435a95c609 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Fri, 24 Nov 2017 14:54:24 +0100 Subject: Bump aktualizr version for good Should fix PRO-4260 --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 6c4b57c..8b1b1ca 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -18,7 +18,7 @@ PR = "7" SRC_URI = " \ git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ " -SRCREV = "5c871180bc3c1f845d0e95e6f4876a581ed0f919" +SRCREV = "31d5954aaa16d1e1a14a1872b136e94ec4f79479" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 261f3f8f22cc366626fabc8a51e9a53d7589dc5b Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Mon, 27 Nov 2017 12:23:38 +0100 Subject: Actually do something with aktualizr-info. --- recipes-sota/aktualizr/aktualizr_git.bb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 8b1b1ca..de1c801 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -39,10 +39,12 @@ do_install_append_class-target () { } do_install_append_class-native () { rm -f ${D}${bindir}/aktualizr + rm -f ${D}${bindir}/aktualizr-info } FILES_${PN}_class-target = " \ ${bindir}/aktualizr \ + ${bindir}/aktualizr-info \ " FILES_${PN}_class-native = " \ ${bindir}/aktualizr_implicit_writer \ -- cgit v1.2.3-54-g00ecf From f110c624d682b50dfc40f64bf9973f2fad242dab Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Mon, 27 Nov 2017 12:24:52 +0100 Subject: Bump aktualizr version for C++98 standard fix. --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index de1c801..140a670 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -18,7 +18,7 @@ PR = "7" SRC_URI = " \ git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ " -SRCREV = "31d5954aaa16d1e1a14a1872b136e94ec4f79479" +SRCREV = "860553a1c98513bf43f6ce98491bf65addcf7e48" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 6f13bd2461f88f9658a3d94bffe9550d05fa5da4 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Tue, 28 Nov 2017 08:22:26 +0100 Subject: Fix builds outside the .repo directory The repo tool searches up the directory tree to find the .repo directory. Cleanly handle the case where it can't find anything. --- classes/image_repo_manifest.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/image_repo_manifest.bbclass b/classes/image_repo_manifest.bbclass index d508574..2012363 100644 --- a/classes/image_repo_manifest.bbclass +++ b/classes/image_repo_manifest.bbclass @@ -14,9 +14,9 @@ HOSTTOOLS_NONFATAL += " repo " # Write build information to target filesystem buildinfo () { if [ $(which repo) ]; then - repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml + repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml || echo "Android repo tool failed to run; manifest not copied" else - echo "Android repo tool not food; manifest not copied." + echo "Android repo tool not found; manifest not copied." fi } -- cgit v1.2.3-54-g00ecf From a212eae4a5878860917e93c9268a5e57d94d70f9 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Tue, 28 Nov 2017 10:46:07 +0100 Subject: Remove sdimg-rpi from IMAGE_FSTYPES The image is incompatible with meta-updater and we have our own --- classes/sota_raspberrypi.bbclass | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass index 51d07b2..f8e7347 100644 --- a/classes/sota_raspberrypi.bbclass +++ b/classes/sota_raspberrypi.bbclass @@ -3,6 +3,7 @@ PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" UBOOT_MACHINE_raspberrypi2_sota ?= "rpi_2_defconfig" UBOOT_MACHINE_raspberrypi3_sota ?= "rpi_3_32b_defconfig" +IMAGE_FSTYPES_remove_sota = "rpi-sdimg" OSTREE_BOOTLOADER ?= "u-boot" # OSTree puts its own boot.scr to bcm2835-bootfiles -- cgit v1.2.3-54-g00ecf From 7a973cbc775e4f384eeba1613eef71c74c687004 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 30 Nov 2017 14:39:40 +0100 Subject: Remove aktualizr-manual-provision.service We don't support this scenario any more and it makes testing more complicated. --- recipes-sota/aktualizr/aktualizr-auto-prov.bb | 7 +++---- recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb | 4 ++-- recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 4 ++-- .../aktualizr/files/aktualizr-autoprovision.service | 13 ------------- .../aktualizr/files/aktualizr-manual-provision.service | 13 ------------- recipes-sota/aktualizr/files/aktualizr.service | 13 +++++++++++++ 6 files changed, 20 insertions(+), 34 deletions(-) delete mode 100644 recipes-sota/aktualizr/files/aktualizr-autoprovision.service delete mode 100644 recipes-sota/aktualizr/files/aktualizr-manual-provision.service create mode 100644 recipes-sota/aktualizr/files/aktualizr.service diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb index 4f9fe4f..4436d48 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb @@ -11,8 +11,7 @@ PR = "6" SRC_URI = " \ file://LICENSE \ - file://aktualizr-manual-provision.service \ - file://aktualizr-autoprovision.service \ + file://aktualizr.service \ file://sota_autoprov.toml \ " @@ -38,7 +37,7 @@ do_install_append() { if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then install -d ${D}/${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service + install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service install -d ${D}${libdir}/sota install -m "0644" ${WORKDIR}/sota_autoprov.toml ${D}${libdir}/sota/sota.toml @@ -51,7 +50,7 @@ do_install_append() { fi else install -d ${D}/${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr-manual-provision.service ${D}/${systemd_unitdir}/system/aktualizr.service + install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service fi } diff --git a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb index c443c56..33e472b 100644 --- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb @@ -10,7 +10,7 @@ RDEPENDS_${PN} = "aktualizr softhsm softhsm-testtoken" SRC_URI = " \ file://LICENSE \ - file://aktualizr-autoprovision.service \ + file://aktualizr.service \ file://sota_hsm_test.toml \ " PV = "1.0" @@ -22,7 +22,7 @@ inherit systemd do_install() { install -d ${D}/${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service + install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service install -d ${D}${libdir}/sota aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ -i ${WORKDIR}/sota_hsm_test.toml -o ${D}${libdir}/sota/sota.toml -p ${D} diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb index 21e38c9..a1db87f 100644 --- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb @@ -11,7 +11,7 @@ PR = "1" SRC_URI = " \ file://LICENSE \ - file://aktualizr-autoprovision.service \ + file://aktualizr.service \ file://sota_implicit_prov.toml \ " @@ -21,7 +21,7 @@ inherit systemd do_install() { install -d ${D}/${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service + install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service install -d ${D}${libdir}/sota aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} \ -i ${WORKDIR}/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} 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 @@ -[Unit] -Description=Aktualizr SOTA Client -Wants=network-online.target -After=network.target network-online.target -Requires=network-online.target - -[Service] -RestartSec=10 -Restart=always -ExecStart=/usr/bin/aktualizr --config /usr/lib/sota/sota.toml - -[Install] -WantedBy=multi-user.target diff --git a/recipes-sota/aktualizr/files/aktualizr-manual-provision.service b/recipes-sota/aktualizr/files/aktualizr-manual-provision.service deleted file mode 100644 index a70f2f9..0000000 --- a/recipes-sota/aktualizr/files/aktualizr-manual-provision.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Aktualizr SOTA Client -Wants=network-online.target -After=network.target network-online.target -Requires=network-online.target - -[Service] -RestartSec=10 -Restart=always -ExecStart=/usr/bin/aktualizr --config /sysroot/boot/sota.toml --loglevel 2 - -[Install] -WantedBy=multi-user.target diff --git a/recipes-sota/aktualizr/files/aktualizr.service b/recipes-sota/aktualizr/files/aktualizr.service new file mode 100644 index 0000000..8cb8d78 --- /dev/null +++ b/recipes-sota/aktualizr/files/aktualizr.service @@ -0,0 +1,13 @@ +[Unit] +Description=Aktualizr SOTA Client +Wants=network-online.target +After=network.target network-online.target +Requires=network-online.target + +[Service] +RestartSec=10 +Restart=always +ExecStart=/usr/bin/aktualizr --config /usr/lib/sota/sota.toml + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3-54-g00ecf From fba014fd897e938a130d1229929839c7930bc671 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Fri, 1 Dec 2017 11:04:56 +0100 Subject: Add a hint when machine autodetection fails Also fix a pylint warning about indentation --- scripts/qemucommand.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index 82a9540..9a893d8 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py @@ -46,7 +46,7 @@ class QemuCommand(object): if len(machines) == 1: self.machine = machines[0] else: - raise ValueError("Could not autodetect machine type from %s" % args.dir) + raise ValueError("Could not autodetect machine type. More than one entry in %s. Maybe --machine qemux86-64?" % args.dir) if args.efi: self.bios = 'OVMF.fd' else: @@ -118,10 +118,9 @@ class QemuCommand(object): def img_command_line(self): cmdline = [ - "qemu-img", "create", - "-o", "backing_file=%s" % self.image, - "-f", "qcow2", - self.overlay] + "qemu-img", "create", + "-o", "backing_file=%s" % self.image, + "-f", "qcow2", + self.overlay] return cmdline - -- cgit v1.2.3-54-g00ecf From 4a8889661693ce23880c73c2e35e3112ea55f139 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Fri, 1 Dec 2017 16:29:24 +0100 Subject: Add spaces before "_append" clauses Under some conditions missing space can lead to a corrupted environment variable --- recipes-sota/aktualizr/aktualizr_git.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 140a670..d6beecb 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -28,8 +28,8 @@ inherit cmake BBCLASSEXTEND =+ "native" EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} " -EXTRA_OECMAKE_append_class-target = "-DBUILD_OSTREE=ON ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " -EXTRA_OECMAKE_append_class-native = "-DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF " +EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " +EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF " do_install_append () { rm -f ${D}${bindir}/aktualizr_cert_provider -- cgit v1.2.3-54-g00ecf From 0643f7204cf0fa34e513563772431c0e293074bc Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Mon, 4 Dec 2017 14:50:26 +0100 Subject: Provide user interface to add legacy secondary bridge --- recipes-sota/aktualizr/aktualizr-auto-prov.bb | 2 ++ recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb | 2 ++ recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 2 ++ recipes-sota/aktualizr/environment.inc | 10 ++++++++++ recipes-sota/aktualizr/files/aktualizr.service | 3 ++- 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 recipes-sota/aktualizr/environment.inc diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb index 4436d48..4a802f5 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb @@ -19,6 +19,8 @@ SYSTEMD_SERVICE_${PN} = "aktualizr.service" inherit systemd +require environment.inc + export SOTA_PACKED_CREDENTIALS do_install_append() { diff --git a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb index 33e472b..4761f25 100644 --- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb @@ -20,6 +20,8 @@ SYSTEMD_SERVICE_${PN} = "aktualizr.service" inherit systemd +require environment.inc + do_install() { install -d ${D}/${systemd_unitdir}/system install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb index a1db87f..ba8a16b 100644 --- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb @@ -19,6 +19,8 @@ SYSTEMD_SERVICE_${PN} = "aktualizr.service" inherit systemd +require environment.inc + do_install() { install -d ${D}/${systemd_unitdir}/system install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service diff --git a/recipes-sota/aktualizr/environment.inc b/recipes-sota/aktualizr/environment.inc new file mode 100644 index 0000000..a811508 --- /dev/null +++ b/recipes-sota/aktualizr/environment.inc @@ -0,0 +1,10 @@ +do_install_append() { + if [ -n "${SOTA_LEGACY_SECONDARY_INTERFACE}" ]; then + AKTUALIZR_PARAMETERS_LEGACYSEC="--legacy-interface ${SOTA_LEGACY_SECONDARY_INTERFACE}"; + fi + + AKTUALIZR_PARAMETERS_CONFIGFILE="--config /usr/lib/sota/sota.toml" + echo "AKTUALIZR_CMDLINE_PARAMETERS=${AKTUALIZR_PARAMETERS_CONFIGFILE} ${AKTUALIZR_PARAMETERS_LEGACYSEC}" > ${D}${libdir}/sota/sota.env +} + +FILES_${PN}_append = " ${libdir}/sota/sota.env" diff --git a/recipes-sota/aktualizr/files/aktualizr.service b/recipes-sota/aktualizr/files/aktualizr.service index 8cb8d78..b6df9d7 100644 --- a/recipes-sota/aktualizr/files/aktualizr.service +++ b/recipes-sota/aktualizr/files/aktualizr.service @@ -7,7 +7,8 @@ Requires=network-online.target [Service] RestartSec=10 Restart=always -ExecStart=/usr/bin/aktualizr --config /usr/lib/sota/sota.toml +EnvironmentFile=/usr/lib/sota/sota.env +ExecStart=/usr/bin/aktualizr $AKTUALIZR_CMDLINE_PARAMETERS [Install] WantedBy=multi-user.target -- cgit v1.2.3-54-g00ecf From 3e2f51ec1a3af07064ebdcd522310c9623f78ff0 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Mon, 4 Dec 2017 16:14:31 +0100 Subject: Add support for virtual secondaries --- recipes-sota/aktualizr/environment.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/environment.inc b/recipes-sota/aktualizr/environment.inc index a811508..cba77e7 100644 --- a/recipes-sota/aktualizr/environment.inc +++ b/recipes-sota/aktualizr/environment.inc @@ -1,10 +1,17 @@ +export SOTA_LEGACY_SECONDARY_INTERFACE +export SOTA_VIRTUAL_SECONDARIES + do_install_append() { if [ -n "${SOTA_LEGACY_SECONDARY_INTERFACE}" ]; then AKTUALIZR_PARAMETERS_LEGACYSEC="--legacy-interface ${SOTA_LEGACY_SECONDARY_INTERFACE}"; fi AKTUALIZR_PARAMETERS_CONFIGFILE="--config /usr/lib/sota/sota.toml" - echo "AKTUALIZR_CMDLINE_PARAMETERS=${AKTUALIZR_PARAMETERS_CONFIGFILE} ${AKTUALIZR_PARAMETERS_LEGACYSEC}" > ${D}${libdir}/sota/sota.env + for sec in ${SOTA_VIRTUAL_SECONDARIES}; do + AKTUALIZR_PARAMETERS_VIRTUALSECS="${AKTUALIZR_PARAMETERS_VIRTUALSECS} --secondary-config $sec" + done + + echo "AKTUALIZR_CMDLINE_PARAMETERS=${AKTUALIZR_PARAMETERS_CONFIGFILE} ${AKTUALIZR_PARAMETERS_LEGACYSEC} ${AKTUALIZR_PARAMETERS_VIRTUALSECS}" > ${D}${libdir}/sota/sota.env } FILES_${PN}_append = " ${libdir}/sota/sota.env" -- cgit v1.2.3-54-g00ecf From 85095e8dc9beda9a3c6e070bc303276ac02a7281 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 30 Nov 2017 10:41:38 +0100 Subject: Use *.toml files provided in aktualizr github repo This enables backwards incompatible changes to configuration format --- recipes-sota/aktualizr/aktualizr-auto-prov.bb | 5 ++--- recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb | 3 +-- recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 3 +-- recipes-sota/aktualizr/aktualizr_git.bb | 7 ++++++- recipes-sota/aktualizr/files/sota_autoprov.toml | 14 -------------- recipes-sota/aktualizr/files/sota_hsm_test.toml | 18 ------------------ recipes-sota/aktualizr/files/sota_implicit_prov.toml | 11 ----------- 7 files changed, 10 insertions(+), 51 deletions(-) delete mode 100644 recipes-sota/aktualizr/files/sota_autoprov.toml delete mode 100644 recipes-sota/aktualizr/files/sota_hsm_test.toml delete mode 100644 recipes-sota/aktualizr/files/sota_implicit_prov.toml diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb index 4436d48..e44530a 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb @@ -4,7 +4,7 @@ HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" SECTION = "base" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" -DEPENDS = "zip-native" +DEPENDS = "aktualizr-native zip-native" RDEPENDS_${PN} = "aktualizr" PV = "1.0" PR = "6" @@ -12,7 +12,6 @@ PR = "6" SRC_URI = " \ file://LICENSE \ file://aktualizr.service \ - file://sota_autoprov.toml \ " SYSTEMD_SERVICE_${PN} = "aktualizr.service" @@ -39,7 +38,7 @@ do_install_append() { install -d ${D}/${systemd_unitdir}/system install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service install -d ${D}${libdir}/sota - install -m "0644" ${WORKDIR}/sota_autoprov.toml ${D}${libdir}/sota/sota.toml + install -m "0644" ${STAGING_DIR_NATIVE}/${libdir}/sota/sota_autoprov.toml ${D}${libdir}/sota/sota.toml # deploy SOTA credentials if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then diff --git a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb index 33e472b..cc34528 100644 --- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb @@ -11,7 +11,6 @@ RDEPENDS_${PN} = "aktualizr softhsm softhsm-testtoken" SRC_URI = " \ file://LICENSE \ file://aktualizr.service \ - file://sota_hsm_test.toml \ " PV = "1.0" PR = "6" @@ -25,7 +24,7 @@ do_install() { install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service install -d ${D}${libdir}/sota aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ - -i ${WORKDIR}/sota_hsm_test.toml -o ${D}${libdir}/sota/sota.toml -p ${D} + -i ${STAGING_DIR_NATIVE}/${libdir}/sota/sota_hsm_test.toml -o ${D}${libdir}/sota/sota.toml -p ${D} } FILES_${PN} = " \ diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb index a1db87f..5688b95 100644 --- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb @@ -12,7 +12,6 @@ PR = "1" SRC_URI = " \ file://LICENSE \ file://aktualizr.service \ - file://sota_implicit_prov.toml \ " SYSTEMD_SERVICE_${PN} = "aktualizr.service" @@ -24,7 +23,7 @@ do_install() { install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service install -d ${D}${libdir}/sota aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} \ - -i ${WORKDIR}/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} + -i ${STAGING_DIR_NATIVE}/${libdir}/sota/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} } FILES_${PN} = " \ diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index d6beecb..e713571 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -18,7 +18,7 @@ PR = "7" SRC_URI = " \ git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ " -SRCREV = "860553a1c98513bf43f6ce98491bf65addcf7e48" +SRCREV = "1fb258b13547e229043113380e4a69d404756524" BRANCH ?= "master" S = "${WORKDIR}/git" @@ -40,6 +40,10 @@ do_install_append_class-target () { do_install_append_class-native () { rm -f ${D}${bindir}/aktualizr rm -f ${D}${bindir}/aktualizr-info + install -d ${D}${libdir}/sota + install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml + install -m 0644 ${S}/config/sota_hsm_test.toml ${D}/${libdir}/sota/sota_hsm_test.toml + install -m 0644 ${S}/config/sota_implicit_prov.toml ${D}/${libdir}/sota/sota_implicit_prov.toml } FILES_${PN}_class-target = " \ @@ -50,4 +54,5 @@ FILES_${PN}_class-native = " \ ${bindir}/aktualizr_implicit_writer \ ${bindir}/garage-deploy \ ${bindir}/garage-push \ + ${libdir}/sota/* \ " 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 @@ -[tls] -certificates_directory = "/var/sota/" -ca_file = "root.crt" -client_certificate = "client.pem" -pkey_file = "pkey.pem" - -[uptane] -metadata_path = "/var/sota/metadata" -private_key_path = "ecukey.der" -public_key_path = "ecukey.pub" - -[provision] -provision_path = "/var/sota/sota_provisioning_credentials.zip" - 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 @@ -[tls] -certificates_directory = "/var/sota/" -ca_file = "/var/sota/token/root.crt" -client_certificate = "01" -cert_source = "pkcs11" -pkey_file = "02" -pkey_source = "pkcs11" - -[p11] -module = "/usr/lib/softhsm/libsofthsm2.so" -pass = "1234" - -[uptane] -metadata_path = "/var/sota/metadata" -key_source = "pkcs11" -private_key_path = "03" -public_key_path = "03" - 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 @@ -[tls] -certificates_directory = "/var/sota/" -ca_file = "/usr/lib/sota/root.crt" -client_certificate = "client.pem" -pkey_file = "pkey.pem" - -[uptane] -metadata_path = "/var/sota/metadata" -private_key_path = "ecukey.der" -public_key_path = "ecukey.pub" - -- cgit v1.2.3-54-g00ecf From 2475cbb2939568f36320d1a130ee1a7202351ad4 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 5 Dec 2017 16:48:19 +0100 Subject: Fix erroneous do_install_append that should just be do_install. --- recipes-sota/aktualizr/aktualizr-auto-prov.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb index 4a802f5..51c2873 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb @@ -23,7 +23,7 @@ require environment.inc export SOTA_PACKED_CREDENTIALS -do_install_append() { +do_install() { if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then bbwarn "SOTA_AUTOPROVISION_CREDENTIALS are ignored. Please use SOTA_PACKED_CREDENTIALS" fi -- cgit v1.2.3-54-g00ecf From c7cc719de50d16f7edd625c15d68a2938f93d1bf Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 5 Dec 2017 17:00:41 +0100 Subject: Fix garage-sign targets add. --- classes/image_types_ostree.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index ea3c7a2..56a9720 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -207,7 +207,7 @@ IMAGE_CMD_garagesign () { push_success=0 for push_retries in $( seq 3 ); do garage-sign targets pull --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} ${reposerver_args} - 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} + garage-sign targets add --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --name ${OSTREE_BRANCHNAME} --format OSTREE --version ${ostree_target_hash} --length 0 --url "https://example.com/" --sha256 ${ostree_target_hash} --hardwareids ${MACHINE} garage-sign targets sign --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --key-name=targets errcode=0 garage-sign targets push --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} ${reposerver_args} || errcode=$? -- cgit v1.2.3-54-g00ecf From 9948edf252ba57f7386d647884f9c50d4f31310e Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Tue, 5 Dec 2017 18:42:23 +0100 Subject: Always create /usr/lib/sota in autoprov recipe The directory is required by environment.inc --- recipes-sota/aktualizr/aktualizr-auto-prov.bb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb index 6588c20..dd23c06 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb @@ -36,15 +36,15 @@ do_install() { bbwarn "OSTREE_PUSH_CREDENTIALS is ignored. Please use SOTA_PACKED_CREDENTIALS" fi + install -d ${D}${libdir}/sota + install -d ${D}${localstatedir}/sota if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then install -d ${D}/${systemd_unitdir}/system install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service - install -d ${D}${libdir}/sota install -m "0644" ${STAGING_DIR_NATIVE}/${libdir}/sota/sota_autoprov.toml ${D}${libdir}/sota/sota.toml # deploy SOTA credentials if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then - mkdir -p ${D}/var/sota cp ${SOTA_PACKED_CREDENTIALS} ${D}/var/sota/sota_provisioning_credentials.zip # Device should not be able to push data to treehub zip -d ${D}/var/sota/sota_provisioning_credentials.zip treehub.json @@ -58,5 +58,5 @@ do_install() { FILES_${PN} = " \ ${systemd_unitdir}/system/aktualizr.service \ ${libdir}/sota/sota.toml \ - /var/sota/sota_provisioning_credentials.zip \ + ${localstatedir}/sota/sota_provisioning_credentials.zip \ " -- cgit v1.2.3-54-g00ecf From e8fac2d3727c9e7b4f554f359ab5704e785cb1ac Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Wed, 6 Dec 2017 10:44:49 +0100 Subject: Bump garage-sign --- recipes-sota/garage-sign/garage-sign.bb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes-sota/garage-sign/garage-sign.bb b/recipes-sota/garage-sign/garage-sign.bb index d5388bc..61c4b5a 100644 --- a/recipes-sota/garage-sign/garage-sign.bb +++ b/recipes-sota/garage-sign/garage-sign.bb @@ -6,14 +6,14 @@ LICENSE = "CLOSED" LIC_FILES_CHKSUM = "file://${S}/docs/LICENSE;md5=3025e77db7bd3f1d616b3ffd11d54c94" DEPENDS = "" -PV = "0.2.0-35-g0544c33" +PV = "0.2.0-48-g7ee8146" SRC_URI = " \ https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${PV}.tgz \ " -SRC_URI[md5sum] = "1546e06d1e747f67aee5ed7096bf1c74" -SRC_URI[sha256sum] = "1432348bca8ca5ad75df1218f348f480d429d7509d6454deb6e16ff31c5e08fc" +SRC_URI[md5sum] = "0691f36c5b58acc1ca9c23ffbfaae1f3" +SRC_URI[sha256sum] = "9f230944643088a1e6a77663baa06dfa64d52885e66bd48a7cb1ed1c70936cfa" S = "${WORKDIR}/${BPN}" -- cgit v1.2.3-54-g00ecf From 061ac69fbfc8416ea7d4ce4833a84393daf8145d Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Wed, 6 Dec 2017 14:56:50 +0100 Subject: Install /var/sota. If not using SOTA_PROVISIONING_CREDENTIALS, nothing is written to /var/sota but it is still created. Quick fix: install it. --- recipes-sota/aktualizr/aktualizr-auto-prov.bb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb index dd23c06..cee5039 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb @@ -39,9 +39,7 @@ do_install() { install -d ${D}${libdir}/sota install -d ${D}${localstatedir}/sota if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then - install -d ${D}/${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service - install -m "0644" ${STAGING_DIR_NATIVE}/${libdir}/sota/sota_autoprov.toml ${D}${libdir}/sota/sota.toml + install -m 0644 ${STAGING_DIR_NATIVE}/${libdir}/sota/sota_autoprov.toml ${D}${libdir}/sota/sota.toml # deploy SOTA credentials if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then @@ -49,14 +47,14 @@ do_install() { # Device should not be able to push data to treehub zip -d ${D}/var/sota/sota_provisioning_credentials.zip treehub.json fi - else - install -d ${D}/${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service fi + install -d ${D}/${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service } FILES_${PN} = " \ ${systemd_unitdir}/system/aktualizr.service \ ${libdir}/sota/sota.toml \ + ${localstatedir}/sota \ ${localstatedir}/sota/sota_provisioning_credentials.zip \ " -- cgit v1.2.3-54-g00ecf From 9ba47ed5058d525c575905caa937c1eca190f7b2 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 7 Dec 2017 10:43:08 +0100 Subject: Deploy OSTree image without a branch name --- classes/image_types_ota.bbclass | 6 ++++-- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 09c30ff..5dc4811 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass @@ -85,14 +85,16 @@ IMAGE_CMD_otaimg () { bberror "Invalid bootloader: ${OSTREE_BOOTLOADER}" fi; - ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${OSTREE_BRANCHNAME} + ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) + + ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash} export OSTREE_BOOT_PARTITION="/boot" kargs_list="" for arg in ${OSTREE_KERNEL_ARGS}; do kargs_list="${kargs_list} --karg-append=$arg" done - ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_BRANCHNAME} + ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${ostree_target_hash} # Copy deployment /home and /var/sota to sysroot HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX` diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index e713571..44af1f6 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -18,7 +18,7 @@ PR = "7" SRC_URI = " \ git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ " -SRCREV = "1fb258b13547e229043113380e4a69d404756524" +SRCREV = "57e9cdb8aa1e8ee9e682628bd67031d9be7aaafa" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From c99f5e78eaddc41904ebd6e2b15214b4fd4e5a91 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Wed, 6 Dec 2017 09:20:27 +0100 Subject: Minor fixes and cleanup. * hsm-test is no longer used. * Use Yocto variables where suitable. * Eliminate redundant directory slashes. --- lib/oeqa/selftest/updater.py | 2 +- recipes-sota/aktualizr/aktualizr-auto-prov.bb | 8 ++++---- recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb | 6 +++--- recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 6 +++--- recipes-sota/garage-sign/garage-sign.bb | 7 +++---- recipes-support/ca-certificates/ca-certificates_%.bbappend | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index e3d4fc3..c07b154 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -51,7 +51,7 @@ class GarageSignTests(oeSelfTest): class HsmTests(oeSelfTest): def test_hsm(self): - self.write_config('SOTA_CLIENT_FEATURES="hsm hsm-test"') + self.write_config('SOTA_CLIENT_FEATURES="hsm"') bitbake('core-image-minimal') diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb index cee5039..f05bf75 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb @@ -43,13 +43,13 @@ do_install() { # deploy SOTA credentials if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then - cp ${SOTA_PACKED_CREDENTIALS} ${D}/var/sota/sota_provisioning_credentials.zip + cp ${SOTA_PACKED_CREDENTIALS} ${D}${localstatedir}/sota/sota_provisioning_credentials.zip # Device should not be able to push data to treehub - zip -d ${D}/var/sota/sota_provisioning_credentials.zip treehub.json + zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip treehub.json fi fi - install -d ${D}/${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/aktualizr.service ${D}${systemd_unitdir}/system/aktualizr.service } FILES_${PN} = " \ diff --git a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb index ddc8dbf..e0a8efe 100644 --- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb @@ -22,11 +22,11 @@ inherit systemd require environment.inc do_install() { - install -d ${D}/${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/aktualizr.service ${D}${systemd_unitdir}/system/aktualizr.service install -d ${D}${libdir}/sota aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ - -i ${STAGING_DIR_NATIVE}/${libdir}/sota/sota_hsm_test.toml -o ${D}${libdir}/sota/sota.toml -p ${D} + -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_hsm_test.toml -o ${D}${libdir}/sota/sota.toml -p ${D} } FILES_${PN} = " \ diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb index 37d0e91..5ce55e0 100644 --- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb @@ -21,11 +21,11 @@ inherit systemd require environment.inc do_install() { - install -d ${D}/${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr.service ${D}/${systemd_unitdir}/system/aktualizr.service + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/aktualizr.service ${D}${systemd_unitdir}/system/aktualizr.service install -d ${D}${libdir}/sota aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} \ - -i ${STAGING_DIR_NATIVE}/${libdir}/sota/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} + -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} } FILES_${PN} = " \ diff --git a/recipes-sota/garage-sign/garage-sign.bb b/recipes-sota/garage-sign/garage-sign.bb index 61c4b5a..7057a57 100644 --- a/recipes-sota/garage-sign/garage-sign.bb +++ b/recipes-sota/garage-sign/garage-sign.bb @@ -27,8 +27,7 @@ do_install() { } FILES_${PN} = " \ - /usr/bin \ - /usr/bin/garage-sign.bat \ - /usr/bin/garage-sign \ - /usr/lib/* \ + ${bindir}/garage-sign.bat \ + ${bindir}/garage-sign \ + ${libdir}/* \ " 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}" -- cgit v1.2.3-54-g00ecf From 76c065bf34a767a5ca797d762735c0a980d5b35a Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 7 Dec 2017 14:02:17 +0100 Subject: Consistent indents. OE standard is apparently four spaces. --- recipes-sota/aktualizr/aktualizr-auto-prov.bb | 18 ++++++++++-------- recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb | 2 ++ recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 2 ++ recipes-sota/aktualizr/aktualizr_git.bb | 2 ++ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb index f05bf75..43b23f9 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb @@ -39,14 +39,14 @@ do_install() { install -d ${D}${libdir}/sota install -d ${D}${localstatedir}/sota if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then - install -m 0644 ${STAGING_DIR_NATIVE}/${libdir}/sota/sota_autoprov.toml ${D}${libdir}/sota/sota.toml - - # deploy SOTA credentials - if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then - cp ${SOTA_PACKED_CREDENTIALS} ${D}${localstatedir}/sota/sota_provisioning_credentials.zip - # Device should not be able to push data to treehub - zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip treehub.json - fi + install -m 0644 ${STAGING_DIR_NATIVE}${libdir}/sota/sota_autoprov.toml ${D}${libdir}/sota/sota.toml + + # deploy SOTA credentials + if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then + cp ${SOTA_PACKED_CREDENTIALS} ${D}${localstatedir}/sota/sota_provisioning_credentials.zip + # Device should not be able to push data to treehub + zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip treehub.json + fi fi install -d ${D}${systemd_unitdir}/system install -m 0644 ${WORKDIR}/aktualizr.service ${D}${systemd_unitdir}/system/aktualizr.service @@ -58,3 +58,5 @@ FILES_${PN} = " \ ${localstatedir}/sota \ ${localstatedir}/sota/sota_provisioning_credentials.zip \ " + +# 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 index e0a8efe..b1b2bff 100644 --- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb @@ -33,3 +33,5 @@ FILES_${PN} = " \ ${systemd_unitdir}/system/aktualizr.service \ ${libdir}/sota/sota.toml \ " + +# vim:set ts=4 sw=4 sts=4 expandtab: diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb index 5ce55e0..f73829d 100644 --- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb @@ -33,3 +33,5 @@ FILES_${PN} = " \ ${libdir}/sota/sota.toml \ ${libdir}/sota/root.crt \ " + +# 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 44af1f6..457abfd 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -56,3 +56,5 @@ FILES_${PN}_class-native = " \ ${bindir}/garage-push \ ${libdir}/sota/* \ " + +# vim:set ts=4 sw=4 sts=4 expandtab: -- cgit v1.2.3-54-g00ecf From d64e6f3f1367786c9c3cf77dc5a288259bfb28b6 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Mon, 11 Dec 2017 16:28:31 +0100 Subject: Rerun provisioning recipes when credentials have changed Signed-off-by: Anton Gerasimov --- recipes-sota/aktualizr/aktualizr-auto-prov.bb | 1 + recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb | 1 + recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 1 + recipes-sota/aktualizr/credentials.inc | 1 + 4 files changed, 4 insertions(+) create mode 100644 recipes-sota/aktualizr/credentials.inc diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb index 43b23f9..c97cbb8 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb @@ -19,6 +19,7 @@ SYSTEMD_SERVICE_${PN} = "aktualizr.service" inherit systemd require environment.inc +require credentials.inc export SOTA_PACKED_CREDENTIALS diff --git a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb index b1b2bff..8779c67 100644 --- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb @@ -20,6 +20,7 @@ SYSTEMD_SERVICE_${PN} = "aktualizr.service" inherit systemd require environment.inc +require credentials.inc do_install() { install -d ${D}${systemd_unitdir}/system diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb index f73829d..c8f0741 100644 --- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb @@ -19,6 +19,7 @@ SYSTEMD_SERVICE_${PN} = "aktualizr.service" inherit systemd require environment.inc +require credentials.inc do_install() { install -d ${D}${systemd_unitdir}/system diff --git a/recipes-sota/aktualizr/credentials.inc b/recipes-sota/aktualizr/credentials.inc new file mode 100644 index 0000000..fe09550 --- /dev/null +++ b/recipes-sota/aktualizr/credentials.inc @@ -0,0 +1 @@ +SRC_URI_append = "${@'file://${SOTA_PACKED_CREDENTIALS}' if d.getVar('SOTA_PACKED_CREDENTIALS', True) else ' '}" -- cgit v1.2.3-54-g00ecf From 599c048c03d3cd454270dc729e8ad746497588b2 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 7 Dec 2017 11:31:08 +0100 Subject: Properly install example-interface on target and remove it on host. --- recipes-sota/aktualizr/aktualizr_git.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 457abfd..fc65c51 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -18,7 +18,7 @@ PR = "7" SRC_URI = " \ git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ " -SRCREV = "57e9cdb8aa1e8ee9e682628bd67031d9be7aaafa" +SRCREV = "5bf2975aee4af667a1af17381bf68c34a00f03a3" BRANCH ?= "master" S = "${WORKDIR}/git" @@ -40,6 +40,7 @@ do_install_append_class-target () { do_install_append_class-native () { rm -f ${D}${bindir}/aktualizr rm -f ${D}${bindir}/aktualizr-info + rm -f ${D}${bindir}/example-interface install -d ${D}${libdir}/sota install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml install -m 0644 ${S}/config/sota_hsm_test.toml ${D}/${libdir}/sota/sota_hsm_test.toml @@ -49,6 +50,7 @@ do_install_append_class-native () { FILES_${PN}_class-target = " \ ${bindir}/aktualizr \ ${bindir}/aktualizr-info \ + ${bindir}/example-interface \ " FILES_${PN}_class-native = " \ ${bindir}/aktualizr_implicit_writer \ -- cgit v1.2.3-54-g00ecf From 36c032b7972c42f6f31aeaf8c1dae6c9ce667194 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Fri, 8 Dec 2017 12:08:11 +0100 Subject: Only install example-interface if explicitly asked for. To do so, use this in local.conf: SOTA_CLIENT_FEATURES = "secondary-example" --- recipes-sota/aktualizr/aktualizr_git.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index fc65c51..e4ffc5a 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -36,6 +36,7 @@ do_install_append () { } do_install_append_class-target () { rm -f ${D}${bindir}/aktualizr_implicit_writer + ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', '', 'rm -f ${D}${bindir}/example-interface', d)} } do_install_append_class-native () { rm -f ${D}${bindir}/aktualizr @@ -50,8 +51,8 @@ do_install_append_class-native () { FILES_${PN}_class-target = " \ ${bindir}/aktualizr \ ${bindir}/aktualizr-info \ - ${bindir}/example-interface \ " +FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', '${bindir}/example-interface', '', d)} " FILES_${PN}_class-native = " \ ${bindir}/aktualizr_implicit_writer \ ${bindir}/garage-deploy \ -- cgit v1.2.3-54-g00ecf From cbad4a92fd9f6a0de74085d588c01be48ea449a0 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Wed, 13 Dec 2017 10:53:15 +0100 Subject: Bump to latest garage-sign. --- recipes-sota/garage-sign/garage-sign.bb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes-sota/garage-sign/garage-sign.bb b/recipes-sota/garage-sign/garage-sign.bb index 7057a57..32dda47 100644 --- a/recipes-sota/garage-sign/garage-sign.bb +++ b/recipes-sota/garage-sign/garage-sign.bb @@ -6,14 +6,14 @@ LICENSE = "CLOSED" LIC_FILES_CHKSUM = "file://${S}/docs/LICENSE;md5=3025e77db7bd3f1d616b3ffd11d54c94" DEPENDS = "" -PV = "0.2.0-48-g7ee8146" +PV = "0.2.0-57-g3f86c67" SRC_URI = " \ https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${PV}.tgz \ " -SRC_URI[md5sum] = "0691f36c5b58acc1ca9c23ffbfaae1f3" -SRC_URI[sha256sum] = "9f230944643088a1e6a77663baa06dfa64d52885e66bd48a7cb1ed1c70936cfa" +SRC_URI[md5sum] = "5bbe080c0c3a80928b8856d2076dd49a" +SRC_URI[sha256sum] = "f653d24172ed245a6256b2f341a9b77bddf624cd6bbda574c1a85430e3155394" S = "${WORKDIR}/${BPN}" -- cgit v1.2.3-54-g00ecf From 1838969e3b238baa1c2886a4f7f27163bc36b488 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Wed, 13 Dec 2017 14:18:04 +0100 Subject: Fix variable expansion problem when SOTA_PACKED_CREDENTIALS is not set. Reported by Stevan, traced to the problem by me, actually fixed by Anton. --- recipes-sota/aktualizr/credentials.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/credentials.inc b/recipes-sota/aktualizr/credentials.inc index fe09550..256c8ff 100644 --- a/recipes-sota/aktualizr/credentials.inc +++ b/recipes-sota/aktualizr/credentials.inc @@ -1 +1 @@ -SRC_URI_append = "${@'file://${SOTA_PACKED_CREDENTIALS}' if d.getVar('SOTA_PACKED_CREDENTIALS', True) else ' '}" +SRC_URI_append = "${@('file://' + d.getVar('SOTA_PACKED_CREDENTIALS', True)) if d.getVar('SOTA_PACKED_CREDENTIALS', True) else ''}" -- cgit v1.2.3-54-g00ecf From a2662b5ddfda86abfae19aec3aaf1a7c7614613f Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Wed, 13 Dec 2017 14:59:19 +0100 Subject: Don't run implicit_writer if SOTA_PACKED_CREDENTIALS is not set. This basically cripples implicit provisioning but at least it bitbakes without error. --- recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb index c8f0741..67bd2c2 100644 --- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb @@ -25,8 +25,10 @@ do_install() { install -d ${D}${systemd_unitdir}/system install -m 0644 ${WORKDIR}/aktualizr.service ${D}${systemd_unitdir}/system/aktualizr.service install -d ${D}${libdir}/sota - aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} \ - -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} + if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then + aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} \ + -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} + fi } FILES_${PN} = " \ -- cgit v1.2.3-54-g00ecf From ff2e2c18c26b92a7a2aee4f76bcf476c44e1e1a5 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Wed, 13 Dec 2017 17:33:04 +0100 Subject: Port fix for non-repo use-case from pyro --- classes/image_repo_manifest.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/image_repo_manifest.bbclass b/classes/image_repo_manifest.bbclass index d508574..7f41a97 100644 --- a/classes/image_repo_manifest.bbclass +++ b/classes/image_repo_manifest.bbclass @@ -14,9 +14,9 @@ HOSTTOOLS_NONFATAL += " repo " # Write build information to target filesystem buildinfo () { if [ $(which repo) ]; then - repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml + repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml || bbwarn "Android repo tool failed to run; manifest not copied" else - echo "Android repo tool not food; manifest not copied." + bbwarn "Android repo tool not food; manifest not copied." fi } -- cgit v1.2.3-54-g00ecf From 037d091061bbb98ee41ee53270889ba0e9ebd8d1 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Fri, 15 Dec 2017 12:07:17 +0100 Subject: Update documentation, specifically about variables to support secondaries. Also add a missing mkdir so that SOTA_SECONDARY_ECUS actually works. We can improve this in the future but for now it works and I'm using it. --- README.adoc | 21 ++++++++++++--------- classes/image_types_ostree.bbclass | 1 + 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.adoc b/README.adoc index b4608d5..7b4cf2b 100644 --- a/README.adoc +++ b/README.adoc @@ -1,10 +1,10 @@ = meta-updater -This 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]. +This layer enables over-the-air updates (OTA) with https://github.com/ostreedev/ostree[OSTree] and https://github.com/advancedtelematic/aktualizr[Aktualizr]. https://github.com/ostreedev/ostree[OSTree] is a tool for atomic full file system upgrades with rollback capability. OSTree has several advantages over traditional dual-bank systems, but the most important one is that it minimizes network bandwidth and data storage footprint by sharing files with the same contents across file system deployments. -https://github.com/advancedtelematic/rvi_sota_client[RVI SOTA client] and/or https://github.com/advancedtelematic/aktualizr[aktualizr] add authentication and provisioning capabilities to OTA and are integrated with OSTree. You can connect with the open-source https://github.com/advancedtelematic/rvi_sota_server[RVI SOTA server] or sign up for a free account at https://app.atsgarage.com[ATS Garage] to get started. +https://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. == Build @@ -22,8 +22,6 @@ If you already have a Yocto-based project and you want to add atomic filesystem You 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 <>. -=== Build with OpenIVI - === Build in AGL With AGL you can just add agl-sota feature while configuring your build environment: @@ -67,11 +65,16 @@ Although we have used U-Boot so far, other boot loaders can be configured work w == SOTA-related variables in local.conf -* OSTREE_REPO - path to your OSTree repository. Defaults to "$\{DEPLOY_DIR_IMAGE}/ostree_repo" -* OSTREE_BRANCHNAME - the branch your rootfs will be committed to. Defaults to "ota" -* 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". -* 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. -* 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]. +* `OSTREE_REPO` - path to your OSTree repository. Defaults to `$\{DEPLOY_DIR_IMAGE}/ostree_repo` +* `OSTREE_BRANCHNAME` - the branch your rootfs will be committed to. Defaults to the same value as `MACHINE`. +* `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". +* `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. +* `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]. +* `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-test-prov`. The default is `aktualizr-auto-prov`. This can also be set to an empty string to avoid using a provisioning recipe. +* `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). +* `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"`. +* `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. +* `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`. == Usage diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 56a9720..a20a135 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -119,6 +119,7 @@ IMAGE_CMD_ostree () { fi if [ -n "${SOTA_SECONDARY_ECUS}" ]; then + mkdir -p var/sota/ecus cp ${SOTA_SECONDARY_ECUS} var/sota/ecus fi -- cgit v1.2.3-54-g00ecf From 1e3db15064a942144a87df7864f47317dea97482 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Fri, 15 Dec 2017 16:54:29 +0100 Subject: Add MIT license to recipe metadata Many other Yocto layers are alse under the MIT license, so this matches what people will likely expect. For example meta-rust, meta-ti, meta-raspberrypi are all MIT licensed. --- COPYING.MIT | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 COPYING.MIT diff --git a/COPYING.MIT b/COPYING.MIT new file mode 100644 index 0000000..fb950dc --- /dev/null +++ b/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. -- cgit v1.2.3-54-g00ecf From 6630a83d1292bb96a531208b7c52aa1744c54f79 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Wed, 13 Dec 2017 15:30:03 +0100 Subject: Fixes for Spekulatius - New garage-sign interface - Remove garage-sign recipe (now installed with aktualizr-native) - Small but critical bugfixes in aktualizr --- classes/image_repo_manifest.bbclass | 4 +-- classes/image_types_ostree.bbclass | 13 ++++----- classes/sota.bbclass | 4 +-- lib/oeqa/selftest/updater.py | 14 ++-------- recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 2 +- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- recipes-sota/garage-sign/garage-sign.bb | 33 ----------------------- 7 files changed, 13 insertions(+), 59 deletions(-) delete mode 100644 recipes-sota/garage-sign/garage-sign.bb diff --git a/classes/image_repo_manifest.bbclass b/classes/image_repo_manifest.bbclass index 2012363..467fd9a 100644 --- a/classes/image_repo_manifest.bbclass +++ b/classes/image_repo_manifest.bbclass @@ -14,9 +14,9 @@ HOSTTOOLS_NONFATAL += " repo " # Write build information to target filesystem buildinfo () { if [ $(which repo) ]; then - repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml || echo "Android repo tool failed to run; manifest not copied" + repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml || bbwarn "Android repo tool failed to run; manifest not copied" else - echo "Android repo tool not found; manifest not copied." + bbwarn "Android repo tool not found; manifest not copied." fi } diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 56a9720..05db62a 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -179,7 +179,7 @@ IMAGE_CMD_ostreepush () { } IMAGE_TYPEDEP_garagesign = "ostreepush" -IMAGE_DEPENDS_garagesign = "garage-sign-native:do_populate_sysroot" +IMAGE_DEPENDS_garagesign = "aktualizr-native:do_populate_sysroot" IMAGE_CMD_garagesign () { if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then # if credentials are issued by a server that doesn't support offline signing, exit silently @@ -194,11 +194,8 @@ IMAGE_CMD_garagesign () { exit 1 fi - if [ ! -d "${GARAGE_SIGN_REPO}" ]; then - garage-sign init --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --credentials ${SOTA_PACKED_CREDENTIALS} - fi - - reposerver_args="--reposerver $( unzip -p ${SOTA_PACKED_CREDENTIALS} tufrepo.url )" + rm -rf ${GARAGE_SIGN_REPO} + garage-sign init --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --credentials ${SOTA_PACKED_CREDENTIALS} ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) @@ -206,11 +203,11 @@ IMAGE_CMD_garagesign () { # in which case targets.json should be pulled again and the whole procedure repeated push_success=0 for push_retries in $( seq 3 ); do - garage-sign targets pull --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} ${reposerver_args} + garage-sign targets pull --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} garage-sign targets add --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --name ${OSTREE_BRANCHNAME} --format OSTREE --version ${ostree_target_hash} --length 0 --url "https://example.com/" --sha256 ${ostree_target_hash} --hardwareids ${MACHINE} garage-sign targets sign --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --key-name=targets errcode=0 - garage-sign targets push --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} ${reposerver_args} || errcode=$? + garage-sign targets push --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} || errcode=$? if [ "$errcode" -eq "0" ]; then push_success=1 break diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 0f42332..bbb9ac9 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -13,8 +13,8 @@ IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PRO IMAGE_CLASSES += " image_types_ostree image_types_ota" IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign garagecheck otaimg wic', ' ', d)}" -PACKAGECONFIG_append_pn-curl = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', " ssl", " ", d)}" -PACKAGECONFIG_remove_pn-curl = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', " gnutls", " ", d)}" +PACKAGECONFIG_append_pn-curl = " ssl" +PACKAGECONFIG_remove_pn-curl = "gnutls" WKS_FILE_sota ?= "sdimage-sota.wks" diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index c07b154..f28349f 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -31,23 +31,13 @@ class SotaToolsTests(oeSelfTest): result = runCmd('%s --help' % p, ignore_status=True) self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - -class GarageSignTests(oeSelfTest): - - @classmethod - def setUpClass(cls): - logger = logging.getLogger("selftest") - logger.info('Running bitbake to build garage-sign-native') - bitbake('garage-sign-native') - - def test_help(self): - bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'garage-sign-native') + def test_garagesign_help(self): + bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-sign" self.assertTrue(os.path.isfile(p), msg = "No garage-sign found (%s)" % p) result = runCmd('%s --help' % p, ignore_status=True) self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - class HsmTests(oeSelfTest): def test_hsm(self): diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb index 67bd2c2..e5d9c9b 100644 --- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb @@ -27,7 +27,7 @@ do_install() { install -d ${D}${libdir}/sota if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} \ - -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} + -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} --no-root-ca fi } diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index e4ffc5a..08aa6c2 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -18,7 +18,7 @@ PR = "7" SRC_URI = " \ git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ " -SRCREV = "5bf2975aee4af667a1af17381bf68c34a00f03a3" +SRCREV = "eb6c0b43c2b8b32f66f228c1c3f590b5c16ad448" BRANCH ?= "master" S = "${WORKDIR}/git" diff --git a/recipes-sota/garage-sign/garage-sign.bb b/recipes-sota/garage-sign/garage-sign.bb deleted file mode 100644 index 32dda47..0000000 --- a/recipes-sota/garage-sign/garage-sign.bb +++ /dev/null @@ -1,33 +0,0 @@ -SUMMARY = "garage-sign" -DESCRIPTION = "Metadata signing tool for ATS Garage" -HOMEPAGE = "https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/index.html" -SECTION = "base" -LICENSE = "CLOSED" -LIC_FILES_CHKSUM = "file://${S}/docs/LICENSE;md5=3025e77db7bd3f1d616b3ffd11d54c94" -DEPENDS = "" - -PV = "0.2.0-57-g3f86c67" - -SRC_URI = " \ - https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${PV}.tgz \ - " - -SRC_URI[md5sum] = "5bbe080c0c3a80928b8856d2076dd49a" -SRC_URI[sha256sum] = "f653d24172ed245a6256b2f341a9b77bddf624cd6bbda574c1a85430e3155394" - -S = "${WORKDIR}/${BPN}" - -BBCLASSEXTEND =+ "native" - -do_install() { - install -d ${D}${bindir} - install -m "0755" -t ${D}${bindir} ${S}/bin/* - install -d ${D}${libdir} - install -m "0644" -t ${D}${libdir} ${S}/lib/* -} - -FILES_${PN} = " \ - ${bindir}/garage-sign.bat \ - ${bindir}/garage-sign \ - ${libdir}/* \ - " -- cgit v1.2.3-54-g00ecf From af9c7323bf45708230299d7ee1c64da2c7dbf116 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Thu, 21 Dec 2017 23:50:08 +0200 Subject: sota_qemux86-64.bbclass: Use u-boot-ota Use u-boot-ota recipe for QEMU x86-64 bootloader. Signed-off-by: Leon Anavi --- classes/sota_qemux86-64.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/sota_qemux86-64.bbclass b/classes/sota_qemux86-64.bbclass index 666ad6b..53e0026 100644 --- a/classes/sota_qemux86-64.bbclass +++ b/classes/sota_qemux86-64.bbclass @@ -4,7 +4,7 @@ PREFERRED_VERSION_linux-yocto_qemux86-64_sota = "4.4%" IMAGE_FSTYPES_remove = "wic" # U-Boot support for SOTA -PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot" +PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot-ota" UBOOT_MACHINE_sota = "qemu-x86_defconfig" OSTREE_BOOTLOADER ?= "u-boot" -- cgit v1.2.3-54-g00ecf From aca234ac228c5a3a01f02cd1feea29ed4e552fe4 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Thu, 4 Jan 2018 11:37:07 +0100 Subject: Remove OSTREE_BRANCHNAME mention in README Not relevant to the user, as per PRO-4483 --- README.adoc | 1 - 1 file changed, 1 deletion(-) diff --git a/README.adoc b/README.adoc index 7b4cf2b..0917e45 100644 --- a/README.adoc +++ b/README.adoc @@ -66,7 +66,6 @@ Although we have used U-Boot so far, other boot loaders can be configured work w == SOTA-related variables in local.conf * `OSTREE_REPO` - path to your OSTree repository. Defaults to `$\{DEPLOY_DIR_IMAGE}/ostree_repo` -* `OSTREE_BRANCHNAME` - the branch your rootfs will be committed to. Defaults to the same value as `MACHINE`. * `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". * `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. * `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]. -- cgit v1.2.3-54-g00ecf From 168203768ec831450f8df9c1b345d8b9a15506dd Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 4 Jan 2018 11:40:02 +0100 Subject: Bump aktualizr to get open source server CA fix. Also remove --no-root-ca for implicit prov. It's still there for the HSM case. If we really do need that flag for the implict recipe for Spekulatius, then we need to do some thinking. --- recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 2 +- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb index e5d9c9b..67bd2c2 100644 --- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb @@ -27,7 +27,7 @@ do_install() { install -d ${D}${libdir}/sota if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} \ - -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} --no-root-ca + -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_implicit_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} fi } diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 08aa6c2..3aed745 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -18,7 +18,7 @@ PR = "7" SRC_URI = " \ git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ " -SRCREV = "eb6c0b43c2b8b32f66f228c1c3f590b5c16ad448" +SRCREV = "6bd88e1de1f0216c0b411868af3a596d9974cd0c" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 5764d3fb222f06c43a5944056cc892c0e5f79ba6 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Fri, 5 Jan 2018 16:48:01 +0200 Subject: sota_raspberrypi*.inc: Included meta-python Add Yocto/OE layer meta-updater to bblayers as it required for building recipe rpi-gpio for Yocto/OE layer meta-raspberrypi. Signed-off-by: Leon Anavi --- conf/include/bblayers/sota_raspberrypi2.inc | 1 + conf/include/bblayers/sota_raspberrypi3.inc | 1 + 2 files changed, 2 insertions(+) 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 @@ +BBLAYERS += " ${METADIR}/meta-openembedded/meta-python " BBLAYERS += " ${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 @@ +BBLAYERS += " ${METADIR}/meta-openembedded/meta-python " BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi " -- cgit v1.2.3-54-g00ecf From eed239d897045a93d69461b7c093c9c928518f5f Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Mon, 8 Jan 2018 14:41:22 +0100 Subject: Delete dependency on libsoup It makes supporting different platforms somewhat easier --- .../0001-Allow-building-without-libsoup.patch | 26 ++++++++++++++++++++++ recipes-sota/ostree/ostree_git.bb | 7 +++--- .../glib-networking/glib-networking_%.bbappend | 8 ------- recipes-support/libsoup/libsoup-2.4_%.bbappend | 3 --- 4 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 recipes-sota/ostree/files/0001-Allow-building-without-libsoup.patch delete mode 100644 recipes-support/glib-networking/glib-networking_%.bbappend delete mode 100644 recipes-support/libsoup/libsoup-2.4_%.bbappend diff --git a/recipes-sota/ostree/files/0001-Allow-building-without-libsoup.patch b/recipes-sota/ostree/files/0001-Allow-building-without-libsoup.patch new file mode 100644 index 0000000..f45bae4 --- /dev/null +++ b/recipes-sota/ostree/files/0001-Allow-building-without-libsoup.patch @@ -0,0 +1,26 @@ +From 666e80acda17680e20d363ddc6fcf0a63f9c1dde Mon Sep 17 00:00:00 2001 +From: Anton Gerasimov +Date: Thu, 21 Dec 2017 22:36:06 +0100 +Subject: [PATCH] Allow building without libsoup + +--- + configure.ac | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 92248af8..baf66e4f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -182,9 +182,6 @@ AM_COND_IF(BUILDOPT_TRIVIAL_HTTPD, + [AC_DEFINE([BUILDOPT_ENABLE_TRIVIAL_HTTPD_CMDLINE], 1, [Define if we are enabling ostree trivial-httpd entrypoint])] + ) + +-AS_IF([test x$with_curl = xyes && test x$with_soup = xno], [ +- AC_MSG_ERROR([Curl enabled, but libsoup is not; libsoup is needed for tests]) +-]) + AM_CONDITIONAL(USE_CURL_OR_SOUP, test x$with_curl != xno || test x$with_soup != xno) + AS_IF([test x$with_curl != xno || test x$with_soup != xno], + [AC_DEFINE([HAVE_LIBCURL_OR_LIBSOUP], 1, [Define if we have soup or curl])]) +-- +2.15.0 + diff --git a/recipes-sota/ostree/ostree_git.bb b/recipes-sota/ostree/ostree_git.bb index 724976a..9ef4478 100644 --- a/recipes-sota/ostree/ostree_git.bb +++ b/recipes-sota/ostree/ostree_git.bb @@ -6,7 +6,8 @@ inherit autotools-brokensep pkgconfig systemd gobject-introspection INHERIT_remove_class-native = "systemd" -SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master" +SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master \ + file://0001-Allow-building-without-libsoup.patch" SRCREV="ae61321046ad7f4148a5884c8c6c8b2594ff840e" @@ -16,14 +17,14 @@ S = "${WORKDIR}/git" BBCLASSEXTEND = "native" -DEPENDS += "attr libarchive glib-2.0 pkgconfig gpgme libgsystem fuse libsoup-2.4 e2fsprogs gtk-doc-native curl xz" +DEPENDS += "attr libarchive glib-2.0 pkgconfig gpgme libgsystem fuse e2fsprogs gtk-doc-native curl xz" DEPENDS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd', '', d)}" DEPENDS_remove_class-native = "systemd-native" RDEPENDS_${PN} = "python util-linux-libuuid util-linux-libblkid util-linux-libmount libcap bash" RDEPENDS_${PN}_remove_class-native = "python-native" -EXTRA_OECONF = "--with-libarchive --disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf --disable-man --with-smack --with-builtin-grub2-mkconfig --with-curl" +EXTRA_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" EXTRA_OECONF_append_class-native = " --enable-wrpseudo-compat" # Path to ${prefix}/lib/ostree/ostree-grub-generator is hardcoded on the 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 @@ -BBCLASSEXTEND_append_sota = " native nativesdk" - -# Hackery to prevent relocatable_native_pcfiles from crashing -do_install_append_class-native () { - if [ -d ${D}${libdir}/pkgconfig ]; then - rmdir ${D}${libdir}/pkgconfig - fi -} 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 @@ -BBCLASSEXTEND_append_sota = " native nativesdk" - -DEPENDS_append_class-native = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ' glib-networking-native', ' ', d)}" -- cgit v1.2.3-54-g00ecf From 537de14d5018f9525964e7d4c64d736e9186c696 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Fri, 22 Dec 2017 19:14:16 +0100 Subject: Add support of ISO/TP legacy secondaries and serial CAN --- recipes-sota/aktualizr/aktualizr-auto-prov.bb | 10 +--------- recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb | 9 +-------- recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 9 +-------- recipes-sota/aktualizr/aktualizr_git.bb | 20 ++++++++++++++++++-- .../aktualizr/files/aktualizr-serialcan.service | 15 +++++++++++++++ recipes-support/slcand-start/files/slcand@.service | 8 ++++++++ recipes-support/slcand-start/slcand-start.bb | 21 +++++++++++++++++++++ 7 files changed, 65 insertions(+), 27 deletions(-) create mode 100644 recipes-sota/aktualizr/files/aktualizr-serialcan.service create mode 100644 recipes-support/slcand-start/files/slcand@.service create mode 100644 recipes-support/slcand-start/slcand-start.bb diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb index c97cbb8..2190512 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb @@ -1,4 +1,4 @@ -SUMMARY = "Aktualizr systemd service and configurations" +SUMMARY = "Aktualizr configuration for autoprovisioning" DESCRIPTION = "Systemd service and configurations for autoprovisioning Aktualizr, the SOTA Client application written in C++" HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" SECTION = "base" @@ -11,13 +11,8 @@ PR = "6" SRC_URI = " \ file://LICENSE \ - file://aktualizr.service \ " -SYSTEMD_SERVICE_${PN} = "aktualizr.service" - -inherit systemd - require environment.inc require credentials.inc @@ -49,12 +44,9 @@ do_install() { zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip treehub.json fi fi - install -d ${D}${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr.service ${D}${systemd_unitdir}/system/aktualizr.service } FILES_${PN} = " \ - ${systemd_unitdir}/system/aktualizr.service \ ${libdir}/sota/sota.toml \ ${localstatedir}/sota \ ${localstatedir}/sota/sota_provisioning_credentials.zip \ diff --git a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb index 8779c67..1e893fa 100644 --- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb @@ -1,4 +1,4 @@ -SUMMARY = "Aktualizr systemd service and configuration with HSM support" +SUMMARY = "Aktualizr configuration with HSM support" DESCRIPTION = "Systemd service and configurations for Aktualizr, the SOTA Client application written in C++" HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" SECTION = "base" @@ -10,28 +10,21 @@ RDEPENDS_${PN} = "aktualizr softhsm softhsm-testtoken" SRC_URI = " \ file://LICENSE \ - file://aktualizr.service \ " PV = "1.0" PR = "6" -SYSTEMD_SERVICE_${PN} = "aktualizr.service" - -inherit systemd require environment.inc require credentials.inc do_install() { - install -d ${D}${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr.service ${D}${systemd_unitdir}/system/aktualizr.service install -d ${D}${libdir}/sota aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_hsm_test.toml -o ${D}${libdir}/sota/sota.toml -p ${D} } FILES_${PN} = " \ - ${systemd_unitdir}/system/aktualizr.service \ ${libdir}/sota/sota.toml \ " diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb index 67bd2c2..b5bf420 100644 --- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb @@ -1,4 +1,4 @@ -SUMMARY = "Aktualizr systemd service and configurations" +SUMMARY = "Aktualizr configuration for implicit provisioning" DESCRIPTION = "Systemd service and configurations for implicitly provisioning Aktualizr, the SOTA Client application written in C++" HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" SECTION = "base" @@ -11,19 +11,13 @@ PR = "1" SRC_URI = " \ file://LICENSE \ - file://aktualizr.service \ " -SYSTEMD_SERVICE_${PN} = "aktualizr.service" - -inherit systemd require environment.inc require credentials.inc do_install() { - install -d ${D}${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/aktualizr.service ${D}${systemd_unitdir}/system/aktualizr.service install -d ${D}${libdir}/sota if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} \ @@ -32,7 +26,6 @@ do_install() { } FILES_${PN} = " \ - ${systemd_unitdir}/system/aktualizr.service \ ${libdir}/sota/sota.toml \ ${libdir}/sota/root.crt \ " diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 3aed745..d2e5477 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -11,12 +11,15 @@ DEPENDS_append_class-native = "glib-2.0-native " RDEPENDS_${PN}_class-target = "lshw " RDEPENDS_${PN}_append_class-target = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', ' engine-pkcs11', '', d)} " +RDEPENDS_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', ' slcand-start', '', d)} " PV = "1.0+git${SRCPV}" PR = "7" SRC_URI = " \ - git://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ + gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ + file://aktualizr.service \ + file://aktualizr-serialcan.service \ " SRCREV = "6bd88e1de1f0216c0b411868af3a596d9974cd0c" BRANCH ?= "master" @@ -25,6 +28,9 @@ S = "${WORKDIR}/git" inherit cmake +inherit systemd +SYSTEMD_SERVICE_${PN} = "aktualizr.service" + BBCLASSEXTEND =+ "native" EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} " @@ -37,6 +43,11 @@ do_install_append () { do_install_append_class-target () { rm -f ${D}${bindir}/aktualizr_implicit_writer ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', '', 'rm -f ${D}${bindir}/example-interface', d)} + ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-isotp-example', '', 'rm -f ${D}${bindir}/isotp-test-interface', d)} + + install -d ${D}${systemd_unitdir}/system + aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)} + install -m 0644 ${aktualizr_service} ${D}${systemd_unitdir}/system/aktualizr.service } do_install_append_class-native () { rm -f ${D}${bindir}/aktualizr @@ -46,13 +57,18 @@ do_install_append_class-native () { install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml install -m 0644 ${S}/config/sota_hsm_test.toml ${D}/${libdir}/sota/sota_hsm_test.toml install -m 0644 ${S}/config/sota_implicit_prov.toml ${D}/${libdir}/sota/sota_implicit_prov.toml + + install -m 0755 ${B}/src/sota_tools/garage-sign-prefix/src/garage-sign/bin/* ${D}${bindir} + install -m 0644 ${B}/src/sota_tools/garage-sign-prefix/src/garage-sign/lib/* ${D}${libdir} } FILES_${PN}_class-target = " \ ${bindir}/aktualizr \ ${bindir}/aktualizr-info \ + ${systemd_unitdir}/system/aktualizr.service \ " -FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', '${bindir}/example-interface', '', d)} " +FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', ' ${bindir}/example-interface', '', d)} " +FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-isotp-example', ' ${bindir}/isotp-test-interface', '', d)} " FILES_${PN}_class-native = " \ ${bindir}/aktualizr_implicit_writer \ ${bindir}/garage-deploy \ 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 @@ +[Unit] +Description=Aktualizr SOTA Client +Wants=network-online.target slcand@ttyACM0.service +After=network.target network-online.target slcand@ttyACM0.service + +Requires=network-online.target + +[Service] +RestartSec=10 +Restart=always +EnvironmentFile=/usr/lib/sota/sota.env +ExecStart=/bin/sh -c "(ip addr | grep can0) && /usr/bin/aktualizr $AKTUALIZR_CMDLINE_PARAMETERS" + +[Install] +WantedBy=multi-user.target 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 @@ +[Unit] +Description=Serial CAN daemon (can-utils) + +[Service] +Type=forking +ExecStart=/usr/bin/slcand -o -c -s4 %I can0 +ExecStartPost=/bin/sh -c '/bin/sleep 3; /sbin/ip link set can0 up' + 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 @@ +SUMMARY = "Mock smartcard for aktualizr" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + + +inherit systemd + +RDEPENDS_${PN} = "can-utils" + +SRC_URI = "file://slcand@.service" + +SYSTEMD_SERVICE_${PN} = "slcand@.service" + +do_install() { + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/slcand@.service ${D}${systemd_unitdir}/system/slcand@.service +} + +FILES_${PN} = "${systemd_unitdir}/system/createtoken.service" + -- cgit v1.2.3-54-g00ecf From 56678801b71069a6df4c181eef353ee52e8ad94d Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Mon, 8 Jan 2018 12:09:46 +0100 Subject: Support for BUILD_ISOTP cmake variable --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index d2e5477..4ea5e55 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -34,7 +34,7 @@ SYSTEMD_SERVICE_${PN} = "aktualizr.service" BBCLASSEXTEND =+ "native" EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} " -EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " +EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON -DBUILD_ISOTP=ON ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF " do_install_append () { -- cgit v1.2.3-54-g00ecf From 4b13457c579db11e153ef89c345b34ed761d4ee7 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Mon, 8 Jan 2018 17:14:14 +0200 Subject: sota_raspberrypi.bbclass: Remove sdimg-rpi Remove sdimg-rpi from IMAGE_FSTYPES and rely only on wic image for SOTA as it has been done at commit 27e0edbef0180fd7643e2b1558e313bc2baa92d9 for Pyro. Signed-off-by: Leon Anavi --- classes/sota_raspberrypi.bbclass | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass index 51d07b2..f8e7347 100644 --- a/classes/sota_raspberrypi.bbclass +++ b/classes/sota_raspberrypi.bbclass @@ -3,6 +3,7 @@ PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" UBOOT_MACHINE_raspberrypi2_sota ?= "rpi_2_defconfig" UBOOT_MACHINE_raspberrypi3_sota ?= "rpi_3_32b_defconfig" +IMAGE_FSTYPES_remove_sota = "rpi-sdimg" OSTREE_BOOTLOADER ?= "u-boot" # OSTree puts its own boot.scr to bcm2835-bootfiles -- cgit v1.2.3-54-g00ecf From c1872be518040d03f8836cec92e7e0a80f9a43f3 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Wed, 10 Jan 2018 16:33:56 +0100 Subject: Fix --repo parameter for garage-sign --- classes/image_types_ostree.bbclass | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 3edbc72..cf2e52f 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -196,7 +196,7 @@ IMAGE_CMD_garagesign () { fi rm -rf ${GARAGE_SIGN_REPO} - garage-sign init --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --credentials ${SOTA_PACKED_CREDENTIALS} + garage-sign init --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --credentials ${SOTA_PACKED_CREDENTIALS} ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) @@ -204,11 +204,11 @@ IMAGE_CMD_garagesign () { # in which case targets.json should be pulled again and the whole procedure repeated push_success=0 for push_retries in $( seq 3 ); do - garage-sign targets pull --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} - garage-sign targets add --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --name ${OSTREE_BRANCHNAME} --format OSTREE --version ${ostree_target_hash} --length 0 --url "https://example.com/" --sha256 ${ostree_target_hash} --hardwareids ${MACHINE} - garage-sign targets sign --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --key-name=targets + garage-sign targets pull --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} + garage-sign targets add --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --name ${OSTREE_BRANCHNAME} --format OSTREE --version ${ostree_target_hash} --length 0 --url "https://example.com/" --sha256 ${ostree_target_hash} --hardwareids ${MACHINE} + garage-sign targets sign --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --key-name=targets errcode=0 - garage-sign targets push --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} || errcode=$? + garage-sign targets push --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} || errcode=$? if [ "$errcode" -eq "0" ]; then push_success=1 break -- cgit v1.2.3-54-g00ecf From 07a7774937dc617a7cf0ce6534b57d874e498277 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Wed, 10 Jan 2018 16:59:22 +0100 Subject: Bump aktualizr version to get fixed garage-sign --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 4ea5e55..48ed652 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -21,7 +21,7 @@ SRC_URI = " \ file://aktualizr.service \ file://aktualizr-serialcan.service \ " -SRCREV = "6bd88e1de1f0216c0b411868af3a596d9974cd0c" +SRCREV = "e53f2a5747bba3e4f40609aa27f3d89e80c2d784" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 1be51459ab93b1f4c83a22624928610eecdd1dd4 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Thu, 11 Jan 2018 17:56:24 +0200 Subject: sota_raspberrypi.bbclass: Enable U-Boot for Raspberry Pi Enable U-Boot for Raspberry Pi using the new setting from Yocto/OE layer meta-raspberrypi RPI_USE_U_BOOT. Signed-off-by: Leon Anavi --- classes/sota_raspberrypi.bbclass | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass index f8e7347..2c69ea0 100644 --- a/classes/sota_raspberrypi.bbclass +++ b/classes/sota_raspberrypi.bbclass @@ -1,3 +1,4 @@ +RPI_USE_U_BOOT_sota = "1" KERNEL_IMAGETYPE_sota = "uImage" PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" UBOOT_MACHINE_raspberrypi2_sota ?= "rpi_2_defconfig" -- cgit v1.2.3-54-g00ecf From 13a294b1aeec9cc18efd4ac006d104c73dded658 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 11 Jan 2018 23:24:04 +0100 Subject: Bump OSTree version Patched merged into upstream removed, Minnowboard boot failure fixed --- .../0001-Allow-building-without-libsoup.patch | 26 ---------------------- recipes-sota/ostree/ostree_git.bb | 5 ++--- 2 files changed, 2 insertions(+), 29 deletions(-) delete mode 100644 recipes-sota/ostree/files/0001-Allow-building-without-libsoup.patch diff --git a/recipes-sota/ostree/files/0001-Allow-building-without-libsoup.patch b/recipes-sota/ostree/files/0001-Allow-building-without-libsoup.patch deleted file mode 100644 index f45bae4..0000000 --- a/recipes-sota/ostree/files/0001-Allow-building-without-libsoup.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 666e80acda17680e20d363ddc6fcf0a63f9c1dde Mon Sep 17 00:00:00 2001 -From: Anton Gerasimov -Date: Thu, 21 Dec 2017 22:36:06 +0100 -Subject: [PATCH] Allow building without libsoup - ---- - configure.ac | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 92248af8..baf66e4f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -182,9 +182,6 @@ AM_COND_IF(BUILDOPT_TRIVIAL_HTTPD, - [AC_DEFINE([BUILDOPT_ENABLE_TRIVIAL_HTTPD_CMDLINE], 1, [Define if we are enabling ostree trivial-httpd entrypoint])] - ) - --AS_IF([test x$with_curl = xyes && test x$with_soup = xno], [ -- AC_MSG_ERROR([Curl enabled, but libsoup is not; libsoup is needed for tests]) --]) - AM_CONDITIONAL(USE_CURL_OR_SOUP, test x$with_curl != xno || test x$with_soup != xno) - AS_IF([test x$with_curl != xno || test x$with_soup != xno], - [AC_DEFINE([HAVE_LIBCURL_OR_LIBSOUP], 1, [Define if we have soup or curl])]) --- -2.15.0 - diff --git a/recipes-sota/ostree/ostree_git.bb b/recipes-sota/ostree/ostree_git.bb index 9ef4478..00559b6 100644 --- a/recipes-sota/ostree/ostree_git.bb +++ b/recipes-sota/ostree/ostree_git.bb @@ -6,10 +6,9 @@ inherit autotools-brokensep pkgconfig systemd gobject-introspection INHERIT_remove_class-native = "systemd" -SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master \ - file://0001-Allow-building-without-libsoup.patch" +SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master" -SRCREV="ae61321046ad7f4148a5884c8c6c8b2594ff840e" +SRCREV="854a823e05d6fe8b610c02c2a71eaeb2bf1e98a6" PV = "v2017.13" -- cgit v1.2.3-54-g00ecf From 28d1c1cd6f6ff93bdb1b89e5bdb5a9d065052e3d Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Tue, 16 Jan 2018 09:49:50 +0100 Subject: Get the newest aktualizr using sqlstorage --- recipes-sota/aktualizr/aktualizr_git.bb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 48ed652..ebbb403 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -21,7 +21,7 @@ SRC_URI = " \ file://aktualizr.service \ file://aktualizr-serialcan.service \ " -SRCREV = "e53f2a5747bba3e4f40609aa27f3d89e80c2d784" +SRCREV = "e1f27b92ec9eaffab4a2091a5aeecb0b4c540c58" BRANCH ?= "master" S = "${WORKDIR}/git" @@ -48,6 +48,9 @@ do_install_append_class-target () { install -d ${D}${systemd_unitdir}/system aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)} install -m 0644 ${aktualizr_service} ${D}${systemd_unitdir}/system/aktualizr.service + + install -d ${D}${libdir}/sota/schemas + install -m 0755 ${S}/config/storage/* ${D}${libdir}/sota/schemas } do_install_append_class-native () { rm -f ${D}${bindir}/aktualizr @@ -66,6 +69,7 @@ FILES_${PN}_class-target = " \ ${bindir}/aktualizr \ ${bindir}/aktualizr-info \ ${systemd_unitdir}/system/aktualizr.service \ + ${libdir}/sota/schemas \ " FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', ' ${bindir}/example-interface', '', d)} " FILES_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-isotp-example', ' ${bindir}/isotp-test-interface', '', d)} " -- cgit v1.2.3-54-g00ecf From 0ccd10c27fbf94778553cea02f67d269df7c2854 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Tue, 16 Jan 2018 18:51:19 +0100 Subject: Deploy startup.nsh before composing flashable image Additionally don't create extra images to save space and not confuse the user --- classes/sota_minnowboard.bbclass | 3 +++ 1 file changed, 3 insertions(+) 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" WKS_FILE_sota = "efiimage-sota.wks" IMAGE_BOOT_FILES_sota = "" +IMAGE_FSTYPES_remove_sota = "live hddimg" OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 console=ttyS0,115200 console=tty0" + +IMAGE_INSTALL_append = " minnowboard-efi-startup" -- cgit v1.2.3-54-g00ecf From 3975d4085d4ddceaba05d3d557be92ab1e8f9eb3 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 18 Jan 2018 10:55:24 +0100 Subject: Use u-boot version with patches for newer QEMU --- classes/sota_qemux86-64.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/sota_qemux86-64.bbclass b/classes/sota_qemux86-64.bbclass index 53e0026..666ad6b 100644 --- a/classes/sota_qemux86-64.bbclass +++ b/classes/sota_qemux86-64.bbclass @@ -4,7 +4,7 @@ PREFERRED_VERSION_linux-yocto_qemux86-64_sota = "4.4%" IMAGE_FSTYPES_remove = "wic" # U-Boot support for SOTA -PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot-ota" +PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot" UBOOT_MACHINE_sota = "qemu-x86_defconfig" OSTREE_BOOTLOADER ?= "u-boot" -- cgit v1.2.3-54-g00ecf From 10ae4092dc80e598f996a9ec06148117b7db6dc9 Mon Sep 17 00:00:00 2001 From: Jon Oster Date: Thu, 18 Jan 2018 10:40:32 +0100 Subject: PRO-4645 Update OSTree httpd instructions --- README.adoc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.adoc b/README.adoc index 0917e45..e82b904 100644 --- a/README.adoc +++ b/README.adoc @@ -79,25 +79,25 @@ Although we have used U-Boot so far, other boot loaders can be configured work w === OSTree -OSTree 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].) - -To expose your repo, run ostree trivial-httpd using any free port: +OSTree 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: .... -ostree trivial-httpd tmp/deploy/images/qemux86-64/ostree_repo -P 57556 +cd tmp/deploy/images/qemux86-64/ostree_repo +python -m SimpleHTTPServer # port defaults to 8000 .... You can then run ostree from inside your device by adding your repo: .... -# agl-remote identifies the remote server in your local repo -ostree remote add --no-gpg-verify my-remote http://192.168.7.1:57556 ota +# This behaves like adding a Git remote; you can name it anything +ostree remote add --no-gpg-verify my-remote http://: -# ota is a branch name in the remote repo, set in OSTREE_BRANCHNAME -ostree pull my-remote ota +# If OSTREE_BRANCHNAME is set in local.conf, that will be the name of the +# branch. If not set, it defaults to the value of MACHINE (e.g. qemux86-64). +ostree pull my-remote -# poky is OS name as set in OSTREE_OSNAME -ostree admin deploy --os=poky my-remote:ota +# poky is the OS name as set in OSTREE_OSNAME +ostree admin deploy --os=poky my-remote: .... After restarting, you will boot into the newly deployed OS image. -- cgit v1.2.3-54-g00ecf From 20b8d55c760ff9021f32a57a12563b01ef039e4e Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 18 Jan 2018 12:33:08 +0100 Subject: oe-selftest fixes for rocko. --- lib/oeqa/selftest/cases/qemucommand.py | 1 + lib/oeqa/selftest/cases/updater.py | 209 +++++++++++++++++++++++++++++++++ lib/oeqa/selftest/qemucommand.py | 1 - lib/oeqa/selftest/updater.py | 207 -------------------------------- 4 files changed, 210 insertions(+), 208 deletions(-) create mode 120000 lib/oeqa/selftest/cases/qemucommand.py create mode 100644 lib/oeqa/selftest/cases/updater.py delete mode 120000 lib/oeqa/selftest/qemucommand.py delete mode 100644 lib/oeqa/selftest/updater.py 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..7d7bde7 --- /dev/null +++ b/lib/oeqa/selftest/cases/updater.py @@ -0,0 +1,209 @@ +import os +import logging +import subprocess +import time +import unittest + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars +from qemucommand import QemuCommand + + +class SotaToolsTests(OESelftestTestCase): + + @classmethod + def setUpClass(cls): + logger = logging.getLogger("selftest") + logger.info('Running bitbake to build aktualizr-native tools') + bitbake('aktualizr-native') + + def test_push_help(self): + bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') + p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-push" + self.assertTrue(os.path.isfile(p), msg = "No garage-push found (%s)" % p) + result = runCmd('%s --help' % p, ignore_status=True) + self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) + + def test_deploy_help(self): + bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') + p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-deploy" + self.assertTrue(os.path.isfile(p), msg = "No garage-deploy found (%s)" % p) + result = runCmd('%s --help' % p, ignore_status=True) + self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) + + def test_garagesign_help(self): + bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') + p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-sign" + self.assertTrue(os.path.isfile(p), msg = "No garage-sign found (%s)" % p) + result = runCmd('%s --help' % p, ignore_status=True) + self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) + + +class HsmTests(OESelftestTestCase): + + def test_hsm(self): + self.write_config('SOTA_CLIENT_FEATURES="hsm"') + bitbake('core-image-minimal') + + +class GeneralTests(OESelftestTestCase): + + def test_feature_sota(self): + result = get_bb_var('DISTRO_FEATURES').find('sota') + self.assertNotEqual(result, -1, 'Feature "sota" not set at DISTRO_FEATURES'); + + def test_feature_systemd(self): + result = get_bb_var('DISTRO_FEATURES').find('systemd') + self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES'); + + def test_credentials(self): + bitbake('core-image-minimal') + credentials = get_bb_var('SOTA_PACKED_CREDENTIALS') + # skip the test if the variable SOTA_PACKED_CREDENTIALS is not set + if credentials is None: + raise unittest.SkipTest("Variable 'SOTA_PACKED_CREDENTIALS' not set.") + # Check if the file exists + self.assertTrue(os.path.isfile(credentials), "File %s does not exist" % credentials) + deploydir = get_bb_var('DEPLOY_DIR_IMAGE') + imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal') + # Check if the credentials are included in the output image + result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' % (deploydir, imagename), ignore_status=True) + self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) + + def test_java(self): + result = runCmd('which java', ignore_status=True) + self.assertEqual(result.status, 0, "Java not found.") + + def test_add_package(self): + print('') + deploydir = get_bb_var('DEPLOY_DIR_IMAGE') + imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal') + image_path = deploydir + '/' + imagename + '.otaimg' + logger = logging.getLogger("selftest") + + logger.info('Running bitbake with man in the image package list') + self.write_config('IMAGE_INSTALL_append = " man "') + bitbake('-c cleanall man') + bitbake('core-image-minimal') + result = runCmd('oe-pkgdata-util find-path /usr/bin/man') + self.assertEqual(result.output, 'man: /usr/bin/man') + path1 = os.path.realpath(image_path) + size1 = os.path.getsize(path1) + logger.info('First image %s has size %i' % (path1, size1)) + + logger.info('Running bitbake without man in the image package list') + self.write_config('IMAGE_INSTALL_remove = " man "') + bitbake('-c cleanall man') + bitbake('core-image-minimal') + result = runCmd('oe-pkgdata-util find-path /usr/bin/man', ignore_status=True) + self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output) + self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /usr/bin/man') + path2 = os.path.realpath(image_path) + size2 = os.path.getsize(path2) + logger.info('Second image %s has size %i' % (path2, size2)) + self.assertNotEqual(path1, path2, "Image paths are identical; image was not rebuilt.") + self.assertNotEqual(size1, size2, "Image sizes are identical; image was not rebuilt.") + + +class QemuTests(OESelftestTestCase): + + @classmethod + def setUpClass(cls): + cls.qemu, cls.s = qemu_launch(machine='qemux86-64') + + @classmethod + def tearDownClass(cls): + qemu_terminate(cls.s) + + def test_hostname(self): + print('') + print('Checking machine name (hostname) of device:') + value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') + machine = get_bb_var('MACHINE', 'core-image-minimal') + self.assertEqual(err, b'', 'Error: ' + err.decode()) + # Strip off line ending. + value_str = value.decode()[:-1] + self.assertEqual(value_str, machine, + 'MACHINE does not match hostname: ' + machine + ', ' + value_str) + print(value_str) + + def test_var_sota(self): + print('') + print('Checking contents of /var/sota:') + value, err = qemu_send_command(self.qemu.ssh_port, 'ls /var/sota') + self.assertEqual(err, b'', 'Error: ' + err.decode()) + print(value.decode()) + + +class GrubTests(OESelftestTestCase): + + def setUpLocal(self): + # This is a bit of a hack but I can't see a better option. + path = os.path.abspath(os.path.dirname(__file__)) + metadir = path + "/../../../../" + grub_config = 'OSTREE_BOOTLOADER = "grub"\nMACHINE = "intel-corei7-64"' + self.append_config(grub_config) + self.meta_intel = metadir + "meta-intel" + self.meta_minnow = metadir + "meta-updater-minnowboard" + runCmd('bitbake-layers add-layer "%s"' % self.meta_intel) + runCmd('bitbake-layers add-layer "%s"' % self.meta_minnow) + self.qemu, self.s = qemu_launch(efi=True, machine='intel-corei7-64') + + def tearDownLocal(self): + qemu_terminate(self.s) + runCmd('bitbake-layers remove-layer "%s"' % self.meta_intel, ignore_status=True) + runCmd('bitbake-layers remove-layer "%s"' % self.meta_minnow, ignore_status=True) + + def test_grub(self): + print('') + print('Checking machine name (hostname) of device:') + value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') + machine = get_bb_var('MACHINE', 'core-image-minimal') + self.assertEqual(err, b'', 'Error: ' + err.decode()) + # Strip off line ending. + value_str = value.decode()[:-1] + self.assertEqual(value_str, machine, + 'MACHINE does not match hostname: ' + machine + ', ' + value_str) + print(value_str) + + +def qemu_launch(efi=False, machine=None): + logger = logging.getLogger("selftest") + logger.info('Running bitbake to build core-image-minimal') + bitbake('core-image-minimal') + # Create empty object. + args = type('', (), {})() + args.imagename = 'core-image-minimal' + args.mac = None + # Could use DEPLOY_DIR_IMAGE here but it's already in the machine + # subdirectory. + args.dir = 'tmp/deploy/images' + args.efi = efi + args.machine = machine + args.kvm = None # Autodetect + args.no_gui = True + args.gdb = False + args.pcap = None + args.overlay = None + args.dry_run = False + + qemu = QemuCommand(args) + cmdline = qemu.command_line() + print('Booting image with run-qemu-ota...') + s = subprocess.Popen(cmdline) + time.sleep(10) + return qemu, s + +def qemu_terminate(s): + try: + s.terminate() + except KeyboardInterrupt: + pass + +def qemu_send_command(port, command): + command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + + str(port) + ' "' + command + '"'] + s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + value, err = s2.communicate() + return value, err + diff --git a/lib/oeqa/selftest/qemucommand.py b/lib/oeqa/selftest/qemucommand.py deleted file mode 120000 index bc06dde..0000000 --- a/lib/oeqa/selftest/qemucommand.py +++ /dev/null @@ -1 +0,0 @@ -../../../scripts/qemucommand.py \ No newline at end of file diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py deleted file mode 100644 index f28349f..0000000 --- a/lib/oeqa/selftest/updater.py +++ /dev/null @@ -1,207 +0,0 @@ -import unittest -import os -import logging -import subprocess -import time - -from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars -from oeqa.selftest.qemucommand import QemuCommand - - -class SotaToolsTests(oeSelfTest): - - @classmethod - def setUpClass(cls): - logger = logging.getLogger("selftest") - logger.info('Running bitbake to build aktualizr-native tools') - bitbake('aktualizr-native') - - def test_push_help(self): - bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') - p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-push" - self.assertTrue(os.path.isfile(p), msg = "No garage-push found (%s)" % p) - result = runCmd('%s --help' % p, ignore_status=True) - self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - - def test_deploy_help(self): - bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') - p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-deploy" - self.assertTrue(os.path.isfile(p), msg = "No garage-deploy found (%s)" % p) - result = runCmd('%s --help' % p, ignore_status=True) - self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - - def test_garagesign_help(self): - bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'aktualizr-native') - p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "garage-sign" - self.assertTrue(os.path.isfile(p), msg = "No garage-sign found (%s)" % p) - result = runCmd('%s --help' % p, ignore_status=True) - self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - -class HsmTests(oeSelfTest): - - def test_hsm(self): - self.write_config('SOTA_CLIENT_FEATURES="hsm"') - bitbake('core-image-minimal') - - -class GeneralTests(oeSelfTest): - - def test_feature_sota(self): - result = get_bb_var('DISTRO_FEATURES').find('sota') - self.assertNotEqual(result, -1, 'Feature "sota" not set at DISTRO_FEATURES'); - - def test_feature_systemd(self): - result = get_bb_var('DISTRO_FEATURES').find('systemd') - self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES'); - - def test_credentials(self): - bitbake('core-image-minimal') - credentials = get_bb_var('SOTA_PACKED_CREDENTIALS') - # skip the test if the variable SOTA_PACKED_CREDENTIALS is not set - if credentials is None: - raise unittest.SkipTest("Variable 'SOTA_PACKED_CREDENTIALS' not set.") - # Check if the file exists - self.assertTrue(os.path.isfile(credentials), "File %s does not exist" % credentials) - deploydir = get_bb_var('DEPLOY_DIR_IMAGE') - imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal') - # Check if the credentials are included in the output image - result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' % (deploydir, imagename), ignore_status=True) - self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) - - def test_java(self): - result = runCmd('which java', ignore_status=True) - self.assertEqual(result.status, 0, "Java not found.") - - def test_add_package(self): - print('') - deploydir = get_bb_var('DEPLOY_DIR_IMAGE') - imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal') - image_path = deploydir + '/' + imagename + '.otaimg' - logger = logging.getLogger("selftest") - - logger.info('Running bitbake with man in the image package list') - self.write_config('IMAGE_INSTALL_append = " man "') - bitbake('-c cleanall man') - bitbake('core-image-minimal') - result = runCmd('oe-pkgdata-util find-path /usr/bin/man') - self.assertEqual(result.output, 'man: /usr/bin/man') - path1 = os.path.realpath(image_path) - size1 = os.path.getsize(path1) - logger.info('First image %s has size %i' % (path1, size1)) - - logger.info('Running bitbake without man in the image package list') - self.write_config('IMAGE_INSTALL_remove = " man "') - bitbake('-c cleanall man') - bitbake('core-image-minimal') - result = runCmd('oe-pkgdata-util find-path /usr/bin/man', ignore_status=True) - self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output) - self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /usr/bin/man') - path2 = os.path.realpath(image_path) - size2 = os.path.getsize(path2) - logger.info('Second image %s has size %i' % (path2, size2)) - self.assertNotEqual(path1, path2, "Image paths are identical; image was not rebuilt.") - self.assertNotEqual(size1, size2, "Image sizes are identical; image was not rebuilt.") - - -class QemuTests(oeSelfTest): - - @classmethod - def setUpClass(cls): - cls.qemu, cls.s = qemu_launch(machine='qemux86-64') - - @classmethod - def tearDownClass(cls): - qemu_terminate(cls.s) - - def test_hostname(self): - print('') - print('Checking machine name (hostname) of device:') - value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') - machine = get_bb_var('MACHINE', 'core-image-minimal') - self.assertEqual(err, b'', 'Error: ' + err.decode()) - # Strip off line ending. - value_str = value.decode()[:-1] - self.assertEqual(value_str, machine, - 'MACHINE does not match hostname: ' + machine + ', ' + value_str) - print(value_str) - - def test_var_sota(self): - print('') - print('Checking contents of /var/sota:') - value, err = qemu_send_command(self.qemu.ssh_port, 'ls /var/sota') - self.assertEqual(err, b'', 'Error: ' + err.decode()) - print(value.decode()) - -class GrubTests(oeSelfTest): - - def setUpLocal(self): - # This is a bit of a hack but I can't see a better option. - path = os.path.abspath(os.path.dirname(__file__)) - metadir = path + "/../../../../" - grub_config = 'OSTREE_BOOTLOADER = "grub"\nMACHINE = "intel-corei7-64"' - self.append_config(grub_config) - self.meta_intel = metadir + "meta-intel" - self.meta_minnow = metadir + "meta-updater-minnowboard" - runCmd('bitbake-layers add-layer "%s"' % self.meta_intel) - runCmd('bitbake-layers add-layer "%s"' % self.meta_minnow) - self.qemu, self.s = qemu_launch(efi=True, machine='intel-corei7-64') - - def tearDownLocal(self): - qemu_terminate(self.s) - runCmd('bitbake-layers remove-layer "%s"' % self.meta_intel, ignore_status=True) - runCmd('bitbake-layers remove-layer "%s"' % self.meta_minnow, ignore_status=True) - - def test_grub(self): - print('') - print('Checking machine name (hostname) of device:') - value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') - machine = get_bb_var('MACHINE', 'core-image-minimal') - self.assertEqual(err, b'', 'Error: ' + err.decode()) - # Strip off line ending. - value_str = value.decode()[:-1] - self.assertEqual(value_str, machine, - 'MACHINE does not match hostname: ' + machine + ', ' + value_str) - print(value_str) - - -def qemu_launch(efi=False, machine=None): - logger = logging.getLogger("selftest") - logger.info('Running bitbake to build core-image-minimal') - bitbake('core-image-minimal') - # Create empty object. - args = type('', (), {})() - args.imagename = 'core-image-minimal' - args.mac = None - # Could use DEPLOY_DIR_IMAGE here but it's already in the machine - # subdirectory. - args.dir = 'tmp/deploy/images' - args.efi = efi - args.machine = machine - args.kvm = None # Autodetect - args.no_gui = True - args.gdb = False - args.pcap = None - args.overlay = None - args.dry_run = False - - qemu = QemuCommand(args) - cmdline = qemu.command_line() - print('Booting image with run-qemu-ota...') - s = subprocess.Popen(cmdline) - time.sleep(10) - return qemu, s - -def qemu_terminate(s): - try: - s.terminate() - except KeyboardInterrupt: - pass - -def qemu_send_command(port, command): - command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + - str(port) + ' "' + command + '"'] - s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - value, err = s2.communicate() - return value, err - -- cgit v1.2.3-54-g00ecf From b5b2458b320bd88599bcd3af02566712c8877c1c Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 18 Jan 2018 12:36:21 +0100 Subject: Add PR = "1" to ostree to fix annoying caching problem. --- recipes-sota/ostree/ostree_git.bb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes-sota/ostree/ostree_git.bb b/recipes-sota/ostree/ostree_git.bb index 00559b6..ad85775 100644 --- a/recipes-sota/ostree/ostree_git.bb +++ b/recipes-sota/ostree/ostree_git.bb @@ -11,6 +11,7 @@ SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master" SRCREV="854a823e05d6fe8b610c02c2a71eaeb2bf1e98a6" PV = "v2017.13" +PR = "1" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 1f78561ca3de7609877097642b41e527a1294569 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 18 Jan 2018 14:35:00 +0100 Subject: Bump aktualizr version to get misconfigured ecu fix. --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index ebbb403..3925922 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -21,7 +21,7 @@ SRC_URI = " \ file://aktualizr.service \ file://aktualizr-serialcan.service \ " -SRCREV = "e1f27b92ec9eaffab4a2091a5aeecb0b4c540c58" +SRCREV = "37fbf0dfd88d42d76301890818dc4e83b35d9fa4" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 84baa1c3d8f996f7daf2d8aa3d26197378218f21 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 18 Jan 2018 18:36:33 +0100 Subject: Fix some basic oe-selftest errors. Grub, HSM, and qemu hostname tests still fail for reasons I haven't figured out yet. --- lib/oeqa/selftest/cases/updater.py | 4 +++- scripts/qemucommand.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py index 7d7bde7..253320d 100644 --- a/lib/oeqa/selftest/cases/updater.py +++ b/lib/oeqa/selftest/cases/updater.py @@ -13,6 +13,7 @@ class SotaToolsTests(OESelftestTestCase): @classmethod def setUpClass(cls): + super(SotaToolsTests, cls).setUpClass() logger = logging.getLogger("selftest") logger.info('Running bitbake to build aktualizr-native tools') bitbake('aktualizr-native') @@ -109,6 +110,7 @@ class QemuTests(OESelftestTestCase): @classmethod def setUpClass(cls): + super(QemuTests, cls).setUpClass() cls.qemu, cls.s = qemu_launch(machine='qemux86-64') @classmethod @@ -140,7 +142,7 @@ class GrubTests(OESelftestTestCase): def setUpLocal(self): # This is a bit of a hack but I can't see a better option. path = os.path.abspath(os.path.dirname(__file__)) - metadir = path + "/../../../../" + metadir = path + "/../../../../../" grub_config = 'OSTREE_BOOTLOADER = "grub"\nMACHINE = "intel-corei7-64"' self.append_config(grub_config) self.meta_intel = metadir + "meta-intel" diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index 9a893d8..7ae9381 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py @@ -96,7 +96,7 @@ class QemuCommand(object): "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port, "-m", "1G", "-usb", - "-usbdevice", "tablet", + "-device", "usb-tablet", "-show-cursor", "-vga", "std", "-net", netuser, -- cgit v1.2.3-54-g00ecf From 44a4dd8e039ea16319f337c3881964759ada73a5 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Fri, 19 Jan 2018 09:16:49 +0100 Subject: More general exception handler for `kvm-ok` If the program is not in PATH, `FileNotFoundError` is raised --- scripts/qemucommand.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index 7ae9381..6b1106d 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py @@ -73,7 +73,7 @@ class QemuCommand(object): try: check_output(['kvm-ok']) self.kvm = True - except CalledProcessError: + except Exception: self.kvm = False else: self.kvm = args.kvm -- cgit v1.2.3-54-g00ecf From b605cf215ff4cef35c3f62fee0ec14e3c8d5ba22 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Fri, 19 Jan 2018 14:12:22 +0100 Subject: Add a brief doc section for common build problems. Also add a helpful hint for the oe-selftest grub problem. --- README.adoc | 10 ++++++++++ lib/oeqa/selftest/cases/updater.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index 0917e45..a85be18 100644 --- a/README.adoc +++ b/README.adoc @@ -44,6 +44,16 @@ and get as a result an "ostree_repo" folder in your images directory (tmp/deploy Although aglsetup.sh hooks provide reasonable defaults for SOTA-related variables, you may want to tune some of them. +=== Build problems + +Multilib systems may require adding this line to `local.conf`: + +.... +HOSTTOOLS += "x86_64-linux-gnu-gcc" +.... + +Ubuntu users that encounter an error due to missing `Python.h` should install `libpython2.7-dev` on their host machine. + == Supported boards Currently supported platforms are diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py index 253320d..9264616 100644 --- a/lib/oeqa/selftest/cases/updater.py +++ b/lib/oeqa/selftest/cases/updater.py @@ -165,7 +165,8 @@ class GrubTests(OESelftestTestCase): # Strip off line ending. value_str = value.decode()[:-1] self.assertEqual(value_str, machine, - 'MACHINE does not match hostname: ' + machine + ', ' + value_str) + 'MACHINE does not match hostname: ' + machine + ', ' + value_str + + '\nIs tianocore ovmf installed?') print(value_str) -- cgit v1.2.3-54-g00ecf From fe5193054cfc6e815fdd91baa0f24111461d7dd4 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Fri, 19 Jan 2018 15:49:57 +0100 Subject: Add EVP_PKEY_meth_get* replacement functions to use with OpenSSL 1.0.2m as well I couldn't find the reason why these functions are not present in libopenssl.so, but apparently it doesn't affect 1.0.2k --- ...und-for-a-buggy-version-of-openssl-1.0.2m.patch | 42 ++++++++++++++++++++++ recipes-support/libp11/libp11_0.4.7.bb | 3 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 recipes-support/libp11/files/0001-Workaround-for-a-buggy-version-of-openssl-1.0.2m.patch 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 @@ +From ccab5ce63dd5d3dbb4bd02998d21d34407e550f2 Mon Sep 17 00:00:00 2001 +From: Anton Gerasimov +Date: Fri, 19 Jan 2018 12:44:27 +0100 +Subject: [PATCH] Workaround for a buggy version of openssl (1.0.2m) + +--- + src/p11_pkey.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/src/p11_pkey.c b/src/p11_pkey.c +index 45d5ad3..75625e6 100644 +--- a/src/p11_pkey.c ++++ b/src/p11_pkey.c +@@ -139,8 +139,14 @@ static void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src) + + #endif + +-#if OPENSSL_VERSION_NUMBER < 0x100020d0L || defined(LIBRESSL_VERSION_NUMBER) +-static void EVP_PKEY_meth_get_sign(EVP_PKEY_METHOD *pmeth, ++#if OPENSSL_VERSION_NUMBER <= 0x100020e0L || defined(LIBRESSL_VERSION_NUMBER) ++ ++# if (OPENSSL_VERSION_NUMBER & 0xFFFFFFF0) == 0x100020d0L ++# undef EVP_PKEY_meth_get_sign ++# undef EVP_PKEY_meth_get_decrypt ++# endif ++ ++void EVP_PKEY_meth_get_sign(EVP_PKEY_METHOD *pmeth, + int (**psign_init) (EVP_PKEY_CTX *ctx), + int (**psign) (EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, +@@ -152,7 +158,7 @@ static void EVP_PKEY_meth_get_sign(EVP_PKEY_METHOD *pmeth, + *psign = pmeth->sign; + } + +-static void EVP_PKEY_meth_get_decrypt(EVP_PKEY_METHOD *pmeth, ++void EVP_PKEY_meth_get_decrypt(EVP_PKEY_METHOD *pmeth, + int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), + int (**pdecrypt) (EVP_PKEY_CTX *ctx, + unsigned char *out, +-- +2.15.1 + 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+" LIC_FILES_CHKSUM = "file://COPYING;md5=fad9b3332be894bab9bc501572864b29" DEPENDS = "libtool openssl" -SRC_URI = "git://github.com/OpenSC/libp11.git" +SRC_URI = "git://github.com/OpenSC/libp11.git \ + file://0001-Workaround-for-a-buggy-version-of-openssl-1.0.2m.patch" SRCREV = "da725ab727342083478150a203a3c80c4551feb4" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 9e6d437d73aa990aff85d2cf456b77367be01920 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Fri, 19 Jan 2018 16:38:13 +0100 Subject: Deploy initial primary version information --- classes/image_types_ostree.bbclass | 4 +++- classes/image_types_ota.bbclass | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index cf2e52f..dcc376d 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -12,6 +12,8 @@ IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \ export OSTREE_REPO export OSTREE_BRANCHNAME +export GARAGE_TARGET_NAME + RAMDISK_EXT ?= ".ext4.gz" RAMDISK_EXT_arm ?= ".ext4.gz.u-boot" @@ -205,7 +207,7 @@ IMAGE_CMD_garagesign () { push_success=0 for push_retries in $( seq 3 ); do garage-sign targets pull --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} - garage-sign targets add --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --name ${OSTREE_BRANCHNAME} --format OSTREE --version ${ostree_target_hash} --length 0 --url "https://example.com/" --sha256 ${ostree_target_hash} --hardwareids ${MACHINE} + 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} garage-sign targets sign --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --key-name=targets errcode=0 garage-sign targets push --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} || errcode=$? diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 5dc4811..be9a017 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass @@ -53,6 +53,8 @@ export OSTREE_BRANCHNAME export OSTREE_REPO export OSTREE_BOOTLOADER +export GARAGE_TARGET_NAME + IMAGE_CMD_otaimg () { if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then if [ -z "$OSTREE_REPO" ]; then @@ -106,6 +108,9 @@ IMAGE_CMD_otaimg () { mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ || true # Ensure that /var/local exists (AGL symlinks /usr/local to /var/local) install -d ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/local + # Set package version for the first deployment + echo "{\"${ostree_target_hash}\":\"${GARAGE_TARGET_NAME}-${ostree_target_hash}\"}" > ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/installed_versions + rm -rf ${HOME_TMP} # Calculate image type -- cgit v1.2.3-54-g00ecf From 19883e9d2602c9cb096bcd81b5a1c49e1faba74f Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Fri, 19 Jan 2018 17:02:27 +0100 Subject: Rename all instances of hsm-test and use latest aktualizr. --- README.adoc | 2 +- recipes-sota/aktualizr/aktualizr-hsm-prov.bb | 31 +++++++++++++++++++++++ recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb | 31 ----------------------- recipes-sota/aktualizr/aktualizr_git.bb | 4 +-- 4 files changed, 34 insertions(+), 34 deletions(-) create mode 100644 recipes-sota/aktualizr/aktualizr-hsm-prov.bb delete mode 100644 recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb diff --git a/README.adoc b/README.adoc index e82b904..fbd3239 100644 --- a/README.adoc +++ b/README.adoc @@ -69,7 +69,7 @@ Although we have used U-Boot so far, other boot loaders can be configured work w * `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". * `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. * `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]. -* `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-test-prov`. The default is `aktualizr-auto-prov`. This can also be set to an empty string to avoid using a provisioning recipe. +* `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. * `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). * `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"`. * `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. diff --git a/recipes-sota/aktualizr/aktualizr-hsm-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb new file mode 100644 index 0000000..944607c --- /dev/null +++ b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb @@ -0,0 +1,31 @@ +SUMMARY = "Aktualizr configuration with HSM support" +DESCRIPTION = "Systemd service and configurations for Aktualizr, the SOTA Client application written in C++" +HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" +SECTION = "base" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" + +DEPENDS = "aktualizr-native" +RDEPENDS_${PN} = "aktualizr softhsm softhsm-testtoken" + +SRC_URI = " \ + file://LICENSE \ + " +PV = "1.0" +PR = "6" + + +require environment.inc +require credentials.inc + +do_install() { + install -d ${D}${libdir}/sota + aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ + -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_hsm_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} +} + +FILES_${PN} = " \ + ${libdir}/sota/sota.toml \ + " + +# 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 1e893fa..0000000 --- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb +++ /dev/null @@ -1,31 +0,0 @@ -SUMMARY = "Aktualizr configuration with HSM support" -DESCRIPTION = "Systemd service and configurations for Aktualizr, the SOTA Client application written in C++" -HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" -SECTION = "base" -LICENSE = "MPL-2.0" -LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" - -DEPENDS = "aktualizr-native" -RDEPENDS_${PN} = "aktualizr softhsm softhsm-testtoken" - -SRC_URI = " \ - file://LICENSE \ - " -PV = "1.0" -PR = "6" - - -require environment.inc -require credentials.inc - -do_install() { - install -d ${D}${libdir}/sota - aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ - -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_hsm_test.toml -o ${D}${libdir}/sota/sota.toml -p ${D} -} - -FILES_${PN} = " \ - ${libdir}/sota/sota.toml \ - " - -# 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 48ed652..872ae9a 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -21,7 +21,7 @@ SRC_URI = " \ file://aktualizr.service \ file://aktualizr-serialcan.service \ " -SRCREV = "e53f2a5747bba3e4f40609aa27f3d89e80c2d784" +SRCREV = "07d73645231681848bd943074498581e930d8582" BRANCH ?= "master" S = "${WORKDIR}/git" @@ -55,7 +55,7 @@ do_install_append_class-native () { rm -f ${D}${bindir}/example-interface install -d ${D}${libdir}/sota install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml - install -m 0644 ${S}/config/sota_hsm_test.toml ${D}/${libdir}/sota/sota_hsm_test.toml + install -m 0644 ${S}/config/sota_hsm_prov.toml ${D}/${libdir}/sota/sota_hsm_prov.toml install -m 0644 ${S}/config/sota_implicit_prov.toml ${D}/${libdir}/sota/sota_implicit_prov.toml install -m 0755 ${B}/src/sota_tools/garage-sign-prefix/src/garage-sign/bin/* ${D}${bindir} -- cgit v1.2.3-54-g00ecf From fbfdf91079a93b446a7502851ab9508b38146eef Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 18 Jan 2018 12:36:21 +0100 Subject: Add PR = "1" to ostree to fix annoying caching problem. --- recipes-sota/ostree/ostree_git.bb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes-sota/ostree/ostree_git.bb b/recipes-sota/ostree/ostree_git.bb index 00559b6..ad85775 100644 --- a/recipes-sota/ostree/ostree_git.bb +++ b/recipes-sota/ostree/ostree_git.bb @@ -11,6 +11,7 @@ SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master" SRCREV="854a823e05d6fe8b610c02c2a71eaeb2bf1e98a6" PV = "v2017.13" +PR = "1" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From 62b32e9cc348758e8569040f4d5f4d337234d3ad Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Mon, 22 Jan 2018 19:15:40 +0200 Subject: Drop rvi-sota-client and remove meta-rust dependency Remove the old RVI SOTA Client and the dependecy from Yocto/OE layer meta-rust. Signed-off-by: Leon Anavi --- conf/include/bblayers/sota.inc | 1 - .../files/sota-client-autoprovision.service | 15 -- .../files/sota-client-ostree.service | 13 -- .../files/sota-client-uptane.service | 15 -- .../rvi-sota-client/files/sota-installer.service | 12 -- recipes-sota/rvi-sota-client/rvi-sota-client.inc | 173 --------------------- .../rvi-sota-client/rvi-sota-client_git.bb | 59 ------- recipes-sota/rvi-sota-client/sota-installer_git.bb | 25 --- recipes-sota/rvi-sota-client/sota-launcher_git.bb | 15 -- 9 files changed, 328 deletions(-) delete mode 100644 recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service delete mode 100644 recipes-sota/rvi-sota-client/files/sota-client-ostree.service delete mode 100644 recipes-sota/rvi-sota-client/files/sota-client-uptane.service delete mode 100644 recipes-sota/rvi-sota-client/files/sota-installer.service delete mode 100644 recipes-sota/rvi-sota-client/rvi-sota-client.inc delete mode 100644 recipes-sota/rvi-sota-client/rvi-sota-client_git.bb delete mode 100644 recipes-sota/rvi-sota-client/sota-installer_git.bb delete mode 100644 recipes-sota/rvi-sota-client/sota-launcher_git.bb diff --git a/conf/include/bblayers/sota.inc b/conf/include/bblayers/sota.inc index b1fd28a..26eea22 100644 --- a/conf/include/bblayers/sota.inc +++ b/conf/include/bblayers/sota.inc @@ -1,4 +1,3 @@ BBLAYERS += "${METADIR}/meta-updater" BBLAYERS += "${METADIR}/meta-openembedded/meta-filesystems" BBLAYERS += "${METADIR}/meta-openembedded/meta-oe" -BBLAYERS += "${METADIR}/meta-rust" 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 @@ -[Unit] -Description=SOTA Client Autoprovisioning -Requires=network-online.target -After=network-online.target - -[Service] -Type=oneshot -WorkingDirectory=/var/sota -Environment=SOTA_CERT_DIR=/var/sota -ExecStart=/usr/bin/sota_provision.sh sota_provisioning_credentials -RemainAfterExit=true -StandardOutput=journal - -[Install] -WantedBy=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 @@ -[Unit] -Description=SOTA Client -Requires=network-online.target -After=network.target network-online.target - -[Service] -RestartSec=5 -Restart=on-failure -Environment="RUST_LOG=debug" -ExecStart=/usr/bin/sota_client --config /sysroot/boot/sota.toml --device-package-manager ostree - -[Install] -WantedBy=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 @@ -[Unit] -Description=SOTA Client -Requires=network-online.target -After=network.target network-online.target -Requires=sota-client-autoprovision -After=sota-client-autoprovision - -[Service] -RestartSec=5 -Restart=on-failure -Environment="RUST_LOG=debug" -ExecStart=/usr/bin/sota_client --config /var/sota/sota.toml --device-package-manager uptane - -[Install] -WantedBy=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 @@ -[Unit] -Description=SOTA Secondary ECU Installer -Requires=network-online.target -After=network-online.target - -[Service] -RestartSec=10 -Restart=always -ExecStart=/usr/bin/sota-installer --level debug --oneshot --config /var/sota/installer.toml - -[Install] -WantedBy=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 @@ -inherit cargo systemd - -DESCRIPTION = "rvi-sota-client recipe" -HOMEPAGE = "https://github.com/advancedtelematic/rvi_sota_client" -LICENSE = "MPL-2.0" -LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea" - -BBCLASSEXTEND = "native" - -S = "${WORKDIR}/git" - -SRC_URI[index.md5sum] = "6a635e8a081b4d4ba4cebffd721c2d7d" -SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2" - -# also update PV and SRC_URI crates when updating SRCREV -SRCREV = "be8ec83af2051a2b2499ce8878242771c65f0f1c" - -PR = "1" - -# generate with: `make package-version` -PV = "0.2.34-8-gbe8ec83" - -# generate with: `make yocto-version` -SRC_URI = " \ -git://github.com/advancedtelematic/rvi_sota_client \ -file://sota-client-autoprovision.service \ -file://sota-client-ostree.service \ -file://sota-client-uptane.service \ -file://sota-installer.service \ -crate://crates.io/adler32/1.0.2 \ -crate://crates.io/advapi32-sys/0.2.0 \ -crate://crates.io/aho-corasick/0.6.3 \ -crate://crates.io/ansi_term/0.9.0 \ -crate://crates.io/antidote/1.0.0 \ -crate://crates.io/atty/0.2.3 \ -crate://crates.io/backtrace/0.3.3 \ -crate://crates.io/backtrace-sys/0.1.15 \ -crate://crates.io/base64/0.6.0 \ -crate://crates.io/bincode/0.9.0 \ -crate://crates.io/bit-set/0.4.0 \ -crate://crates.io/bit-vec/0.4.4 \ -crate://crates.io/bitflags/0.7.0 \ -crate://crates.io/bitflags/0.9.1 \ -crate://crates.io/block-buffer/0.2.0 \ -crate://crates.io/byte-tools/0.2.0 \ -crate://crates.io/byteorder/1.1.0 \ -crate://crates.io/bytes/0.4.5 \ -crate://crates.io/cc/1.0.1 \ -crate://crates.io/cfg-if/0.1.2 \ -crate://crates.io/chan/0.1.19 \ -crate://crates.io/chan-signal/0.3.1 \ -crate://crates.io/chrono/0.4.0 \ -crate://crates.io/clap/2.26.2 \ -crate://crates.io/coco/0.1.1 \ -crate://crates.io/constant_time_eq/0.1.3 \ -crate://crates.io/core-foundation/0.2.3 \ -crate://crates.io/core-foundation-sys/0.2.3 \ -crate://crates.io/crossbeam/0.3.0 \ -crate://crates.io/crypt32-sys/0.2.0 \ -crate://crates.io/crypto-mac/0.4.0 \ -crate://crates.io/dbghelp-sys/0.2.0 \ -crate://crates.io/dbus/0.5.4 \ -crate://crates.io/digest/0.6.2 \ -crate://crates.io/dtoa/0.4.2 \ -crate://crates.io/either/1.2.0 \ -crate://crates.io/env_logger/0.4.3 \ -crate://crates.io/error-chain/0.10.0 \ -crate://crates.io/fake-simd/0.1.2 \ -crate://crates.io/filetime/0.1.14 \ -crate://crates.io/foreign-types/0.2.0 \ -crate://crates.io/fuchsia-zircon/0.2.1 \ -crate://crates.io/fuchsia-zircon-sys/0.2.0 \ -crate://crates.io/futures/0.1.16 \ -crate://crates.io/gcc/0.3.54 \ -crate://crates.io/generic-array/0.8.3 \ -crate://crates.io/getopts/0.2.15 \ -crate://crates.io/hex/0.2.0 \ -crate://crates.io/hmac/0.4.2 \ -crate://crates.io/httparse/1.2.3 \ -crate://crates.io/hyper/0.10.13 \ -crate://crates.io/hyper-native-tls/0.2.4 \ -crate://crates.io/idna/0.1.4 \ -crate://crates.io/iovec/0.1.1 \ -crate://crates.io/itoa/0.3.4 \ -crate://crates.io/kernel32-sys/0.2.2 \ -crate://crates.io/language-tags/0.2.2 \ -crate://crates.io/lazy_static/0.2.9 \ -crate://crates.io/libc/0.2.32 \ -crate://crates.io/libdbus-sys/0.1.1 \ -crate://crates.io/libflate/0.1.11 \ -crate://crates.io/log/0.3.8 \ -crate://crates.io/maplit/0.1.5 \ -crate://crates.io/matches/0.1.6 \ -crate://crates.io/memchr/1.0.1 \ -crate://crates.io/metadeps/1.1.2 \ -crate://crates.io/mime/0.2.6 \ -crate://crates.io/native-tls/0.1.4 \ -crate://crates.io/net2/0.2.31 \ -crate://crates.io/nodrop/0.1.9 \ -crate://crates.io/num/0.1.40 \ -crate://crates.io/num-integer/0.1.35 \ -crate://crates.io/num-iter/0.1.34 \ -crate://crates.io/num-traits/0.1.40 \ -crate://crates.io/num_cpus/1.7.0 \ -crate://crates.io/odds/0.2.25 \ -crate://crates.io/openssl/0.9.19 \ -crate://crates.io/openssl-sys/0.9.19 \ -crate://crates.io/pem/0.4.1 \ -crate://crates.io/percent-encoding/1.0.0 \ -crate://crates.io/pkg-config/0.3.9 \ -crate://crates.io/quote/0.3.15 \ -crate://crates.io/rand/0.3.17 \ -crate://crates.io/rayon/0.8.2 \ -crate://crates.io/rayon-core/1.2.1 \ -crate://crates.io/redox_syscall/0.1.31 \ -crate://crates.io/redox_termios/0.1.1 \ -crate://crates.io/regex/0.2.2 \ -crate://crates.io/regex-syntax/0.4.1 \ -crate://crates.io/reqwest/0.6.2 \ -crate://crates.io/ring/0.12.1 \ -crate://crates.io/rust-crypto/0.2.36 \ -crate://crates.io/rustc-demangle/0.1.5 \ -crate://crates.io/rustc-serialize/0.3.24 \ -crate://crates.io/safemem/0.2.0 \ -crate://crates.io/schannel/0.1.8 \ -crate://crates.io/scopeguard/0.3.2 \ -crate://crates.io/secur32-sys/0.2.0 \ -crate://crates.io/security-framework/0.1.16 \ -crate://crates.io/security-framework-sys/0.1.16 \ -crate://crates.io/serde/1.0.15 \ -crate://crates.io/serde_derive/1.0.15 \ -crate://crates.io/serde_derive_internals/0.16.0 \ -crate://crates.io/serde_json/1.0.3 \ -crate://crates.io/serde_urlencoded/0.5.1 \ -crate://crates.io/sha1/0.2.0 \ -crate://crates.io/sha2/0.6.0 \ -crate://crates.io/strsim/0.6.0 \ -crate://crates.io/syn/0.11.11 \ -crate://crates.io/synom/0.11.3 \ -crate://crates.io/tar/0.4.13 \ -crate://crates.io/tempdir/0.3.5 \ -crate://crates.io/term_size/0.3.0 \ -crate://crates.io/termion/1.5.1 \ -crate://crates.io/textwrap/0.8.0 \ -crate://crates.io/thread_local/0.3.4 \ -crate://crates.io/time/0.1.38 \ -crate://crates.io/toml/0.2.1 \ -crate://crates.io/toml/0.4.5 \ -crate://crates.io/traitobject/0.1.0 \ -crate://crates.io/tungstenite/0.5.0 \ -crate://crates.io/typeable/0.1.2 \ -crate://crates.io/typenum/1.9.0 \ -crate://crates.io/unicase/1.4.2 \ -crate://crates.io/unicode-bidi/0.3.4 \ -crate://crates.io/unicode-normalization/0.1.5 \ -crate://crates.io/unicode-width/0.1.4 \ -crate://crates.io/unicode-xid/0.0.4 \ -crate://crates.io/unix_socket/0.5.0 \ -crate://crates.io/unreachable/1.0.0 \ -crate://crates.io/untrusted/0.5.1 \ -crate://crates.io/url/1.5.1 \ -crate://crates.io/utf-8/0.7.1 \ -crate://crates.io/utf8-ranges/1.0.0 \ -crate://crates.io/uuid/0.5.1 \ -crate://crates.io/vcpkg/0.2.2 \ -crate://crates.io/vec_map/0.8.0 \ -crate://crates.io/version_check/0.1.3 \ -crate://crates.io/void/1.0.2 \ -crate://crates.io/winapi/0.2.8 \ -crate://crates.io/winapi-build/0.1.1 \ -crate://crates.io/ws2_32-sys/0.2.1 \ -crate://crates.io/xattr/0.1.11 \ -" 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 @@ -require rvi-sota-client.inc - - -SYSTEMD_SERVICE_${PN} = "sota-client.service sota-client-autoprovision.service" - -FILES_${PN} = " \ -/lib64 \ -${bindir}/sota_client \ -${bindir}/sota_sysinfo.sh \ -${bindir}/sota_provision.sh \ -${sysconfdir}/sota_client.version \ -${sysconfdir}/sota_certificates \ -${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client.service', '', d)} \ -${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client-autoprovision.service', '', d)} \ -" - -DEPENDS += " openssl openssl-native dbus " -RDEPENDS_${PN} = " \ -bash \ -curl \ -libcrypto \ -libssl \ -lshw \ -jq \ -python-petname \ -sota-launcher \ -zip \ -" - -export SOTA_PACKED_CREDENTIALS - -do_compile_prepend() { - export SOTA_VERSION=$(make sota-version) - cd sota-client -} - -do_install() { - ln -fs /lib ${D}/lib64 - - install -d ${D}${bindir} - install -d ${D}${sysconfdir} - - echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version - install -c ${S}/sota-client/docker/sota_certificates ${D}${sysconfdir} - - install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir} - install -m 0755 ${S}/sota-client/docker/sota_provision.sh ${D}${bindir} - install -m 0755 ${S}/sota-client/docker/sota_sysinfo.sh ${D}${bindir} - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}/${systemd_unitdir}/system - if [ -n "$SOTA_PACKED_CREDENTIALS" ]; then - install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service - else - install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service - fi - install -m 0644 ${WORKDIR}/sota-client-autoprovision.service ${D}/${systemd_unitdir}/system/sota-client-autoprovision.service - fi -} 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 @@ -require rvi-sota-client.inc - - -SYSTEMD_SERVICE_${PN} = "sota-installer.service" - -DEPENDS += " rvi-sota-client " - -FILES_${PN} = " \ -${bindir}/sota-installer \ -${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-installer.service', '', d)} \ -" - -do_compile_prepend() { - cd sota-installer -} - -do_install() { - install -d ${D}${bindir} - install -m 0755 target/${TARGET_SYS}/release/sota-installer ${D}${bindir} - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}/${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/sota-installer.service ${D}/${systemd_unitdir}/system/sota-installer.service - fi -} 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 @@ -require rvi-sota-client.inc - - -DEPENDS += " rvi-sota-client " -FILES_${PN} = "${bindir}/sota-launcher" - - -do_compile_prepend() { - cd sota-launcher -} - -do_install() { - install -d ${D}${bindir} - install -m 0755 target/${TARGET_SYS}/release/sota-launcher ${D}${bindir} -} -- cgit v1.2.3-54-g00ecf From 45bd8d6995119b84d9622dd8ce3d1fedfa2ed0ef Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Tue, 23 Jan 2018 17:41:25 +0100 Subject: Add asn1c dependency for aktualizr --- recipes-sota/aktualizr/aktualizr_git.bb | 2 +- recipes-sota/asn1c/asn1c.bb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 recipes-sota/asn1c/asn1c.bb diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 872ae9a..3d80cd9 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -5,7 +5,7 @@ SECTION = "base" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" -DEPENDS = "boost curl openssl libarchive libsodium " +DEPENDS = "boost curl openssl libarchive libsodium asn1c-native " DEPENDS_append_class-target = "jansson ostree ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', ' libp11', '', d)} " DEPENDS_append_class-native = "glib-2.0-native " diff --git a/recipes-sota/asn1c/asn1c.bb b/recipes-sota/asn1c/asn1c.bb new file mode 100644 index 0000000..7539825 --- /dev/null +++ b/recipes-sota/asn1c/asn1c.bb @@ -0,0 +1,16 @@ +SUMMARY = "ASN.1 to C compiler" +DESCRIPTION = "Generates serialization routines from ASN.1 schemas" +HOMEPAGE = "http://lionet.info/asn1c" +SECTION = "base" +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://LICENSE;md5=ee8bfaaa7d71cf3edb079475e6716d4b" + +inherit autotools native + +PV = "0.9.28" +SRC_URI = "https://github.com/vlm/asn1c/releases/download/v${PV}/asn1c-${PV}.tar.gz" +SRC_URI[sha256sum] = "8007440b647ef2dd9fb73d931c33ac11764e6afb2437dbe638bb4e5fc82386b9" + +BBCLASSEXTEND = "native nativesdk" + +# vim:set ts=4 sw=4 sts=4 expandtab: -- cgit v1.2.3-54-g00ecf From 79497c99576f3f3f68d82d25f266d4b421af510f Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Wed, 24 Jan 2018 17:15:04 +0100 Subject: Patch asn1c skeletons file discovery The OpenEmbedded native build process interferes with asn1c's method to find its required data: asn1c-native is moved after being built but the data directory is hardcoded from configure time in asn1c. There is an alternative detection method builtin in asn1c, used for development. Let's just hack into that and target '../share/asn1c' from the binary directory. --- recipes-sota/asn1c/asn1c.bb | 3 +- recipes-sota/asn1c/files/skeletons_dir_fix.patch | 44 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 recipes-sota/asn1c/files/skeletons_dir_fix.patch diff --git a/recipes-sota/asn1c/asn1c.bb b/recipes-sota/asn1c/asn1c.bb index 7539825..9d1517d 100644 --- a/recipes-sota/asn1c/asn1c.bb +++ b/recipes-sota/asn1c/asn1c.bb @@ -8,7 +8,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=ee8bfaaa7d71cf3edb079475e6716d4b" inherit autotools native PV = "0.9.28" -SRC_URI = "https://github.com/vlm/asn1c/releases/download/v${PV}/asn1c-${PV}.tar.gz" +SRC_URI = "https://github.com/vlm/asn1c/releases/download/v${PV}/asn1c-${PV}.tar.gz \ + file://skeletons_dir_fix.patch" SRC_URI[sha256sum] = "8007440b647ef2dd9fb73d931c33ac11764e6afb2437dbe638bb4e5fc82386b9" BBCLASSEXTEND = "native nativesdk" 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 @@ +From 1a1c2c94f700cf0f4dc5dba863950b16477fdc6d Mon Sep 17 00:00:00 2001 +From: Laurent Bonnans +Date: Thu, 25 Jan 2018 09:49:41 +0100 +Subject: [PATCH] Patch the skeletons directory detection + +Detect `share/asn1c` from `bin/` if it exists +--- + asn1c/asn1c.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/asn1c/asn1c.c b/asn1c/asn1c.c +index eb1eff7c..dd9fc832 100644 +--- a/asn1c/asn1c.c ++++ b/asn1c/asn1c.c +@@ -226,22 +226,21 @@ main(int ac, char **av) { + if(skeletons_dir == NULL) { + struct stat sb; + skeletons_dir = DATADIR; +- if((av[-optind][0] == '.' || av[-optind][1] == '/') +- && stat(skeletons_dir, &sb)) { ++ if(stat(skeletons_dir, &sb)) { + /* + * The default skeletons directory does not exist, + * compute it from my file name: +- * ./asn1c/asn1c -> ./skeletons ++ * ./asn1c/asn1c -> ./share/asn1c + */ + char *p; + size_t len; + + p = a1c_dirname(av[-optind]); + +- len = strlen(p) + sizeof("/../skeletons"); ++ len = strlen(p) + sizeof("/../share/asn1c"); + skeletons_dir = malloc(len); + assert(skeletons_dir); +- snprintf(skeletons_dir, len, "%s/../skeletons", p); ++ snprintf(skeletons_dir, len, "%s/../share/asn1c", p); + if(stat(skeletons_dir, &sb)) { + fprintf(stderr, + "WARNING: skeletons are neither in " +-- +2.15.1 + -- cgit v1.2.3-54-g00ecf From c64b399633975bc05856e5eded519c4f22adfe44 Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Fri, 1 Dec 2017 11:56:51 +0100 Subject: Add tests for aktualizr-info --- lib/oeqa/selftest/cases/updater.py | 54 +++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py index 9264616..91ac9fc 100644 --- a/lib/oeqa/selftest/cases/updater.py +++ b/lib/oeqa/selftest/cases/updater.py @@ -1,8 +1,9 @@ +# pylint: disable=C0111,C0325 import os import logging import subprocess -import time import unittest +from time import sleep from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars @@ -51,11 +52,11 @@ class GeneralTests(OESelftestTestCase): def test_feature_sota(self): result = get_bb_var('DISTRO_FEATURES').find('sota') - self.assertNotEqual(result, -1, 'Feature "sota" not set at DISTRO_FEATURES'); + self.assertNotEqual(result, -1, 'Feature "sota" not set at DISTRO_FEATURES') def test_feature_systemd(self): result = get_bb_var('DISTRO_FEATURES').find('systemd') - self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES'); + self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES') def test_credentials(self): bitbake('core-image-minimal') @@ -68,7 +69,8 @@ class GeneralTests(OESelftestTestCase): deploydir = get_bb_var('DEPLOY_DIR_IMAGE') imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal') # Check if the credentials are included in the output image - result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' % (deploydir, imagename), ignore_status=True) + result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' % + (deploydir, imagename), ignore_status=True) self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) def test_java(self): @@ -101,7 +103,7 @@ class GeneralTests(OESelftestTestCase): self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /usr/bin/man') path2 = os.path.realpath(image_path) size2 = os.path.getsize(path2) - logger.info('Second image %s has size %i' % (path2, size2)) + logger.info('Second image %s has size %i', path2, size2) self.assertNotEqual(path1, path2, "Image paths are identical; image was not rebuilt.") self.assertNotEqual(size1, size2, "Image sizes are identical; image was not rebuilt.") @@ -117,14 +119,17 @@ class QemuTests(OESelftestTestCase): def tearDownClass(cls): qemu_terminate(cls.s) + def run_command(self, command): + return qemu_send_command(self.qemu.ssh_port, command) + def test_hostname(self): print('') print('Checking machine name (hostname) of device:') - value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') + stdout, stderr, retcode = self.run_command('hostname') machine = get_bb_var('MACHINE', 'core-image-minimal') - self.assertEqual(err, b'', 'Error: ' + err.decode()) + self.assertEqual(stderr, b'', 'Error: ' + stderr.decode()) # Strip off line ending. - value_str = value.decode()[:-1] + value_str = stdout.decode()[:-1] self.assertEqual(value_str, machine, 'MACHINE does not match hostname: ' + machine + ', ' + value_str) print(value_str) @@ -132,9 +137,26 @@ class QemuTests(OESelftestTestCase): def test_var_sota(self): print('') print('Checking contents of /var/sota:') - value, err = qemu_send_command(self.qemu.ssh_port, 'ls /var/sota') - self.assertEqual(err, b'', 'Error: ' + err.decode()) - print(value.decode()) + stdout, stderr, retcode = self.run_command('ls /var/sota') + self.assertEqual(stderr, b'', 'Error: ' + stderr.decode()) + self.assertEqual(retcode, 0) + print(stdout.decode()) + + def test_aktualizr_info(self): + print('Checking output of aktualizr-info:') + ran_ok = False + for delay in [0, 1, 2, 5, 10, 15]: + sleep(delay) + try: + stdout, stderr, retcode = self.run_command('aktualizr-info') + if retcode == 0 and stderr == b'': + ran_ok = True + break + except IOError as e: + print(e) + if not ran_ok: + print(stdout.decode()) + print(stderr.decode()) class GrubTests(OESelftestTestCase): @@ -159,9 +181,10 @@ class GrubTests(OESelftestTestCase): def test_grub(self): print('') print('Checking machine name (hostname) of device:') - value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') + value, err, retcode = qemu_send_command(self.qemu.ssh_port, 'hostname') machine = get_bb_var('MACHINE', 'core-image-minimal') self.assertEqual(err, b'', 'Error: ' + err.decode()) + self.assertEqual(retcode, 0) # Strip off line ending. value_str = value.decode()[:-1] self.assertEqual(value_str, machine, @@ -194,7 +217,7 @@ def qemu_launch(efi=False, machine=None): cmdline = qemu.command_line() print('Booting image with run-qemu-ota...') s = subprocess.Popen(cmdline) - time.sleep(10) + sleep(10) return qemu, s def qemu_terminate(s): @@ -207,6 +230,7 @@ def qemu_send_command(port, command): command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + str(port) + ' "' + command + '"'] s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - value, err = s2.communicate() - return value, err + stdout, stderr = s2.communicate() + return stdout, stderr, s2.returncode +# vim:set ts=4 sw=4 sts=4 expandtab: -- cgit v1.2.3-54-g00ecf From bb25b4540fbe15fbc638087e8e7b86939c65db85 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Fri, 19 Jan 2018 17:02:27 +0100 Subject: Rename all instances of hsm-test and use latest aktualizr. --- README.adoc | 2 +- recipes-sota/aktualizr/aktualizr-hsm-prov.bb | 31 +++++++++++++++++++++++ recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb | 31 ----------------------- recipes-sota/aktualizr/aktualizr_git.bb | 4 +-- 4 files changed, 34 insertions(+), 34 deletions(-) create mode 100644 recipes-sota/aktualizr/aktualizr-hsm-prov.bb delete mode 100644 recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb diff --git a/README.adoc b/README.adoc index e82b904..fbd3239 100644 --- a/README.adoc +++ b/README.adoc @@ -69,7 +69,7 @@ Although we have used U-Boot so far, other boot loaders can be configured work w * `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". * `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. * `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]. -* `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-test-prov`. The default is `aktualizr-auto-prov`. This can also be set to an empty string to avoid using a provisioning recipe. +* `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. * `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). * `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"`. * `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. diff --git a/recipes-sota/aktualizr/aktualizr-hsm-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb new file mode 100644 index 0000000..944607c --- /dev/null +++ b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb @@ -0,0 +1,31 @@ +SUMMARY = "Aktualizr configuration with HSM support" +DESCRIPTION = "Systemd service and configurations for Aktualizr, the SOTA Client application written in C++" +HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" +SECTION = "base" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" + +DEPENDS = "aktualizr-native" +RDEPENDS_${PN} = "aktualizr softhsm softhsm-testtoken" + +SRC_URI = " \ + file://LICENSE \ + " +PV = "1.0" +PR = "6" + + +require environment.inc +require credentials.inc + +do_install() { + install -d ${D}${libdir}/sota + aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ + -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_hsm_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} +} + +FILES_${PN} = " \ + ${libdir}/sota/sota.toml \ + " + +# 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 1e893fa..0000000 --- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb +++ /dev/null @@ -1,31 +0,0 @@ -SUMMARY = "Aktualizr configuration with HSM support" -DESCRIPTION = "Systemd service and configurations for Aktualizr, the SOTA Client application written in C++" -HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" -SECTION = "base" -LICENSE = "MPL-2.0" -LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" - -DEPENDS = "aktualizr-native" -RDEPENDS_${PN} = "aktualizr softhsm softhsm-testtoken" - -SRC_URI = " \ - file://LICENSE \ - " -PV = "1.0" -PR = "6" - - -require environment.inc -require credentials.inc - -do_install() { - install -d ${D}${libdir}/sota - aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ - -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_hsm_test.toml -o ${D}${libdir}/sota/sota.toml -p ${D} -} - -FILES_${PN} = " \ - ${libdir}/sota/sota.toml \ - " - -# 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 3925922..67ec104 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -21,7 +21,7 @@ SRC_URI = " \ file://aktualizr.service \ file://aktualizr-serialcan.service \ " -SRCREV = "37fbf0dfd88d42d76301890818dc4e83b35d9fa4" +SRCREV = "07d73645231681848bd943074498581e930d8582" BRANCH ?= "master" S = "${WORKDIR}/git" @@ -58,7 +58,7 @@ do_install_append_class-native () { rm -f ${D}${bindir}/example-interface install -d ${D}${libdir}/sota install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml - install -m 0644 ${S}/config/sota_hsm_test.toml ${D}/${libdir}/sota/sota_hsm_test.toml + install -m 0644 ${S}/config/sota_hsm_prov.toml ${D}/${libdir}/sota/sota_hsm_prov.toml install -m 0644 ${S}/config/sota_implicit_prov.toml ${D}/${libdir}/sota/sota_implicit_prov.toml install -m 0755 ${B}/src/sota_tools/garage-sign-prefix/src/garage-sign/bin/* ${D}${bindir} -- cgit v1.2.3-54-g00ecf From 4d1b5eef40ec0c9587bbb99e24f75e36f4c77df7 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 30 Jan 2018 12:07:41 +0100 Subject: Delete redundant sota.toml in aktualizr recipe. It's installed for the Ubuntu case but is not necessary in meta-updater. --- recipes-sota/aktualizr/aktualizr_git.bb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 495162e..beaf893 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -42,6 +42,7 @@ do_install_append () { } do_install_append_class-target () { rm -f ${D}${bindir}/aktualizr_implicit_writer + rm -f ${D}${libdir}/sota/sota.toml ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-example', '', 'rm -f ${D}${bindir}/example-interface', d)} ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-isotp-example', '', 'rm -f ${D}${bindir}/isotp-test-interface', d)} -- cgit v1.2.3-54-g00ecf From 5f033dd60d20ce332d3f1d8d44e296791660d6d3 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 30 Jan 2018 12:08:56 +0100 Subject: Minor changes to keep hsm and implicit recipes consistent. At present they should be very similar. The only outstanding difference (other than the HSM parts) is whether the root CA is installed. --- recipes-sota/aktualizr/aktualizr-hsm-prov.bb | 9 +++++---- recipes-sota/aktualizr/aktualizr-implicit-prov.bb | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr-hsm-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb index 944607c..5f8da3c 100644 --- a/recipes-sota/aktualizr/aktualizr-hsm-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb @@ -1,5 +1,5 @@ SUMMARY = "Aktualizr configuration with HSM support" -DESCRIPTION = "Systemd service and configurations for Aktualizr, the SOTA Client application written in C++" +DESCRIPTION = "Systemd service and configurations for HSM provisioning with Aktualizr, the SOTA Client application written in C++" HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" SECTION = "base" LICENSE = "MPL-2.0" @@ -14,14 +14,15 @@ SRC_URI = " \ PV = "1.0" PR = "6" - require environment.inc require credentials.inc do_install() { install -d ${D}${libdir}/sota - aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ - -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_hsm_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} + if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then + aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ + -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_hsm_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} + fi } FILES_${PN} = " \ diff --git a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb index b5bf420..cf3d22c 100644 --- a/recipes-sota/aktualizr/aktualizr-implicit-prov.bb +++ b/recipes-sota/aktualizr/aktualizr-implicit-prov.bb @@ -4,15 +4,15 @@ HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" SECTION = "base" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" + DEPENDS = "aktualizr-native" RDEPENDS_${PN} = "aktualizr" -PV = "1.0" -PR = "1" SRC_URI = " \ file://LICENSE \ " - +PV = "1.0" +PR = "1" require environment.inc require credentials.inc -- cgit v1.2.3-54-g00ecf