I currently have Ubuntu 10.10, but I could not find the code for USB driver.... it had only the makefiles !

I need the object files, c files or perl files for that driver !

How do I do that ?
Please help ! :D

Dani AI

Generated

Brief, practical next steps building on ’s question and ’s pointer: most USB drivers are part of the kernel tree (drivers/usb/...), but many distro packages only provide headers or Makefile fragments — that’s why only Makefiles were visible. To get the actual C sources and produce object/module files you must obtain the matching kernel source tree, locate the specific module name, and build that module against the running kernel configuration.

Commands to identify the module and fetch/extract a distro source tarball:

uname -r
lsmod | grep usb
dmesg | tail -n 40 | grep -i usb
modinfo -n <modulename>          # shows /lib/modules/$(uname -r)/.../name.ko
sudo apt-get update
sudo apt-get install linux-source
cd /usr/src && sudo tar xvf linux-source-*.tar.bz2
cd linux-source-*/drivers/usb
grep -R "<modulename_or_symbol>" -n .

How to build the module (produce .o/.ko) from that source tree:

cp /boot/config-$(uname -r) .config
make oldconfig
make modules_prepare
make M=drivers/usb/<subdir> modules   # or try SUBDIRS= for older kernels

After this the compiled object and module will appear in the source subdirectory (and you can install the .ko into /lib/modules/$(uname -r)/ if needed).

Notes and troubleshooting: the kernel source version must match the running kernel (mismatches produce build errors). If the driver was built into the kernel (not a module) there will be no .ko — rebuilding the kernel with the driver set as a module is required to get separate object files. Perl or other helper scripts are usually userspace packages, not in kernel source; look at the vendor/distribution source packages for those.

The code for the USB driver will more likely be a Kernel module, so I think you'll need to take a look at the Linux kernel source code. The source for the kernel used in Ubuntu 10.10 should be in the repos.

If you want to create your own kernel modules, you might want to look at this, which deals with compiling new/custom kernels in Ubuntu 10.10

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.