diff options
4 files changed, 91 insertions, 5 deletions
diff --git a/meta-app-framework/recipes-core/af-binder/af-binder_1.0.bb b/meta-app-framework/recipes-core/af-binder/af-binder_1.0.bb index 3b70fec..5c47e3a 100644 --- a/meta-app-framework/recipes-core/af-binder/af-binder_1.0.bb +++ b/meta-app-framework/recipes-core/af-binder/af-binder_1.0.bb @@ -16,7 +16,7 @@ SRC_URI = "${SRC_URI_git} \ ${SRC_URI_files} \ " -SRCREV = "b0d9ff9157f188a32d46c7a583b5b2e35ca26343" +SRCREV = "dc011f99aed9407c8319b1b70a81f56ad2f02bc8" S = "${WORKDIR}/git" inherit cmake pkgconfig diff --git a/meta-app-framework/recipes-core/af-main/af-main_1.0.inc b/meta-app-framework/recipes-core/af-main/af-main_1.0.inc index e89f616..141ae46 100644 --- a/meta-app-framework/recipes-core/af-main/af-main_1.0.inc +++ b/meta-app-framework/recipes-core/af-main/af-main_1.0.inc @@ -14,7 +14,7 @@ SRC_URI = "${SRC_URI_git} \ ${SRC_URI_files} \ " -SRCREV = "373b10369b60cf2bfa54388197c05a09ef32de41" +SRCREV = "628dc10767d95436538391534dc3c95f45fe9a3a" S = "${WORKDIR}/git" diff --git a/meta-sota/classes/image_types_ostree.bbclass b/meta-sota/classes/image_types_ostree.bbclass new file mode 100644 index 0000000..5b9ac97 --- /dev/null +++ b/meta-sota/classes/image_types_ostree.bbclass @@ -0,0 +1,87 @@ +# OSTree deployment + +inherit image_types + +IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \ + virtual/kernel:do_deploy \ + ${INITRAMFS_IMAGE}:do_image_cpio" + +# Please redefine OSTREE_REPO in your local.conf in order to have a persistent +# OSTree repo +OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" +export OSTREE_REPO + +# OSTREE_BRANCHNAME can also be redefined +OSTREE_BRANCHNAME ?= "${IMAGE_BASENAME}" +export OSTREE_BRANCHNAME + +IMAGE_CMD_ostree () { + OSTREE_ROOTFS=`mktemp -d ${WORKDIR}/ostree-root-XXXXX` + cp -rp ${IMAGE_ROOTFS}/* ${OSTREE_ROOTFS} + cd ${OSTREE_ROOTFS} + + # Create sysroot directory to which physical sysroot will be mounted + mkdir sysroot + ln -sf /sysroot/ostree ostree + ln -sf /sysroot/tmp tmp + + mkdir -p usr/rootdirs + mkdir -p var/rootdirs + + # Implement UsrMove + dirs="bin sbin lib" + + for dir in ${dirs} ; do + if [ -d ${dir} ] && [ ! -L ${dir} ] ; then + mv ${dir} usr/rootdirs/ + rm -rf ${dir} + ln -sf /usr/rootdirs/${dir} ${dir} + fi + done + + # Move persistent directories to /var + dirs="home opt mnt media srv" + + for dir in ${dirs}; do + if [ -d ${dir} ] && [ ! -L ${dir} ]; then + mv ${dir} var/rootdirs/ + ln -sf /var/rootdirs/${dir} ${dir} + fi + done + + if [ -d root ] && [ ! -L root ]; then + mv root var/roothome + ln -sf /var/roothome root + fi + + # Creating boot directories is required for "ostree admin deploy" + + mkdir -p boot/loader.0 + mkdir -p boot/loader.1 + ln -sf boot/loader.0 boot/loader + + checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} | cut -f 1 -d " "` + + cp ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} boot/vmlinuz-${checksum} + cp ${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}-${MACHINE}.cpio.gz boot/initramfs-${checksum} + + cd ${WORKDIR} + + # Create a tarball that can be then commited to OSTree repo + OSTREE_TAR=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ostree.tar.bz2 + tar -C ${OSTREE_ROOTFS} -cjf ${OSTREE_TAR} . + rm -rf ${OSTREE_ROOTFS} + + if [ ! -d ${OSTREE_REPO} ]; then + ostree --repo=${OSTREE_REPO} init --mode=archive-z2 + fi + + # Commit the result + ostree --repo=${OSTREE_REPO} commit \ + --tree=tar=${OSTREE_TAR} \ + --skip-if-unchanged \ + --branch=${OSTREE_BRANCHNAME} \ + --subject="Commit-id: ${IMAGE_NAME}" + +} + diff --git a/meta-sota/classes/image_types_ota.bbclass b/meta-sota/classes/image_types_ota.bbclass index cc526b6..bb55e61 100644 --- a/meta-sota/classes/image_types_ota.bbclass +++ b/meta-sota/classes/image_types_ota.bbclass @@ -13,8 +13,8 @@ do_otaimg[depends] += "e2fsprogs-native:do_populate_sysroot \ parted-native:do_populate_sysroot \ virtual/kernel:do_deploy \ virtual/bootloader:do_deploy \ - ${INITRD_IMAGE}:do_rootfs \ - ${PN}:do_rootfs" + ${INITRD_IMAGE}:do_image_cpio \ + ${PN}:do_image_ext4" ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.ext4" INITRD_IMAGE ?= "core-image-minimal-initramfs" @@ -45,7 +45,6 @@ do_otaimg () { rm -f $BOOTIMG build_bootfs $BOOTIMG - # ext4 image should be already here because of IMAGE_TYPEDEP_otaimg ROOTIMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext4 BOOTFSBLOCKS=`du -bks ${BOOTIMG} | cut -f 1` |