35 lines
2.0 KiB
Bash
Executable File
35 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run after building on the target Orin; outputs a relocatable ./orin/run.sh package.
|
|
set -euo pipefail
|
|
root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
package="$root/orin"
|
|
engine_dir="${ENGINE_DIR:-$root/models/engines}"
|
|
driver_dir="${DRIVER_DIR:-$root/../vision-anti-pinch-0920/orin/bin/drivers}"
|
|
[[ -f "$root/build/libvision_native.so" ]] || { echo 'Build the Orin native library first.' >&2; exit 1; }
|
|
mkdir -p "$package/build" "$package/lib" "$package/pipeline" "$package/annotations" "$package/models/engines" "$package/bin/drivers" "$package/scripts" "$package/examples"
|
|
cp -p "$root/build/libvision_native.so" "$package/build/"
|
|
cp -p "$root/run_camera.py" "$package/"
|
|
cp -p "$root/pipeline/"*.py "$package/pipeline/"
|
|
cp -p "$root/annotations/"*.json "$package/annotations/"
|
|
cp -p "$root/lib/libusbcanfd.so" "$root/lib/libusb-1.0.so" "$package/lib/"
|
|
ln -sfn libusbcanfd.so "$package/lib/libusbcanfd.so.1.0.12"
|
|
ln -sfn libusb-1.0.so "$package/lib/libusb-1.0.so.0"
|
|
for model in yolo11s.engine rtmw_l_384.engine; do
|
|
[[ -f "$engine_dir/$model" ]] || { echo "Missing engine: $engine_dir/$model" >&2; exit 1; }
|
|
cp -p "$engine_dir/$model" "$package/models/engines/"
|
|
done
|
|
for driver in max9295 max9296 sgx-yuv-gmsl2; do
|
|
if [[ -f "$driver_dir/$driver.ko" ]]; then cp -p "$driver_dir/$driver.ko" "$package/bin/drivers/"; fi
|
|
[[ -f "$package/bin/drivers/$driver.ko" ]] || { echo "Missing driver: $driver.ko" >&2; exit 1; }
|
|
done
|
|
cp -p "$root/scripts/initialize_camera.sh" "$package/scripts/initialize_camera_impl.sh"
|
|
cp -p "$root/examples/read_latest.py" "$package/examples/"
|
|
python3 - "$package" <<'PY'
|
|
import hashlib,sys
|
|
from pathlib import Path
|
|
root=Path(sys.argv[1]);ignored={'__pycache__','outputs','logs'}
|
|
files=sorted(p for p in root.rglob('*') if p.is_file() and not p.is_symlink() and p.name!='SHA256SUMS' and not ignored.intersection(p.relative_to(root).parts))
|
|
(root/'SHA256SUMS').write_text(''.join(hashlib.sha256(p.read_bytes()).hexdigest()+' '+p.relative_to(root).as_posix()+'\n' for p in files))
|
|
PY
|
|
echo "Package ready: $package/run.sh"
|