diff options
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/image_repo_manifest.bbclass | 4 | ||||
| -rw-r--r-- | classes/image_types_ostree.bbclass | 44 | ||||
| -rw-r--r-- | classes/image_types_ota.bbclass | 17 | ||||
| -rw-r--r-- | classes/sota.bbclass | 6 | ||||
| -rw-r--r-- | classes/sota_minnowboard.bbclass | 3 | ||||
| -rw-r--r-- | classes/sota_qemux86-64.bbclass | 4 | ||||
| -rw-r--r-- | classes/sota_raspberrypi.bbclass | 2 |
7 files changed, 51 insertions, 29 deletions
diff --git a/classes/image_repo_manifest.bbclass b/classes/image_repo_manifest.bbclass index d508574..467fd9a 100644 --- a/classes/image_repo_manifest.bbclass +++ b/classes/image_repo_manifest.bbclass | |||
| @@ -14,9 +14,9 @@ HOSTTOOLS_NONFATAL += " repo " | |||
| 14 | # Write build information to target filesystem | 14 | # Write build information to target filesystem |
| 15 | buildinfo () { | 15 | buildinfo () { |
| 16 | if [ $(which repo) ]; then | 16 | if [ $(which repo) ]; then |
| 17 | repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml | 17 | repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml || bbwarn "Android repo tool failed to run; manifest not copied" |
| 18 | else | 18 | else |
| 19 | echo "Android repo tool not food; manifest not copied." | 19 | bbwarn "Android repo tool not found; manifest not copied." |
| 20 | fi | 20 | fi |
| 21 | } | 21 | } |
| 22 | 22 | ||
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index dc8474c..904db96 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # OSTree deployment | 1 | # OSTree deployment |
| 2 | 2 | ||
| 3 | IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \ | 3 | do_image_ostree[depends] += "ostree-native:do_populate_sysroot \ |
| 4 | openssl-native:do_populate_sysroot \ | 4 | openssl-native:do_populate_sysroot \ |
| 5 | coreutils-native:do_populate_sysroot \ | 5 | coreutils-native:do_populate_sysroot \ |
| 6 | unzip-native:do_populate_sysroot \ | 6 | unzip-native:do_populate_sysroot \ |
| @@ -11,6 +11,7 @@ export OSTREE_REPO | |||
| 11 | export OSTREE_BRANCHNAME | 11 | export OSTREE_BRANCHNAME |
| 12 | 12 | ||
| 13 | RAMDISK_EXT ?= ".${INITRAMFS_FSTYPES}" | 13 | RAMDISK_EXT ?= ".${INITRAMFS_FSTYPES}" |
| 14 | export GARAGE_TARGET_NAME | ||
| 14 | 15 | ||
| 15 | OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" | 16 | OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" |
| 16 | 17 | ||
| @@ -116,6 +117,7 @@ IMAGE_CMD_ostree () { | |||
| 116 | fi | 117 | fi |
| 117 | 118 | ||
| 118 | if [ -n "${SOTA_SECONDARY_ECUS}" ]; then | 119 | if [ -n "${SOTA_SECONDARY_ECUS}" ]; then |
| 120 | mkdir -p var/sota/ecus | ||
| 119 | cp ${SOTA_SECONDARY_ECUS} var/sota/ecus | 121 | cp ${SOTA_SECONDARY_ECUS} var/sota/ecus |
| 120 | fi | 122 | fi |
| 121 | 123 | ||
| @@ -158,7 +160,7 @@ IMAGE_CMD_ostree () { | |||
| 158 | } | 160 | } |
| 159 | 161 | ||
| 160 | IMAGE_TYPEDEP_ostreepush = "ostree" | 162 | IMAGE_TYPEDEP_ostreepush = "ostree" |
| 161 | IMAGE_DEPENDS_ostreepush = "aktualizr-native:do_populate_sysroot ca-certificates-native:do_populate_sysroot " | 163 | do_image_ostreepush[depends] += "aktualizr-native:do_populate_sysroot ca-certificates-native:do_populate_sysroot" |
| 162 | IMAGE_CMD_ostreepush () { | 164 | IMAGE_CMD_ostreepush () { |
| 163 | # Print warnings if credetials are not set or if the file has not been found. | 165 | # Print warnings if credetials are not set or if the file has not been found. |
| 164 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 166 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
| @@ -176,11 +178,11 @@ IMAGE_CMD_ostreepush () { | |||
| 176 | } | 178 | } |
| 177 | 179 | ||
| 178 | IMAGE_TYPEDEP_garagesign = "ostreepush" | 180 | IMAGE_TYPEDEP_garagesign = "ostreepush" |
| 179 | IMAGE_DEPENDS_garagesign = "garage-sign-native:do_populate_sysroot" | 181 | do_image_garage_sign[depends] += "aktualizr-native:do_populate_sysroot" |
| 180 | IMAGE_CMD_garagesign () { | 182 | IMAGE_CMD_garagesign () { |
| 181 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 183 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
| 182 | # if credentials are issued by a server that doesn't support offline signing, exit silently | 184 | # if credentials are issued by a server that doesn't support offline signing, exit silently |
| 183 | unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec 2>&1 >/dev/null || exit 0 | 185 | unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 |
| 184 | 186 | ||
| 185 | java_version=$( java -version 2>&1 | awk -F '"' '/version/ {print $2}' ) | 187 | java_version=$( java -version 2>&1 | awk -F '"' '/version/ {print $2}' ) |
| 186 | if [ "${java_version}" = "" ]; then | 188 | if [ "${java_version}" = "" ]; then |
| @@ -191,15 +193,8 @@ IMAGE_CMD_garagesign () { | |||
| 191 | exit 1 | 193 | exit 1 |
| 192 | fi | 194 | fi |
| 193 | 195 | ||
| 194 | if [ ! -d "${GARAGE_SIGN_REPO}" ]; then | 196 | rm -rf ${GARAGE_SIGN_REPO} |
| 195 | garage-sign init --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --credentials ${SOTA_PACKED_CREDENTIALS} | 197 | garage-sign init --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --credentials ${SOTA_PACKED_CREDENTIALS} |
| 196 | fi | ||
| 197 | |||
| 198 | if [ -n "${GARAGE_SIGN_REPOSERVER}" ]; then | ||
| 199 | reposerver_args="--reposerver ${GARAGE_SIGN_REPOSERVER}" | ||
| 200 | else | ||
| 201 | reposerver_args="" | ||
| 202 | fi | ||
| 203 | 198 | ||
| 204 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | 199 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) |
| 205 | 200 | ||
| @@ -207,11 +202,11 @@ IMAGE_CMD_garagesign () { | |||
| 207 | # in which case targets.json should be pulled again and the whole procedure repeated | 202 | # in which case targets.json should be pulled again and the whole procedure repeated |
| 208 | push_success=0 | 203 | push_success=0 |
| 209 | for push_retries in $( seq 3 ); do | 204 | for push_retries in $( seq 3 ); do |
| 210 | garage-sign targets pull --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} ${reposerver_args} | 205 | garage-sign targets pull --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} |
| 211 | 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} | 206 | 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} |
| 212 | garage-sign targets sign --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} --key-name=targets | 207 | garage-sign targets sign --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --key-name=targets |
| 213 | errcode=0 | 208 | errcode=0 |
| 214 | garage-sign targets push --repo ${GARAGE_SIGN_REPO} --home-dir ${GARAGE_SIGN_REPO} ${reposerver_args} || errcode=$? | 209 | garage-sign targets push --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} || errcode=$? |
| 215 | if [ "$errcode" -eq "0" ]; then | 210 | if [ "$errcode" -eq "0" ]; then |
| 216 | push_success=1 | 211 | push_success=1 |
| 217 | break | 212 | break |
| @@ -224,9 +219,20 @@ IMAGE_CMD_garagesign () { | |||
| 224 | bberror "Couldn't push to garage repository" | 219 | bberror "Couldn't push to garage repository" |
| 225 | exit 1 | 220 | exit 1 |
| 226 | fi | 221 | fi |
| 227 | else | ||
| 228 | bbwarn "SOTA_PACKED_CREDENTIALS not set. Please add SOTA_PACKED_CREDENTIALS." | ||
| 229 | fi | 222 | fi |
| 230 | } | 223 | } |
| 231 | 224 | ||
| 225 | IMAGE_TYPEDEP_garagecheck = "ostreepush garagesign" | ||
| 226 | do_image_garagecheck[depends] += "aktualizr-native:do_populate_sysroot" | ||
| 227 | IMAGE_CMD_garagecheck () { | ||
| 228 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | ||
| 229 | # if credentials are issued by a server that doesn't support offline signing, exit silently | ||
| 230 | unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 | ||
| 231 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | ||
| 232 | |||
| 233 | garage-check --ref=${ostree_target_hash} \ | ||
| 234 | --credentials=${SOTA_PACKED_CREDENTIALS} \ | ||
| 235 | --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt | ||
| 236 | fi | ||
| 237 | } | ||
| 232 | # vim:set ts=4 sw=4 sts=4 expandtab: | 238 | # vim:set ts=4 sw=4 sts=4 expandtab: |
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 1b487e7..84095a6 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass | |||
| @@ -7,9 +7,11 @@ | |||
| 7 | # boot scripts, kernel and initramfs images | 7 | # boot scripts, kernel and initramfs images |
| 8 | # | 8 | # |
| 9 | 9 | ||
| 10 | OSTREE_BOOTLOADER ??= 'u-boot' | ||
| 11 | |||
| 10 | do_image_otaimg[depends] += "e2fsprogs-native:do_populate_sysroot \ | 12 | do_image_otaimg[depends] += "e2fsprogs-native:do_populate_sysroot \ |
| 11 | ${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER', True) == 'grub' else ''} \ | 13 | ${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER', True) == 'grub' else ''} \ |
| 12 | ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot' else ''}" | 14 | ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot' else ''}" |
| 13 | 15 | ||
| 14 | calculate_size () { | 16 | calculate_size () { |
| 15 | BASE=$1 | 17 | BASE=$1 |
| @@ -49,6 +51,8 @@ export OSTREE_BRANCHNAME | |||
| 49 | export OSTREE_REPO | 51 | export OSTREE_REPO |
| 50 | export OSTREE_BOOTLOADER | 52 | export OSTREE_BOOTLOADER |
| 51 | 53 | ||
| 54 | export GARAGE_TARGET_NAME | ||
| 55 | |||
| 52 | IMAGE_CMD_otaimg () { | 56 | IMAGE_CMD_otaimg () { |
| 53 | if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then | 57 | if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then |
| 54 | if [ -z "$OSTREE_REPO" ]; then | 58 | if [ -z "$OSTREE_REPO" ]; then |
| @@ -81,14 +85,16 @@ IMAGE_CMD_otaimg () { | |||
| 81 | bberror "Invalid bootloader: ${OSTREE_BOOTLOADER}" | 85 | bberror "Invalid bootloader: ${OSTREE_BOOTLOADER}" |
| 82 | fi; | 86 | fi; |
| 83 | 87 | ||
| 84 | ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${OSTREE_BRANCHNAME} | 88 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) |
| 89 | |||
| 90 | ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash} | ||
| 85 | export OSTREE_BOOT_PARTITION="/boot" | 91 | export OSTREE_BOOT_PARTITION="/boot" |
| 86 | kargs_list="" | 92 | kargs_list="" |
| 87 | for arg in ${OSTREE_KERNEL_ARGS}; do | 93 | for arg in ${OSTREE_KERNEL_ARGS}; do |
| 88 | kargs_list="${kargs_list} --karg-append=$arg" | 94 | kargs_list="${kargs_list} --karg-append=$arg" |
| 89 | done | 95 | done |
| 90 | 96 | ||
| 91 | ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_BRANCHNAME} | 97 | ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${ostree_target_hash} |
| 92 | 98 | ||
| 93 | # Copy deployment /home and /var/sota to sysroot | 99 | # Copy deployment /home and /var/sota to sysroot |
| 94 | HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX` | 100 | HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX` |
| @@ -100,6 +106,9 @@ IMAGE_CMD_otaimg () { | |||
| 100 | mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ || true | 106 | mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ || true |
| 101 | # Ensure that /var/local exists (AGL symlinks /usr/local to /var/local) | 107 | # Ensure that /var/local exists (AGL symlinks /usr/local to /var/local) |
| 102 | install -d ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/local | 108 | install -d ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/local |
| 109 | # Set package version for the first deployment | ||
| 110 | echo "{\"${ostree_target_hash}\":\"${GARAGE_TARGET_NAME}-${ostree_target_hash}\"}" > ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/installed_versions | ||
| 111 | |||
| 103 | rm -rf ${HOME_TMP} | 112 | rm -rf ${HOME_TMP} |
| 104 | 113 | ||
| 105 | # Calculate image type | 114 | # Calculate image type |
diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 7e9adca..2a12e8f 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass | |||
| @@ -11,10 +11,10 @@ SOTA_CLIENT ??= "aktualizr" | |||
| 11 | SOTA_CLIENT_PROV ??= "aktualizr-auto-prov" | 11 | SOTA_CLIENT_PROV ??= "aktualizr-auto-prov" |
| 12 | IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" | 12 | IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" |
| 13 | IMAGE_CLASSES += " image_types_ostree image_types_ota" | 13 | IMAGE_CLASSES += " image_types_ostree image_types_ota" |
| 14 | IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign otaimg wic', ' ', d)}" | 14 | IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign garagecheck otaimg wic', ' ', d)}" |
| 15 | 15 | ||
| 16 | PACKAGECONFIG_append_pn-curl = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', " ssl", " ", d)}" | 16 | PACKAGECONFIG_append_pn-curl = " ssl" |
| 17 | PACKAGECONFIG_remove_pn-curl = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', " gnutls", " ", d)}" | 17 | PACKAGECONFIG_remove_pn-curl = "gnutls" |
| 18 | 18 | ||
| 19 | WKS_FILE_sota ?= "sdimage-sota.wks" | 19 | WKS_FILE_sota ?= "sdimage-sota.wks" |
| 20 | 20 | ||
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" | |||
| 4 | WKS_FILE_sota = "efiimage-sota.wks" | 4 | WKS_FILE_sota = "efiimage-sota.wks" |
| 5 | IMAGE_BOOT_FILES_sota = "" | 5 | IMAGE_BOOT_FILES_sota = "" |
| 6 | 6 | ||
| 7 | IMAGE_FSTYPES_remove_sota = "live hddimg" | ||
| 7 | OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 console=ttyS0,115200 console=tty0" | 8 | OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 console=ttyS0,115200 console=tty0" |
| 9 | |||
| 10 | IMAGE_INSTALL_append = " minnowboard-efi-startup" | ||
diff --git a/classes/sota_qemux86-64.bbclass b/classes/sota_qemux86-64.bbclass index 5ec4f69..666ad6b 100644 --- a/classes/sota_qemux86-64.bbclass +++ b/classes/sota_qemux86-64.bbclass | |||
| @@ -4,8 +4,10 @@ PREFERRED_VERSION_linux-yocto_qemux86-64_sota = "4.4%" | |||
| 4 | IMAGE_FSTYPES_remove = "wic" | 4 | IMAGE_FSTYPES_remove = "wic" |
| 5 | 5 | ||
| 6 | # U-Boot support for SOTA | 6 | # U-Boot support for SOTA |
| 7 | PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot-ota" | 7 | PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot" |
| 8 | UBOOT_MACHINE_sota = "qemu-x86_defconfig" | 8 | UBOOT_MACHINE_sota = "qemu-x86_defconfig" |
| 9 | OSTREE_BOOTLOADER ?= "u-boot" | 9 | OSTREE_BOOTLOADER ?= "u-boot" |
| 10 | 10 | ||
| 11 | OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 ostree_root=/dev/hda" | 11 | OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 ostree_root=/dev/hda" |
| 12 | |||
| 13 | IMAGE_ROOTFS_EXTRA_SPACE = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', '65536', '', d)}" | ||
diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass index 51d07b2..2c69ea0 100644 --- a/classes/sota_raspberrypi.bbclass +++ b/classes/sota_raspberrypi.bbclass | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | RPI_USE_U_BOOT_sota = "1" | ||
| 1 | KERNEL_IMAGETYPE_sota = "uImage" | 2 | KERNEL_IMAGETYPE_sota = "uImage" |
| 2 | PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" | 3 | PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" |
| 3 | UBOOT_MACHINE_raspberrypi2_sota ?= "rpi_2_defconfig" | 4 | UBOOT_MACHINE_raspberrypi2_sota ?= "rpi_2_defconfig" |
| 4 | UBOOT_MACHINE_raspberrypi3_sota ?= "rpi_3_32b_defconfig" | 5 | UBOOT_MACHINE_raspberrypi3_sota ?= "rpi_3_32b_defconfig" |
| 5 | 6 | ||
| 7 | IMAGE_FSTYPES_remove_sota = "rpi-sdimg" | ||
| 6 | OSTREE_BOOTLOADER ?= "u-boot" | 8 | OSTREE_BOOTLOADER ?= "u-boot" |
| 7 | 9 | ||
| 8 | # OSTree puts its own boot.scr to bcm2835-bootfiles | 10 | # OSTree puts its own boot.scr to bcm2835-bootfiles |
