# Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of NVIDIA CORPORATION nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. sub_var_token() { local var="$1"; local from="$2"; local to="$3"; if [ "${var}" != "" -a "${!var}" != "" ]; then if [[ "${!var}" =~ "${from}" ]]; then local val=`echo "${!var}" | sed -e s/${from}/${to}/`; eval "${var}=${val}"; fi; fi; } # Process fuse version: # # Production Fused BD vs non-fused BD:::::: # # preboot_d15_dev_cr.bin vs. preboot_d15_prod_cr.bin # mce_mts_d15_dev_cr.bin vs. mce_mts_d15_prod_cr.bin # mb1_dev.bin vs. mb1_prod.bin # mb1_recovery_dev.bin vs. mb1_recovery_prod.bin # process_fuse_level() { local fuselevel="${1}"; local srctoken="_dev"; local trgtoken="_prod"; # fuselevel: # "fuselevel_unknown" # "fuselevel_nofuse" # "fuselevel_production" # if [ "${fuselevel}" = "fuselevel_unknown" ]; then return; fi; if [ "${fuselevel}" = "fuselevel_nofuse" ]; then srctoken="_prod"; trgtoken="_dev"; sub_var_token "WB0BOOT" "warmboot.bin" "warmboot_dev.bin"; else sub_var_token "WB0BOOT" "warmboot_dev.bin" "warmboot.bin"; fi; sub_var_token "MTSPREBOOT" "${srctoken}" "${trgtoken}"; sub_var_token "MTS" "${srctoken}" "${trgtoken}"; sub_var_token "MB1FILE" "${srctoken}" "${trgtoken}"; sub_var_token "SOSFILE" "${srctoken}" "${trgtoken}"; } process_board_version() { local board_id="${1}"; local board_version="${2}"; local bdv=${board_version^^}; local bid=${board_id^^}; local uboot_build=500; local fromfab="-a00"; local tofab="-c03"; # default = C03 local pmicfab="-c00"; # default = C00 local bpfdtbfab="-c00"; # default = C00 local tbcdtbfab="-c03"; # default = C03 local kerndtbfab="-c03"; # default = C03 ODMDATA=0x7090000; # # Board version is Alpah-Numeric value. # echo "Board ID(${board_id}) version(${board_version}) " >/dev/stderr; if ! [[ "${bdv}" =~ ^[A-Z0-9][0-9][0-9]$ ]]; then bdv="${DEFAULT_FAB:-Z99}"; fi; if [ "${bid}" \= "3313" ]; then if [ "${bdv}" \= "000" ]; then # FAB - A00 pmicfab="-c04"; bpfdtbfab="-c04"; else if [ "${USE_UBOOT}" -eq 1 ]; then echo "not supported by U-Boot" >/dev/stderr; exit 1; fi; echo -n "Invalid board version(${board_version})." >/dev/stderr; echo " Using default ODMDATA(${ODMDATA})" >/dev/stderr; fi; elif [ "${bid}" \= "3301" ]; then ODMDATA=0x90000; uboot_build=000; tofab="-a00"; pmicfab="-a00"; bpfdtbfab="-a00"; tbcdtbfab="-a00"; kerndtbfab="-a00"; elif [ "${bid}" \= "3489" ]; then ODMDATA=0x1090000; tofab="-a00"; pmicfab="-a00"; bpfdtbfab="-a00"; tbcdtbfab="-a00"; kerndtbfab="-a00"; if [ "${bdv}" \< "300" ]; then bpfdtbfab="-evt"; fi else if [ "${bdv}" \< "300" ]; then # FAB - A02 ODMDATA=0x2090000; uboot_build=000; tofab="-a00"; pmicfab="-a00"; bpfdtbfab="-a00"; tbcdtbfab="-a00"; kerndtbfab="-a00"; elif [ "${bdv}" \< "500" ]; then # FAB - A03.. if [ "${USE_UBOOT}" -eq 1 ]; then echo "not supported by U-Boot" >/dev/stderr; exit 1; fi; ODMDATA=0x2090000; uboot_build=000; tofab="-a00"; pmicfab="-a00"; bpfdtbfab="-a00"; tbcdtbfab="-a00"; kerndtbfab="-a00"; elif [ "${bdv}" \< "800" ]; then # FAB = b0x ODMDATA=0x1090000; tofab="-a00"; pmicfab="-a00"; bpfdtbfab="-a00"; tbcdtbfab="-a00"; kerndtbfab="-a00"; elif [ "${bdv}" \< "900" ]; then # FAB = c00 tofab="-c00"; pmicfab="-c00"; bpfdtbfab="-c00"; tbcdtbfab="-a00"; kerndtbfab="-a00"; elif [ "${bdv}" \< "A00" ]; then # FAB = c01 pmicfab="-c01"; bpfdtbfab="-c01"; elif [ "${bdv}" \< "B00" ]; then # FAB = c02 pmicfab="-c02"; bpfdtbfab="-c01"; elif [ "${bdv}" \< "B01" ]; then # FAB = c03 pmicfab="-c03"; bpfdtbfab="-c01"; elif [ "${bdv}" \= "B01" -o "${bdv}" \> "B01" ]; then # FAB = c04 # Treat later VERSIONs as software-compatible. # Incompatible VERSIONs will require a new entry below. pmicfab="-c04"; bpfdtbfab="-c04"; else if [ "${USE_UBOOT}" -eq 1 ]; then echo "not supported by U-Boot" >/dev/stderr; exit 1; fi; echo -n "Invalid board version(${board_version})." >/dev/stderr; echo " Using default ODMDATA(${ODMDATA})" >/dev/stderr; fi; fi; sub_var_token "BPFDTB_FILE" "${fromfab}" "${bpfdtbfab}"; sub_var_token "PINMUX_CONFIG" "${fromfab}" "${tofab}"; sub_var_token "PMIC_CONFIG" "${fromfab}" "${pmicfab}"; sub_var_token "PMC_CONFIG" "${fromfab}" "${tofab}"; sub_var_token "PROD_CONFIG" "${fromfab}" "${tofab}"; sub_var_token "BOOTROM_CONFIG" "${fromfab}" "${tofab}"; sub_var_token "TBCDTB_FILE" "${fromfab}" "${tbcdtbfab}"; sub_var_token "DTB_FILE" "${fromfab}" "${kerndtbfab}"; if [ "${USE_UBOOT}" -eq 1 ]; then DFLT_KERNEL_IMAGE="bootloader/t186ref/p2771-0000/"; DFLT_KERNEL_IMAGE+="${uboot_build}/u-boot.bin"; fi; } # Common values and/or defaults across p2771-0000*.conf: CHIPID=0x18; EMMC_CFG=flash_l4t_t186.xml; BOOTPARTSIZE=8388608; EMMCSIZE=31276924928; ITS_FILE=; SYSBOOTFILE=p2771-0000/extlinux.conf; EMMC_BCT=P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg DTB_FILE=tegra186-quill-p3310-1000-a00-00-base.dtb; TBCDTB_FILE=tegra186-quill-p3310-1000-a00-00-base.dtb; # To configure whether to use U-Boot, # do either of the following before running flash.sh: # 1) Set environment variable USE_UBOOT to 0 or 1. # 2) Edit the line below to set USE_UBOOT to 0 or 1. if [ -z "${USE_UBOOT}" ]; then USE_UBOOT=1; fi; ROOTFSSIZE=28GiB; CMDLINE_ADD="console=ttyS0,115200n8 console=tty0 OS=l4t fbcon=map:0 net.ifnames=0"; target_board="t186ref"; ROOT_DEV="mmcblk0p12 ------------ internal eMMC. sda1 ----------------- external USB devices. (USB memory stick, HDD) eth0 ----------------- nfsroot via RJ45 Ethernet port. eth1 ----------------- nfsroot via USB Ethernet interface."; TEGRABOOT="bootloader/t186ref/nvtboot.bin"; WB0BOOT="bootloader/t186ref/warmboot.bin"; FLASHAPP="bootloader/tegraflash.py"; FLASHER="bootloader/nvtboot_recovery_cpu.bin"; BOOTLOADER="bootloader/nvtboot_cpu.bin"; INITRD="bootloader/l4t_initrd.img"; TBCFILE="bootloader/cboot.bin"; BPFFILE="bootloader/bpmp.bin"; TOSFILE="bootloader/tos.img"; EKSFILE="bootloader/eks.img"; MTSPREBOOT="bootloader/preboot_d15_prod_cr.bin"; MTS="bootloader/mce_mts_d15_prod_cr.bin"; MB1FILE="bootloader/mb1_prod.bin"; SOSFILE="bootloader/mb1_recovery_prod.bin"; MB2BLFILE="bootloader/nvtboot_recovery.bin"; # BCT args: # BCT="--sdram_config"; BINSARGS="--bins \""; DEV_PARAMS="emmc.cfg"; SCR_CONFIG="minimal_scr.cfg"; SCR_COLD_BOOT_CONFIG="mobile_scr.cfg"; MISC_CONFIG="tegra186-mb1-bct-misc-si-l4t.cfg"; PINMUX_CONFIG="tegra186-mb1-bct-pinmux-quill-p3310-1000-a00.cfg"; PMIC_CONFIG="tegra186-mb1-bct-pmic-quill-p3310-1000-a00.cfg"; PMC_CONFIG="tegra186-mb1-bct-pad-quill-p3310-1000-a00.cfg"; PROD_CONFIG="tegra186-mb1-bct-prod-quill-p3310-1000-a00.cfg"; BOOTROM_CONFIG="tegra186-mb1-bct-bootrom-quill-p3310-1000-a00.cfg"; # Default FAB: Force Quill boards without properly programmed EEPROM. # Values: C01->800, C02->900, C02->A00, C03->B00 # DEFAULT_FAB="B01";