install script: enable trustfence if -k is selected

Also use the name DEK_FILE for all the files.

Signed-off-by: Francisco Gil <francisco.gilmartinez@digi.com>
This commit is contained in:
Francisco Gil 2024-06-17 12:05:12 +02:00
parent 828f5da09b
commit 7e493b74ae
6 changed files with 42 additions and 41 deletions

View File

@ -39,8 +39,8 @@ show_usage()
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', " echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..." echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided." echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided."
echo " -k <dek-blob-file> Update includes dek blob file." echo " -k <dek-filename> Update includes dek file."
echo " (requires -t)." echo " (implies -t)."
echo " -n No wait. Skips 10 seconds delay to stop script." echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -t Install Trustfence artifacts." echo " -t Install Trustfence artifacts."
echo " -u <u-boot-filename> U-Boot filename." echo " -u <u-boot-filename> U-Boot filename."
@ -52,7 +52,7 @@ show_usage()
# Params: # Params:
# 1. partition # 1. partition
# 2. file # 2. file
# 3. dek blob file when updating an encrypted bootloader # 3. dek file when updating an encrypted bootloader
part_update() part_update()
{ {
echo "\033[36m" echo "\033[36m"
@ -63,7 +63,7 @@ part_update()
if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "bootloader" ]; then if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "bootloader" ]; then
uuu fb: download -f "${2}" uuu fb: download -f "${2}"
if [ -n "${DEK_BLOB_FILE}" ]; then if [ -n "${DEK_FILE}" ]; then
uuu fb: ucmd setenv uboot_size \${filesize} uuu fb: ucmd setenv uboot_size \${filesize}
uuu fb: ucmd setenv fastboot_buffer \${initrd_addr} uuu fb: ucmd setenv fastboot_buffer \${initrd_addr}
uuu fb: download -f "${3}" uuu fb: download -f "${3}"
@ -90,6 +90,7 @@ echo "############################################################"
# -b, -d, -n (booleans) # -b, -d, -n (booleans)
# -i <image-name> # -i <image-name>
# -u <u-boot-filename> # -u <u-boot-filename>
# -k <dek-filename>
while getopts ':bdhi:k:ntu:' c while getopts ':bdhi:k:ntu:' c
do do
if [ "${c}" = ":" ]; then if [ "${c}" = ":" ]; then
@ -104,7 +105,7 @@ do
d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;; d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;;
h) show_usage ;; h) show_usage ;;
i) IMAGE_NAME=${OPTARG} ;; i) IMAGE_NAME=${OPTARG} ;;
k) DEK_BLOB_FILE=${OPTARG} ;; k) DEK_FILE=${OPTARG} ;;
n) NOWAIT=true ;; n) NOWAIT=true ;;
t) TRUSTFENCE=true ;; t) TRUSTFENCE=true ;;
u) INSTALL_UBOOT_FILENAME=${OPTARG} ;; u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
@ -269,7 +270,7 @@ fi
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
part_update "bootloader" "${INSTALL_UBOOT_FILENAME}" "${DEK_BLOB_FILE}" part_update "bootloader" "${INSTALL_UBOOT_FILENAME}" "${DEK_FILE}"
# Set MMC to boot from BOOT1 partition # Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1 uuu fb: ucmd mmc partconf 0 1 1 1

View File

@ -39,8 +39,8 @@ show_usage()
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', " echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..." echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided." echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided."
echo " -k <dek-blob-file> Update includes dek blob file." echo " -k <dek-filename> Update includes dek file."
echo " (requires -t)." echo " (implies -t)."
echo " -n No wait. Skips 10 seconds delay to stop script." echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -t Install TrustFence artifacts." echo " -t Install TrustFence artifacts."
echo " -u <u-boot-filename> U-Boot filename." echo " -u <u-boot-filename> U-Boot filename."
@ -52,7 +52,7 @@ show_usage()
# Params: # Params:
# 1. partition # 1. partition
# 2. file # 2. file
# 3. dek blob file when updating an encrypted bootloader # 3. dek file when updating an encrypted bootloader
part_update() part_update()
{ {
echo "\033[36m" echo "\033[36m"
@ -63,7 +63,7 @@ part_update()
if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "bootloader" ]; then if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "bootloader" ]; then
uuu fb: download -f "${2}" uuu fb: download -f "${2}"
if [ -n "${DEK_BLOB_FILE}" ]; then if [ -n "${DEK_FILE}" ]; then
uuu fb: ucmd setenv uboot_size \${filesize} uuu fb: ucmd setenv uboot_size \${filesize}
uuu fb: ucmd setenv fastboot_buffer \${initrd_addr} uuu fb: ucmd setenv fastboot_buffer \${initrd_addr}
uuu fb: download -f "${3}" uuu fb: download -f "${3}"
@ -90,7 +90,7 @@ echo "############################################################"
# -b, -d, -n (booleans) # -b, -d, -n (booleans)
# -i <image-name> # -i <image-name>
# -u <u-boot-filename> # -u <u-boot-filename>
# -k <dek-blob-name> # -k <dek-filename>
while getopts ':bdhi:k:ntu:' c while getopts ':bdhi:k:ntu:' c
do do
if [ "${c}" = ":" ]; then if [ "${c}" = ":" ]; then
@ -105,7 +105,7 @@ do
d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;; d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;;
h) show_usage ;; h) show_usage ;;
i) IMAGE_NAME=${OPTARG} ;; i) IMAGE_NAME=${OPTARG} ;;
k) DEK_BLOB_FILE=${OPTARG} ;; k) DEK_FILE=${OPTARG} && TRUSTFENCE=true ;;
n) NOWAIT=true ;; n) NOWAIT=true ;;
t) TRUSTFENCE=true ;; t) TRUSTFENCE=true ;;
u) INSTALL_UBOOT_FILENAME=${OPTARG} ;; u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
@ -289,7 +289,7 @@ fi
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
part_update "bootloader" "${INSTALL_UBOOT_FILENAME}" "${DEK_BLOB_FILE}" part_update "bootloader" "${INSTALL_UBOOT_FILENAME}" "${DEK_FILE}"
# Set MMC to boot from BOOT1 partition # Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1 uuu fb: ucmd mmc partconf 0 1 1 1

View File

@ -39,8 +39,8 @@ show_usage()
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', " echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..." echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided." echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided."
echo " -k <dek-blob-file> Update includes dek blob file." echo " -k <dek-filename> Update includes dek file."
echo " (requires -t)." echo " (implies -t)."
echo " -n No wait. Skips 10 seconds delay to stop script." echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -t Install TrustFence artifacts." echo " -t Install TrustFence artifacts."
echo " -u <u-boot-filename> U-Boot filename." echo " -u <u-boot-filename> U-Boot filename."
@ -56,7 +56,7 @@ show_usage()
# Description: # Description:
# - downloads image to RAM # - downloads image to RAM
# - runs 'update' command from RAM # - runs 'update' command from RAM
# 4. dek blob file when updating an encrypted u-boot # 4. dek file when updating an encrypted u-boot
part_update() part_update()
{ {
echo "\033[36m" echo "\033[36m"
@ -75,7 +75,7 @@ part_update()
fi fi
uuu fb: download -f "${2}" uuu fb: download -f "${2}"
if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "uboot" ]; then if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "uboot" ]; then
if [ -n "${DEK_BLOB_FILE}" ]; then if [ -n "${DEK_FILE}" ]; then
uuu fb: ucmd setenv uboot_size \${filesize} uuu fb: ucmd setenv uboot_size \${filesize}
uuu fb: ucmd setenv fastboot_buffer \${initrd_addr} uuu fb: ucmd setenv fastboot_buffer \${initrd_addr}
uuu fb: download -f "${4}" uuu fb: download -f "${4}"
@ -98,7 +98,7 @@ echo "############################################################"
# -b, -d, -n (booleans) # -b, -d, -n (booleans)
# -i <image-name> # -i <image-name>
# -u <u-boot-filename> # -u <u-boot-filename>
# -k <dek-blob-name> # -k <dek-filename>
while getopts ':bdhi:k:ntu:' c while getopts ':bdhi:k:ntu:' c
do do
if [ "${c}" = ":" ]; then if [ "${c}" = ":" ]; then
@ -113,7 +113,7 @@ do
d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;; d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;;
h) show_usage ;; h) show_usage ;;
i) IMAGE_NAME=${OPTARG} ;; i) IMAGE_NAME=${OPTARG} ;;
k) DEK_BLOB_FILE=${OPTARG} ;; k) DEK_FILE=${OPTARG} && TRUSTFENCE=true ;;
n) NOWAIT=true ;; n) NOWAIT=true ;;
t) TRUSTFENCE=true ;; t) TRUSTFENCE=true ;;
u) INSTALL_UBOOT_FILENAME=${OPTARG} ;; u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
@ -286,7 +286,7 @@ uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
part_update "uboot" "${INSTALL_UBOOT_FILENAME}" 5000 "${DEK_BLOB_FILE}" part_update "uboot" "${INSTALL_UBOOT_FILENAME}" 5000 "${DEK_FILE}"
# Set 'bootcmd' for the second part of the script that will # Set 'bootcmd' for the second part of the script that will
# - Reset environment to defaults # - Reset environment to defaults

View File

@ -39,8 +39,8 @@ show_usage()
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', " echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..." echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided." echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided."
echo " -k <dek-blob-file> Update includes dek blob file." echo " -k <dek-filename> Update includes dek file."
echo " (requires -t)." echo " (implies -t)."
echo " -n No wait. Skips 10 seconds delay to stop script." echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -t Install TrustFence artifacts." echo " -t Install TrustFence artifacts."
echo " -u <u-boot-filename> U-Boot filename." echo " -u <u-boot-filename> U-Boot filename."
@ -52,7 +52,7 @@ show_usage()
# Params: # Params:
# 1. partition # 1. partition
# 2. file # 2. file
# 3. dek blob file when updating an encrypted bootloader # 3. dek file when updating an encrypted bootloader
part_update() part_update()
{ {
echo "\033[36m" echo "\033[36m"
@ -63,7 +63,7 @@ part_update()
if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "bootloader" ]; then if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "bootloader" ]; then
uuu fb: download -f "${2}" uuu fb: download -f "${2}"
if [ -n "${DEK_BLOB_KEY}" ]; then if [ -n "${DEK_FILE}" ]; then
uuu fb: ucmd setenv uboot_size \${filesize} uuu fb: ucmd setenv uboot_size \${filesize}
uuu fb: ucmd setenv fastboot_buffer \${initrd_addr} uuu fb: ucmd setenv fastboot_buffer \${initrd_addr}
uuu fb: download -f "${3}" uuu fb: download -f "${3}"
@ -90,7 +90,7 @@ echo "############################################################"
# -b, -d, -n (booleans) # -b, -d, -n (booleans)
# -i <image-name> # -i <image-name>
# -u <u-boot-filename> # -u <u-boot-filename>
# -k <dek-blob-name> # -k <dek-filename>
while getopts ':bdhi:k:ntu:' c while getopts ':bdhi:k:ntu:' c
do do
if [ "${c}" = ":" ]; then if [ "${c}" = ":" ]; then
@ -105,7 +105,7 @@ do
d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;; d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;;
h) show_usage ;; h) show_usage ;;
i) IMAGE_NAME=${OPTARG} ;; i) IMAGE_NAME=${OPTARG} ;;
k) DEK_BLOB_KEY=${OPTARG} ;; k) DEK_FILE=${OPTARG} && TRUSTFENCE=true ;;
n) NOWAIT=true ;; n) NOWAIT=true ;;
t) TRUSTFENCE=true ;; t) TRUSTFENCE=true ;;
u) INSTALL_UBOOT_FILENAME=${OPTARG} ;; u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
@ -241,7 +241,7 @@ uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
part_update "bootloader" "${INSTALL_UBOOT_FILENAME}" "${DEK_BLOB_KEY}" part_update "bootloader" "${INSTALL_UBOOT_FILENAME}" "${DEK_FILE}"
# Set MMC to boot from BOOT1 partition # Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1 uuu fb: ucmd mmc partconf 0 1 1 1

View File

@ -39,8 +39,8 @@ show_usage()
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', " echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..." echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided." echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided."
echo " -k <dek-blob-file> Update includes dek blob file." echo " -k <dek-filename> Update includes dek file."
echo " (requires -t)." echo " (implies -t)."
echo " -n No wait. Skips 10 seconds delay to stop script." echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -t Install TrustFence artifacts." echo " -t Install TrustFence artifacts."
echo " -u <u-boot-filename> U-Boot filename." echo " -u <u-boot-filename> U-Boot filename."
@ -52,7 +52,7 @@ show_usage()
# Params: # Params:
# 1. partition # 1. partition
# 2. file # 2. file
# 3. dek blob file when updating an encrypted bootloader # 3. dek file when updating an encrypted bootloader
part_update() part_update()
{ {
echo "\033[36m" echo "\033[36m"
@ -63,7 +63,7 @@ part_update()
if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "bootloader" ]; then if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "bootloader" ]; then
uuu fb: download -f "${2}" uuu fb: download -f "${2}"
if [ -n "${DEK_BLOB_KEY}" ]; then if [ -n "${DEK_FILE}" ]; then
uuu fb: ucmd setenv uboot_size \${filesize} uuu fb: ucmd setenv uboot_size \${filesize}
uuu fb: ucmd setenv fastboot_buffer \${initrd_addr} uuu fb: ucmd setenv fastboot_buffer \${initrd_addr}
uuu fb: download -f "${3}" uuu fb: download -f "${3}"
@ -90,7 +90,7 @@ echo "############################################################"
# -b, -d, -n (booleans) # -b, -d, -n (booleans)
# -i <image-name> # -i <image-name>
# -u <u-boot-filename> # -u <u-boot-filename>
# -k <dek-blob-name> # -k <dek-filename>
while getopts ':bdhi:k:ntu:' c while getopts ':bdhi:k:ntu:' c
do do
if [ "${c}" = ":" ]; then if [ "${c}" = ":" ]; then
@ -105,7 +105,7 @@ do
d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;; d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;;
h) show_usage ;; h) show_usage ;;
i) IMAGE_NAME=${OPTARG} ;; i) IMAGE_NAME=${OPTARG} ;;
k) DEK_BLOB_KEY=${OPTARG} ;; k) DEK_FILE=${OPTARG} && TRUSTFENCE=true ;;
n) NOWAIT=true ;; n) NOWAIT=true ;;
t) TRUSTFENCE=true ;; t) TRUSTFENCE=true ;;
u) INSTALL_UBOOT_FILENAME=${OPTARG} ;; u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
@ -248,7 +248,7 @@ uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
part_update "bootloader" "${INSTALL_UBOOT_FILENAME}" "${DEK_BLOB_KEY}" part_update "bootloader" "${INSTALL_UBOOT_FILENAME}" "${DEK_FILE}"
# Set MMC to boot from BOOT1 partition # Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1 uuu fb: ucmd mmc partconf 0 1 1 1

View File

@ -39,8 +39,8 @@ show_usage()
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', " echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..." echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided." echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided."
echo " -k <dek-blob-file> Update includes dek blob file." echo " -k <dek-filename> Update includes dek file."
echo " (requires -t)." echo " (implies -t)."
echo " -n No wait. Skips 10 seconds delay to stop script." echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -u <u-boot-filename> U-Boot filename." echo " -u <u-boot-filename> U-Boot filename."
echo " -t Install TrustFence artifacts." echo " -t Install TrustFence artifacts."
@ -54,7 +54,7 @@ show_usage()
# Params: # Params:
# 1. partition # 1. partition
# 2. file # 2. file
# 3. dek blob file when updating an encrypted bootloader # 3. dek file when updating an encrypted bootloader
part_update() part_update()
{ {
echo "\033[36m" echo "\033[36m"
@ -65,7 +65,7 @@ part_update()
if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "bootloader" ]; then if [ "${TRUSTFENCE}" = "true" ] && [ "${1}" = "bootloader" ]; then
uuu fb: download -f "${2}" uuu fb: download -f "${2}"
if [ -n "${DEK_BLOB_KEY}" ]; then if [ -n "${DEK_FILE}" ]; then
uuu fb: ucmd setenv uboot_size \${filesize} uuu fb: ucmd setenv uboot_size \${filesize}
uuu fb: ucmd setenv fastboot_buffer \${initrd_addr} uuu fb: ucmd setenv fastboot_buffer \${initrd_addr}
uuu fb: download -f "${3}" uuu fb: download -f "${3}"
@ -92,7 +92,7 @@ echo "############################################################"
# -b, -d, -n (booleans) # -b, -d, -n (booleans)
# -i <image-name> # -i <image-name>
# -u <u-boot-filename> # -u <u-boot-filename>
# -k <dek-blob-name> # -k <dek-filename>
while getopts ':bdhti:nu:Uk:' c while getopts ':bdhti:nu:Uk:' c
do do
if [ "${c}" = ":" ]; then if [ "${c}" = ":" ]; then
@ -107,7 +107,7 @@ do
d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;; d) INSTALL_DUALBOOT=true && BOOTCOUNT=true ;;
h) show_usage ;; h) show_usage ;;
i) IMAGE_NAME=${OPTARG} ;; i) IMAGE_NAME=${OPTARG} ;;
k) DEK_BLOB_KEY=${OPTARG} ;; k) DEK_FILE=${OPTARG} && TRUSTFENCE=true ;;
n) NOWAIT=true ;; n) NOWAIT=true ;;
u) INSTALL_UBOOT_FILENAME=${OPTARG} ;; u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
t) TRUSTFENCE=true ;; t) TRUSTFENCE=true ;;
@ -257,7 +257,7 @@ uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
part_update "bootloader" "${INSTALL_UBOOT_FILENAME}" "${DEK_BLOB_KEY}" part_update "bootloader" "${INSTALL_UBOOT_FILENAME}" "${DEK_FILE}"
if [ "${INSTALL_REDUNDANT_UBOOT}" = true ]; then if [ "${INSTALL_REDUNDANT_UBOOT}" = true ]; then
part_update bootloader_redundant "${INSTALL_UBOOT_FILENAME}" part_update bootloader_redundant "${INSTALL_UBOOT_FILENAME}"
fi fi