From 0ac2d77b56823354cc002e28e3e5d7a4bf20c372 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 16 Jan 2018 15:25:26 -0700 Subject: [PATCH] hooks: Add support for Jetson TX2 testing on swarren-lx1 Signed-off-by: Stephen Warren --- test/hooks/bin/flash.recovery_l4t | 46 +++++++++++++++++++ test/hooks/bin/poweron.pm342 | 2 +- test/hooks/bin/recovery.pm342 | 7 ++- test/hooks/bin/reset.pm342 | 21 +++++++++ .../bin/swarren-lx1/conf.p2771-0000-500_na | 31 +++++++++++++ .../u_boot_boardenv_p2771_0000_500_na.py | 29 ++++++++++++ 6 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 test/hooks/bin/flash.recovery_l4t create mode 100644 test/hooks/bin/reset.pm342 create mode 100644 test/hooks/bin/swarren-lx1/conf.p2771-0000-500_na create mode 100644 test/hooks/py/swarren-lx1/u_boot_boardenv_p2771_0000_500_na.py diff --git a/test/hooks/bin/flash.recovery_l4t b/test/hooks/bin/flash.recovery_l4t new file mode 100644 index 00000000000..3612030ba6e --- /dev/null +++ b/test/hooks/bin/flash.recovery_l4t @@ -0,0 +1,46 @@ +# 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: Need to enhance flash.sh to accept --instance parameter and pass to +# tegraflash.py. Sigh. +# 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" -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}" diff --git a/test/hooks/bin/poweron.pm342 b/test/hooks/bin/poweron.pm342 index 60a215e4b49..de3c11f5ce1 100644 --- a/test/hooks/bin/poweron.pm342 +++ b/test/hooks/bin/poweron.pm342 @@ -21,4 +21,4 @@ # Basic power on "${nv_board_automation_bin}/boardctl" --target pm342 --serial "${pm342_serial}" power_on # Put board into recovery so it doesn't boot -"${nv_board_automation_bin}/boardctl" --target pm342 --serial "${pm342_serial}" recovery +. "${bin_dir}/recovery.pm342" diff --git a/test/hooks/bin/recovery.pm342 b/test/hooks/bin/recovery.pm342 index b4e8c4c0e5f..8d7a8aca3c9 100644 --- a/test/hooks/bin/recovery.pm342 +++ b/test/hooks/bin/recovery.pm342 @@ -18,4 +18,9 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -"${nv_board_automation_bin}/boardctl" --target pm342 --serial "${pm342_serial}" recovery +# The "recovery" command doesn't work on p2771-0000, so do this manually: +"${nv_board_automation_bin}/boardctl" --target pm342 --serial "${pm342_serial}" recovery_down +sleep 0.25 +"${nv_board_automation_bin}/boardctl" --target pm342 --serial "${pm342_serial}" reset +sleep 0.25 +"${nv_board_automation_bin}/boardctl" --target pm342 --serial "${pm342_serial}" recovery_up diff --git a/test/hooks/bin/reset.pm342 b/test/hooks/bin/reset.pm342 new file mode 100644 index 00000000000..067a5fa1e78 --- /dev/null +++ b/test/hooks/bin/reset.pm342 @@ -0,0 +1,21 @@ +# 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. + +"${nv_board_automation_bin}/boardctl" --target pm342 --serial "${pm342_serial}" reset diff --git a/test/hooks/bin/swarren-lx1/conf.p2771-0000-500_na b/test/hooks/bin/swarren-lx1/conf.p2771-0000-500_na new file mode 100644 index 00000000000..daf3cbd45af --- /dev/null +++ b/test/hooks/bin/swarren-lx1/conf.p2771-0000-500_na @@ -0,0 +1,31 @@ +# 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. + +console_dev=/dev/serial/by-path/pci-0000:00:14.0-usb-0:14:1.2-port0 +power_impl=pm342 +flash_impl=recovery_l4t +recovery_impl=pm342 +flash_l4t="${HOME}/ubtest-l4t-r28.1-p2771-0000" +flash_l4t_uboot_path=bootloader/t186ref/p2771-0000/500/ +flash_l4t_board=jetson-tx2 +reset_impl=pm342 +nv_board_automation_bin="${HOME}/ubtest-nvidia-board-automation" +pm342_serial=SRW-1 +board_usb_dev=/dev/usbdev-p2771-0000 diff --git a/test/hooks/py/swarren-lx1/u_boot_boardenv_p2771_0000_500_na.py b/test/hooks/py/swarren-lx1/u_boot_boardenv_p2771_0000_500_na.py new file mode 100644 index 00000000000..6856fa1c6c8 --- /dev/null +++ b/test/hooks/py/swarren-lx1/u_boot_boardenv_p2771_0000_500_na.py @@ -0,0 +1,29 @@ +# 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. + +env__net_uses_pci = False + +env__net_dhcp_server = True + +env__net_tftp_readable_file = { + "fn": "ubtest-readable.bin", + "size": 5058624, + "crc32": "c2244b26", +}