swupdate: use dynamic mtd-blacklist for configuration file

The 'mtd-blacklist' parameter prevents swupdate from acting upon those
partitions that we consider sensitive.
Make such list platform-dependent.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2023-11-30 12:34:19 +01:00
parent e9aac1b489
commit fd70bf2fce
4 changed files with 14 additions and 1 deletions

View File

@ -69,3 +69,7 @@ UBOOT_ENV_SIZE ?= "0x20000"
# the U-Boot environment can take up (if undefined, it will take up all the # the U-Boot environment can take up (if undefined, it will take up all the
# available space in the environment partition) # available space in the environment partition)
UBOOT_ENV_RANGE ?= "" UBOOT_ENV_RANGE ?= ""
# Partitions to blacklist for swupdate:
# bootloader, environment, safe
SWUPDATE_MTD_BLACKLIST = "0 1 2"

View File

@ -76,3 +76,7 @@ do_create_flashlayout_config[noexec] = "1"
# Include boot script into the FIT image # Include boot script into the FIT image
UBOOT_ENV = "${@bb.utils.contains('TRUSTFENCE_FIT_IMG', '1', 'boot', '', d)}" UBOOT_ENV = "${@bb.utils.contains('TRUSTFENCE_FIT_IMG', '1', 'boot', '', d)}"
# Partitions to blacklist for swupdate:
# fsbl1, fsbl2, metadata1, metadata2, fip-a, fip-b
SWUPDATE_MTD_BLACKLIST = "0 1 2 3 4 5"

View File

@ -12,7 +12,7 @@ globals : {
verbose = true; verbose = true;
loglevel = 5; loglevel = 5;
syslog = true; syslog = true;
mtd-blacklist = "0 1 2"; #mtd-blacklist
#public-key-file #public-key-file
}; };

View File

@ -24,6 +24,11 @@ do_install:append() {
install -d ${D}${sysconfdir}/ install -d ${D}${sysconfdir}/
install -m 0755 ${WORKDIR}/swupdate.cfg ${D}${sysconfdir} install -m 0755 ${WORKDIR}/swupdate.cfg ${D}${sysconfdir}
# Add MTD blacklist
if ${@oe.utils.conditional('STORAGE_MEDIA', 'mtd', 'true', 'false', d)}; then
sed -i "s,\(^\s*\)#mtd-blacklist,\1mtd-blacklist = \"${SWUPDATE_MTD_BLACKLIST}\",g" ${D}${sysconfdir}/swupdate.cfg
fi
# Add public-key-file setting to config file if TrustFence is enabled # Add public-key-file setting to config file if TrustFence is enabled
if ${@oe.utils.conditional('TRUSTFENCE_ENABLED', '1', 'true', 'false', d)}; then if ${@oe.utils.conditional('TRUSTFENCE_ENABLED', '1', 'true', 'false', d)}; then
sed -i "s,\(^\s*\)#public-key-file,\1public-key-file = \"${sysconfdir}/ssl/certs/key.pub\",g" ${D}${sysconfdir}/swupdate.cfg sed -i "s,\(^\s*\)#public-key-file,\1public-key-file = \"${sysconfdir}/ssl/certs/key.pub\",g" ${D}${sysconfdir}/swupdate.cfg