Skip to content

Commit

Permalink
hostapp-update-hooks: Add boot blob update support for NX
Browse files Browse the repository at this point in the history
Jetson NX stores all signed bootloaders in a separate memory.
We generate this blob in tegra194-nxde-flash-dry recipe.

Signed-off-by: Alexandru Costache <[email protected]>
  • Loading branch information
acostach committed Jun 12, 2020
1 parent 615643b commit 79cab4d
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set -o errexit

. /usr/libexec/os-helpers-fs

bootloader_device="/dev/mtdblock0"
bootloader_blob="/opt/tegra-binaries/boot0.img"
new_part=$(findmnt --noheadings --canonicalize --output SOURCE "/mnt/sysroot/inactive" -t ext4)
echo "New partition is ${new_part}"

Expand Down Expand Up @@ -61,5 +63,17 @@ echo "[INFO] Writing kernel ${kernel} to specific partitions..."
dd if=/opt/tegra-binaries/${kernel} of=$(get_state_path_from_label "kernel")
dd if=/opt/tegra-binaries/${kernel} of=$(get_state_path_from_label "kernel_b")

existing_bootloader_md5sum=$(dd if=$bootloader_device bs=1M status=none | md5sum | awk '{print $1}')
update_bootloader_md5sum=$(md5sum $bootloader_blob | awk '{print $1}')

if [ ! "$existing_bootloader_md5sum" = "$update_bootloader_md5sum" ]; then
echo "[INFO] Will update bootloader device"
flash_erase /dev/mtd0 0 0
dd if=$bootloader_blob of=$bootloader_device bs=1M
else
echo "[INFO] No need to update bootloader device"
fi

sync

echo "Done."

0 comments on commit 79cab4d

Please sign in to comment.