Need help compiling ftdi_sio.ko for JTX1

Hi guys,

I am using the JTX1 to read input from various sensors that communicate through FTDI serial interface. on my x86 machine, the devices simply show up as /dev/ttyUSB0. but after a good amount of research, it seems i need to cross-compile the ftdi_sio.c file for the arm64 platform. I’m trying like crazy to get this working but I’m having issue creating the make file and referencing the correct kernel source…

I’m basically wondering if someone has already compiled the arm64 version of ftdio_sio.ko? and in the next L4T release, can we please include these files… this being a dev board i think we would want to use ftdi devices.

This file would typically not be compiled separately from the kernel. The normal thing is to install the kernel source, use the /proc/config.gz of the running TX1 kernel for initial config (plus CONFIG_LOCALVERSION set for your version), and you’ll have an exact match of the running kernel.

At that point you can make modifications like make menuconfig to enable the FTDI driver, then make modules and make modules_install, all from the TX1. I guess there is some question as to whether the installed compiler on TX1 actually has aarch64 capability, this might be an issue. In that case you might cross compile from your x86 host using a cross compiler with aarch64 support, but you’d still start the same way.

Here are some instructions for building FTDI module from menuconfig, as linuxdev mentioned: [url]Jetson/Tutorials/Program An Arduino - eLinux.org

You shouldn’t have to do your own makefile and you should be able to build as module self-hosted on your Jetson.
Link above was written from the perspective of TK1, so let us know how it works on your Jetson TX1.

Thanks Dusty, i’ll give it a shot. happy thanksgiving

You too. One thing I realized from the wiki article — when you do the make menuconfig step, you should probably also set the kernel local version to ‘-gcdddc52’. This is so your module will match the kernel version 3.10.67-gcdddc52 from uname. In make menuconfig, it is under ‘General setup’ → ‘Local version’. Set it to ‘-gcdddc52’ (including the dash). Before building you can check that the change stuck after saving:

ubuntu@tegra-ubuntu:~/workspace/R23.1/source/kernel$ cat .config | grep LOCALVERSION
CONFIG_LOCALVERSION="-gcdddc52"
CONFIG_LOCALVERSION_AUTO=y

Be forewarned, this is all very experimental at this point.

I’ve placed a repository on Github to install the FTDI module onto the Jetson TX1: https://github.com/jetsonhacks/TX1FTDIModule. Included in the repository are a few scripts.
The first script installFTDIModule.sh should just install the compiled FTDI module into the driver directory and enable it. This is probably what most people want to do.

Git clone the repository or download it, then:

$ ./installFTDIModule.sh

You can then use ‘lsmod’ to check if it is installed, and then check with some of your devices to see if it actually works.

I’d appreciate some feedback as to if it does work for you.

Note: In order to get the modules to compile, the arm64 extensions for GCC need to be installed on the TX1. Doing so appears to break a lot of things, especially CUDA.

The rest of the scripts are very experimental, use at your own risk. It will mess the installation up something fierce.
installGCC.sh will install the aarch64 extensions to GCC and create links between the new compiler with gcc and cpp.
prepareModule.sh downloads the kernel source files, modifies the .config file to indicate that the FTDI module should be compiled, compiles the module, and then places the compiled module into the appropriate spot in the driver hierarchy.

Anyway, it’s a start. Good luck!

Kangalo, my savior. thanks so much for this man. I’ll report back with results in a few days. cheers!

Hi Kangalo, it looks like it installs the ftdi_sio.ko module, but that alone does not get me the /dev/ttyUSB0 that i’m looking for. maybe we need to compile usbserial.ko also? any suggestions?

im trying a few things, but i get ‘Exec format error’ which makes me believe it didnt quite work ;\

That would be typical of trying to use a binary file designed for a different architecture. The most common example would be using an x86 desktop binary on a Jetson, or vice versa. I would expect the same thing under some circumstances using TX1 software with TK1, or vice versa.

What is the result of

$ lsusb

and then

$ lsmod

shasum of ftdi_sio.ko

9b9bda3c65893b53c904090014907965eeac5560 ftdi_sio.ko

ftdi_sio.ko should be in /lib/modules/3.10.67-gcdddc52/kernel/drivers/usb/serial

That’s true, but unlikely in this case. I uploaded the compiled binary straight to Github from a TX1 along with the scripts that were created on the TX1. My initial guess is that the file did not download correctly. When I did a flash on the TX1 from scratch and then downloaded the repository and installed the module driver just now, there were no issues with the caveat that the TX1 has to be rebooted and the actual FTDI device plugged into the USB connected to the Jetson for the module to be activated.

Where were you getting this message from?

when i was trying to load and unload the module.

update today, it decided to work! i dont know what happened, but with this fix i was able to access a /dev/ttyUSB0 device. thanks Kangalow!

You’re welcome! I’m glad you were able to get it to work, it probably just needed a swift kick and a good talking to.