From cd194fdd43a3457f767f2ddf94ee4f852190190d Mon Sep 17 00:00:00 2001 From: Matt Madison Date: Tue, 10 Jan 2023 07:44:12 -0800 Subject: [PATCH] tegra-flash-init: add BCT redundant copies to mmcblk0boot0 writes in the program-boot-device script. Signed-off-by: Matt Madison --- .../tegra-flash-init/program-boot-device.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/recipes-core/initrdscripts/tegra-flash-init/program-boot-device.sh b/recipes-core/initrdscripts/tegra-flash-init/program-boot-device.sh index 8814f3dc..e73e0264 100644 --- a/recipes-core/initrdscripts/tegra-flash-init/program-boot-device.sh +++ b/recipes-core/initrdscripts/tegra-flash-init/program-boot-device.sh @@ -74,6 +74,22 @@ program_mmcboot_partition() { if ! dd if="$part_file" of="$bootpart" bs=1 seek=$part_offset count=$file_size > /dev/null; then return 1 fi + # Multiple copies of the BCT get installed at 16KiB boundaries + # within the defined BCT partition + if [ "$partname" = "BCT" ]; then + local slotsize=16384 + local curr_offset=$(expr $part_offset \+ $slotsize) + local copycount=$(expr $part_size / $slotsize) + local i=1 + while [ $i -lt $copycount ]; do + echo "Writing $part_file (size=$file_size) to BCT+$i (offset=$curr_offset)" + if ! dd if="$part_file" of="$bootpart" bs=1 seek=$curr_offset count=$file_size > /dev/null; then + return 1 + fi + i=$(expr $i \+ 1) + curr_offset=$(expr $curr_offset \+ $slotsize) + done + fi fi return 0 }