Skip to content

Instantly share code, notes, and snippets.

@rbonghi

rbonghi/ftdi.sh

Created Apr 25, 2017
Embed
What would you like to do?
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"
@rbonghi

This comment has been minimized.

Copy link
Owner Author

@rbonghi rbonghi commented Apr 25, 2017

Status now

scripts/kconfig/conf --silentoldconfig Kconfig
drivers/platform/tegra/Kconfig:113⚠️ ignoring type redefinition of 'TEGRA_SOCTHERM' from 'tristate' to 'boolean'

configuration written to .config

CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
make[1]: *** No rule to make target 'arch/arm/tools/gen-mach-types', needed by 'include/generated/mach-types.h'. Stop.
arch/arm64/Makefile:93: recipe for target 'archprepare' failed
make: *** [archprepare] Error 2
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
make[1]: *** No rule to make target 'arch/arm/tools/gen-mach-types', needed by 'include/generated/mach-types.h'. Stop.
arch/arm64/Makefile:93: recipe for target 'archprepare' failed
make: *** [archprepare] Error 2
make[1]: *** No rule to make target 'drivers/usb/serial//usb-serial.o', needed by 'drivers/usb/serial//usbserial.o'. Stop.
Makefile:1399: recipe for target '_module_drivers/usb/serial/' failed
make: *** [_module_drivers/usb/serial/] Error 2
cp: cannot stat 'drivers/usb/serial/ftdi_sio.ko': No such file or directory
FTDI Driver Module Installed.

@rbonghi

This comment has been minimized.

@audstanley

This comment has been minimized.

Copy link

@audstanley audstanley commented Dec 15, 2017

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