From f5e0a7682da5142d154d7605e5de3221d03cdab0 Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Mon, 11 May 2020 20:16:05 +0200 Subject: 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 Signed-off-by: Ming Liu --- classes/image_types_ostree.bbclass | 24 ------------------------ classes/sota.bbclass | 8 +++++++- 2 files changed, 7 insertions(+), 25 deletions(-) (limited to 'classes') diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index ead4693..392a42a 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -1,14 +1,11 @@ # OSTree deployment inherit distro_features_check -OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" OSTREE_ROOTFS ??= "${WORKDIR}/ostree-rootfs" OSTREE_COMMIT_SUBJECT ??= "Commit-id: ${IMAGE_NAME}" OSTREE_COMMIT_BODY ??= "" OSTREE_COMMIT_VERSION ??= "${DISTRO_VERSION}" OSTREE_UPDATE_SUMMARY ??= "0" -OSTREE_DEPLOY_DEVICETREE ??= "0" -OSTREE_DEVICETREE ??= "${KERNEL_DEVICETREE}" BUILD_OSTREE_TARBALL ??= "1" @@ -136,27 +133,6 @@ IMAGE_CMD_ostree () { ln -sf ../var/usrlocal usr/local - if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then - # this is a hack for ostree not to override init= in kernel cmdline - - # make it think that the initramfs is present (while it is in FIT image) - # since initramfs is fake file, it does not need to be included in checksum - checksum=$(sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " ") - touch boot/initramfs-${checksum} - else - if [ ${@ oe.types.boolean('${OSTREE_DEPLOY_DEVICETREE}')} = True ] && [ -n "${OSTREE_DEVICETREE}" ]; then - checksum=$(cat ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} ${OSTREE_DEVICETREE} | sha256sum | cut -f 1 -d " ") - for DTS_FILE in ${OSTREE_DEVICETREE}; do - DTS_FILE_BASENAME=$(basename ${DTS_FILE}) - cp ${DEPLOY_DIR_IMAGE}/${DTS_FILE_BASENAME} boot/devicetree-${DTS_FILE_BASENAME}-${checksum} - done - else - checksum=$(cat ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} | sha256sum | cut -f 1 -d " ") - fi - cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} boot/initramfs-${checksum} - fi - - cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum} - # Copy image manifest cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest } diff --git a/classes/sota.bbclass b/classes/sota.bbclass index c248cfc..52b8747 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -5,8 +5,11 @@ SOTA_CLIENT_PROV ??= "aktualizr-shared-prov" SOTA_DEPLOY_CREDENTIALS ?= "1" SOTA_HARDWARE_ID ??= "${MACHINE}" -IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" IMAGE_CLASSES += " image_types_ostree image_types_ota image_repo_manifest" +IMAGE_INSTALL_append_sota = " ${SOTA_CLIENT} ${SOTA_CLIENT_PROV} \ + ostree os-release ostree-kernel \ + ${@'ostree-initramfs' if d.getVar('KERNEL_IMAGETYPE') != 'fitImage' else ''} \ + ${@'ostree-devicetrees' if oe.types.boolean('${OSTREE_DEPLOY_DEVICETREE}') else ''}" IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign garagecheck ota-ext4 wic', ' ', d)}" IMAGE_FSTYPES += "${@bb.utils.contains('BUILD_OSTREE_TARBALL', '1', 'ostree.tar.bz2', ' ', d)}" @@ -27,6 +30,9 @@ OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}" OSTREE_OSNAME ?= "poky" OSTREE_BOOTLOADER ??= 'u-boot' OSTREE_BOOT_PARTITION ??= "/boot" +OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" +OSTREE_DEPLOY_DEVICETREE ??= "0" +OSTREE_DEVICETREE ??= "${KERNEL_DEVICETREE}" INITRAMFS_IMAGE ?= "initramfs-ostree-image" -- cgit v1.2.3-54-g00ecf