Adding the cp210x module to the NAO kernel
Hi folks,
I'm using the NAO[1] for my research. It uses a linux 2.6.29.6-rt24 kernel[2] which they seem to have customized to their needs. I need to use a NavChip[3] IMU(inertial measurement unit) with the NAO. The NavChip works out of the box with my Fedora 17 kernel(3.5.1-1.fc17.x86_64). This is what dmesg says when I plug it in:
Quoted 11 lines
[71406.521154] usb 2-1.5: new full-speed USB device number 6 using ehci_hcd [71406.607360] usb 2-1.5: New USB device found, idVendor=10c4, idProduct=ea60 [71406.607367] usb 2-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [71406.607372] usb 2-1.5: Product: CP2102 USB to UART Bridge Controller [71406.607376] usb 2-1.5: Manufacturer: Silicon Labs [71406.607379] usb 2-1.5: SerialNumber: 0001 [71406.772438] usbcore: registered new interface driver cp210x [71406.772468] USB Serial support registered for cp210x [71406.772513] cp210x 2-1.5:1.0: cp210x converter detected [71406.845220] usb 2-1.5: reset full-speed USB device number 6 using ehci_hcd [71406.931690] usb 2-1.5: cp210x converter now attached to ttyUSB0
Quoted 1 line
[ankur at ankur 2.6.29.6-rt24-aldebaran-rt]$
However, when I plug it into the NAO, it isn't detected. I looked up, and the kernel they use doesn't seem to have the cp210x module that is required for the NavChip (I think?).
The NavChip's processor is an AMD Geode[1] which is x86 compatible according to wiki.
Can you please tell me how I can add the required module to the NAO's kernel?
I already tried something, but this is my first brush with kernel compilation, so it was probably wrong:
I built the cp210x module using the NAO kernel tree:
Quoted 6 lines
[ankur at ankur aldebaran-linux-aldebaran-66f8749]$ pwd
/home/ankur/Documents/work/code/NAO/OS/aldebaran-linux-aldebaran-66f8749
[ankur at ankur aldebaran-linux-aldebaran-66f8749]$ filedrivers/usb/serial/cp210x.kodrivers/usb/serial/cp210x.ko: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), BuildID[sha1]=0x61274b6a395ca0bbb45729b87283f361c04b396f, not stripped [ankur at ankur aldebaran-linux-aldebaran-66f8749]$
I placed this into the drivers/usb/serial directory in the NAO system, but it didn't work (no surprise there!). It gave me an error:
"Invalid module format" when I tried modprobe or insmod.
The /var/log/messages had this:
"no version for struct_module found: kernel tainted".
Any hints please? It's probably something simple, just not simple enough for a kernel newbie :)
This is the set of modules they ship their kernel with:
Quoted 61 lines
[ankur at ankur 2.6.29.6-rt24-aldebaran-rt]$ pwd
/run/media/ankur/OpenNao-system/lib/modules/2.6.29.6-rt24-aldebaran-rt[ankur at ankur 2.6.29.6-rt24-aldebaran-rt]$ ll
total 409
lrwxrwxrwx. 1 root root 93 Jun 4 01:23 build -> /opennao-geode/tmp/portage/ald-kernel/opennao-kernel-2.6.29-r41/work/linux-2.6.29-opennao-r41
drwxr-xr-x. 5 root root 1024 Jun 4 01:23 kernel(quoted diff) +0
-15-rw-r--r--. 1 root root 59429 Aug 14 11:01 modules.alias -rw-r--r--. 1 root root 49998 Aug 14 11:01 modules.alias.bin -rw-r--r--. 1 root root 69 Aug 14 11:01 modules.ccwmap -rw-r--r--. 1 root root 11117 Aug 14 11:01 modules.dep -rw-r--r--. 1 root root 13279 Aug 14 11:01 modules.dep.bin -rw-r--r--. 1 root root 73 Aug 14 11:01 modules.ieee1394map -rw-r--r--. 1 root root 141 Aug 14 11:01 modules.inputmap -rw-r--r--. 1 root root 81 Aug 14 11:01 modules.isapnpmap -rw-r--r--. 1 root root 74 Aug 14 11:01 modules.ofmap -rw-r--r--. 1 root root 937 Jun 3 17:25 modules.order -rw-r--r--. 1 root root 2829 Aug 14 11:01 modules.pcimap -rw-r--r--. 1 root root 85 Aug 14 11:01 modules.seriomap -rw-r--r--. 1 root root 25281 Aug 14 11:01 modules.symbols -rw-r--r--. 1 root root 36981 Aug 14 11:01 modules.symbols.bin -rw-r--r--. 1 root root 199651 Aug 14 11:01 modules.usbmaplrwxrwxrwx. 1 root root 93 Jun 4 01:23 source -> /opennao-geode/tmp/portage/ald-kernel/opennao-kernel-2.6.29-r41/work/linux-2.6.29-opennao-r41
drwxr-xr-x. 5 root root 1024 Jun 4 01:23 updates
[ankur at ankur 2.6.29.6-rt24-aldebaran-rt]$ find . -name "*.ko" -not -name "cp210x.ko" -print./updates/compat/compat.ko./updates/compat/compat_firmware_class.ko./updates/net/wireless/cfg80211.ko./updates/net/mac80211/mac80211.ko./updates/net/rfkill/rfkill_backport.ko./updates/drivers/misc/eeprom/eeprom_93cx6.ko./updates/drivers/net/wireless/rt2x00/rt2x00pci.ko./updates/drivers/net/wireless/rt2x00/rt2800lib.ko./updates/drivers/net/wireless/rt2x00/rt2400pci.ko./updates/drivers/net/wireless/rt2x00/rt61pci.ko./updates/drivers/net/wireless/rt2x00/rt2x00usb.ko./updates/drivers/net/wireless/rt2x00/rt2800pci.ko./updates/drivers/net/wireless/rt2x00/rt2x00lib.ko./updates/drivers/net/wireless/rt2x00/rt2500usb.ko./updates/drivers/net/wireless/rt2x00/rt2800usb.ko./updates/drivers/net/wireless/rt2x00/rt73usb.ko./updates/drivers/net/wireless/rt2x00/rt2500pci.ko./updates/drivers/net/wireless/zd1211rw/zd1211rw.ko./kernel/net/wireless/cfg80211.ko./kernel/net/mac80211/mac80211.ko./kernel/net/bluetooth/sco.ko./kernel/net/bluetooth/hidp/hidp.ko./kernel/net/bluetooth/l2cap.ko./kernel/net/bluetooth/bnep/bnep.ko./kernel/net/bluetooth/rfcomm/rfcomm.ko./kernel/lib/cimarron/cimarron.ko./kernel/lib/crc-itu-t.ko./kernel/drivers/staging/rt2870/rt3070sta.ko./kernel/drivers/misc/eeprom/eeprom_93cx6.ko./kernel/drivers/usb/class/cdc-acm.ko./kernel/drivers/usb/serial/usbserial.ko./kernel/drivers/usb/serial/ftdi_sio.ko./kernel/drivers/hid/hid.ko./kernel/drivers/net/wireless/zd1211rw/zd1211rw.ko./kernel/drivers/net/wireless/rtl818x/rtl8187.ko./kernel/drivers/hwmon/lm90.ko./kernel/drivers/scsi/scsi_wait_scan.ko
Quoted 8 lines
./kernel/drivers/media/video/lxv4l2/lxv4l2.ko./kernel/drivers/i2c/busses/scx200_acb.ko./kernel/drivers/i2c/busses/i2c-serial.ko./kernel/drivers/bluetooth/btusb.ko./kernel/drivers/bluetooth/bfusb.ko./kernel/drivers/bluetooth/bcm203x.ko./kernel/drivers/bluetooth/hci_vhci.ko
[ankur at ankur 2.6.29.6-rt24-aldebaran-rt]$
Please let me know if you need any more info, and I'll provide it.
The kernel goes on a USB flash drive that needs to be inserted into the NAO to make it boot. They provide a utility that formats the flash drive as such:
Quoted 10 lines
[ankur at ankur ~]$ cd
/run/media/ankur/
[ankur at ankur ankur]$ ll
total 5
drwxr-xr-x. 7 root root 4096 Aug 6 22:28 OpenNao-data
drwxr-xr-x. 17 root root 1024 Aug 14 10:50 OpenNao-system
[ankur at ankur ankur]$ mount | egrep OpenNao/dev/sdb1on/run/media/ankur/OpenNao-systemtype ext3 (rw,nosuid,nodev,relatime,seclabel,data=ordered,uhelper=udisks2)/dev/sdb2on/run/media/ankur/OpenNao-datatype ext3 (rw,nosuid,nodev,relatime,seclabel,data=ordered,uhelper=udisks2) [ankur at ankur ankur]$
[1] http://en.wikipedia.org/wiki/Nao_(robot)
[2] https://github.com/aldebaran/linux-aldebaran/
[3] http://www.intersense.com/pages/16/16/
[4] http://en.wikipedia.org/wiki/Geode_(processor)
Signature · 18 lines
Thanks, Warm regards, Ankur: "FranciscoD" Please only print if necessary. Looking to contribute to Fedora? Look here: https://fedoraproject.org/wiki/Fedora_Join_SIG http://fedoraproject.org/wiki/User:Ankursinha http://dodoincfedora.wordpress.com/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: This is a digitally signed message part Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120815/680472f4/attachment.bin
Hi Ankur :)
Quoted 10 lines · Ankur Sinha
I built the cp210x module using the NAO kernel tree:
Quoted 6 lines
[ankur at ankur aldebaran-linux-aldebaran-66f8749]$ pwd
/home/ankur/Documents/work/code/NAO/OS/aldebaran-linux-aldebaran-66f8749
[ankur at ankur aldebaran-linux-aldebaran-66f8749]$ filedrivers/usb/serial/cp210x.kodrivers/usb/serial/cp210x.ko: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), BuildID[sha1]=0x61274b6a395ca0bbb45729b87283f361c04b396f, not stripped [ankur at ankur aldebaran-linux-aldebaran-66f8749]$
Quoted 4 lines
I placed this into the
drivers/usb/serialdirectory in the NAO system, but it didn't work (no surprise there!). It gave me an error:"Invalid module format" when I tried modprobe or insmod.
Just a quick test, what happen if you do:
insmod -f /path/to/the/module.ko
?
IMHO, quite likely the message you saw happened since you compile the kernel module with different version of gcc and/or different gcc parameter, that somehow yield binary incompatibility.
Another thought, what arch do you use when you compile that kernel module? AMD Geode too?
Signature · 7 lines
regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
Quoted 1 line · Mulyadi Santosa
Hi Ankur :)
Hi Mulyadi,
Thanks for your reply!
<snip>
Quoted 4 lines
Just a quick test, what happen if you do:
insmod -f /path/to/the/module.ko
?
I didn't try the -f switch. (The man page I have in Fedora doesn't even mention it). Unfortunately, the robot is maintained by another
laboratory: we need to take permission and make an appointment to use it. I'll try this the next time I have an appointment.
Quoted 4 lines
IMHO, quite likely the message you saw happened since you compile the kernel module with different version of gcc and/or different gcc parameter, that somehow yield binary incompatibility.
Probably :/ . The manufacturers haven't mentioned what version of gcc etc. they used. I used the one I had available:
Quoted 7 lines
gcc-4.7.0-5.fc17.x86_64
Another thought, what arch do you use when you compile that kernel module? AMD Geode too?
No. I compiled it on my system, which is an x86_64 using the ARCH parameter to the make command:
make ARCH=i386 ... (I got this from here[1])
The system they provide (the Geode), along with their file system etc. has no development tools at all, so I can't build the module there (unless I first compile gcc etc from source, like LFS?). It seems to use a live persistent USB (which has a data and system partition), although none of the partitions are marked bootable. I'm guessing it has a bootloader on-board, but again, no info on that either.
[1]
http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/ch05s04.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120816/f24ce6ab/attachment.bin
Quoted 2 lines · Mulyadi Santosa
Another thought, what arch do you use when you compile that kernel module? AMD Geode too?
Hi Mulyadi,
I think this might be the issue. I chrooted into the usb and checked the modinfos for the various modules:
The cp210x.ko module is what I've built, and the vermagic is completely different compared to the other modules.
Quoted 28 lines
root at ankur [err 130] serial $ for i in
ls; do modinfo "$i" | sed "/alias/ d"; echo ; donefilename: cp210x.ko license: GPL version: v0.09 description: Silicon Labs CP210x RS232 serial adaptor driver srcversion: AABC22BCCBD49828BA2AE5A depends: vermagic: 2.6.33.9-rt31 SMP mod_unload 686 4KSTACKS parm: debug:Enable verbose debugging messages (bool)filename: ftdi_sio.ko license: GPL description: USB FTDI Serial Converters Driver author: Greg Kroah-Hartman <[email protected]>, Bill Ryder <[email protected]>, Kuba Ober <[email protected]> depends: usbserial vermagic: 2.6.29.6-rt24-aldebaran-rt preempt mod_unload modversions GEODE parm: debug:Debug enabled or not (bool) parm: vendor:User specified vendor ID (default=0x0403) (ushort) parm: product:User specified product ID (ushort)filename: usbserial.ko license: GPL description: USB Serial Driver core author: Greg Kroah-Hartman, greg at kroah.com, http://www.kroah.com/linux/ depends: vermagic: 2.6.29.6-rt24-aldebaran-rt preempt mod_unload modversions GEODE parm: debug:Debug enabled or not (bool)
Quoted 2 lines
root at ankur [0] serial $
Is there a way I can compile this module for the GEODE on another system (Cross compile?)? I also seem to have gotten the wrong kernel version (rt24 vs rt31). I'll go find the correct kernel version from their git[1] and retry.
[1] https://github.com/aldebaran/linux-aldebaran/tree/release-1.12/geode
Signature · 17 lines
Thanks, Warm regards, Ankur: "FranciscoD" Please only print if necessary. Looking to contribute to Fedora? Look here: https://fedoraproject.org/wiki/Fedora_Join_SIG http://fedoraproject.org/wiki/User:Ankursinha http://dodoincfedora.wordpress.com/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: This is a digitally signed message part Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120816/894a03e1/attachment.bin
Quoted 5 lines · Ankur Sinha
Is there a way I can compile this module for the GEODE on another system
(Cross compile?)? I also seem to have gotten the wrong kernel version (rt24 vs rt31). I'll go find the correct kernel version from their git[1] and retry.
Hi folks,
It seems I'm a little out of luck :/
I downloaded the correct version kernel source, and it appears to not contain the cp210x module at all:
Quoted 8 lines
[ankur at ankur aldebaran-linux-aldebaran-68edb2f]$ find . -name "*cp21*" -print
./drivers/net/irda/mcp2120-sir.c./drivers/usb/serial/cp2101.o./drivers/usb/serial/.cp2101.o.cmd./drivers/usb/serial/cp2101.c
[ankur at ankur aldebaran-linux-aldebaran-68edb2f]$ pwd/home/ankur/Documents/work/code/NAO/OS/aldebaran-linux-aldebaran-68edb2f[ankur at ankur aldebaran-linux-aldebaran-68edb2f]$
How do I proceed? Can i take the module source from a newer kernel and build it with this one? Or will I have to just use a newer kernel tree altogether and replace the kernel they ship?
On a positive note, I do seem to have built the other modules correctly (vermagic is same to the actual kernel modules now):
Quoted 9 lines
[ankur at ankur aldebaran-linux-aldebaran-68edb2f]$ modinfo
drivers/usb/serial/usbserial.kofilename: /home/ankur/Documents/work/code/NAO/OS/aldebaran-linux-aldebaran-68edb2f/drivers/usb/serial/usbserial.ko license: GPL description: USB Serial Driver core author: Greg Kroah-Hartman, greg at kroah.com, http://www.kroah.com/linux/ depends: vermagic: 2.6.29.6-rt24-aldebaran-rt preempt mod_unload modversions parm: debug:Debug enabled or not (bool)
It misses a "GEODE" at the end though. What does that imply?
Actual kernel modules:
Quoted 14 lines
[root at ankur ~]# !chroot
chroot/run/media/ankur/OpenNao-system/
bash:/dev/null: Permission denied
root at ankur [0] / $ modinfo/lib/modules/2.6.29.6-rt24-aldebaran-rt/kernel/drivers/usb/serial/
ftdi_sio.ko usbserial.ko
root at ankur [0] / $ modinfo/lib/modules/2.6.29.6-rt24-aldebaran-rt/kernel/drivers/usb/serial/usbserial.kofilename: /lib/modules/2.6.29.6-rt24-aldebaran-rt/kernel/drivers/usb/serial/usbserial.ko license: GPL description: USB Serial Driver core author: Greg Kroah-Hartman, greg at kroah.com, http://www.kroah.com/linux/ depends: vermagic: 2.6.29.6-rt24-aldebaran-rt preempt mod_unload modversions GEODE parm: debug:Debug enabled or not (bool)root at ankur [0] / $
Signature · 17 lines
Thanks again, Warm regards, Ankur: "FranciscoD" Please only print if necessary. Looking to contribute to Fedora? Look here: https://fedoraproject.org/wiki/Fedora_Join_SIG http://fedoraproject.org/wiki/User:Ankursinha http://dodoincfedora.wordpress.com/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: This is a digitally signed message part Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120816/86f87d60/attachment.bin
Dear Ankur...
Quoted 23 lines · Ankur Sinha
Quoted 5 lines · Ankur Sinha
Is there a way I can compile this module for the GEODE on another system
(Cross compile?)? I also seem to have gotten the wrong kernel version (rt24 vs rt31). I'll go find the correct kernel version from their git[1] and retry.Hi folks,
It seems I'm a little out of luck :/
I downloaded the correct version kernel source, and it appears to not contain the cp210x module at all:
Quoted 8 lines
[ankur at ankur aldebaran-linux-aldebaran-68edb2f]$ find . -name "*cp21*" -print
./drivers/net/irda/mcp2120-sir.c./drivers/usb/serial/cp2101.o./drivers/usb/serial/.cp2101.o.cmd./drivers/usb/serial/cp2101.c
[ankur at ankur aldebaran-linux-aldebaran-68edb2f]$ pwd/home/ankur/Documents/work/code/NAO/OS/aldebaran-linux-aldebaran-68edb2f[ankur at ankur aldebaran-linux-aldebaran-68edb2f]$
Quoted 3 lines
How do I proceed? Can i take the module source from a newer kernel and build it with this one? Or will I have to just use a newer kernel tree altogether and replace the kernel they ship?
All I can say is, you might just have to try it.
BTW, I think the kernel in your device enforce strict versioning, that's why you need to match it up. That's why I suggest -f in the first place.
Anyway, architecture is sometimes very important to match, because you might hit something nasty, i.e in x86, cmov is available on certain processor model only.
Oh and, beware of the stack size. it seems that the kernel in your device use 4K stack size. You need to match that too.
NB: of course, all this headache can be avoided if your device provides SDK, which is, as you said, seems unavailable.
Signature · 7 lines
regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com