summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2020-02-07 11:42:56 +0100
committerGitHub <noreply@github.com>2020-02-07 11:42:56 +0100
commit98db3460285d634073830879825825c4a893863c (patch)
tree4d4ab78f983d147b4f8bbce6f6b88fda74e732b1
parent5163ff50bb45903ca31b5b19220ad9ddf54ee0c1 (diff)
parent14ba0d94d0bc7448a3b9db409dcc2139836b9d90 (diff)
downloadmeta-updater-98db3460285d634073830879825825c4a893863c.tar.gz
Merge pull request #672 from advancedtelematic/feat/warrior/2020.2
Feat/warrior/2020.2
-rw-r--r--conf/local.conf.nonostree.append11
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb8
-rw-r--r--recipes-sota/aktualizr/files/aktualizr.service2
-rwxr-xr-xscripts/envsetup.sh33
-rw-r--r--scripts/qemucommand.py34
-rwxr-xr-xscripts/run-qemu-ota3
6 files changed, 67 insertions, 24 deletions
diff --git a/conf/local.conf.nonostree.append b/conf/local.conf.nonostree.append
new file mode 100644
index 0000000..0e63e98
--- /dev/null
+++ b/conf/local.conf.nonostree.append
@@ -0,0 +1,11 @@
1
2DISTRO_FEATURES_append = " systemd"
3VIRTUAL-RUNTIME_init_manager = "systemd"
4
5PREFERRED_RPROVIDER_virtual/network-configuration ??= "networkd-dhcp-conf"
6
7SOTA_DEPLOY_CREDENTIALS ?= "1"
8PACKAGECONFIG_pn-aktualizr = ""
9
10IMAGE_INSTALL_append += "aktualizr"
11IMAGE_INSTALL_append += "aktualizr-shared-prov"
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index 1742430..0aa5702 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -30,7 +30,7 @@ SRC_URI = " \
30SRC_URI[garagesign.md5sum] = "36dedbf79f71cb697a18251ea121bcc6" 30SRC_URI[garagesign.md5sum] = "36dedbf79f71cb697a18251ea121bcc6"
31SRC_URI[garagesign.sha256sum] = "f0a8e4bb258fd65a6f1fe561132d5ab3fe25b76aec0f1873993dc65bf2167608" 31SRC_URI[garagesign.sha256sum] = "f0a8e4bb258fd65a6f1fe561132d5ab3fe25b76aec0f1873993dc65bf2167608"
32 32
33SRCREV = "5ead19cf8aefee44e929b7e98bc5aa63e0621aac" 33SRCREV = "56ac8dafb552b1d15638162ca14e0b818ed5e65f"
34BRANCH ?= "master" 34BRANCH ?= "master"
35 35
36S = "${WORKDIR}/git" 36S = "${WORKDIR}/git"
@@ -140,7 +140,7 @@ python split_hosttools_packages () {
140 140
141PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*" 141PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*"
142 142
143PACKAGES =+ "${PN}-host-tools ${PN}-lib ${PN}-resource-control ${PN}-configs ${PN}-examples ${PN}-secondary ${PN}-secondary-lib ${PN}-sotatools-lib" 143PACKAGES =+ "${PN}-host-tools ${PN}-lib ${PN}-resource-control ${PN}-configs ${PN}-secondary ${PN}-secondary-lib ${PN}-sotatools-lib"
144 144
145ALLOW_EMPTY_${PN}-host-tools = "1" 145ALLOW_EMPTY_${PN}-host-tools = "1"
146 146
@@ -163,10 +163,6 @@ FILES_${PN}-configs = " \
163 ${libdir}/sota/* \ 163 ${libdir}/sota/* \
164 " 164 "
165 165
166FILES_${PN}-examples = " \
167 ${bindir}/hmi-stub \
168 "
169
170FILES_${PN}-secondary = " \ 166FILES_${PN}-secondary = " \
171 ${bindir}/aktualizr-secondary \ 167 ${bindir}/aktualizr-secondary \
172 ${libdir}/sota/sota-secondary.toml \ 168 ${libdir}/sota/sota-secondary.toml \
diff --git a/recipes-sota/aktualizr/files/aktualizr.service b/recipes-sota/aktualizr/files/aktualizr.service
index 726809e..b6f0980 100644
--- a/recipes-sota/aktualizr/files/aktualizr.service
+++ b/recipes-sota/aktualizr/files/aktualizr.service
@@ -1,6 +1,6 @@
1[Unit] 1[Unit]
2Description=Aktualizr SOTA Client 2Description=Aktualizr SOTA Client
3After=network.target 3After=network.target nss-lookup.target
4 4
5[Service] 5[Service]
6RestartSec=10 6RestartSec=10
diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh
index 19a5c94..a7ee877 100755
--- a/scripts/envsetup.sh
+++ b/scripts/envsetup.sh
@@ -5,17 +5,24 @@ MACHINE="$1"
5BUILDDIR="build" 5BUILDDIR="build"
6DISTRO="poky-sota-systemd" 6DISTRO="poky-sota-systemd"
7BASE_CONF="local.conf.base.append" 7BASE_CONF="local.conf.base.append"
8declare -A supported_distros=( ["poky-sota-systemd"]="local.conf.systemd.append" ["poky-sota"]="local.conf.base.append" )
9 8
10[[ "$#" -lt 1 ]] && { echo "Usage: ${SCRIPT} <machine> [builddir] [distro=< poky-sota-systemd | poky-sota >]"; return 1; } 9# A definition of a dictionary with a list of configuration files that must be appended
10# to resulting conf/local.conf file for each particular distribution.
11declare -A supported_distros=(
12 ["poky-sota-systemd"]="local.conf.systemd.append"
13 ["poky-sota"]="local.conf.base.append"
14 ["poky"]="local.conf.systemd.append local.conf.nonostree.append"
15)
16
17[[ "$#" -lt 1 ]] && { echo "Usage: ${SCRIPT} <machine> [builddir] [distro=< poky-sota-systemd | poky-sota | poky >]"; return 1; }
11[[ "$#" -ge 2 ]] && { BUILDDIR="$2"; } 18[[ "$#" -ge 2 ]] && { BUILDDIR="$2"; }
12[[ "$#" -eq 3 ]] && { DISTRO="$3"; } 19[[ "$#" -eq 3 ]] && { DISTRO="$3"; }
13 20
14# detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594 21# detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594
15SOURCED=0 22SOURCED=0
16if [ -n "$ZSH_EVAL_CONTEXT" ]; then 23if [[ -n "$ZSH_EVAL_CONTEXT" ]]; then
17 [[ "$ZSH_EVAL_CONTEXT" =~ :file$ ]] && { SOURCED=1; SOURCEDIR=$(cd "$(dirname -- "$0")" && pwd -P); } 24 [[ "$ZSH_EVAL_CONTEXT" =~ :file$ ]] && { SOURCED=1; SOURCEDIR=$(cd "$(dirname -- "$0")" && pwd -P); }
18elif [ -n "$BASH_VERSION" ]; then 25elif [[ -n "$BASH_VERSION" ]]; then
19 [[ "$0" != "${BASH_SOURCE[0]}" ]] && { SOURCED=1; SOURCEDIR=$(cd "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P); } 26 [[ "$0" != "${BASH_SOURCE[0]}" ]] && { SOURCED=1; SOURCEDIR=$(cd "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P); }
20fi 27fi
21 28
@@ -26,23 +33,25 @@ if [[ $SOURCED -ne 1 ]]; then
26fi 33fi
27 34
28METADIR=${METADIR:-${SOURCEDIR}/../..} 35METADIR=${METADIR:-${SOURCEDIR}/../..}
29DISTRO_CONF=${supported_distros[$DISTRO]}
30[[ -n $DISTRO_CONF ]] && { echo "Using $DISTRO_CONF for the specified distro $DISTRO"; } || { echo "The specified distro $DISTRO is not supported"; return 1; }
31 36
32if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then 37if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then
38 declare -a DISTRO_CONFIGS=${supported_distros[$DISTRO]}
39 [[ -n ${DISTRO_CONFIGS[@]} ]] && { echo "Using (${DISTRO_CONFIGS[*]}) for the specified distro '$DISTRO'"; } || { echo "The specified distro $DISTRO is not supported"; return 1; }
40
33 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" 41 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
34 42
35 echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf 43 echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf
36 cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf 44 cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf
37 cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf 45 cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf
38
39 sed -e "s/##MACHINE##/$MACHINE/g" \ 46 sed -e "s/##MACHINE##/$MACHINE/g" \
40 -e "s/##DISTRO##/$DISTRO/g" \ 47 -e "s/##DISTRO##/$DISTRO/g" \
41 "${METADIR}/meta-updater/conf/$BASE_CONF" >> conf/local.conf 48 "${METADIR}/meta-updater/conf/$BASE_CONF" >> conf/local.conf
42 49
43 if [ "$BASE_CONF" != "$DISTRO_CONF" ]; then 50 for config in ${DISTRO_CONFIGS[@]}; do
44 cat "${METADIR}/meta-updater/conf/$DISTRO_CONF" >> conf/local.conf 51 if [[ "$BASE_CONF" != "$config" ]]; then
45 fi 52 cat "${METADIR}/meta-updater/conf/$config" >> conf/local.conf
53 fi
54 done
46else 55else
47 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" 56 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
48fi 57fi \ No newline at end of file
diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py
index 8d3ee0e..86b5b9f 100644
--- a/scripts/qemucommand.py
+++ b/scripts/qemucommand.py
@@ -40,9 +40,25 @@ def random_mac():
40 40
41class QemuCommand(object): 41class QemuCommand(object):
42 def __init__(self, args): 42 def __init__(self, args):
43 print(args)
44 self.enable_u_boot = True
43 self.dry_run = args.dry_run 45 self.dry_run = args.dry_run
44 self.overlay = args.overlay 46 self.overlay = args.overlay
45 self.host_fwd = None 47 self.host_fwd = None
48 self.kernel = None
49 self.drive_interface = "ide"
50
51 if hasattr(args, 'uboot_enable'):
52 self.enable_u_boot = args.uboot_enable.lower() in ("yes", "true", "1")
53
54 # Rise an exception if U-Boot is disabled and overlay option is used
55 if not self.enable_u_boot and self.overlay:
56 raise EnvironmentError("An overlay option is currently supported only with U-Boot loader!")
57
58 # If booting with u-boot is disabled we use "ext4" root fs instead of custom one "ota-ext4"
59 if not self.enable_u_boot:
60 self.drive_interface = "virtio"
61 EXTENSIONS['qemux86-64'] = 'ext4'
46 62
47 if args.machine: 63 if args.machine:
48 self.machine = args.machine 64 self.machine = args.machine
@@ -59,9 +75,7 @@ class QemuCommand(object):
59 # overlay so that we can keep it around just in case. 75 # overlay so that we can keep it around just in case.
60 if args.efi: 76 if args.efi:
61 self.bios = 'OVMF.fd' 77 self.bios = 'OVMF.fd'
62 else: 78 elif self.enable_u_boot:
63 if args.bootloader:
64 uboot_path = args.bootloader
65 uboot_path = abspath(join(args.dir, self.machine, 'u-boot-qemux86-64.rom')) 79 uboot_path = abspath(join(args.dir, self.machine, 'u-boot-qemux86-64.rom'))
66 if self.overlay: 80 if self.overlay:
67 new_uboot_path = self.overlay + '.u-boot.rom' 81 new_uboot_path = self.overlay + '.u-boot.rom'
@@ -77,6 +91,8 @@ class QemuCommand(object):
77 if not exists(uboot_path) and not (self.dry_run and not exists(self.overlay)): 91 if not exists(uboot_path) and not (self.dry_run and not exists(self.overlay)):
78 raise ValueError("U-Boot image %s does not exist" % uboot_path) 92 raise ValueError("U-Boot image %s does not exist" % uboot_path)
79 self.bios = uboot_path 93 self.bios = uboot_path
94 else:
95 self.kernel = abspath(join(args.dir, self.machine, 'bzImage-qemux86-64.bin'))
80 96
81 # If using an overlay, we need to keep the "backing" image around, as 97 # If using an overlay, we need to keep the "backing" image around, as
82 # bitbake will often clean it up, and the overlay silently depends on 98 # bitbake will often clean it up, and the overlay silently depends on
@@ -140,10 +156,14 @@ class QemuCommand(object):
140 156
141 cmdline = [ 157 cmdline = [
142 "qemu-system-x86_64", 158 "qemu-system-x86_64",
143 "-bios", self.bios
144 ] 159 ]
160 if self.enable_u_boot:
161 cmdline += ["-bios", self.bios]
162 else:
163 cmdline += ["-kernel", self.kernel]
164
145 if not self.overlay: 165 if not self.overlay:
146 cmdline += ["-drive", "file=%s,if=ide,format=raw,snapshot=on" % self.image] 166 cmdline += ["-drive", "file=%s,if=%s,format=raw,snapshot=on" % (self.image, self.drive_interface)]
147 cmdline += [ 167 cmdline += [
148 "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port, 168 "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port,
149 "-m", self.mem, 169 "-m", self.mem,
@@ -177,6 +197,10 @@ class QemuCommand(object):
177 cmdline += ['-cpu', 'Haswell'] 197 cmdline += ['-cpu', 'Haswell']
178 if self.overlay: 198 if self.overlay:
179 cmdline.append(self.overlay) 199 cmdline.append(self.overlay)
200
201 # If booting with u-boot is disabled, add kernel command line arguments through qemu -append option
202 if not self.enable_u_boot:
203 cmdline += ["-append", "root=/dev/vda rw highres=off console=ttyS0 ip=dhcp"]
180 return cmdline 204 return cmdline
181 205
182 def img_command_line(self): 206 def img_command_line(self):
diff --git a/scripts/run-qemu-ota b/scripts/run-qemu-ota
index 5652797..59301a4 100755
--- a/scripts/run-qemu-ota
+++ b/scripts/run-qemu-ota
@@ -13,6 +13,9 @@ def main():
13 parser = ArgumentParser(description='Run meta-updater image in qemu') 13 parser = ArgumentParser(description='Run meta-updater image in qemu')
14 parser.add_argument('imagename', default='core-image-minimal', nargs='?', 14 parser.add_argument('imagename', default='core-image-minimal', nargs='?',
15 help="Either the name of the bitbake image target, or a path to the image to run") 15 help="Either the name of the bitbake image target, or a path to the image to run")
16 parser.add_argument('--uboot-enable', default='yes',
17 help='(yes/no). Determines whether or not to use U-Boot loader for running image, '
18 'if yes then u-boot binary file will be passed as -bios option into QEMU cmd line.')
16 parser.add_argument('mac', default=None, nargs='?') 19 parser.add_argument('mac', default=None, nargs='?')
17 parser.add_argument('--dir', default=DEFAULT_DIR, 20 parser.add_argument('--dir', default=DEFAULT_DIR,
18 help='Path to build directory containing the image and u-boot-qemux86-64.rom') 21 help='Path to build directory containing the image and u-boot-qemux86-64.rom')