4444
4545# NVIDIA SDK Manager's JetPack 4.6.1 source_sync.sh doesn't set the right folder name, it mismatches with the direct tar
4646# package source code. Correct the folder name.
47- if [[ " $ACTION " == apply && -d " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen-industrial-dts" ]]; then
48- mv sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen-industrial-dts sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen-industrial
47+ if [[ " $ACTION " == apply && -d " ${SRCS } /hardware/nvidia/platform/t19x/galen-industrial-dts" ]]; then
48+ mv ${SRCS } /hardware/nvidia/platform/t19x/galen-industrial-dts ${SRCS } /hardware/nvidia/platform/t19x/galen-industrial
4949fi
50- if [[ " $ACTION " == reset && -d " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen-industrial" ]]; then
51- rm -rfv " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen-industrial" > /dev/null
50+ if [[ " $ACTION " == reset && -d " ${SRCS } /hardware/nvidia/platform/t19x/galen-industrial" ]]; then
51+ rm -rfv " ${SRCS } /hardware/nvidia/platform/t19x/galen-industrial" > /dev/null
5252fi
5353
5454# Create nvethernetrm symlink for JP 6.x (moved from source_sync_6.x.sh)
5757# and ln -sf cannot replace a directory with a symlink
5858if ! version_lt " $JETPACK_VERSION " 6.0; then
5959 if [[ " $ACTION " == reset ]] || [[ " $ACTION " == apply ]]; then
60- rm -rf " sources_ ${JETPACK_VERSION } /nvidia-oot/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm"
61- ln -sf ../../../../../../nvethernetrm " sources_ ${JETPACK_VERSION } /nvidia-oot/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm"
60+ rm -rf " ${SRCS } /nvidia-oot/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm"
61+ ln -sf ../../../../../../nvethernetrm " ${SRCS } /nvidia-oot/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm"
6262 fi
6363fi
6464
6565apply_external_patches () {
66- git -C " sources_${JETPACK_VERSION} /$2 " status > /dev/null
66+ local source=" ${SRCS} /$2 "
67+ git -C " ${source} " status > /dev/null
6768 if [[ " $ACTION " == ' apply' ]]; then
68- if ! git -C " sources_ ${JETPACK_VERSION} / $2 " diff --quiet || ! git -C " sources_ ${JETPACK_VERSION} / $2 " diff --cached --quiet; then
69- read -p " Repo sources_ ${JETPACK_VERSION} / $2 has changes that may disturb applying patches. Continue (Y/n)? " confirm
69+ if ! git -C " ${source} " diff --quiet || ! git -C " ${source} " diff --cached --quiet; then
70+ read -p " Repo ${source} has changes that may disturb applying patches. Continue (Y/n)? " confirm
7071 [[ -n " $confirm " && " $confirm " != " y" && " $confirm " != " Y" ]] && exit 1
7172 fi
7273 echo -e " \e[33m$( ls -Ld ${PWD} /$2 /$1 ) \e[0m"
7374 ls -Lw1 " ${PWD} /$2 /$1 "
74- git -C " sources_ ${JETPACK_VERSION} / $2 " apply " ${PWD} /$2 /$1 " /*
75+ git -C " ${source} " apply " ${PWD} /$2 /$1 " /*
7576 elif [[ " $ACTION " = " reset" ]]; then
76- if ! git -C " sources_ ${JETPACK_VERSION} / $2 " diff --quiet || ! git -C " sources_ ${JETPACK_VERSION} / $2 " diff --cached --quiet; then
77- read -p " Repo sources_ ${JETPACK_VERSION} / $2 has changes that will be hard reset. Continue (Y/n)? " confirm
77+ if ! git -C " ${source} " diff --quiet || ! git -C " ${source} " diff --cached --quiet; then
78+ read -p " Repo ${source} has changes that will be hard reset. Continue (Y/n)? " confirm
7879 [[ -n " $confirm " && " $confirm " != " y" && " $confirm " != " Y" ]] && exit 1
7980 fi
80- echo -n " $( ls -d " sources_ ${JETPACK_VERSION} / $2 " ) : "
81- git -C " sources_ ${JETPACK_VERSION} / $2 " reset --hard $L4T_VERSION
81+ echo -n " $( ls -d ${source} ) : "
82+ git -C " ${source} " reset --hard $L4T_VERSION
8283 fi
8384}
8485
85- if [[ ! -d " sources_ ${JETPACK_VERSION }" ]]; then
86+ if [[ ! -d " ${SRCS }" ]]; then
8687 echo " Sources folder not found. Run ./setup_workspace.sh first"
8788 exit 2
8889fi
100101echo " Patches applied successfully"
101102
102103if [[ " $ACTION " = " apply" ]]; then
103- version_lt " $JETPACK_VERSION " " 5.0" || ln -f kernel/realsense/d4xx.c " sources_ ${JETPACK_VERSION } /${D4XX_SRC_DST} /drivers/media/i2c/"
104+ version_lt " $JETPACK_VERSION " " 5.0" || ln -f kernel/realsense/d4xx.c " ${SRCS } /${D4XX_SRC_DST} /drivers/media/i2c/"
104105 if version_lt " $JETPACK_VERSION " " 6.0" ; then
105106 # device tree
106- cp " hardware/realsense/${JP5_D4XX_DTSI} " " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-camera-d4xx.dtsi"
107+ cp " hardware/realsense/${JP5_D4XX_DTSI} " " ${SRCS } /hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-camera-d4xx.dtsi"
107108 # max96712 header
108- cp kernel/nvidia/max96712.h " sources_ ${JETPACK_VERSION } /kernel/nvidia/include/media/"
109+ cp kernel/nvidia/max96712.h " ${SRCS } /kernel/nvidia/include/media/"
109110 else
110111 # max96712 header
111- ln -f nvidia-oot/max96712.h " sources_ ${JETPACK_VERSION } /nvidia-oot/include/media/"
112+ ln -f nvidia-oot/max96712.h " ${SRCS } /nvidia-oot/include/media/"
112113 if version_lt " $JETPACK_VERSION " " 7.0" ; then
113114 # jp6 overlay
114- ln -f hardware/realsense/tegra234-camera-d4xx-overlay* .dts " sources_ ${JETPACK_VERSION } /hardware/nvidia/t23x/nv-public/overlay/"
115- ln -f sources_ ${JETPACK_VERSION } /hardware/nvidia/t23x/nv-public/include/platforms/dt-bindings/tegra234-p3737-0000+p3701-0000.h \
116- sources_ ${JETPACK_VERSION } /$KERNEL_DIR /include/dt-bindings/
115+ ln -f hardware/realsense/tegra234-camera-d4xx-overlay* .dts " ${SRCS } /hardware/nvidia/t23x/nv-public/overlay/"
116+ ln -f ${SRCS } /hardware/nvidia/t23x/nv-public/include/platforms/dt-bindings/tegra234-p3737-0000+p3701-0000.h \
117+ ${SRCS } /$KERNEL_DIR /include/dt-bindings/
117118 else
118119 # Copy tegra264-gpio.h for Thor overlay compilation if not already present
119- if [[ ! -f " sources_ ${JETPACK_VERSION } /$KERNEL_DIR /include/dt-bindings/gpio/tegra264-gpio.h" ]]; then
120- ln -f " sources_ ${JETPACK_VERSION } /$KERNEL_DIR /3rdparty/canonical/linux-noble/include/dt-bindings/gpio/tegra264-gpio.h" \
121- " sources_ ${JETPACK_VERSION } /$KERNEL_DIR /include/dt-bindings/gpio/" 2> /dev/null || true
120+ if [[ ! -f " ${SRCS } /$KERNEL_DIR /include/dt-bindings/gpio/tegra264-gpio.h" ]]; then
121+ ln -f " ${SRCS } /$KERNEL_DIR /3rdparty/canonical/linux-noble/include/dt-bindings/gpio/tegra264-gpio.h" \
122+ " ${SRCS } /$KERNEL_DIR /include/dt-bindings/gpio/" 2> /dev/null || true
122123 fi
123- ln -f hardware/realsense/tegra264-camera-d4xx-overlay* .dtso " sources_ ${JETPACK_VERSION } /$KERNEL_DIR /arch/arm64/boot/dts/nvidia/"
124+ ln -f hardware/realsense/tegra264-camera-d4xx-overlay* .dtso " ${SRCS } /$KERNEL_DIR /arch/arm64/boot/dts/nvidia/"
124125 fi
125126 fi
126127
127128 # Stage all modified files after patching
128- git -C " sources_ ${JETPACK_VERSION } /$D4XX_SRC_DST " add drivers/media/i2c/d4xx.c
129- git -C " sources_ ${JETPACK_VERSION } /$D4XX_SRC_DST " add -u
130- [[ -d " sources_ ${JETPACK_VERSION } /$KERNEL_DIR " ]] && git -C " sources_ ${JETPACK_VERSION } /$KERNEL_DIR " add -A
131- if [[ -d " sources_ ${JETPACK_VERSION } /hardware/nvidia/t23x/nv-public" ]]; then
132- git -C " sources_ ${JETPACK_VERSION } /hardware/nvidia/t23x/nv-public" add -A
129+ git -C " ${SRCS } /$D4XX_SRC_DST " add drivers/media/i2c/d4xx.c
130+ git -C " ${SRCS } /$D4XX_SRC_DST " add -u
131+ [[ -d " ${SRCS } /$KERNEL_DIR " ]] && git -C " ${SRCS } /$KERNEL_DIR " add -A
132+ if [[ -d " ${SRCS } /hardware/nvidia/t23x/nv-public" ]]; then
133+ git -C " ${SRCS } /hardware/nvidia/t23x/nv-public" add -A
133134 fi
134- if [[ -d " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen/kernel-dts" ]]; then
135- git -C " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen/kernel-dts" add -A
135+ if [[ -d " ${SRCS } /hardware/nvidia/platform/t19x/galen/kernel-dts" ]]; then
136+ git -C " ${SRCS } /hardware/nvidia/platform/t19x/galen/kernel-dts" add -A
136137 fi
137138
138139 # Get author identity from root repo
@@ -150,33 +151,33 @@ if [[ "$ACTION" = "apply" ]]; then
150151 fi
151152
152153 # Update local git identity for subrepos
153- git -C " sources_ ${JETPACK_VERSION } /$D4XX_SRC_DST " config user.name " $GIT_AUTHOR_NAME "
154- git -C " sources_ ${JETPACK_VERSION } /$D4XX_SRC_DST " config user.email " $GIT_AUTHOR_EMAIL "
155- if [[ -d " sources_ ${JETPACK_VERSION } /$KERNEL_DIR " ]]; then
156- git -C " sources_ ${JETPACK_VERSION } /$KERNEL_DIR " config user.name " $GIT_AUTHOR_NAME "
157- git -C " sources_ ${JETPACK_VERSION } /$KERNEL_DIR " config user.email " $GIT_AUTHOR_EMAIL "
154+ git -C " ${SRCS } /$D4XX_SRC_DST " config user.name " $GIT_AUTHOR_NAME "
155+ git -C " ${SRCS } /$D4XX_SRC_DST " config user.email " $GIT_AUTHOR_EMAIL "
156+ if [[ -d " ${SRCS } /$KERNEL_DIR " ]]; then
157+ git -C " ${SRCS } /$KERNEL_DIR " config user.name " $GIT_AUTHOR_NAME "
158+ git -C " ${SRCS } /$KERNEL_DIR " config user.email " $GIT_AUTHOR_EMAIL "
158159 fi
159- if [[ -d " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen/kernel-dts" ]]; then
160- git -C " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen/kernel-dts" config user.name " $GIT_AUTHOR_NAME "
161- git -C " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen/kernel-dts" config user.email " $GIT_AUTHOR_EMAIL "
160+ if [[ -d " ${SRCS } /hardware/nvidia/platform/t19x/galen/kernel-dts" ]]; then
161+ git -C " ${SRCS } /hardware/nvidia/platform/t19x/galen/kernel-dts" config user.name " $GIT_AUTHOR_NAME "
162+ git -C " ${SRCS } /hardware/nvidia/platform/t19x/galen/kernel-dts" config user.email " $GIT_AUTHOR_EMAIL "
162163 fi
163- if [[ -d " sources_ ${JETPACK_VERSION } /hardware/nvidia/t23x/nv-public" ]]; then
164- git -C " sources_ ${JETPACK_VERSION } /hardware/nvidia/t23x/nv-public" config user.name " $GIT_AUTHOR_NAME "
165- git -C " sources_ ${JETPACK_VERSION } /hardware/nvidia/t23x/nv-public" config user.email " $GIT_AUTHOR_EMAIL "
164+ if [[ -d " ${SRCS } /hardware/nvidia/t23x/nv-public" ]]; then
165+ git -C " ${SRCS } /hardware/nvidia/t23x/nv-public" config user.name " $GIT_AUTHOR_NAME "
166+ git -C " ${SRCS } /hardware/nvidia/t23x/nv-public" config user.email " $GIT_AUTHOR_EMAIL "
166167 fi
167168
168169 # Commit all staged files
169- git -C " sources_ ${JETPACK_VERSION } /$D4XX_SRC_DST " commit -m " RS patched" || true
170- [[ -d " sources_ ${JETPACK_VERSION } /$KERNEL_DIR " ]] && git -C " sources_ ${JETPACK_VERSION } /$KERNEL_DIR " commit -m " RS patched" || true
171- if [[ -d " sources_ ${JETPACK_VERSION } /hardware/nvidia/t23x/nv-public" ]]; then
172- git -C " sources_ ${JETPACK_VERSION } /hardware/nvidia/t23x/nv-public" commit -m " RS patched" || true
170+ git -C " ${SRCS } /$D4XX_SRC_DST " commit -m " RS patched" || true
171+ [[ -d " ${SRCS } /$KERNEL_DIR " ]] && git -C " ${SRCS } /$KERNEL_DIR " commit -m " RS patched" || true
172+ if [[ -d " ${SRCS } /hardware/nvidia/t23x/nv-public" ]]; then
173+ git -C " ${SRCS } /hardware/nvidia/t23x/nv-public" commit -m " RS patched" || true
173174 fi
174- if [[ -d " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen/kernel-dts" ]]; then
175- git -C " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen/kernel-dts" commit -m " RS patched" || true
175+ if [[ -d " ${SRCS } /hardware/nvidia/platform/t19x/galen/kernel-dts" ]]; then
176+ git -C " ${SRCS } /hardware/nvidia/platform/t19x/galen/kernel-dts" commit -m " RS patched" || true
176177 fi
177178elif [[ " $ACTION " = " reset" ]]; then
178- if version_lt " $JETPACK_VERSION " " 5.0" ; then
179- rm " sources_ ${JETPACK_VERSION } /${D4XX_SRC_DST} /drivers/media/i2c/d4xx.c" || true
180- rm " sources_ ${JETPACK_VERSION } /hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-camera-d4xx.dtsi" || true
179+ if version_lt " $JP_INPUT_VERSION " " 5.0" ; then
180+ rm " ${SRCS } /${D4XX_SRC_DST} /drivers/media/i2c/d4xx.c" || true
181+ rm " ${SRCS } /hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-camera-d4xx.dtsi" || true
181182 fi
182183fi
0 commit comments