No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

build_tegra.sh 2.6 KiB

hace 4 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. set -e
  3. INPUT_DIR="$1"
  4. TARGET_BOARD="$2"
  5. IMAGE_NAME="$(basename $INPUT_DIR)"
  6. TEGRA_DIR="$TARGET$BUILD/BSP_$TARGET_BOARD"
  7. if [ $TARGET_BOARD == "AGX" ]; then
  8. L4T_ASSET="https://developer.download.nvidia.com/embedded/L4T/r32_Release_v4.4/r32_Release_v4.4-GMC3/T186/Tegra186_Linux_R32.4.4_aarch64.tbz2"
  9. IMG_NAMES=("jetson-xavier-nx-devkit")
  10. IMG_REVS=("default")
  11. elif [ $TARGET_BOARD == "NANO" ]; then
  12. L4T_ASSET="https://developer.download.nvidia.com/embedded/L4T/r32_Release_v4.4/r32_Release_v4.4-GMC3/T210/Tegra210_Linux_R32.4.4_aarch64.tbz2"
  13. IMG_NAMES=("jetson-nano")
  14. IMG_REVS=("200")
  15. fi
  16. printf "Create Tegra directory... "
  17. mkdir -p $TEGRA_DIR
  18. printf "(OK)\n"
  19. echo "Downloading Tegra assets..."
  20. if [ ! "$(ls -A $TEGRA_DIR)" ]; then
  21. wget $L4T_ASSET
  22. tar xpf $(basename $L4T_ASSET) -C $TEGRA_DIR
  23. fi
  24. echo "Downloading Tegra assets... (OK)"
  25. printf "Copying rootfs assets... "
  26. rm -fr $TEGRA_DIR/Linux_for_Tegra/rootfs/*
  27. cp -rp $INPUT_DIR/. $TEGRA_DIR/Linux_for_Tegra/rootfs/
  28. printf "(OK)\n"
  29. printf "Ameliorate Tegra installer... "
  30. rm -fr $TEGRA_DIR/Linux_for_Tegra/tools/python-jetson-gpio_2.0.11_arm64.deb
  31. rm -fr $TEGRA_DIR/Linux_for_Tegra/nv_tegra/l4t_deb_packages/nvidia-l4t-oem-config*.deb
  32. sed -i -e 's/ln -sf nv-oem-config.target default.target//g' \
  33. $TEGRA_DIR/Linux_for_Tegra/nv_tools/scripts/nv_customize_rootfs.sh
  34. sed -i -e 's/dpkg -i/dpkg --force-overwrite -i/g' \
  35. $TEGRA_DIR/Linux_for_Tegra/nv_tegra/nv-apply-debs.sh
  36. tar -jxvf $TEGRA_DIR/Linux_for_Tegra/nv_tegra/config.tbz2 \
  37. usr/lib/nvidia/resizefs/nvresizefs.sh \
  38. --one-top-level=$TEGRA_DIR/Linux_for_Tegra/rootfs/
  39. printf "(OK)\n"
  40. echo "Run pre application tasks..."
  41. pushd $TARGET/ansible > /dev/null
  42. export ANSIBLE_ROOTFS_DIR=$TEGRA_DIR/Linux_for_Tegra/rootfs
  43. ansible-playbook -v 03_tegra.yaml --tags "pre"
  44. echo "Run pre application tasks... (OK)"
  45. echo "Applying Tegra binaries..."
  46. pushd $TEGRA_DIR/Linux_for_Tegra/ > /dev/null
  47. ./apply_binaries.sh
  48. echo "Applying Tegra binaries... (OK)"
  49. echo "Run post application tasks..."
  50. pushd $TARGET/ansible > /dev/null
  51. export ANSIBLE_ROOTFS_DIR=$TEGRA_DIR/Linux_for_Tegra/rootfs
  52. ansible-playbook -v 03_tegra.yaml --tags "post"
  53. echo "Run post application tasks... (OK)"
  54. for i in ${!IMG_NAMES[@]};
  55. do
  56. BOARD=${IMG_NAMES[$i]}
  57. REV=${IMG_REVS[$i]}
  58. echo "Creating $BOARD image..."
  59. pushd $TEGRA_DIR/Linux_for_Tegra/ > /dev/null
  60. sudo ./tools/jetson-disk-image-creator.sh -o export.img -b $BOARD -r $REV
  61. mv $TEGRA_DIR/Linux_for_Tegra/export.img "${EXPORT_DIR}/${PISDR_IMG_NAME}-${IMAGE_NAME}-${BOARD}-${REV}.img" > /dev/null
  62. echo "Creating $BOARD image... (OK)"
  63. done