Building Gadget USB Module

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Ubuntu Feisty 7.0.4)
Line 8: Line 8:
 
</pre>
 
</pre>
  
Uncompress /usr/src/linux-source-2.6.##.tar.gz, link it to /usr/src/linux, and ensure /lib/modules/`uanme -r`/build exists, then run the following:
+
Uncompress /usr/src/linux-source-2.6.##.tar.gz, link it to /usr/src/linux, and ensure /lib/modules/`uname -r`/build exists, then run the following:
 
<pre>
 
<pre>
 
mkdir usb_module_dir
 
mkdir usb_module_dir

Revision as of 03:30, 27 July 2007

General Comments

You will most likely need kernel version 2.6.20 or higher

Ubuntu Feisty 7.0.4

To prepare your environment run the following:

sudo apt-get install linux-kernel-source linux-kernel-headers

Uncompress /usr/src/linux-source-2.6.##.tar.gz, link it to /usr/src/linux, and ensure /lib/modules/`uname -r`/build exists, then run the following:

mkdir usb_module_dir
cd usb_module_dir
cp -r /usr/src/linux/drivers/usb/* .
cd gadget
echo "KDIR := /lib/modules/`uname -r`/build" >> Makefile
echo "PWD := `pwd`" >> Makefile
echo "obj-m := dummy_hcd.o gadgetfs.o" >> Makefile
echo "default: " >> Makefile
echo -e "\t\$(MAKE) -C \$(KDIR) SUBDIRS=\$(PWD) modules" >> Makefile
make

Once the kernel modules ( dummy_hcd.ko and gadgetfs.ko ) are built, you must remove (or move) the gadgetfs and net2280 as follows:

sudo mv /lib/modules/`uname -r`/kernel/drivers/usb/net/net2280.ko ./original_net2280.ko
sudo mv /lib/modules/`uname -r`/kernel/drivers/usb/net/gadget.ko ./original_gadgetfs.ko

and replace them with the new modules:

sudo cp dummy_hcd.ko and gadgetfs.ko /lib/modules/`uname -r`/kernel/drivers/usb/net/
sudo depmod

The net2280 module provides conflicting symbols and causes interference with the dummy_hcd module.

Personal tools

General Comments

You will most likely need kernel version 2.6.20 or higher

Ubuntu Feisty 7.0.4

To prepare your environment run the following:

sudo apt-get install linux-kernel-source linux-kernel-headers

Uncompress /usr/src/linux-source-2.6.##.tar.gz, link it to /usr/src/linux, and ensure /lib/modules/`uanme -r`/build exists, then run the following:

mkdir usb_module_dir
cd usb_module_dir
cp -r /usr/src/linux/drivers/usb/* .
cd gadget
echo "KDIR := /lib/modules/`uname -r`/build" >> Makefile
echo "PWD := `pwd`" >> Makefile
echo "obj-m := dummy_hcd.o gadgetfs.o" >> Makefile
echo "default: " >> Makefile
echo -e "\t\$(MAKE) -C \$(KDIR) SUBDIRS=\$(PWD) modules" >> Makefile
make

Once the kernel modules ( dummy_hcd.ko and gadgetfs.ko ) are built, you must remove (or move) the gadgetfs and net2280 as follows:

sudo mv /lib/modules/`uname -r`/kernel/drivers/usb/net/net2280.ko ./original_net2280.ko
sudo mv /lib/modules/`uname -r`/kernel/drivers/usb/net/gadget.ko ./original_gadgetfs.ko

and replace them with the new modules:

sudo cp dummy_hcd.ko and gadgetfs.ko /lib/modules/`uname -r`/kernel/drivers/usb/net/
sudo depmod

The net2280 module provides conflicting symbols and causes interference with the dummy_hcd module.