Skip to content

Commit

Permalink
resin-init/resin-init-flasher-board: Trigger an UEFI capsule update i…
Browse files Browse the repository at this point in the history
…f QSPI is inaccessible

This allows for flasher images to be booted even if
the device isn't in recovery mode, as long as the
vanilla firmware in the QSPI is in sync with the hostOS
L4T version.

Signed-off-by: Alexandru Costache <alexandru@balena.io>
  • Loading branch information
acostach committed Nov 28, 2024
1 parent 59e6847 commit 7a814f4
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
set -e

. /usr/libexec/os-helpers-logging
source /usr/libexec/jetson-qspi-helpers

MMC_DEV="mmcblk0"
MTD_DEV="mtd0"
FLASHER_CONF_FILE=/etc/resin-init-flasher.conf
BOOT_BLOB="boot0.img"
INTERNAL_BOOT_MP="/tmp/internal_boot"

if [ -f ${FLASHER_CONF_FILE} ]; then
source ${FLASHER_CONF_FILE}
Expand All @@ -27,11 +29,12 @@ if [[ -e /dev/${MTD_DEV} ]]; then

log "QSPI is accessible, it will be updated"
mtd_debug erase /dev/${MTD_DEV} 0x0 0x4000000
gunzip -k -c "${BOOT_BLOB_PATH}" | dd of=/tmp/${BOOT_BLOB} bs=1M
gunzip -k -f -c "${BOOT_BLOB_PATH}" | dd of=/tmp/${BOOT_BLOB} bs=1M
mtd_debug write /dev/${MTD_DEV} 0x0 0x4000000 /tmp/${BOOT_BLOB}
sync
else
log "QSPI is inaccessible, it will not be updated"
log "QSPI is inaccessible in the hostOS update hook, will attempt update trough capsule on next boot"
try_capsule_update $INTERNAL_BOOT_MP $INTERNAL_BOOT_MP
fi

# Relocate secondary gpt after writing image to the internal medium
Expand Down

0 comments on commit 7a814f4

Please sign in to comment.