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 (limited to 'scripts') 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 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 (limited to 'scripts') 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 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(-) (limited to 'scripts') 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(-) (limited to 'scripts') 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 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(-) (limited to 'scripts') 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 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 (limited to 'scripts') 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 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(-) (limited to 'scripts') 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 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(-) (limited to 'scripts') 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(-) (limited to 'scripts') 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