I just spent a lot of time on this when trying to get the Android image up on running on a AT91SAM9M10-EKES board and thought I should share a few pieces of info since it was not all that straight forward even if this thread was really helpful.
My setup is a development machine running Ubuntu 10.04 (64 bit). The module modification suggested by tbosserman seems to solve the problem for me but rebuilding the module was not that straight forward, my ubuntu kernel hacking experience is somewhat limited. Below is what I did, there are probably easier ways to rebuild a specific module but I found it hard to google up something. So if anyone got suggestions on how to get just the source for the module I want to modify and build that against the correct Linux headers quickly feel free to comment.
----------------------------------------------------
First get the correct kernel for the distribution to get the driver. Git kernel repos for different distributions can be found at
https://wiki.ubuntu.com/Kernel/Dev/KernelGitGuide?action=show&redirect=KernelTeam/KernelGitGuide%20. For my setup (10.04):
mkdir mykernels
cd mykernels
git clone
git://kernel.ubuntu.com/ubuntu/ubuntu-lucid.gitThis creates a folder in mykernels named ubuntu-lucid which contains the source code for the 10.04 kernel. In this case we do not want to build the entire kernel, just the usbserial driver with a modification. At this point I run in to issues with module version numbers, just building the module directly in the kernel source will use the wrong header set and that will cause a problem when we try to install it. Instead it should be built against the kernel headers for the distribution. To get these headers run
uname -a
Which should result in something like this:
Linux selunwsmpetlinux 2.6.32-25-generic #44-Ubuntu SMP Fri Sep 17 20:05:27 UTC 2010 x86_64 GNU/Linux
Now we now what version of the kernel headers we need so download them by running (I already had my kernel headers available so this may be incomplete)
sudo apt-get install linux-headers-2.6.32-25-generic
Remember to replace the version above with the one for your system throughout this example. The header files will end up in /usr/src and can be used for building modules and programs that make use of kernel features. In this case we want to use them to rebuild a driver module and I copied them to my home folder in order not to mess up the standard installation.
cd ~
mkdir modulehack
cp -r /usr/src/linux-headers-2.6.32-25-generic modulehack/
cp -r /usr/src/linux-headers-2.6.32-25 modulehack/
I built the the new module from this modulehack directory by first copying the source files to it.
cd mykernels/ubuntu-lucid/drivers/usb/serial
cp * ~/modulehack/linux-headers-2.6.32-25/drivers/usb/serial/
Now it is time to do the modification of the usbserial driver that we are going to build. Open and edit usbserial.c
cd ~/modulehack/linux-headers-2.6.32-25/drivers/usb/serial/
gedit usbserial.c
Add this line
serial->type->max_in_flight_urbs = 1;
After line 274 in the serial_open function to make the code look something like:
if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags)) {
if (mutex_lock_interruptible(&port->mutex))
return -ERESTARTSYS;
mutex_lock(&serial->disc_mutex);
if (serial->disconnected)
retval = -ENODEV;
else {
retval = port->serial->type->open(tty, port);
serial->type->max_in_flight_urbs = 1;
}
mutex_unlock(&serial->disc_mutex);
mutex_unlock(&port->mutex);
if (retval)
return retval;
set_bit(ASYNCB_INITIALIZED, &port->port.flags);
}
Now we have the headers and the modified driver file all in the modulehack folder and we are ready to build. The build itself is started from the <linux_headers..>-generic folder to get the version info right. This contains symbolic links to the drivers folder where we put the modified driver. Build the module by
cd ~/modulehack/linux-headers-2.6.32-25-generic
make M=drivers/usb/serial/
Hopefully we now have a working modified module. Last step is to install but first backup the current module.
sudo cp /lib/modules/2.6.32-25-generic/kernel/drivers/usb/serial/usbserial.ko ~/backupusbserial.ko
Now if everything worked out alright copy the modified module and install it using the instructions for the Atmel SAM boot assistant.
cd ~/modulehack/linux-headers-2.6.32-25/drivers/usb/serial/
sudo cp usbserial.ko /lib/modules/2.6.32-25-generic/kernel/drivers/usb/serial/usbserial.ko
sudo rmod usbserial
sudo modprobe usbserial vendor=0x03eb product=0x6124
If everything works out alright it should now be possible to follow the instructions in with the SAM-BA tool to reflash the board.