From 047849b848ed322a5b89c0a53897f44edaa4c912 Mon Sep 17 00:00:00 2001 From: David Escalona Date: Tue, 13 Dec 2016 11:39:16 +0100 Subject: [PATCH] recovery: add recovery image types for DEY images generation - Added the new image type 'recovery.vfat' to the DEY images generation process. This new image is a clone of the 'boot.vfat' but including the recovery ramdisk and the recovery boot script. - Added the new image type 'recovery.ubifs' to the DEY images generation process. This new image is similar to the 'boot.ubifs' but including the recovery ramdisk and the recovery boot script. Signed-off-by: David Escalona --- .../classes/image_types_digi.bbclass | 71 +++++++++++++++++++ meta-digi-arm/conf/machine/ccimx6sbc.conf | 2 +- meta-digi-arm/conf/machine/ccimx6ulsbc.conf | 2 +- .../conf/machine/ccimx6ulstarter.conf | 2 +- meta-digi-dey/conf/distro/dey.conf | 3 + 5 files changed, 77 insertions(+), 3 deletions(-) diff --git a/meta-digi-arm/classes/image_types_digi.bbclass b/meta-digi-arm/classes/image_types_digi.bbclass index e79819b44..3210922b6 100644 --- a/meta-digi-arm/classes/image_types_digi.bbclass +++ b/meta-digi-arm/classes/image_types_digi.bbclass @@ -124,6 +124,77 @@ IMAGE_CMD_boot.ubifs() { rm -rf ${TMP_BOOTDIR} } +IMAGE_DEPENDS_recovery.vfat = "${RECOVERY_INITRAMFS_IMAGE}:do_rootfs" + +# The recovery vfat image requires the boot image to be built before +IMAGE_TYPEDEP_recovery.vfat = "${SDIMG_BOOTFS_TYPE}" + +IMAGE_CMD_recovery.vfat() { + # + # Image generation code for image type 'recovery.vfat' + # + # Copy the boot.vfat image + cp ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.vfat ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.vfat + + # Copy the recovery init script into the VFAT image + mcopy -o -i ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.vfat -s ${DEPLOY_DIR_IMAGE}/recovery.scr ::/boot.scr + + # Copy the recovery ramdisk into the VFAT image + mcopy -i ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.vfat -s ${DEPLOY_DIR_IMAGE}/${RECOVERY_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot.tf ::/uramdisk-recovery.img + + # Create the symlink + if [ -n "${IMAGE_LINK_NAME}" ] && [ -e ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.vfat ]; then + ln -s ${IMAGE_NAME}.recovery.vfat ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.recovery.vfat + fi +} + +IMAGE_DEPENDS_recovery.ubifs = " \ + mtd-utils-native:do_populate_sysroot \ + u-boot:do_deploy \ + virtual/kernel:do_deploy \ + ${RECOVERY_INITRAMFS_IMAGE}:do_rootfs \ +" + +IMAGE_CMD_recovery.ubifs() { + # + # Image generation code for image type 'recovery.ubifs' + # + RECOVERYIMG_FILES_SYMLINK="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin" + if [ -n "${KERNEL_DEVICETREE}" ]; then + for DTB in ${KERNEL_DEVICETREE}; do + if [ -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB}" ]; then + RECOVERYIMG_FILES_SYMLINK="${RECOVERYIMG_FILES_SYMLINK} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB}" + fi + done + fi + + # Create temporary folder + TMP_RECOVERYDIR="$(mktemp -d ${DEPLOY_DIR_IMAGE}/recovery.XXXXXX)" + + # Hard-link RECOVERYIMG_FILES into the temporary folder with the symlink filename + for item in ${RECOVERYIMG_FILES_SYMLINK}; do + orig="$(readlink -e ${item})" + ln ${orig} ${TMP_RECOVERYDIR}/$(basename ${item}) + done + + # Copy the recovery init script. + cp ${DEPLOY_DIR_IMAGE}/recovery.scr ${TMP_RECOVERYDIR}/boot.scr + + # Copy the recovery ramdisk image. + cp ${DEPLOY_DIR_IMAGE}/${RECOVERY_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot.tf ${TMP_RECOVERYDIR}/uramdisk-recovery.img + + # Build UBIFS boot image out of temp folder + mkfs.ubifs -r ${TMP_RECOVERYDIR} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.ubifs ${MKUBIFS_BOOT_ARGS} + + # Create the symlink + if [ -n "${IMAGE_LINK_NAME}" ] && [ -e ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.ubifs ]; then + ln -s ${IMAGE_NAME}.recovery.ubifs ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.recovery.ubifs + fi + + # Remove the temporary folder + rm -rf ${TMP_RECOVERYDIR} +} + IMAGE_CMD_cpio.gz.u-boot.tf() { # # Image generation code for image type 'cpio.gz.u-boot.tf' diff --git a/meta-digi-arm/conf/machine/ccimx6sbc.conf b/meta-digi-arm/conf/machine/ccimx6sbc.conf index 4b70319bb..38d494206 100644 --- a/meta-digi-arm/conf/machine/ccimx6sbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6sbc.conf @@ -36,4 +36,4 @@ BT_TTY ?= "ttymxc1" BOOT_SCRIPTS = "boot.scr:boot.scr" # Flash image types -IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2" +IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2 recovery.vfat" diff --git a/meta-digi-arm/conf/machine/ccimx6ulsbc.conf b/meta-digi-arm/conf/machine/ccimx6ulsbc.conf index cefca191a..eb03ffb63 100644 --- a/meta-digi-arm/conf/machine/ccimx6ulsbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6ulsbc.conf @@ -27,4 +27,4 @@ BT_TTY ?= "ttymxc0" BOOT_SCRIPTS = "boot.scr:boot.scr" # Flash image types -IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs" +IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs recovery.ubifs" diff --git a/meta-digi-arm/conf/machine/ccimx6ulstarter.conf b/meta-digi-arm/conf/machine/ccimx6ulstarter.conf index 6593173e4..81beaca28 100644 --- a/meta-digi-arm/conf/machine/ccimx6ulstarter.conf +++ b/meta-digi-arm/conf/machine/ccimx6ulstarter.conf @@ -25,4 +25,4 @@ BT_TTY ?= "ttymxc0" BOOT_SCRIPTS = "boot.scr:boot.scr" # Flash image types -IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs" +IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs recovery.ubifs" diff --git a/meta-digi-dey/conf/distro/dey.conf b/meta-digi-dey/conf/distro/dey.conf index 897753c07..3e73ee11b 100644 --- a/meta-digi-dey/conf/distro/dey.conf +++ b/meta-digi-dey/conf/distro/dey.conf @@ -25,6 +25,9 @@ POKY_DEFAULT_DISTRO_FEATURES_remove = "ptest wayland" GRAPHICAL_BACKEND = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'fb', d)}" +# Recovery initramfs image name. +RECOVERY_INITRAMFS_IMAGE ?= "dey-image-recovery-initramfs" + # DEY image features (alphabetical order) FEATURE_PACKAGES_dey-audio = "packagegroup-dey-audio" FEATURE_PACKAGES_dey-bluetooth = "packagegroup-dey-bluetooth"