Skip to content

Commit

Permalink
initramfs/migrate: Copy Jetson Orin boot artifact and UEFI capsule
Browse files Browse the repository at this point in the history
Copying these files before unmounting the rootfs is needed
for the case where the NVME is provisioned with a flasher
image already.

If the QSPI is accessible, it will be written directly, otherwise
a capsule update will be prepared by the resin-init-flasher-board
script and applied by the UEFI firmware as soon as the board re-boots.

If the capsule update is interrupted on the first boot, a device
specific service will attempt to re-trigger it in the next two
boots.

Change-type: patch
Signed-off-by: Alexandru Costache <alexandru@balena.io>
  • Loading branch information
acostach committed Nov 19, 2024
1 parent 9060838 commit c6b629c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion meta-balena-common/recipes-core/initrdscripts/files/migrate
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ migrate_enabled() {
migrate_run() {
# Find the raw image in the rootfs partition
image=$(find "${ROOTFS_DIR}" -xdev -type f -name "${BALENA_IMAGE}")
kernel_images=$(find "${ROOTFS_DIR}" -xdev -type f -name "@@KERNEL_IMAGETYPE@@*")
kernel_images=$(find "${ROOTFS_DIR}" -xdev -type f -name "Image*")
jetson_orin_capsule=$(find "${ROOTFS_DIR}" -xdev -type f -name "TEGRA_BL_*Cap*")
jetson_orin_boot_artifact=$(find "${ROOTFS_DIR}" -xdev -type f -name "boot0.img.gz")
if [ -n "${image}" ]; then
EXTERNAL_DEVICE_BOOT_PART_MOUNTPOINT="${BALENA_BOOT_MOUNTPOINT}"
if findmnt "${FLASH_BOOT_MOUNT}" > /dev/null; then
Expand All @@ -120,6 +122,21 @@ migrate_run() {
# shellcheck disable=SC2086
cp -a ${kernel_images} "/tmp"

# If this is a Jetson Orin device, the flasher image contains
# a compressed boot blob as well as a UEFI capsule.
# If the QSPI is accessible, it will be written directly,
# otherwise a capsule update will be triggered on the next boot
# after provisioning
if [ -f "${jetson_orin_capsule}" ]; then
cp "${jetson_orin_capsule}" "/tmp/"
info "Copied ${jetson_orin_capsule}"
fi

if [ -f "${jetson_orin_boot_artifact}" ]; then
cp "${jetson_orin_boot_artifact}" "/tmp/"
info "Copied ${jetson_orin_boot_artifact}"
fi

# Need to source this again to set CONFIG_PATH correctly
unset CONFIG_PATH
# shellcheck disable=SC1091
Expand Down

0 comments on commit c6b629c

Please sign in to comment.