5 Replies Latest reply on Feb 28, 2016 8:02 AM by nullptr2this

    Cross Compilation Woes

    nullptr2this

      Hi, I'm trying to compile a driver for a simple USB serial device I am planning to connect to the Edison via the USB serial port provided by the mini breakout board.

       

      I am having difficulties with the driver developer's make file finding any of the linux header files it requires, specifically linux/linkage.h and asm/linkage.h.

       

      I have installed the sdk tool chain (/opt/poky-edison/1.7.2 and it's ilk are present) and I have sourced the environment setup file (environment-setup-core2-32-poky-linux) in my shell.

       

      The makefile in questions use KERNELDIR := $(shell echo "/lib/modules/`uname -r`/build") and INCLUDEDIR = $(KERNELDIR)/include.  KERNEL can be overridden and is only set if not already defined.  It is my understanding that when cross compiling (environment-setup-core2-32-poky-linux has been sourced in the current shell) I should be able to set KERNELDIR to some path within /opt/poky-edison/1.7.2/sysroots/core2-32-poky-linux and I should find that the include paths should line up, I should be able to include standard linux header files, and they should be found by the compiler.

       

      My initial inclination was to try to set KERNELDIR:=/opt/poky-edison/1.7.2/sysroots/core2-32-poky-linux/lib/modules/3.10.17-poky-edison+/build, however unlike the linux-generic header paths on my host machine (I'm running Ubuntu 14.04 by the way) I don't see a build dir under 3.10.17-poky-edison+ and I have been unable to locate linkage.h anywhere in the /opt/poky-edison/1.7.2 directory structure.

       

      I do see that a great many of the linux headers appear in /opt/poky-edison/1.7.2/sysroots/core2-32-poky-linux/usr/include/, including the linux and asm directories in which I would expect to find the linkage.h headers I am looking for but they are not present.

       

      Anyone have any ideas how to resolve this issue?  Thanks!

        • 1. Re: Cross Compilation Woes
          Intel_Peter

          Hello nullptr2this,

           

          Are you building the Edison's SDK or are you downloading it? Which version are you using?

          Why are you looking for linkage.h in the SDK? If you want to build a driver for Edison I suggest you to do it from the host PC using the board's BSP.

          In fact linkage.h is not included in the image by default, you have to manually add it to the image. In case you need it, linkage.h can be found in edison-linux/linkage.h at master · 01org/edison-linux · GitHub

           

          Peter.

          • 2. Re: Cross Compilation Woes
            nullptr2this

            Peter,

             

            Thanks for the reply.  I appreciate the help.

             

            I've tried both downloading and installing the SDK and building the SDK.  I'm using the latest source for 2.1.

             

            I'm not specifically looking for linkage.h myself.  The .h/.c files of the driver I'm trying to compile (ftdi sio) import linux/linkage.h, which in turn imports asm/linkage.h.  I don't know that I'm really looking for that in the SDK per se.  I was under the impression that if I installed or built the SDK that I would be able to source the cross compilation tools and then compile.  It sounds like I need to do this with a yocto/bitbake recipe?

             

            I plan to create a custom image with which to flash my devices at some point anyway so that will work.  I was just hoping to prove out several of my plans without customizing the image or the SDK prior to diving into writing recipes, etc.  I've been able to adhoc load C, C++, Python and a lot of systemd configuration onto the device without getting involved in the BSP and was hoping to do the same with drivers just until I get my POC up and running.  Then I was going to move on to working with bitbake and recipes for all of my customizations.

             

            So I just need to setup the driver compilation using the BSP, include linkage.h in the image generation, and I should be good?

            • 3. Re: Cross Compilation Woes
              Intel_Peter

              Yes, if you'd like to include a driver into the Edison's image, I believe you should add it to the image using the BSP. You will have to enable the kernel module with menuconfig or in the defconfig file. If I'm not mistaken, the driver should find linkage.h if you include it in the image and after that you shouldn't have problems.

               

              The thing with drivers is that many of them reach kernel level and sometimes it's preferable to build them directly in the image as a yocto/bitbake recipe. I understand it represents a lot more work but sometimes you can avoid issues that would appear if it was simply installed.

               

              Peter.

              • 4. Re: Cross Compilation Woes
                CMata_Intel

                Hi nullptr2this,

                 

                I would like to know if you have been able to work on your driver.

                 

                Regards,

                Charlie

                • 5. Re: Cross Compilation Woes
                  nullptr2this

                  Charlie,

                   

                  I've been side tracked with other things and have a few other customizations I need to build into my custom image (mostly just serviced configuration) and wanted to get everything lined up before trying to build it.  That work will likely begin tonight.

                   

                  Thanks for checking up.

                   

                  --Jon