27 lines
1.6 KiB
Bash
Executable File
27 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Refresh the standalone runtime after compiling on the target Orin.
|
|
set -euo pipefail
|
|
root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
python3 - "$root" <<'PY'
|
|
from pathlib import Path
|
|
import hashlib,shutil,sys
|
|
root=Path(sys.argv[1]);package=root/'orin'
|
|
library=root/'build/libvision_native.so'
|
|
if not library.is_file():raise SystemExit('Run scripts/build.sh on Orin first.')
|
|
# Replace generated Python directories so removed modules cannot survive packaging.
|
|
for name in ('pipeline','annotations'):
|
|
target=package/name
|
|
if target.exists():shutil.rmtree(target)
|
|
shutil.copytree(root/name,target,ignore=shutil.ignore_patterns('__pycache__','*.pyc'))
|
|
(package/'build').mkdir(exist_ok=True)
|
|
shutil.copy2(library,package/'build/libvision_native.so')
|
|
shutil.copy2(root/'run_camera.py',package/'run_camera.py')
|
|
shutil.copy2(root/'scripts/initialize_camera.sh',package/'scripts/initialize_camera_impl.sh')
|
|
for name in ('lib/libusbcanfd.so','lib/libusb-1.0.so','models/engines/yolo11s.engine','models/engines/rtmw_l_384.engine','bin/drivers/max9295.ko','bin/drivers/max9296.ko','bin/drivers/sgx-yuv-gmsl2.ko'):
|
|
if not (package/name).is_file():raise SystemExit('Missing packaged dependency: '+name)
|
|
ignored={'__pycache__','outputs','logs'}
|
|
files=sorted(p for p in package.rglob('*') if p.is_file() and not p.is_symlink() and p.name!='SHA256SUMS' and not ignored.intersection(p.relative_to(package).parts))
|
|
(package/'SHA256SUMS').write_text(''.join(hashlib.sha256(p.read_bytes()).hexdigest()+' '+p.relative_to(package).as_posix()+'\n' for p in files))
|
|
print('Package ready:',package/'run.sh')
|
|
PY
|