|
| 1 | +# Copilot Instructions for realsense_mipi_platform_driver |
| 2 | + |
| 3 | +## Project Overview |
| 4 | +This repository provides the RealSense™ camera driver for GMSL/MIPI interfaces, targeting NVIDIA® Jetson platforms (AGX Xavier, AGX Orin) and supporting multiple JetPack versions (6.x, 5.x, 4.6.1). It enables control and streaming of RealSense™ 3D MIPI cameras via custom kernel drivers, device trees, and build scripts. |
| 5 | + |
| 6 | +## Architecture & Key Components |
| 7 | +- **hardware/**: Device tree overlays and platform-specific configuration files for NVIDIA and RealSense hardware. |
| 8 | +- **kernel/**: Kernel patches and sources for different JetPack and kernel versions. |
| 9 | +- **nvidia-oot/**: Out-of-tree NVIDIA kernel modules and related patches. |
| 10 | +- **scripts/**: Build, patch, and utility scripts for workspace setup, compilation, and firmware management. |
| 11 | +- **test/**: Test scripts and metadata validation tools. |
| 12 | +- **utilities/**: Example applications, parsers, and stream utilities for RealSense cameras. |
| 13 | + |
| 14 | +## Developer Workflows |
| 15 | +### 1. Workspace Setup & Build |
| 16 | +- Use `setup_workspace.sh [JetPack_version]` to prepare sources and toolchains. |
| 17 | +- Apply kernel and driver patches with `apply_patches.sh [--one-cam|--dual-cam] apply [JetPack_version]`. |
| 18 | +- For CI/external builds, use `apply_patches_ext.sh`. |
| 19 | +- Build all components with `build_all.sh [--dev-dbg] [JetPack_version]`. |
| 20 | +- Example: |
| 21 | + ```sh |
| 22 | + ./setup_workspace.sh 6.2 |
| 23 | + ./apply_patches.sh 6.2 |
| 24 | + ./build_all.sh 6.2 |
| 25 | + ``` |
| 26 | +- For debug logging, add `--dev-dbg` to build scripts. |
| 27 | + |
| 28 | +### 2. Testing & Validation |
| 29 | +- Use `test/` scripts for firmware and metadata validation. |
| 30 | +- After installation, verify driver and video devices: |
| 31 | + ```sh |
| 32 | + sudo dmesg | grep d4xx |
| 33 | + ls -l /dev/video* |
| 34 | + ``` |
| 35 | +- Use V4L2 utilities for device checks: `sudo apt install v4l-utils` |
| 36 | + |
| 37 | +### 3. Device Tree & Kernel Integration |
| 38 | +- Device tree overlays are in `hardware/realsense/` and `hardware/nvidia/platform/`. |
| 39 | +- Kernel patches are versioned under `kernel/` and must match JetPack version. |
| 40 | +- Out-of-tree modules are managed in `nvidia-oot/`. |
| 41 | + |
| 42 | +## Project-Specific Conventions |
| 43 | +- JetPack version is a required argument for most scripts and build steps. |
| 44 | +- Patch scripts support single/dual camera configuration for JetPack 5.x (`--one-cam`, `--dual-cam`). |
| 45 | +- Kernel versioning and file paths must be updated per JetPack release. |
| 46 | +- Artifacts (modules, images, dtb, etc.) are archived under `images/[JetPack_version]/`. |
| 47 | + |
| 48 | +## Integration Points & External Dependencies |
| 49 | +- Relies on NVIDIA Jetson Linux BSP sources and toolchains (see README_JP6.md, README_JP5.md, README_JP4.md). |
| 50 | +- Uses RealSense de-serialize hardware and Leopard Imaging adapter boards. |
| 51 | +- Artifactory integration for CI/CD and artifact uploads (see Jenkins pipeline scripts). |
| 52 | + |
| 53 | +## Example: CI Pipeline Highlights |
| 54 | + |
| 55 | +## CI Pipeline: GitHub Actions & Jenkins |
| 56 | + |
| 57 | +### GitHub Actions Workflows |
| 58 | +- Located in `.github/workflows/`, these YAML files automate build and release for each JetPack version: |
| 59 | + - `build-jp6.yml`, `build-jp6.2.yml`, `build-jp6.1.yml`, `build-jp512.yml`, `build-jp502.yml`: Build/test for JetPack 6.x/5.x/4.x on push/PR. |
| 60 | + - `release-jp6.yml`: Publishes release artifacts for JetPack 6.x. |
| 61 | +- Each workflow: |
| 62 | + - Checks out code |
| 63 | + - Runs setup (`setup_workspace.sh [version]`), applies patches, builds (`build_all.sh [version]`) |
| 64 | + - Archives build outputs (modules, dtb, rootfs, etc.) |
| 65 | + - Uploads artifacts (via `actions/upload-artifact` or `softprops/action-gh-release`) |
| 66 | +- Example build steps: |
| 67 | + ```yaml |
| 68 | + - name: setup workspace |
| 69 | + run: yes | ./setup_workspace.sh 6.2 |
| 70 | + - name: apply patches |
| 71 | + run: ./apply_patches.sh 6.2 |
| 72 | + - name: build |
| 73 | + run: ./build_all.sh 6.2 |
| 74 | + ``` |
| 75 | +- Artifacts are found in `images/[JetPack_version]/` and uploaded for CI/release consumption. |
| 76 | + |
| 77 | +### Jenkins Pipeline |
| 78 | +- `LRS_Jetson_mipi_usb_driver_jp6.groovy` (legacy/optional): Automates checkout, patching, build, artifact archiving, and upload to Artifactory. |
| 79 | +- Environment variables and parameters control build options, JetPack version, and artifact destinations. |
| 80 | +- Artifacts are uploaded to Artifactory and notification emails are sent on build completion/failure. |
| 81 | + |
| 82 | +## References |
| 83 | +- See `README.md` for overall project intro and hardware requirements. |
| 84 | +- See `README_JP6.md`, `README_JP5.md`, `README_JP4.md` for JetPack-specific build instructions. |
| 85 | +- See `README_tools.md` for build script usage and options. |
| 86 | +- See `README_driver.md` for driver API and validation steps. |
| 87 | + |
| 88 | +--- |
| 89 | +**Feedback Requested:** |
| 90 | +If any section is unclear or missing key details, please specify which workflows, conventions, or integration points need further documentation for AI agents. |
0 commit comments