2

I'm trying to add the usb to serial port driver to my arch linux arm device, and I noticed that the kernel source tree already includes the source files for the FTDI driver, located in:

drivers/usb/serial, there exists the ftdi_sio.c and ftdi_sio.h files.

When I navigate to kernel/drivers, I cannot find the ftdi_sio.ko module anywhere.

How do I build the ftdi kernel module and include it to boot so I can have usb to serial port capability on my arch linux arm?

user3215598
  • 103
  • 1
  • 3
  • 9

2 Answers2

3

I suppose you have the kernel source tree (from your distro package manager) on your arm device and you don't cross-compile :

make menuconfig

Navigate to : Device Drivers -> USB Support -> USB Serial Converter Support

And choose 'M'odule for USB FTDI Single Port Serial Driver

Exit, save changes and

make M=drivers/usb/serial/
make modules_install
Mali
  • 2,990
  • 18
  • 18
  • Thanks, those steps worked. If I want to boot from a uImage with the included driver now, how would I proceed to do that? Would I then run make uImage after make modules_install? I tried doing that and it didn't work. – user3215598 Jan 21 '14 at 19:00
  • basically, `make modules_install` should do the necessary stuff. it should copy the generated .ko in /lib/modules/kernel-version/ and runnig `depmod`, so if you build with the same sources as current running kernel, it's ok. – Mali Jan 21 '14 at 20:49
  • I'm actually cross-compiling, so what I've done is: make ARCH=arm menuconfig, choose 'M'odule for USB FTDI, make M=drivers/usb/serial ARCH=arm CROSS_COMPILE=/home/z3/bin/arm- , then: INSTALL_MOD_PATH= make ARCH=arm CROSS_COMPILE=/home/z3/bin/arm modules_install . And all I have to do now is u-boot from the uImage again? (no need to re-compile and build a new uImage?) – user3215598 Jan 21 '14 at 20:59
  • How do I depmod for my target system? – user3215598 Jan 21 '14 at 21:14
  • you can try to copy only ftdi_sio.ko on your target. And then `insmod ftdio.ko` (ensure that usbcore and usbserial are loaded before). It's hard to say you how to reinstall whole kernel without knowing your target and environment. And I don't want to brick your board :) – Mali Jan 22 '14 at 08:32
  • thank you so much! Your initial suggestion in your answer worked. I just had to add the ARCH and CROSS_COMPILE env variables, and specify the INSTALL_MOD_PATH. Afterwards, insmod both usbserial.ko and ftdi_sio.ko. I'd definitely upvote your answer if I had enough reputation. – user3215598 Jan 22 '14 at 19:50
1

Edit the .config:

make ARCH=arm menuconfig 

Make and install modules: make modules and make modules_install

Don't forget: insmod usbserial.ko and insmod ftdi_sio.ko if you need to, and depmod -a to have them load after a power cycle.

diddles
  • 124
  • 6