diff options
| author | Ming Liu <ming.liu@toradex.com> | 2020-05-11 20:16:05 +0200 |
|---|---|---|
| committer | Ming Liu <ming.liu@toradex.com> | 2020-06-27 10:38:10 +0200 |
| commit | 75069b6a653a19e298c1b2ea791e80955a26b7b6 (patch) | |
| tree | 38ed0624f19b61f5ab6205b06f29d3ab88deb765 /classes | |
| parent | 4fcf797368139cb42ced99fc3b14bd543b37108d (diff) | |
| download | meta-updater-75069b6a653a19e298c1b2ea791e80955a26b7b6.tar.gz | |
meta: introduce ostree-kernel-initramfs recipe
We package kernel image, devicetrees, initramfs and install them to
/usr/lib/modules/${KERNEL_VERSION}, which is the preferred location
according to ostree's new implementation, this could simplify the
deployment.
Reference:
https://github.com/ostreedev/ostree/commit/3ab0d5e6644885440bac6abd17b6d2637df5435f
To let initramfs-ostree-image be able to be depended by
ostree-kernel-initramfs, it must inherit nopackages to avoid a annoying
QA warning like the follows:
| WARNING: initramfs-ostree-image-0.0.1-r0 do_package: Manifest ...initramfs-ostree-image.packagedata
| not found in colibri_imx6 armv7ahf-neon-imx armv7at2hf-neon-imx armv7at2hf-neon armv7ahf-neon armv7at2hf-vfp
| armv7ahf-vfp armv6thf-vfp armv6hf-vfp armv5tehf-vfp armv5ehf-vfp armv5thf-vfp armv5hf-vfp allarch
| x86_64_x86_64-nativesdk (variant '')?
Also we need define OSTREE_KERNEL, OSTREE_DEPLOY_DEVICETREE and
OSTREE_DEVICETREE in sota.bbclass so they could be accessed in other
recipes as well as in image recipes.
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Signed-off-by: Ming Liu <ming.liu@toradex.com>
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/image_types_ostree.bbclass | 24 | ||||
| -rw-r--r-- | classes/sota.bbclass | 8 |
2 files changed, 7 insertions, 25 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index c95aa5e..219218d 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
| @@ -1,14 +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 | OSTREE_DEVICETREE ??= "${KERNEL_DEVICETREE}" | ||
| 12 | 9 | ||
| 13 | BUILD_OSTREE_TARBALL ??= "1" | 10 | BUILD_OSTREE_TARBALL ??= "1" |
| 14 | 11 | ||
| @@ -134,27 +131,6 @@ IMAGE_CMD_ostree () { | |||
| 134 | 131 | ||
| 135 | ln -sf ../var/usrlocal usr/local | 132 | ln -sf ../var/usrlocal usr/local |
| 136 | 133 | ||
| 137 | if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then | ||
| 138 | # this is a hack for ostree not to override init= in kernel cmdline - | ||
| 139 | # make it think that the initramfs is present (while it is in FIT image) | ||
| 140 | # since initramfs is fake file, it does not need to be included in checksum | ||
| 141 | checksum=$(sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " ") | ||
| 142 | touch boot/initramfs-${checksum} | ||
| 143 | else | ||
| 144 | if [ ${@ oe.types.boolean('${OSTREE_DEPLOY_DEVICETREE}')} = True ] && [ -n "${OSTREE_DEVICETREE}" ]; then | ||
| 145 | checksum=$(cat ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} ${OSTREE_DEVICETREE} | sha256sum | cut -f 1 -d " ") | ||
| 146 | for DTS_FILE in ${OSTREE_DEVICETREE}; do | ||
| 147 | DTS_FILE_BASENAME=$(basename ${DTS_FILE}) | ||
| 148 | cp ${DEPLOY_DIR_IMAGE}/${DTS_FILE_BASENAME} boot/devicetree-${DTS_FILE_BASENAME}-${checksum} | ||
| 149 | done | ||
| 150 | else | ||
| 151 | checksum=$(cat ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} | sha256sum | cut -f 1 -d " ") | ||
| 152 | fi | ||
| 153 | cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} boot/initramfs-${checksum} | ||
| 154 | fi | ||
| 155 | |||
| 156 | cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum} | ||
| 157 | |||
| 158 | # Copy image manifest | 134 | # Copy image manifest |
| 159 | cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest | 135 | cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest |
| 160 | } | 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 | ||
