jetsonhacks / buildLibrealsense2Xavier

Build librealsense 2.0 library on the NVIDIA Jetson AGX Xavier Developer Kit. Intel RealSense D400 series cameras.
MIT License
56 stars 29 forks source link

Making it work with L4T v32.4.4 #18

Open Xavier0301 opened 3 years ago

Xavier0301 commented 3 years ago

I have to report my fix for making it work for L4T v32.4.4, on a Jetson AGX Xavier.

First, as a prerequisite to what follows, in buildPatchedKernel.sh, replace every occurence of 32.1.0 with 32.4.4 (or for people in the future: whatever the newest version is). This allows the script to run freely, even if correctness has not been proven by the author.

Now, the real fun begin. When doing ./buildPatchedKernel.sh you might get an error in the script makeKernel.sh. In particular, make Image does not work.

The /kernel/nvidia/... stuff we download in the "Getting Kernel sources" part of ./buildPatchedKernel.sh has been modified since jetsonhacks wrote this script.

The problem happens because make is configured to stop when an warning is caught at a certain point in the compilation. In particular when compiling the file /usr/src/kernel/nvidia/drivers/video/tegra/dc/hdcp/hdmihdcp.c, a unused variable warning is thrown and is interpreted as an error by make, which fails the compilation.

I can get into the details here, but what is interesting is the fix:

  1. Open a terminal and cd /usr/src/kernel/nvidia/drivers/video/tegra/dc/hdcp/. If it does not exist yet, run ./buildPatchedKernel.sh and wait for it to fail in the same way I described above before going pack to these instructions.
  2. Without quitting the terminal, open Files and go to /usr/src/kernel/nvidia/drivers/video/tegra/dc/hdcp/ (you are going to understand why)
  3. Open a new terminal and run ./buildPatchedKernel.sh
  4. When you see that ./buildPatchedKernel.sh is starting to "Patching and configuring kernel", then it is done "Getting Kernel sources" and now you have to do two things quickly:
  5. In the first terminal window, run chmod a+x hdmihdcp.c. This grants you access to write the file.
  6. In the Files window, open hdmihdcp.c and go to line 1940 and delete: unsigned char nonce[HDCP_NONE_SIZE]. This is the line which caused the compilation to fail: nonce is unused (warning) and every warning counts as an error because of the -Werror flag in the makefile of a parent directory.
  7. Save the change.
  8. If you did it fast enough, compilation will complete smoothly (at least for L4T v32.4.4) .

This sure was not a very eloquent post, nor does it really qualify as an issue, but I hope it helps someone running into the same troubles as I did.

Buying a RealSense camera sure was a great match for the Jetson!