Creating a gadget snap for the TX2 Development Board


I would like to ask if anyone could point me towards the direction of creating a gadget snap for the TX2 Development Board. I have not been successful in googling one. I understand that L4T is the OS the TX2 Development Board runs on, not exactly Ubuntu Core.

My use case is that I have snaps that would run various sensors for ROS. Because snaps are self contained, they do not have access to serial ports and other interfaces. These snaps require hardware access and permissions that is only configurable via udev rules and possible only if I create the gadget snap.

I am open to other manners(outside of snaps) of solving my problem. Thank you.

I have never done anything with this (hadn’t even heard of it until now), but this seems to imply it could be reasonable to port snaps to a Jetson:

…but…do you have an example of the configuration files from any other platform? For example, if kernel arguments for a desktop PC give grub arguments, then it probably wouldn’t be too hard to convert it to U-Boot arguments (within extlinux.conf or device tree). Basically it sounds like each device is custom and you’ll want as many examples for the specific hardware which you can get so they can be tweaked instead of created from scratch.

Btw, L4T is Ubuntu, but with NVIDIA hardware drivers. The bootloader is U-Boot, and although someone may think that is part of L4T and NVIDIA, this is really just part of the architecture and many other embedded systems have this as well.

I actually am unfamiliar with kernel stuff. Hence, I am looking for any assistance anyone could point me to. Another roadblock is the need for model assertion by Nvidia which requires manual review.

Is there some specific piece of hardware you need to use on a TX2? USB? PCIe? I am new to snap as well, I suspect you’ll need to be able to give specific hardware devices to look up before you can do anything.

The kernel itself just gets command line arguments via the “APPEND” key/value pair in “/boot/extlinux/extlinux.conf”. Some parameters are instead added via the device tree if needed earlier in boot. Without specific it won’t be possible to help. Can you give more details about the exact hardware involved?

I need the USB. Give udev rules for to the kernel. I am using RPLidar and ZED/realsense camera. I am following on getting a gadget snap done for the Intel Nuc, using it to familiarize myself. Currently awaiting manual review for the gadget snap.

I have used RPLidar and ZED with Jetson TX2 before without issue, using their standard drivers and JetPack-L4T from Ubuntu desktop.
I recommend just running these devices natively as opposed to from within containers.

Obviously @dusty_nv’s idea to not bother with snaps is easiest :P If you do want to pursue snaps anyway (when not needed), then you can run “lsusb -v” to see the vendor ID, device ID, and serial number of all USB devices (I see this is what they are using in udev rules).

Note that if you use “lsusb” by itself it shows an ID column. An example of a ZED stereo camera on a TX2:

Bus 002 Device 002: ID 2b03:f582

Notice that you can limit a query to that one device type via adding the ID:

lsusb -d 2b03:f582

Then you can list verbosely:

lsusb -d 2b03:f582 -vvv

Within this is the vendor ID and device ID used in udev:

  idVendor           0x2b03 
  idProduct          0xf582

This is how you would go about adjusting for your specific devices, though it seems a lot easier to not use snaps :P

Yea, I have things running as expected outside of snaps. However, I do wish to have them run in a container so that access to the source code would not be possible. My use case for the sensors is with ROS. And because ROS is inside a container(snap), it can’t get the sensor feed without having those nodes in a snap that exposes the serial ports. To expose a serial port in a snap, I do need the gadget snap.

In your opinion, would and be what I should be following to make a TX2 development board gadget snap? @linuxdev @dusty_nv

I haven’t actually set up ROS before, but many people here have. I don’t think any of them used snaps. I’m not sure how they do it. Perhaps @dusty_nv or someone else can suggest how sensors are accessed without snaps. You might add specific use-case information on the serial port you are trying to access…then it would be easier for people to suggest alternate ways of accessing it.

Most of what I read about snaps is just a case of creating a configuration file and then using existing tools to add the snap. It is possible there is some kernel config needed to support this since they assumed Core Ubuntu, but it is also possible the existing kernel already has all you need. You should probably first try using those existing tools and trying without any kernel change (which means creating one of those config files and running the snap commands on the files). I doubt this is the right way of doing it, but that’s where I’d start if I were going to attempt it. If you succeed with a configuration, and yet the kernel doesn’t support something, then likely you’d get an error something like “operation not supported”. Then you’d know the kernel configuration needs an edit.