Compile FTDI kernel module

10,501

Solution 1

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

Solution 2

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.

Share:
10,501
user3215598
Author by

user3215598

Updated on June 04, 2022

Comments

  • user3215598
    user3215598 almost 2 years

    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
    user3215598 over 10 years
    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.
  • Mali
    Mali over 10 years
    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.
  • user3215598
    user3215598 over 10 years
    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=<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
    user3215598 over 10 years
    How do I depmod for my target system?
  • Mali
    Mali over 10 years
    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 :)
  • user3215598
    user3215598 over 10 years
    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.