swupdate: add support to update U-Boot in the redundant partition
The support to update U-Boot in the redundant partition must be enabled in the project configuration file by setting the variable "SWUPDATE_UBOOTIMG_REDUNDANT" to "true": SWUPDATE_UBOOTIMG_REDUNDANT = "true" This feature is only available for the newer platforms: ccmp13, ccmp15 and ccimx93. Trying to enable it in older platforms will display a warning and fallback to non-redundant update. Signed-off-by: David Escalona <david.escalona@digi.com>
This commit is contained in:
parent
9348d94d22
commit
2ecaf1ca55
|
|
@ -89,6 +89,7 @@ BOOT_SCRIPTS += "boot.scr:boot.scr"
|
||||||
|
|
||||||
# This can be used to enable U-Boot update through swupdate
|
# This can be used to enable U-Boot update through swupdate
|
||||||
SWUPDATE_UBOOTIMG ?= "false"
|
SWUPDATE_UBOOTIMG ?= "false"
|
||||||
|
SWUPDATE_UBOOTIMG_REDUNDANT ?= "false"
|
||||||
|
|
||||||
# ConnectCore Cloud Services packages to install
|
# ConnectCore Cloud Services packages to install
|
||||||
CCCS_PKGS ?= "cccs-gs-demo dey-examples-cccs"
|
CCCS_PKGS ?= "cccs-gs-demo dey-examples-cccs"
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,18 @@ def get_swupdate_uboot_enc(d):
|
||||||
|
|
||||||
SWUPDATE_UBOOT_ENC ?= "${@get_swupdate_uboot_enc(d)}"
|
SWUPDATE_UBOOT_ENC ?= "${@get_swupdate_uboot_enc(d)}"
|
||||||
|
|
||||||
|
# Retrieve the redundant U-Boot value.
|
||||||
|
def get_uboot_redundant(d):
|
||||||
|
if d.getVar("SWUPDATE_UBOOTIMG") == "true" and d.getVar("SWUPDATE_UBOOTIMG_REDUNDANT") == "true":
|
||||||
|
if any(d.getVar("MACHINE").startswith(platform) for platform in ("ccimx6", "ccimx8")):
|
||||||
|
bb.warn("Target does not support updating redundant U-Boot. Continuing with single SWU U-Boot update.")
|
||||||
|
return "single"
|
||||||
|
return "redundant"
|
||||||
|
|
||||||
|
return "single"
|
||||||
|
|
||||||
|
SWUPDATE_UBOOT_REDUNDANT = "${@get_uboot_redundant(d)}"
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
########## SWU Update Script ##########
|
########## SWU Update Script ##########
|
||||||
#######################################
|
#######################################
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
filename = "@@SWUPDATE_UBOOT_SCRIPT_NAME@@";
|
filename = "@@SWUPDATE_UBOOT_SCRIPT_NAME@@";
|
||||||
type = "preinstall";
|
type = "preinstall";
|
||||||
data = "@@SWUPDATE_UBOOT_NAME@@ @@SWUPDATE_UBOOT_ENC@@ @@SWUPDATE_UBOOT_OFFSET@@ @@SWUPDATE_UBOOT_NAME_TFA@@";
|
data = "@@SWUPDATE_UBOOT_NAME@@ @@SWUPDATE_UBOOT_ENC@@ @@SWUPDATE_UBOOT_OFFSET@@ @@SWUPDATE_UBOOT_REDUNDANT@@ @@SWUPDATE_UBOOT_NAME_TFA@@";
|
||||||
sha256 = "$swupdate_get_sha256(@@SWUPDATE_UBOOT_SCRIPT_NAME@@)";
|
sha256 = "$swupdate_get_sha256(@@SWUPDATE_UBOOT_SCRIPT_NAME@@)";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,10 @@
|
||||||
UBOOT_NAME="$1"
|
UBOOT_NAME="$1"
|
||||||
UBOOT_ENC="$2"
|
UBOOT_ENC="$2"
|
||||||
UBOOT_SEEK_KB="$3"
|
UBOOT_SEEK_KB="$3"
|
||||||
|
UBOOT_REDUNDANT="$4"
|
||||||
UBOOT_FILE="/tmp/${UBOOT_NAME}"
|
UBOOT_FILE="/tmp/${UBOOT_NAME}"
|
||||||
UBOOT_BLOCK_MAIN="mmcblk0boot0"
|
UBOOT_BLOCK_MAIN="mmcblk0boot0"
|
||||||
|
UBOOT_BLOCK_REDUNDANT="mmcblk0boot1"
|
||||||
UBOOT_MMC_DEV_MAIN="/dev/${UBOOT_BLOCK_MAIN}"
|
UBOOT_MMC_DEV_MAIN="/dev/${UBOOT_BLOCK_MAIN}"
|
||||||
UBOOT_MMC_DUMP="/tmp/u-boot-dump.hex"
|
UBOOT_MMC_DUMP="/tmp/u-boot-dump.hex"
|
||||||
UBOOT_ENCRYPTED_DEK="/tmp/u-boot-encrypted-with-dek.imx"
|
UBOOT_ENCRYPTED_DEK="/tmp/u-boot-encrypted-with-dek.imx"
|
||||||
|
|
@ -258,6 +260,10 @@ if [ "${UBOOT_ENC}" = "enc" ]; then
|
||||||
fi
|
fi
|
||||||
# Write U-Boot
|
# Write U-Boot
|
||||||
write_uboot_emmc ${UBOOT_BLOCK_MAIN}
|
write_uboot_emmc ${UBOOT_BLOCK_MAIN}
|
||||||
|
# Check if redundant U-Boot update is requested.
|
||||||
|
if [ "${UBOOT_REDUNDANT}" = "redundant" ]; then
|
||||||
|
write_uboot_emmc ${UBOOT_BLOCK_REDUNDANT}
|
||||||
|
fi
|
||||||
# Clean intermediate artifacts.
|
# Clean intermediate artifacts.
|
||||||
clean_artifacts
|
clean_artifacts
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@
|
||||||
UBOOT_NAME="$1"
|
UBOOT_NAME="$1"
|
||||||
UBOOT_ENC="$2"
|
UBOOT_ENC="$2"
|
||||||
UBOOT_SEEK_KB="$3"
|
UBOOT_SEEK_KB="$3"
|
||||||
UBOOT_TFA_NAME="$4"
|
UBOOT_REDUNDANT="$4"
|
||||||
|
UBOOT_TFA_NAME="$5"
|
||||||
UBOOT_TFA_FILE="/tmp/${UBOOT_TFA_NAME}"
|
UBOOT_TFA_FILE="/tmp/${UBOOT_TFA_NAME}"
|
||||||
UBOOT_FILE="/tmp/${UBOOT_NAME}"
|
UBOOT_FILE="/tmp/${UBOOT_NAME}"
|
||||||
UBOOT_NAND_DUMP="/tmp/u-boot-dump.hex"
|
UBOOT_NAND_DUMP="/tmp/u-boot-dump.hex"
|
||||||
|
|
@ -148,6 +149,13 @@ if expr "${PLATFORM}" : "ccmp1.*" >/dev/null; then
|
||||||
write_file_to_nand "/dev/mtd$(get_mtd_number_from_partition fsbl1)" "${UBOOT_TFA_FILE}"
|
write_file_to_nand "/dev/mtd$(get_mtd_number_from_partition fsbl1)" "${UBOOT_TFA_FILE}"
|
||||||
# Install U-Boot FIP file in fip-a partition.
|
# Install U-Boot FIP file in fip-a partition.
|
||||||
write_file_to_nand "/dev/mtd$(get_mtd_number_from_partition fip-a)" "${UBOOT_FILE}"
|
write_file_to_nand "/dev/mtd$(get_mtd_number_from_partition fip-a)" "${UBOOT_FILE}"
|
||||||
|
# Check if redundant U-Boot update is requested.
|
||||||
|
if [ "${UBOOT_REDUNDANT}" = "redundant" ]; then
|
||||||
|
# Install TFA file in fsbl2 partition (redundant).
|
||||||
|
write_file_to_nand "/dev/mtd$(get_mtd_number_from_partition fsbl2)" "${UBOOT_TFA_FILE}"
|
||||||
|
# Install U-Boot FIP file in fip-b partition (redundant).
|
||||||
|
write_file_to_nand "/dev/mtd$(get_mtd_number_from_partition fip-b)" "${UBOOT_FILE}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# Mount debug file system to remove some kobs-ng warnings.
|
# Mount debug file system to remove some kobs-ng warnings.
|
||||||
if ! grep -qs debugfs /proc/mounts; then
|
if ! grep -qs debugfs /proc/mounts; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue