Skip to content

Instantly share code, notes, and snippets.

@audstanley
Created December 15, 2017 22:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save audstanley/de4198e90f313b9816e16ad05932035f to your computer and use it in GitHub Desktop.
Save audstanley/de4198e90f313b9816e16ad05932035f to your computer and use it in GitHub Desktop.
#!/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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment