Skip to content

Instantly share code, notes, and snippets.

@rbonghi
Created April 25, 2017 18:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbonghi/66c1c77d797c7209302e11f89ca9ebf0 to your computer and use it in GitHub Desktop.
Save rbonghi/66c1c77d797c7209302e11f89ca9ebf0 to your computer and use it in GitHub Desktop.
build FTDI module for Jetson TX2
#!/bin/sh
# Prepare to build the FTDI module the NVIDIA Jetson TX2
if [ $(id -u) != 0 ]; then
echo "This script requires root permissions"
echo "$ sudo "$0""
exit
fi
# Go to the kernel sources
cd /usr/src/linux-headers-$(uname -r)
# Get the kernel configuration file
zcat /proc/config.gz > .config
# Enable FTDI compilation
sudo sed -i 's/# CONFIG_USB_SERIAL_FTDI_SIO is not set/CONFIG_USB_SERIAL_FTDI_SIO=m/' .config
# Make sure that the local kernel version is set
LOCALVERSION=$(uname -r)
# vodoo incantation; This removes everything from the beginning to the last occurrence of "-"
# of the local version string i.e. 3.10.67 is removed
release="${LOCALVERSION##*-}"
CONFIGVERSION="CONFIG_LOCALVERSION=\"-$release\""
# Replace the empty local version with the local version of this kernel
sudo sed -i 's/CONFIG_LOCALVERSION=""/'$CONFIGVERSION'/' .config
# Prepare the module for compilation
make prepare
make modules_prepare
# Compile the module
make M=drivers/usb/serial/
# After compilation, copy the compiled module to the system area
cp drivers/usb/serial/ftdi_sio.ko /lib/modules/$(uname -r)/kernel/drivers/usb/serial
depmod -a
/bin/echo -e "\e[1;32mFTDI Driver Module Installed.\e[0m"
@audstanley
Copy link

HOLY FUCK! thank you so much. Star for you, for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment