Files
u-boot/test/hooks/bin/flash.recovery_l4t
Stephen Warren b1eb771d33 hooks: Pass --instance of L4T flash.sh to flash the correct board
This is required when multiple boards may be in recovery mode at once.
This option isn't currently supported by flash.sh; it needs to be patched
in manually...

Signed-off-by: Stephen Warren <swarren@nvidia.com>
2025-05-28 10:43:07 +01:00

45 lines
2.2 KiB
Plaintext

# Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
. "${bin_dir}/recovery.${recovery_impl}"
# USB enumeration delay
for ((i = 0; i <= 100; i++)); do
if [ -e "${board_usb_dev}" ]; then
break
fi
sleep 0.1
done
sleep 1
cp "${U_BOOT_BUILD_DIR}"/u-boot-dtb.bin "${flash_l4t}/${flash_l4t_uboot_path}/u-boot.bin"
# FIXME: To speed things up here, we could add "-k kernel" and just reflash the
# "kernel" partition (which holds U-Boot when it's in use). However, this
# relies on having the right L4T already flashed, which isn't likely on my
# system since I use the board for other things.
(cd "${flash_l4t}" && sudo "${flash_l4t}/flash.sh" --usb-instance "${board_usb_port_path}" -r "${flash_l4t_board}" mmcblk0p1)
# Prevent the system from booting before the reset script is run. Otherwise,
# either (a) the test system won't capture the start of the UART log, or (b)
# U-Boot will start running early, and the test system will start capturing
# part way through boot, and see extra copies of all the U-Boot messages, and
# hence fail the boot test. Ideally, flash.sh wouldn't auto-reset/boot the
# system.
. "${bin_dir}/recovery.${recovery_impl}"