Menu

#51 Compiling for ARM

open
nobody
None
5
2016-02-05
2012-04-10
No

I have a NI USB to GPIB converter I'm trying to get working with Linux. The ARM's operating system is Debian 6.0 sid.

The package libgpib0-dev hasn't been built for the arm architecture so instead I'm compiling from the source. I've checked out linux-gpib from your svn repository (tried with revision 1588 and 1584) after reading http://sourceforge.net/tracker/index.php?func=detail&aid=3458217&group_id=42378&atid=432940.

I'm building on Ubuntu 10.04.3 32-bit, trying to cross compile for the ARM architecture.
I've exported ARCH=arm, and exported CROSS_COMPILE=/path/to/crosscompile/env/arm-arago-linux-gnueabi-
After running ./bootstrap I run ./configure:
./configure \ --host=arm-arago-linux-gnueabi \ --with-linux-srcdir=${HOME}/workspace/trunk/linux-omap/ \ --prefix=${HOME}/cm-t3517/rootfs/ \ --disable-guile-binding \ --disable-perl-binding \ --disable-php-binding \ --disable-python-binding \ --disable-tcl-binding

Then when I make I get the following errors:
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c: In function 'send_command':
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c:230:2: error: implicit declaration of function 'get_fs'
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c:231:2: error: implicit declaration of function 'set_fs'
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c:231:10: error: 'KERNEL_DS' undeclared (first use in this function)
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c:231:10: note: each undeclared identifier is reported only once for each function it appears in
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c: In function 'usb_gpib_detach':
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c:493:12: error: 'KERNEL_DS' undeclared (first use in this function)
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c: In function 'usb_gpib_read':
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c:723:12: error: 'KERNEL_DS' undeclared (first use in this function)
make[6]: *** [/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.o] Error 1
make[5]: *** [/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/lpvo_usb_gpib] Error 2
make[4]: *** [_module_/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib] Error 2

Following your advice at (http://sourceforge.net/tracker/index.php?func=detail&aid=3458217&group_id=42378&atid=432940) I add #include <asm/uaccess.h>

I re-make and get the following errors:
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/pc2/pc2_init.c: In function 'pc2_generic_attach':
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/pc2/pc2_init.c:299:3: error: implicit declaration of function 'request_dma'
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/pc2/pc2_init.c: In function 'pc2_detach':
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/pc2/pc2_init.c:366:4: error: implicit declaration of function 'free_dma'
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/pc2/pc2_init.c: In function 'pc2a_common_attach':
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/pc2/pc2_init.c:429:3: warning: 'check_region' is deprecated (declared at include/linux/ioport.h:160)
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/pc2/pc2_init.c:432:2: warning: 'check_region' is deprecated (declared at include/linux/ioport.h:160)
make[6]: *** [/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/pc2/pc2_init.o] Error 1
make[5]: *** [/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/pc2] Error 2
make[4]: *** [_module_/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib] Error 2

Since <asm/dma.h> is in the include list, I resolve this by adding #ifdef CONFIG_ISA_DMA_API around the calls to request_dma and free_dma. I also change the calls to check_region to check_mem_region even though it's just a warning.

I re-make and get the following errors:
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/tnt4882/mite.c: In function 'mite_init':
/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/tnt4882/mite.c:87:3: error: implicit declaration of function 'pci_dev_get'
make[6]: *** [/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/tnt4882/mite.o] Error 1
make[5]: *** [/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib/tnt4882] Error 2
make[4]: *** [_module_/home/paul-dev/workspace/linux-gpib_1588/linux-gpib/drivers/gpib] Error 2

I resolved this by adding a #ifdef CONFIG_PCI around the call to pci_dev_get

I re-make and all the kernel modules compile successfully.
Running file on one of the modules indicated it was an ARM binary. Oddly, some of the test binary tools like gpib_config and ibtest were listed as x86 binaries. When I tried make install, I can't get past the following errors:

cc1: error: unrecognized command line option "-m64"
cc1: error: unrecognized command line option "-mno-red-zone"
cc1: error: unrecognized command line option "-mcmodel=kernel"
cc1: error: unrecognized command line option "-maccumulate-outgoing-args"

When I run ${CROSS_COMPILE}gcc -dumpspecs and grep for the above options, they're not listed. However when I run gcc -dumpspecs and grep for the above options, they are listed. Some how the specs for my local copy of gcc are being included in the make install.

I believe there are some issues with the automake scripts because gpib_config and ibtest are still x86 binaries and somehow local gcc specs are being used instead of the cross compiler's specs.

The kernel source I'm using is based on the linux-omap tree and I've been cross compiling it successfully for months using the same cross compiler.

Any help would be greatly appreciated.

Discussion

  • spathis

    spathis - 2013-02-05

    Hi,

    I am also desperately trying to build linux-gpib on a raspberry pi (ARM architecture also) to use a NI GPIB-USB-HS adapter.
    I am stuck at the very same situation with Paul.
    Any clue on how to proceed ?

    Thanks

     
  • Andreas Huettel

    Andreas Huettel - 2013-05-27

    I don't think the issue is with the linux-gpib files (I have just completed 99% successfully a native build of 3.2.17(plus r1600) on armv5tel [*]; the only errors were the unresolved symbols request_dma and free_dma in pc2_gpib.ko as above, but the binaries were all generated fine). Please check your cross-compile environment- do you mabe have special arm equivalents for the automake/autoconf binaries, similar to ${CROSS_COMPILE}gcc as the arm gcc? configure.log might be interesting, too.

    [*]
    cassis portage # uname -a
    Linux cassis 3.7.10-gentoo #2 Mon Apr 1 07:44:36 CEST 2013 armv5tel Feroceon 88FR131 rev 1 (v5l) Marvell OpenRD Ultimate Board GNU/Linux

     
  • odo2064

    odo2064 - 2016-02-05

    Hi!

    Where in the world would someone want to crosscompile this for the Raspi??? it doesn't take 5 minutes even on Raspi1.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.