Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asahi Linux Installation Guide #12763

Open
wants to merge 13 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!--
Pull requests should go to the development branch:
https://github.com/IntelRealSense/librealsense/tree/development/
If this is still a work-in-progress, please open it as DRAFT.
For further details, please see our contribution guidelines:
https://github.com/IntelRealSense/librealsense/blob/master/CONTRIBUTING.md
-->
2 changes: 2 additions & 0 deletions .github/workflows/build-ROS2-package-CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
pull_request:
branches: ['**']

permissions: read-all

jobs:

build_lrs_ros2_package:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/buildsCI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: ['**']
pull_request:
branches: ['**']

permissions: read-all

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/static_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: ['**']
pull_request:
branches: ['**']

permissions: read-all

jobs:
cppcheck:
Expand Down
2 changes: 1 addition & 1 deletion doc/distribution_linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### Using pre-build packages
**Intel® RealSense™ SDK 2.0** provides installation packages for Intel X86/AMD64-based Debian distributions in [`dpkg`](https://en.wikipedia.org/wiki/Dpkg) format for Ubuntu 16/18/20/22 [LTS](https://wiki.ubuntu.com/LTS).
The Realsense [DKMS](https://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support) kernel drivers package (`librealsense2-dkms`) supports Ubuntu LTS kernels 4.4, 4.8, 4.10, 4.13, 4.15, 4.18*, 5.0*, 5.3*, 5.4, 5.13 and 5.15. Please refer to [Ubuntu Kernel Release Schedule](https://wiki.ubuntu.com/Kernel/Support) for further details.
The Realsense [DKMS](https://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support) kernel drivers package (`librealsense2-dkms`) supports Ubuntu LTS kernels 4.4, 4.8, 4.10, 4.13, 4.15, 4.18*, 5.0*, 5.3*, 5.4, 5.13, 5.15, 5.19 and 6.2. Please refer to [Ubuntu Kernel Release Schedule](https://wiki.ubuntu.com/Kernel/Support) for further details.

#### Configuring and building from the source code
While we strongly recommend to use DKMS package whenever possible, there are certain cases where installing and patching the system manually is necessary:
Expand Down
133 changes: 133 additions & 0 deletions doc/installation_asahi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<a name="readme-top"></a>

# Asahi Ubuntu Installation


## Table of contents

* [Prerequisites](#prerequisites)
* [Install dependencies](#install-dependencies)
* [Install librealsense2](#install-librealsense2)
* [Building librealsense2 SDK](#building-librealsense2-sdk)
* [Troubleshooting Installation and Patch-related Issues](#troubleshooting-installation-and-patch-related-issues)

**Note:** Ubuntu Aasahi LTS has been deprecated by the team working on it. Currently, only Ubuntu Desktop 23.10 works. Check the [repository](https://github.com/UbuntuAsahi/ubuntu-asahi) for the latest information.

**Note:** Some Mac hardware features that might be used during development (like using external displays) might not be supported on Asahi. Check the [documentation](https://asahilinux.org/fedora/#device-support) for the latest information.

**Note:** The installation has been tested on a 16'' M1 Pro MacBook Pro with Ubuntu Asahi 23.10 with the Intel RealSense D455 depth camera.

**Note:** The scripts and commands below invoke `wget, git, add-apt-repository` which may be blocked by router settings or a firewall. \
Infrequently, apt-get mirrors or repositories may also cause timeout. For _librealsense_ users behind an enterprise firewall, \
configuring the system-wide Ubuntu proxy generally resolves most timeout issues.

## Prerequisites

Apple Silicon machine running Ubuntu Asahi.

USB-A to USB-C adapter. Avoid using [small adapters](https://www.amazon.com/Henrety-Adapter-Female-Compatible-MacBook/dp/B0B4S2SKNH/ref=sr_1_11?crid=7ZELTWN9XIZ5&dib=eyJ2IjoiMSJ9.CaJU0UhhA1-dAJiLYaVrjJwpmfcLIfDwNxIladP6dT7iRz3FCge_4Gfn1J2gAqMV3uF3-KIu35i7TR5Z-0-PnVQMJLrP_0Sgz64CQv9xuvRapH2fxTt0LHZfz76wSbVq25pST-q4oE4ehi0_i4gmDBGy9aMsAwG_IKMJvz5wHcX0dxDvcxu39VfCYX1Fsy0fbXxzv2kPUMv2mjgn-CoM39DLpxqdUUu__8HUYfBXOts._Mxa1MFaQEql-xXh-oK1lvVnR02J1zQAa6zcSZZIA4Y&dib_tag=se&keywords=usb-a%2Bto%2Busb-c%2Badapter&qid=1710749441&sprefix=usb-a%2Bto%2Busb-c%2B%2Caps%2C298&sr=8-11&th=1). Using more robust adapters like the TP-LINK UC400 or the adapter sold by Apple is recommended.

Install Toshy for [Mac](https://github.com/RedBearAK/toshy?tab=readme-ov-file#requirements) shortcuts which might make pasting commands a lot easier (Optional).


## Install dependencies

1. Make Ubuntu up-to-date including the latest stable kernel:
```sh
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
```
2. Install the core packages required to build _librealsense_ binaries and the affected kernel modules:
```sh
sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev at
```
3. Prepare Linux Backend and the Dev. Environment \
Unplug any connected Intel RealSense camera and run:
```sh
sudo apt-get install libssl-dev libusb-1.0-0-dev libudev-dev pkg-config libgtk-3-dev
```
4. Install CMAKE:
```sh
sudo apt-get install cmake
```
Optionally install `cmake-gui` which will make building things like [OpenCV](https://github.com/opencv/opencv_contrib/blob/master/README.md) & [rs-kinfu](https://github.com/opencv/opencv_contrib/blob/master/README.md) a lot easier.

**Note**:

* on graphic sub-system utilization: \
*glfw3*, *mesa* and *gtk* packages are required if you plan to build the SDK's OpenGL-enabled examples. \
The *librealsens2e* core library and a range of demos/tools are designed for headless environment deployment.

* `libudev-dev` installation is optional but recommended, \
when the `libudev-dev` is installed the SDK will use an event-driven approach for triggering USB detection and enumeration, \
if not the SDK will use a timer polling approach which is less sensitive for device detection.


## Install librealsense2

1. Clone/Download the latest stable version of _librealsense2_ in one of the following ways:
* Clone the _librealsense2_ repo
```sh
git clone https://github.com/IntelRealSense/librealsense.git
```
* Download and unzip the latest stable _librealsense2_ version from `master` branch \
[IntelRealSense.zip](https://github.com/IntelRealSense/librealsense/archive/master.zip)

2. Run Intel Realsense permissions script from _librealsense2_ root directory:
```sh
cd librealsense
sudo ./scripts/setup_udev_rules.sh
```
Notice: You can always remove permissions by running: `./scripts/setup_udev_rules.sh --uninstall`

## Building librealsense2 SDK

* Navigate to _librealsense2_ root directory and run:
```sh
mkdir build && cd build
```
* Run cmake configure step, here are some cmake configure examples:

**Note:** Always build with `-DFORCE_RSUSB_BACKEND=true`.

Builds _librealsense2_ along with the demos and tutorials:
```sh
cmake .. -DBUILD_EXAMPLES=true -DFORCE_RSUSB_BACKEND=true
```
Builds _librealsense2_ and _pyrealsense2_ along with the demos and tutorials:
```sh
cmake .. -DBUILD_PYTHON_BINDINGS=bool:true -DPYTHON_EXECUTABLE=$(which python3) -DBUILD_EXAMPLES=bool:true -DFORCE_RSUSB_BACKEND=true
```
* Recompile and install:
```sh
sudo make uninstall && make clean && make && sudo make -j<number of jobs> install
```
**Note:** The number of jobs is limited by the amout of unified memory (RAM) and cores your Mac has. The higher the job count, the faster the process is.
It's recommended to use at least 2.

For example:
```sh
sudo make uninstall && make clean && make && sudo make -j2 install
```
**Note:** You can find more information about the available configuration options on [this wiki page](https://github.com/IntelRealSense/librealsense/wiki/Build-Configuration). Some things might not work due to Asahi kernel limitations.

**Note:** The shared object will be installed in `/usr/local/lib`, header files in `/usr/local/include`.
The binary demos, tutorials and test files will be copied into `/usr/local/bin`

**Note:** Linux build configuration is presently configured to use the V4L2 backend by default.

**Note:** If you encounter the following error during compilation `gcc: internal compiler error`
it might indicate that you do not have enough memory or swap space on your machine.




## Troubleshooting Installation and Patch-related Issues

| Error | Cause | Correction Steps |
|-----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| ` Multiple realsense udev-rules were found!` | The issue occurs when user install both Debians and manual from source | Remove the unneeded installation (manual / Deb) |
| `git.launchpad... access timeout` | Behind Firewall | Configure Proxy Server |
| `sudo modprobe uvcvideo` produces `dmesg: uvc kernel module is not loaded` | The patched module kernel version is incompatible with the resident kernel | Verify the actual kernel version with `uname -r`. Revert and proceed from [Make Ubuntu Up-to-date](#install-dependencies) step |
| Execution of `./scripts/patch-realsense-ubuntu-lts-hwe.sh` fails with `fatal error: openssl/opensslv.h` | Missing Dependency | Install _openssl_ package |

<p align="right">(<a href="#readme-top">back to top</a>)</p>
10 changes: 5 additions & 5 deletions doc/installation_jetson.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NVidia Jetson Devices
# Nvidia Jetson Devices

**NOTE**: See [support-matrix.md](./support-matrix.md) to learn more about Jetson support for RealSense devices.

Expand All @@ -8,12 +8,12 @@

### 1. Prerequisites

* NVIDIA® **Jetson Nano™**, **Jetson TX2™** and **Jetson AGX Xavier™** board (may also work on other Jetson devices)
* Nvidia® **Jetson Nano™**, **Jetson TX2™** and **Jetson AGX Xavier™** board (may also work on other Jetson devices)
* RealSense **D415**, **D435**, **D435i**, **D455**, **L515** and **SR300** Camera devices.

### 2. Establish Developer's Environment

Follow [official instructions](https://developer.nvidia.com/embedded/learn/getting-started-jetson) to get your board ready. This guide will assume you are using **NVIDIA® L4T Ubuntu 16.04/18.04/20.04** image with kernels 4.9/5.10. Note that in most cases it is necessary to install a toll named "SDK Manager" to flash and install **Jetson** boards with both the L4T (Linux for Tegra) and NVIDIA-specific software packages (CUDA, Tensor Flow, AI, etc.)
Follow [official instructions](https://developer.nvidia.com/embedded/learn/getting-started-jetson) to get your board ready. This guide will assume you are using **Nvidia® L4T Ubuntu 16.04/18.04/20.04** image with kernels 4.9/5.10. Note that in most cases it is necessary to install a toll named "SDK Manager" to flash and install **Jetson** boards with both the L4T (Linux for Tegra) and Nvidia-specific software packages (CUDA, Tensor Flow, AI, etc.)
For **Jetson Nano™** we strongly recommend enabling the Barrel Jack connector for extra power (See [jetsonhacks.com/jetson-nano-use-more-power/](https://www.jetsonhacks.com/2019/04/10/jetson-nano-use-more-power/) to learn how)

![Jetson Nano](./img/jetson.jpg)
Expand All @@ -36,7 +36,7 @@ If that's the case, what is the dilemma?

In order to enable the full capabilities of RealSense devices certain modifications in the kernel (driver) modules shall be applied, such as support of Depth-related streaming formats and access to per-frame metadata attributes. There is a small set of generic kernel changes that are mostly retrofitted with more advanced kernel versions aimed at improving the overall drivers stability.

NVIDIA's L4T delivers an Ubuntu-based distribution with a customized kernel based on version 4.9/5.10. The way the kernel is configured and deployed is different from a desktop Ubuntu image with two notable differences being the list of kernel modules included in default configuration and the way a new image is flashed.
Nvidia's L4T delivers an Ubuntu-based distribution with a customized kernel based on version 4.9/5.10. The way the kernel is configured and deployed is different from a desktop Ubuntu image with two notable differences being the list of kernel modules included in default configuration and the way a new image is flashed.

And while it is possible to rebuild and flash a new kernel image the procedure can be perceived as challenging and shall be performed with extra caution.
This guide comes with a script that allows to modify the kernel modules with Librealsense2-related patches without replacing the kernel image. The script has been verified with **Jetson AGX Xavier™** board using L4T versions 4.2.3, 4.3, 4.4 (Sept 2020) and 5.0.2. Scroll to the end of the guide for details.
Expand Down Expand Up @@ -133,7 +133,7 @@ The method has not yet been verified on the **Jetson Nano** board.
cmake .. -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=release -DFORCE_RSUSB_BACKEND=false -DBUILD_WITH_CUDA=true && make -j$(($(nproc)-1)) && sudo make install
```

The CMAKE `-DBUILD_WITH_CUDA=true` flag assumes CUDA modules are installed. If not, please reconnect the board to the Ubuntu Host PC and use NVIDIA `SDK Manager` tool to install the missing components.
The CMAKE `-DBUILD_WITH_CUDA=true` flag assumes CUDA modules are installed. If not, please reconnect the board to the Ubuntu Host PC and use Nvidia `SDK Manager` tool to install the missing components.

* **Connect Realsense Device, run `realsense-viewer` and inspect the results**

Expand Down
2 changes: 1 addition & 1 deletion third-party/rsutils/include/rsutils/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <string>
#include <iosfwd>

#include <cstdint>

struct tm;

Expand Down
4 changes: 2 additions & 2 deletions wrappers/python/pyrsutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void init_util(py::module &m) {
};

m.def("rs2_project_color_pixel_to_depth_pixel", cp_to_dp, "Given pixel coordinates of the color image and a minimum and maximum depth, compute the corresponding pixel coordinates in the depth image. Returns [-1 -1] on failure.",
"data"_a, "depth_scale"_a, "depth_min"_a, "depth_max"_a, "depth_intrin"_a, "color_intrin"_a, "depth_to_color"_a,
"color_to_depth"_a, "from_pixel"_a);
"data"_a, "depth_scale"_a, "depth_min"_a, "depth_max"_a, "depth_intrin"_a, "color_intrin"_a, "color_to_depth"_a,
"depth_to_color"_a, "from_pixel"_a);
/** end rsutil.h **/
}