|
22 | 22 |
|
23 | 23 | . scripts/setup-common "$1" |
24 | 24 |
|
| 25 | +# Determine which sources directory exists (specific version like 6.0 or normalized like 6.x) |
| 26 | +if [[ -d "sources_$1" ]]; then |
| 27 | + SOURCES_VERSION="$1" |
| 28 | +elif [[ -d "sources_$JETPACK_VERSION" ]]; then |
| 29 | + SOURCES_VERSION="$JETPACK_VERSION" |
| 30 | +else |
| 31 | + SOURCES_VERSION="$1" # Default to original input if neither exists yet |
| 32 | +fi |
| 33 | + |
25 | 34 | ACTION="$2" |
26 | 35 | [[ -z "$ACTION" ]] && ACTION="apply" |
27 | 36 |
|
|
37 | 46 |
|
38 | 47 | # NVIDIA SDK Manager's JetPack 4.6.1 source_sync.sh doesn't set the right folder name, it mismatches with the direct tar |
39 | 48 | # package source code. Correct the folder name. |
40 | | -if [[ "$ACTION" == apply && -d "sources_$JETPACK_VERSION/hardware/nvidia/platform/t19x/galen-industrial-dts" ]]; then |
41 | | - mv sources_$JETPACK_VERSION/hardware/nvidia/platform/t19x/galen-industrial-dts sources_$JETPACK_VERSION/hardware/nvidia/platform/t19x/galen-industrial |
| 49 | +if [[ "$ACTION" == apply && -d "sources_$SOURCES_VERSION/hardware/nvidia/platform/t19x/galen-industrial-dts" ]]; then |
| 50 | + mv sources_$SOURCES_VERSION/hardware/nvidia/platform/t19x/galen-industrial-dts sources_$SOURCES_VERSION/hardware/nvidia/platform/t19x/galen-industrial |
42 | 51 | fi |
43 | | -if [[ "$ACTION" == reset && -d "sources_$JETPACK_VERSION/hardware/nvidia/platform/t19x/galen-industrial" ]]; then |
44 | | - rm -rfv "sources_$JETPACK_VERSION/hardware/nvidia/platform/t19x/galen-industrial" > /dev/null |
| 52 | +if [[ "$ACTION" == reset && -d "sources_$SOURCES_VERSION/hardware/nvidia/platform/t19x/galen-industrial" ]]; then |
| 53 | + rm -rfv "sources_$SOURCES_VERSION/hardware/nvidia/platform/t19x/galen-industrial" > /dev/null |
45 | 54 | fi |
46 | 55 |
|
47 | 56 | apply_external_patches() { |
48 | | - git -C "sources_$JETPACK_VERSION/$3" status > /dev/null |
| 57 | + git -C "sources_$SOURCES_VERSION/$3" status > /dev/null |
49 | 58 | if [[ "$1" == 'apply' ]]; then |
50 | | - if ! git -C "sources_$JETPACK_VERSION/$3" diff --quiet || ! git -C "sources_$JETPACK_VERSION/$3" diff --cached --quiet; then |
51 | | - read -p "Repo sources_$JETPACK_VERSION/$3 has changes that may disturb applying patches. Continue (y/N)? " confirm |
| 59 | + if ! git -C "sources_$SOURCES_VERSION/$3" diff --quiet || ! git -C "sources_$SOURCES_VERSION/$3" diff --cached --quiet; then |
| 60 | + read -p "Repo sources_$SOURCES_VERSION/$3 has changes that may disturb applying patches. Continue (y/N)? " confirm |
52 | 61 | [[ "$confirm" != "y" && "$confirm" != "Y" ]] && exit 1 |
53 | 62 | fi |
54 | 63 | ls -Ld "${PWD}/$3/$2" |
55 | 64 | ls -Lw1 "${PWD}/$3/$2" |
56 | | - git -C "sources_$JETPACK_VERSION/$3" apply "${PWD}/$3/$2"/* |
| 65 | + git -C "sources_$SOURCES_VERSION/$3" apply "${PWD}/$3/$2"/* |
57 | 66 | elif [ "$1" = "reset" ]; then |
58 | | - if ! git -C "sources_$JETPACK_VERSION/$3" diff --quiet || ! git -C "sources_$JETPACK_VERSION/$3" diff --cached --quiet; then |
59 | | - read -p "Repo sources_$JETPACK_VERSION/$3 has changes that will be hard reset. Continue (y/N)? " confirm |
| 67 | + if ! git -C "sources_$SOURCES_VERSION/$3" diff --quiet || ! git -C "sources_$SOURCES_VERSION/$3" diff --cached --quiet; then |
| 68 | + read -p "Repo sources_$SOURCES_VERSION/$3 has changes that will be hard reset. Continue (y/N)? " confirm |
60 | 69 | [[ "$confirm" != "y" && "$confirm" != "Y" ]] && exit 1 |
61 | 70 | fi |
62 | | - echo -n "$(ls -d "sources_$JETPACK_VERSION/$3"): " |
63 | | - git -C "sources_$JETPACK_VERSION/$3" reset --hard $4 |
| 71 | + echo -n "$(ls -d "sources_$SOURCES_VERSION/$3"): " |
| 72 | + git -C "sources_$SOURCES_VERSION/$3" reset --hard $4 |
64 | 73 | fi |
65 | 74 | } |
66 | 75 |
|
67 | 76 | apply_external_patches "$ACTION" "$1" "$D4XX_SRC_DST" "$L4T_VERSION" |
68 | 77 |
|
69 | | -[[ -d "sources_$JETPACK_VERSION/$KERNEL_DIR" ]] && apply_external_patches "$ACTION" "$1" "$KERNEL_DIR" "$L4T_VERSION" |
| 78 | +[[ -d "sources_$SOURCES_VERSION/$KERNEL_DIR" ]] && apply_external_patches "$ACTION" "$1" "$KERNEL_DIR" "$L4T_VERSION" |
70 | 79 |
|
71 | 80 | if [[ "$JETPACK_VERSION" == "6.x" ]]; then |
72 | 81 | apply_external_patches "$ACTION" "$JETPACK_VERSION" "hardware/nvidia/t23x/nv-public" "$L4T_VERSION" |
|
75 | 84 | fi |
76 | 85 |
|
77 | 86 | if [[ "$ACTION" = "apply" ]]; then |
78 | | - cp -i kernel/realsense/d4xx.c "sources_$JETPACK_VERSION/${D4XX_SRC_DST}/drivers/media/i2c/" |
| 87 | + cp -i kernel/realsense/d4xx.c "sources_$SOURCES_VERSION/${D4XX_SRC_DST}/drivers/media/i2c/" |
79 | 88 | if [[ "$JETPACK_VERSION" == "6.x" ]]; then |
80 | 89 | # jp6 overlay |
81 | | - cp hardware/realsense/tegra234-camera-d4xx-overlay*.dts "sources_$JETPACK_VERSION/hardware/nvidia/t23x/nv-public/overlay/" |
| 90 | + cp hardware/realsense/tegra234-camera-d4xx-overlay*.dts "sources_$SOURCES_VERSION/hardware/nvidia/t23x/nv-public/overlay/" |
82 | 91 | else |
83 | | - cp "hardware/realsense/${JP5_D4XX_DTSI}" "sources_$JETPACK_VERSION/hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-camera-d4xx.dtsi" |
| 92 | + cp "hardware/realsense/${JP5_D4XX_DTSI}" "sources_$SOURCES_VERSION/hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-camera-d4xx.dtsi" |
84 | 93 | fi |
85 | 94 | fi |
0 commit comments