Jump to content

compiling the external module


ValdasRK

Recommended Posts

Hello, All
 
I'm trying to compile the ftdi_sio module using suggestions from http://www.cyberciti.biz/tips/build-linux-kernel-module-against-installed-kernel-source-tree.html.
I got the message:
fatal error: asm/linkage.h: No such file or directory
 
I added following lines to the standard Makefile from http://www.ftdichip.com/Drivers/VCP/Linux/ftdi_sio.tar.gz:
CFLAGS += -I$(shell echo "/usr/src/linux-headers-`uname -r`/arch/arm/include")
CFLAGS += -I$(shell echo "/usr/src/linux-headers-`uname -r`/arch/arm/include/generated")
but now I got the message:
fatal error: mach/irqs.h: No such file or directory
 
when I trying to find the file missing
find /usr/ -type f -name "irqs.h"

I get to many results.

 

My second approach is to follow http://stackoverflow.com/questions/21239505/compile-ftdi-kernel-module

but when I  type

 root@micro:/usr/src/linux# make menuconfig

I get the message

fatal error: curses.h: No such file or directory

 

So I need instructions how to build ftdi_sio module on

Linux micro 4.0.4-lime #10 SMP Fri May 22 06:53:33 CEST 2015 armv7l GNU/Linux

 

Any help, please!

Link to comment
Share on other sites

Try this way:

 

1. Download latest kernel, you can use the one from Cubietruck: http://mirror.igorpecovnik.com/kernel/4.0.5-cubietruck-next.tar

2. Install image, headers and libc

3. Go to /usr/src/linux-headers-4.0.5-cubietruck

4. make headers_check; make headers_install ; make scripts

 

Than try to compile again and try also to compile just some driver.

Link to comment
Share on other sites

Stopped on step 4, with `make scripts` error:
 

  HOSTCC  scripts/sortextable
scripts/sortextable.c:31:32: fatal error: tools/be_byteshift.h: No such file or directory
 #include <tools/be_byteshift.h>
                                ^
compilation terminated.
scripts/Makefile.host:91: recipe for target 'scripts/sortextable' failed
make[1]: *** [scripts/sortextable] Error 1
Makefile:557: recipe for target 'scripts' failed
make: *** [scripts] Error 2

Then, I commented following lines in /usr/src/linux-headers-4.0.5-cubietruck/scripts/Makefile:

# hostprogs-$(CONFIG_BUILDTIME_EXTABLE_SORT) += sortextable
# HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include

After that, `make scripts` finished without any error.
But that result is zero worth, because  original FTDI drivers ver 1.5.0 is not ready for new kernels, I think.
At that point, I can to continue with compiling internal FTDI driver from full kernel sources, but I can't get sources for may kernel version 4.0.4:

apt-cache show linux-source
Package: linux-source
Source: linux-latest (63)
Version: 3.16+63

I tried to compile the kernel 4.0.5 sources from kernel.org. This took more than 3 hours, but finished successfully.

Link to comment
Share on other sites

I can't to continue with 4.0.4 and 4.0.5, because 

grep USB_SERIAL config-4.0.4-lime
# CONFIG_USB_SERIAL is not set

grep USB_SERIAL config-4.0.5-cubietruck
# CONFIG_USB_SERIAL is not set

and after editing the ./config file, I got:

/usr/src/linux-headers-4.0.5-cubietruck# make modules
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: *** No rule to make target 'arch/arm/tools/gen-mach-types', needed by 'include/generated/mach-types.h'.  Stop.
arch/arm/Makefile:297: recipe for target 'archprepare' failed
make: *** [archprepare] Error 2

Can I use kernel 4.0.5 from kernel.org with my Olimex micro? Because I can compile it on-board.
I need CLI (headless), libboost and USB serial in my project.

Link to comment
Share on other sites

I'm trying to answer my questions by myself.
But I got wrong architecture after compiling sources from kernel.org:

dpkg-deb: building package `linux-headers-4.0.5' in `../linux-headers-4.0.5_4.0.5-3_armel.deb'.
dpkg-deb: building package `linux-libc-dev' in `../linux-libc-dev_4.0.5-3_armel.deb'.
dpkg-deb: building package `linux-image-4.0.5' in `../linux-image-4.0.5_4.0.5-3_armel.deb'.

dpkg -i linux-headers-4.0.5_4.0.5-3_armel.deb
dpkg: error processing archive linux-headers-4.0.5_4.0.5-3_armel.deb (--install):
 package architecture (armel) does not match system (armhf)

I still need help.

Link to comment
Share on other sites

Use this kernel. FTDI should work:

 

http://mirror.igorpecovnik.com/kernel/4.0.5-lamobo-r1-next.tar

 

But I got wrong architecture after compiling sources from kernel.org:

 

Because you need to define this in the compilation process - make ARCH=arm or whatever target.

 

Kernel compilation is / can be a nightmare ... I made a script to minimize risk, to simplify process, to save time but even if you fully stick to defaults, problems might occur. If you want do compile in any other but theoretically proper environment, native included, it might fail :mellow:  :huh:

Link to comment
Share on other sites

I don't found the way to build modules on-board.

I started to use the Emdebian tool-chain on Debian machine, like described in https://romanrm.net/a10/cross-compile-kernel.

Now, I can run Your script. Thank You, Igor, very much for that!
I can switch on/off internal modules with this script.

 

I'm waiting now to include the Oduino XU3 and Cubieboard4 to the list of supported boards.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines