Instructions for installing the cp210x serial bridge driver


This USB driver is not in the kernel by default and have to be installed specifically for your kernel version:

Source link is: http://unix.stackexchange.com/questions/75558/ubuntu-make-fails-with-no-such-file-or-directory-lib-modules-3-4-0-build

Building cp210x for your kernel version

First make note of your major & minor numbers for your kernel you have (i.e. 3.4, 3.5, etc.).

$ uname -r
3.5.0-19-generic

Incidentally I’m on Ubuntu 12.10:

$ lsb_release -r
Release:    12.10

Install the kernel headers & build tools for your kernel version:

sudo apt-get install linux-headers-$(uname -r) build-essentials

Now make yourself a little work area for all this:

mkdir -p $HOME/cp210x && cd $HOME/cp210x

Download the VCP Driver Source:

wget  http://www.silabs.com/Support%20Documents/Software/Linux_3.x.x_VCP_Driver_Source.zip
unzip Linux_3.x.x_VCP_Driver_Source.zip
cd Linux_3.x.x_VCP_Driver_Source
mv cp210x.c cp210x.c_orig

Get kernel.org cp210x.c

Now download the appropriate version of cp210x.c for your kernel. Replace the linux-3.5.y with your version:

$ wget https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/drivers/usb/serial/cp210x.c?h=linux-3.5.y -O cp210x.c

NOTE: You can browse the different versions of the kernel here: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/

Compile

Now we compile using make:

$ make
make -C /lib/modules/3.5.0-19-generic/build M=/home/manny/cp210x/Linux_3.x.x_VCP_Driver_Source modules
make[1]: Entering directory `/usr/src/linux-headers-3.5.0-19-generic'
  CC [M]  /home/manny/cp210x/Linux_3.x.x_VCP_Driver_Source/cp210x.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/manny/cp210x/Linux_3.x.x_VCP_Driver_Source/cp210x.mod.o
  LD [M]  /home/manny/cp210x/Linux_3.x.x_VCP_Driver_Source/cp210x.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-19-generic'

Deploy

Now move any pre-existing cp210x.ko kernel out of the way:

sudo mv /lib/modules/`uname -r`/kernel/drivers/usb/serial/cp210x.ko /lib/modules/`uname -r`/kernel/drivers/usb/serial/cp210x.ko.orig

Now copy the newly built kernel module, cp210x.ko in it’s place:

sudo cp cp210x.ko /lib/modules/`uname -r`/kernel/drivers/usb/serial/cp210x.ko

==== Load ====

Now make sure the previous cp210x.ko kernel module wasn’t loaded:

$ lsmod | grep cp210x
$

If it is, unload it:

sudo rmmod cp210x

Now let’s load our new cp210x.ko module:

sudo modprobe cp210x

Test

Confirm that it loaded correctly:

$ lsmod |grep cp210x
cp210x                 21822  0 
usbserial              42355  1 cp210x

Also check dmesg for any issues:

$ dmesg | tail
...
...
[979772.614394] usbcore: registered new interface driver usbserial
[979772.614410] usbcore: registered new interface driver usbserial_generic
[979772.614456] USB Serial support registered for generic
[979772.614461] usbserial: USB Serial Driver core
[979772.614810] usbcore: registered new interface driver cp210x
[979772.614822] USB Serial support registered for cp210x

Done…