diff options
-rw-r--r-- | conf/local.conf.nonostree.append | 11 | ||||
-rw-r--r-- | recipes-sota/aktualizr/aktualizr_git.bb | 8 | ||||
-rw-r--r-- | recipes-sota/aktualizr/files/aktualizr.service | 2 | ||||
-rwxr-xr-x | scripts/envsetup.sh | 33 | ||||
-rw-r--r-- | scripts/qemucommand.py | 34 | ||||
-rwxr-xr-x | scripts/run-qemu-ota | 3 |
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 | |||
2 | DISTRO_FEATURES_append = " systemd" | ||
3 | VIRTUAL-RUNTIME_init_manager = "systemd" | ||
4 | |||
5 | PREFERRED_RPROVIDER_virtual/network-configuration ??= "networkd-dhcp-conf" | ||
6 | |||
7 | SOTA_DEPLOY_CREDENTIALS ?= "1" | ||
8 | PACKAGECONFIG_pn-aktualizr = "" | ||
9 | |||
10 | IMAGE_INSTALL_append += "aktualizr" | ||
11 | IMAGE_INSTALL_append += "aktualizr-shared-prov" | ||
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 7aa611f..4460b53 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
@@ -30,7 +30,7 @@ SRC_URI = " \ | |||
30 | SRC_URI[garagesign.md5sum] = "36dedbf79f71cb697a18251ea121bcc6" | 30 | SRC_URI[garagesign.md5sum] = "36dedbf79f71cb697a18251ea121bcc6" |
31 | SRC_URI[garagesign.sha256sum] = "f0a8e4bb258fd65a6f1fe561132d5ab3fe25b76aec0f1873993dc65bf2167608" | 31 | SRC_URI[garagesign.sha256sum] = "f0a8e4bb258fd65a6f1fe561132d5ab3fe25b76aec0f1873993dc65bf2167608" |
32 | 32 | ||
33 | SRCREV = "5ead19cf8aefee44e929b7e98bc5aa63e0621aac" | 33 | SRCREV = "56ac8dafb552b1d15638162ca14e0b818ed5e65f" |
34 | BRANCH ?= "master" | 34 | BRANCH ?= "master" |
35 | 35 | ||
36 | S = "${WORKDIR}/git" | 36 | S = "${WORKDIR}/git" |
@@ -140,7 +140,7 @@ python split_hosttools_packages () { | |||
140 | 140 | ||
141 | PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*" | 141 | PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*" |
142 | 142 | ||
143 | PACKAGES =+ "${PN}-host-tools ${PN}-lib ${PN}-resource-control ${PN}-configs ${PN}-examples ${PN}-secondary ${PN}-secondary-lib ${PN}-sotatools-lib" | 143 | PACKAGES =+ "${PN}-host-tools ${PN}-lib ${PN}-resource-control ${PN}-configs ${PN}-secondary ${PN}-secondary-lib ${PN}-sotatools-lib" |
144 | 144 | ||
145 | ALLOW_EMPTY_${PN}-host-tools = "1" | 145 | ALLOW_EMPTY_${PN}-host-tools = "1" |
146 | 146 | ||
@@ -163,10 +163,6 @@ FILES_${PN}-configs = " \ | |||
163 | ${libdir}/sota/* \ | 163 | ${libdir}/sota/* \ |
164 | " | 164 | " |
165 | 165 | ||
166 | FILES_${PN}-examples = " \ | ||
167 | ${bindir}/hmi-stub \ | ||
168 | " | ||
169 | |||
170 | FILES_${PN}-secondary = " \ | 166 | FILES_${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] |
2 | Description=Aktualizr SOTA Client | 2 | Description=Aktualizr SOTA Client |
3 | After=network.target | 3 | After=network.target nss-lookup.target |
4 | 4 | ||
5 | [Service] | 5 | [Service] |
6 | RestartSec=10 | 6 | RestartSec=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" | |||
5 | BUILDDIR="build" | 5 | BUILDDIR="build" |
6 | DISTRO="poky-sota-systemd" | 6 | DISTRO="poky-sota-systemd" |
7 | BASE_CONF="local.conf.base.append" | 7 | BASE_CONF="local.conf.base.append" |
8 | declare -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. | ||
11 | declare -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 |
15 | SOURCED=0 | 22 | SOURCED=0 |
16 | if [ -n "$ZSH_EVAL_CONTEXT" ]; then | 23 | if [[ -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); } |
18 | elif [ -n "$BASH_VERSION" ]; then | 25 | elif [[ -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); } |
20 | fi | 27 | fi |
21 | 28 | ||
@@ -26,23 +33,25 @@ if [[ $SOURCED -ne 1 ]]; then | |||
26 | fi | 33 | fi |
27 | 34 | ||
28 | METADIR=${METADIR:-${SOURCEDIR}/../..} | 35 | METADIR=${METADIR:-${SOURCEDIR}/../..} |
29 | DISTRO_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 | ||
32 | if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then | 37 | if [[ ! -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 | ||
46 | else | 55 | else |
47 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" | 56 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" |
48 | fi | 57 | fi \ 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 | ||
41 | class QemuCommand(object): | 41 | class 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') |