swu-images: fix support to preinstallation script in swu update package
Since commit 11558352 ("swu-images: add "installed-directly" flag to
sw-description") the swu package images are streamed into the target without
any temporary copy to support devices with low memory available, that forces a
different order according with the swupdate documentation because scripts
should packed before the rest. This means that all the pre, post and shell
scripts will be executed after the images will be installed. This behavior
breaks the current support to mount the cryptorootfs node before install an
encrypted rootfs.
This commit moves the shell script to mount the cryptorootfs node to the
recovery initramfs and modifies the swupdate command line to call the shell
script before the images installation.
https://onedigi.atlassian.net/browse/CC8X-320
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
parent
b03a2af5b2
commit
d81444a574
|
|
@ -16,6 +16,7 @@ SRC_URI = " \
|
|||
file://automount_block.sh \
|
||||
file://automount_mtd.sh \
|
||||
file://mdev.conf \
|
||||
${@bb.utils.contains('STORAGE_MEDIA', 'mmc', 'file://mount_cryptrootfs.sh', '', d)} \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
|
@ -24,6 +25,9 @@ do_install() {
|
|||
install -d ${D}${sysconfdir}
|
||||
install -m 0755 ${WORKDIR}/recovery-initramfs-init ${D}/init
|
||||
install -m 0644 ${WORKDIR}/swupdate.cfg ${D}${sysconfdir}
|
||||
if [ "${STORAGE_MEDIA}" = "mmc" ]; then
|
||||
install -m 0755 ${WORKDIR}/mount_cryptrootfs.sh ${D}${sysconfdir}
|
||||
fi
|
||||
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
|
||||
|
|
|
|||
|
|
@ -833,7 +833,8 @@ if [ -n "${update_package_bool}" ]; then
|
|||
progress -wp &
|
||||
# Execute the software update.
|
||||
if [ -f "${PUBLIC_KEY}" ]; then
|
||||
swupdate -e "${SWUPDATE_IMAGE_SET}" -f "${SW_CONFIG}" -i "${update_package}" -k "${PUBLIC_KEY}"
|
||||
[ "${ENCRYPT_ROOTFS}" = "yes" ] && SWUPDATE_PREUPDATE_CMD="-P /etc/mount_cryptrootfs.sh"
|
||||
swupdate -e "${SWUPDATE_IMAGE_SET}" -f "${SW_CONFIG}" -i "${update_package}" -k "${PUBLIC_KEY}" ${SWUPDATE_PREUPDATE_CMD}
|
||||
else
|
||||
swupdate -e "${SWUPDATE_IMAGE_SET}" -f "${SW_CONFIG}" -i "${update_package}"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ software =
|
|||
installed-directly = true;
|
||||
}
|
||||
);
|
||||
}
|
||||
##PREINSTALL_SCRIPT##
|
||||
};
|
||||
};
|
||||
mtd = {
|
||||
platform: {
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ LICENSE = "GPL-2.0"
|
|||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
|
||||
|
||||
SRC_URI = "file://sw-description"
|
||||
SRC_URI_append_ccimx6 = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_ENCRYPT_ROOTFS', True) == '1', 'file://preinstall_swu.sh', '')}"
|
||||
SRC_URI_append_ccimx8x = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_ENCRYPT_ROOTFS', True) == '1', 'file://preinstall_swu.sh', '')}"
|
||||
SRC_URI_append_ccimx8m = " ${@oe.utils.ifelse(d.getVar('TRUSTFENCE_ENCRYPT_ROOTFS', True) == '1', 'file://preinstall_swu.sh', '')}"
|
||||
|
||||
inherit swupdate
|
||||
|
||||
|
|
@ -32,9 +29,6 @@ ROOTFS_DEV_NAME_ccimx6ul ?= "rootfs"
|
|||
ROOTFS_ENC_DEV = "/dev/mapper/cryptrootfs"
|
||||
ROOTFS_ENC_DEV_ccimx6ul = "${ROOTFS_DEV_NAME}"
|
||||
ROOTFS_DEV_NAME_FINAL = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_ENCRYPT_ROOTFS', True) == '1', '${ROOTFS_ENC_DEV}', '${ROOTFS_DEV_NAME}')}"
|
||||
PREINST_SCRIPT_TEMPLATE = "scripts: ( { filename = \\"preinstall_swu.sh\\"; type = \\"preinstall\\"; sha256 = \\"@preinstall_swu.sh\\"; \\x7D );"
|
||||
PREINST_SCRIPT_DESC = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_ENCRYPT_ROOTFS', True) == '1', '${PREINST_SCRIPT_TEMPLATE}', '')}"
|
||||
PREINST_SCRIPT_DESC_ccimx6ul = ""
|
||||
|
||||
python () {
|
||||
img_fstypes = d.getVar('BOOTFS_EXT', True) + " " + d.getVar('ROOTFS_EXT', True)
|
||||
|
|
@ -61,5 +55,4 @@ fill_description() {
|
|||
sed -i -e "s,##ROOTFS_DEV##,${ROOTFS_DEV_NAME_FINAL},g" "${WORKDIR}/sw-description"
|
||||
sed -i -e "s,##SW_VERSION##,${SOFTWARE_VERSION},g" "${WORKDIR}/sw-description"
|
||||
sed -i -e "s,##DESCRIPTION##,${DESCRIPTION},g" "${WORKDIR}/sw-description"
|
||||
sed -i -e "s/##PREINSTALL_SCRIPT##/${PREINST_SCRIPT_DESC}/g" "${WORKDIR}/sw-description"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue