diff options
| author | Patrick Vacek <patrickvacek@gmail.com> | 2020-06-30 09:51:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-30 09:51:48 +0200 |
| commit | ef2bf0c17073fe5a486a36c1c9ec3fc0039fe86d (patch) | |
| tree | 718c2ecd4cafa46edd46e37afb82dedbdb78738a | |
| parent | 1739961a0a52c10e2839a99ff67f619128bff921 (diff) | |
| parent | b712720da6d82e2a4b43f89c380cd33e2ddce86d (diff) | |
| download | meta-updater-ef2bf0c17073fe5a486a36c1c9ec3fc0039fe86d.tar.gz | |
Merge pull request #740 from liuming50/cherry-pick-several-patches-from-master-to-zeus
Cherry pick several patches from master to zeus
| -rw-r--r-- | classes/image_types_ostree.bbclass | 23 | ||||
| -rw-r--r-- | classes/sota.bbclass | 8 | ||||
| -rw-r--r-- | recipes-core/images/initramfs-ostree-image.bb | 2 | ||||
| -rw-r--r-- | recipes-sota/aktualizr/files/aktualizr.service | 3 | ||||
| -rw-r--r-- | recipes-sota/ostree-kernel-initramfs/ostree-kernel-initramfs_0.0.1.bb | 53 |
5 files changed, 63 insertions, 26 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 8d68b5a..219218d 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
| @@ -1,13 +1,11 @@ | |||
| 1 | # OSTree deployment | 1 | # OSTree deployment |
| 2 | inherit distro_features_check | 2 | inherit distro_features_check |
| 3 | 3 | ||
| 4 | OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" | ||
| 5 | OSTREE_ROOTFS ??= "${WORKDIR}/ostree-rootfs" | 4 | OSTREE_ROOTFS ??= "${WORKDIR}/ostree-rootfs" |
| 6 | OSTREE_COMMIT_SUBJECT ??= "Commit-id: ${IMAGE_NAME}" | 5 | OSTREE_COMMIT_SUBJECT ??= "Commit-id: ${IMAGE_NAME}" |
| 7 | OSTREE_COMMIT_BODY ??= "" | 6 | OSTREE_COMMIT_BODY ??= "" |
| 8 | OSTREE_COMMIT_VERSION ??= "${DISTRO_VERSION}" | 7 | OSTREE_COMMIT_VERSION ??= "${DISTRO_VERSION}" |
| 9 | OSTREE_UPDATE_SUMMARY ??= "0" | 8 | OSTREE_UPDATE_SUMMARY ??= "0" |
| 10 | OSTREE_DEPLOY_DEVICETREE ??= "0" | ||
| 11 | 9 | ||
| 12 | BUILD_OSTREE_TARBALL ??= "1" | 10 | BUILD_OSTREE_TARBALL ??= "1" |
| 13 | 11 | ||
| @@ -133,27 +131,6 @@ IMAGE_CMD_ostree () { | |||
| 133 | 131 | ||
| 134 | ln -sf ../var/usrlocal usr/local | 132 | ln -sf ../var/usrlocal usr/local |
| 135 | 133 | ||
| 136 | if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then | ||
| 137 | # this is a hack for ostree not to override init= in kernel cmdline - | ||
| 138 | # make it think that the initramfs is present (while it is in FIT image) | ||
| 139 | # since initramfs is fake file, it does not need to be included in checksum | ||
| 140 | checksum=$(sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " ") | ||
| 141 | touch boot/initramfs-${checksum} | ||
| 142 | else | ||
| 143 | if [ ${@ oe.types.boolean('${OSTREE_DEPLOY_DEVICETREE}')} = True ] && [ -n "${KERNEL_DEVICETREE}" ]; then | ||
| 144 | checksum=$(cat ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} ${KERNEL_DEVICETREE} | sha256sum | cut -f 1 -d " ") | ||
| 145 | for DTS_FILE in ${KERNEL_DEVICETREE}; do | ||
| 146 | DTS_FILE_BASENAME=$(basename ${DTS_FILE}) | ||
| 147 | cp ${DEPLOY_DIR_IMAGE}/${DTS_FILE_BASENAME} boot/devicetree-${DTS_FILE_BASENAME}-${checksum} | ||
| 148 | done | ||
| 149 | else | ||
| 150 | checksum=$(cat ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} | sha256sum | cut -f 1 -d " ") | ||
| 151 | fi | ||
| 152 | cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} boot/initramfs-${checksum} | ||
| 153 | fi | ||
| 154 | |||
| 155 | cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum} | ||
| 156 | |||
| 157 | # Copy image manifest | 134 | # Copy image manifest |
| 158 | cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest | 135 | cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest |
| 159 | } | 136 | } |
diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 71bd303..dc18cbc 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass | |||
| @@ -5,8 +5,11 @@ SOTA_CLIENT_PROV ??= "aktualizr-shared-prov" | |||
| 5 | SOTA_DEPLOY_CREDENTIALS ?= "1" | 5 | SOTA_DEPLOY_CREDENTIALS ?= "1" |
| 6 | SOTA_HARDWARE_ID ??= "${MACHINE}" | 6 | SOTA_HARDWARE_ID ??= "${MACHINE}" |
| 7 | 7 | ||
| 8 | IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" | ||
| 9 | IMAGE_CLASSES += " image_types_ostree image_types_ota image_repo_manifest" | 8 | IMAGE_CLASSES += " image_types_ostree image_types_ota image_repo_manifest" |
| 9 | IMAGE_INSTALL_append_sota = " ${SOTA_CLIENT} ${SOTA_CLIENT_PROV} \ | ||
| 10 | ostree os-release ostree-kernel \ | ||
| 11 | ${@'ostree-initramfs' if d.getVar('KERNEL_IMAGETYPE') != 'fitImage' else ''} \ | ||
| 12 | ${@'ostree-devicetrees' if oe.types.boolean('${OSTREE_DEPLOY_DEVICETREE}') else ''}" | ||
| 10 | 13 | ||
| 11 | IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign garagecheck ota-ext4 wic', ' ', d)}" | 14 | IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign garagecheck ota-ext4 wic', ' ', d)}" |
| 12 | IMAGE_FSTYPES += "${@bb.utils.contains('BUILD_OSTREE_TARBALL', '1', 'ostree.tar.bz2', ' ', d)}" | 15 | IMAGE_FSTYPES += "${@bb.utils.contains('BUILD_OSTREE_TARBALL', '1', 'ostree.tar.bz2', ' ', d)}" |
| @@ -27,6 +30,9 @@ OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}" | |||
| 27 | OSTREE_OSNAME ?= "poky" | 30 | OSTREE_OSNAME ?= "poky" |
| 28 | OSTREE_BOOTLOADER ??= 'u-boot' | 31 | OSTREE_BOOTLOADER ??= 'u-boot' |
| 29 | OSTREE_BOOT_PARTITION ??= "/boot" | 32 | OSTREE_BOOT_PARTITION ??= "/boot" |
| 33 | OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" | ||
| 34 | OSTREE_DEPLOY_DEVICETREE ??= "0" | ||
| 35 | OSTREE_DEVICETREE ??= "${KERNEL_DEVICETREE}" | ||
| 30 | 36 | ||
| 31 | INITRAMFS_IMAGE ?= "initramfs-ostree-image" | 37 | INITRAMFS_IMAGE ?= "initramfs-ostree-image" |
| 32 | 38 | ||
diff --git a/recipes-core/images/initramfs-ostree-image.bb b/recipes-core/images/initramfs-ostree-image.bb index bc21ed3..4af1548 100644 --- a/recipes-core/images/initramfs-ostree-image.bb +++ b/recipes-core/images/initramfs-ostree-image.bb | |||
| @@ -20,7 +20,7 @@ IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}" | |||
| 20 | # Avoid circular dependencies | 20 | # Avoid circular dependencies |
| 21 | EXTRA_IMAGEDEPENDS = "" | 21 | EXTRA_IMAGEDEPENDS = "" |
| 22 | 22 | ||
| 23 | inherit core-image | 23 | inherit core-image nopackages |
| 24 | 24 | ||
| 25 | IMAGE_ROOTFS_SIZE = "8192" | 25 | IMAGE_ROOTFS_SIZE = "8192" |
| 26 | 26 | ||
diff --git a/recipes-sota/aktualizr/files/aktualizr.service b/recipes-sota/aktualizr/files/aktualizr.service index 3d807a1..ae5d23a 100644 --- a/recipes-sota/aktualizr/files/aktualizr.service +++ b/recipes-sota/aktualizr/files/aktualizr.service | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | [Unit] | 1 | [Unit] |
| 2 | Description=Aktualizr SOTA Client | 2 | Description=Aktualizr SOTA Client |
| 3 | After=network-online.target nss-lookup.target | 3 | After=network-online.target nss-lookup.target boot-complete.target |
| 4 | Requires=boot-complete.target | ||
| 4 | Wants=network-online.target | 5 | Wants=network-online.target |
| 5 | 6 | ||
| 6 | [Service] | 7 | [Service] |
diff --git a/recipes-sota/ostree-kernel-initramfs/ostree-kernel-initramfs_0.0.1.bb b/recipes-sota/ostree-kernel-initramfs/ostree-kernel-initramfs_0.0.1.bb new file mode 100644 index 0000000..9139c7f --- /dev/null +++ b/recipes-sota/ostree-kernel-initramfs/ostree-kernel-initramfs_0.0.1.bb | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | SUMMARY = "Ostree linux kernel, devicetrees and initramfs packager" | ||
| 2 | DESCRIPTION = "Ostree linux kernel, devicetrees and initramfs packager" | ||
| 3 | SECTION = "kernel" | ||
| 4 | LICENSE = "GPLv2" | ||
| 5 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" | ||
| 6 | |||
| 7 | # Whilst not a module, this ensures we don't get multilib extended (which would make no sense) | ||
| 8 | inherit module-base kernel-artifact-names | ||
| 9 | |||
| 10 | PACKAGES = "ostree-kernel ostree-initramfs ostree-devicetrees" | ||
| 11 | |||
| 12 | ALLOW_EMPTY_ostree-initramfs = "1" | ||
| 13 | ALLOW_EMPTY_ostree-devicetrees = "1" | ||
| 14 | |||
| 15 | FILES_ostree-kernel = "${nonarch_base_libdir}/modules/*/vmlinuz" | ||
| 16 | FILES_ostree-initramfs = "${nonarch_base_libdir}/modules/*/initramfs.img" | ||
| 17 | FILES_ostree-devicetrees = "${nonarch_base_libdir}/modules/*/dtb/*" | ||
| 18 | |||
| 19 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
| 20 | |||
| 21 | KERNEL_BUILD_ROOT = "${nonarch_base_libdir}/modules/" | ||
| 22 | |||
| 23 | # There's nothing to do here, except install the artifacts where we can package them | ||
| 24 | do_fetch[noexec] = "1" | ||
| 25 | do_unpack[noexec] = "1" | ||
| 26 | do_patch[noexec] = "1" | ||
| 27 | do_configure[noexec] = "1" | ||
| 28 | do_compile[noexec] = "1" | ||
| 29 | deltask do_populate_sysroot | ||
| 30 | |||
| 31 | do_install() { | ||
| 32 | kerneldir=${D}${KERNEL_BUILD_ROOT}${KERNEL_VERSION} | ||
| 33 | install -d $kerneldir | ||
| 34 | |||
| 35 | cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} $kerneldir/vmlinuz | ||
| 36 | |||
| 37 | if [ "${KERNEL_IMAGETYPE}" != "fitImage" ]; then | ||
| 38 | if [ -n "${INITRAMFS_IMAGE}" ]; then | ||
| 39 | cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} $kerneldir/initramfs.img | ||
| 40 | fi | ||
| 41 | |||
| 42 | if [ ${@ oe.types.boolean('${OSTREE_DEPLOY_DEVICETREE}')} = True ] && [ -n "${OSTREE_DEVICETREE}" ]; then | ||
| 43 | mkdir -p $kerneldir/dtb | ||
| 44 | for dts_file in ${KERNEL_DEVICETREE}; do | ||
| 45 | dts_file_basename=$(basename $dts_file) | ||
| 46 | cp ${DEPLOY_DIR_IMAGE}/$dts_file_basename $kerneldir/dtb/$dts_file_basename | ||
| 47 | done | ||
| 48 | fi | ||
| 49 | fi | ||
| 50 | } | ||
| 51 | do_install[vardepsexclude] = "KERNEL_VERSION" | ||
| 52 | INITRAMFS_IMAGE ?= "" | ||
| 53 | do_install[depends] = "virtual/kernel:do_deploy ${@['${INITRAMFS_IMAGE}:do_image_complete', ''][d.getVar('INITRAMFS_IMAGE') == '']}" | ||
