diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb b/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb index 24b98b0a1..b10bc069e 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb @@ -5,7 +5,7 @@ LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" # When building a TrustFence enabled recovery initramfs, we need the TrustFence PKI tree to -# be already generated in order to copy the public key. Forcing a dependence against +# be already generated in order to copy the public key. Forcing a dependence against # 'virtual/kernel' ensures that the keys are already generated as they are needed to sign the # kernel artifacts. DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'virtual/kernel openssl-native', '', d)}" @@ -15,6 +15,7 @@ SRC_URI = " \ file://swupdate.cfg \ file://automount_block.sh \ file://automount_mtd.sh \ + file://automount_ubi.sh \ file://mdev.conf \ ${@bb.utils.contains('STORAGE_MEDIA', 'mmc', 'file://mount_cryptrootfs.sh', '', d)} \ " @@ -31,6 +32,7 @@ do_install() { install -d ${D}${base_libdir}/mdev install -m 0755 ${WORKDIR}/automount_block.sh ${D}${base_libdir}/mdev/automount_block.sh install -m 0755 ${WORKDIR}/automount_mtd.sh ${D}${base_libdir}/mdev/automount_mtd.sh + install -m 0755 ${WORKDIR}/automount_ubi.sh ${D}${base_libdir}/mdev/automount_ubi.sh install -m 0644 ${WORKDIR}/mdev.conf ${D}${sysconfdir} # If Trustfence is enabled, copy the public key that is going to be used into the diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/automount_ubi.sh b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/automount_ubi.sh new file mode 100644 index 000000000..cc8ae1d96 --- /dev/null +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/automount_ubi.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# Copyright (c) 2023, Digi International Inc. +# + +UPDATE_MOUNTPOINT="/mnt/update" +PARTITION_NAME="update" + +# Check if there is a UBI volume called 'update' +# (for single MTD systems). +volname="$(ubinfo ${MDEV} | awk '$1=="Name:" {print $2}')" +if [ "${volname}" = "${PARTITION_NAME}" ]; then + if mkdir -p ${UPDATE_MOUNTPOINT} && ! mountpoint -q ${UPDATE_MOUNTPOINT}; then + # Mount the volume. + if ! mount -t ubifs "${MDEV}" "${UPDATE_MOUNTPOINT}"; then + echo "ERROR: Could not mount '${PARTITION_NAME}' partition" + rmdir --ignore-fail-on-non-empty ${UPDATE_MOUNTPOINT} + fi + fi +fi diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/mdev.conf b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/mdev.conf index 20f8a2014..50cee5885 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/mdev.conf +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/mdev.conf @@ -2,3 +2,4 @@ sd[a-z][0-9]+ 0:0 660 */lib/mdev/automount_block.sh mmcblk[0-9]+p[0-9]+ 0:0 660 */lib/mdev/automount_block.sh mtd[0-9]+ 0:0 660 */lib/mdev/automount_mtd.sh +ubi0_[0-9]+ 0:0 660 */lib/mdev/automount_ubi.sh