4 Replies Latest reply on Apr 30, 2015 11:29 AM by mhahn

    How to build a kernel module on the Edison?

    wojci

      I tried to build a kernel module on the Edison. The output was as follows:

       

      root@edison:~/mt7601/src# make

      make: Warning: File '/home/root/mt7601/src/os/linux/config.mk' has modification time 630897 s in the future

      make -C tools

      make[1]: Entering directory '/home/root/mt7601/src/tools'

      make[1]: Warning: File 'Makefile' has modification time 608670 s in the future

      gcc -g bin2h.c -o bin2h

      make[1]: warning:  Clock skew detected.  Your build may be incomplete.

      make[1]: Leaving directory '/home/root/mt7601/src/tools'

      /home/root/mt7601/src/tools/bin2h

      cp -f os/linux/Makefile.6 /home/root/mt7601/src/os/linux/Makefile

      make -C /lib/modules/3.10.17-yocto-standard/build SUBDIRS=/home/root/mt7601/src/os/linux modules

      make[1]: *** /lib/modules/3.10.17-yocto-standard/build: No such file or directory.  Stop.

      Makefile:394: recipe for target 'LINUX' failed

      make: *** [LINUX] Error 2

       

      The source is this git: porjo/mt7601 · GitHub

       

      The quality of this driver and build system makes it hard (for me at least) to build it using a recipe as part of building a Yocto distribution. Building works on my Ubuntu box and this is why I thought that I could build it directly on the Edison.

       

      What do I need to enable to get "/lib/modules/3.10.17-yocto-standard/build" directory on the Edison? Why is this directory not a part of the default install?

        • 1. Re: How to build a kernel module on the Edison?
          mhahn

          if you do have a Yocto build system set up already you could do the following:

          run "bitbake -c devshell linux-yocto"

          This would open a new root shell which

          • has all relevant binutils environment variables set accordingly, e.g.

                    # echo $CXX

                       i586-poky-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer --sysroot=<Yocto path>/build/tmp/sysroots/edison

          • sets paths for binutils ...

                    # echo $PATH

                    <Yocto path>/poky/scripts:<Yocto path>/build/tmp/sysroots/x86_64-linux/usr/bin/core2-32-poky-linux:<Yocto path>/build/tmp/sysroots/edison/usr/bin/crossscripts:<Yocto path>/build/tmp/sysroots/x86_64-linux/usr/sbin:<Yocto path>/build/tmp/sysroots/x86_64-linux/usr/bin:<Yocto path>/build/tmp/sysroots/x86_64-linux/sbin:<Yocto path>/build/tmp/sysroots/x86_64-linux/bin:<Yocto path>/poky/scripts:/Android/edison-src/poky/bitbake/bin:<default $PATH>

          • is already in the linux directory of your Yocto Linux environment

                    # pwd

                    <Yocto path>/build/tmp/work/edison-poky-linux/linux-yocto/3.10.17+gitAUTOINC+6ad20f049a_c03195ed6e-r0/linux

           

          here you could try to put your sources and compile there - note however, that this folder might easily be overwritten at some later stage. So your modifications are not permanent

          • 2. Re: How to build a kernel module on the Edison?
            wojci

            Thank you for your reply.

             

            The build system from that driver was probably why the driver was rejected from the Linux kernel. It is broken. It does not use the standard environment variables and has hardcoded paths in its makefile. Cross compiling is not an option IMHO. This is why I wanted to build it on the device.

            • 3. Re: How to build a kernel module on the Edison?
              nniles

              wojci wrote:

               

              I tried to build a kernel module on the Edison. The output was as follows:

               

              root@edison:~/mt7601/src# make

              make: Warning: File '/home/root/mt7601/src/os/linux/config.mk' has modification time 630897 s in the future

              make -C tools

              make[1]: Entering directory '/home/root/mt7601/src/tools'

              make[1]: Warning: File 'Makefile' has modification time 608670 s in the future

              gcc -g bin2h.c -o bin2h

              make[1]: warning:  Clock skew detected.  Your build may be incomplete.

              make[1]: Leaving directory '/home/root/mt7601/src/tools'

              /home/root/mt7601/src/tools/bin2h

              cp -f os/linux/Makefile.6 /home/root/mt7601/src/os/linux/Makefile

              make -C /lib/modules/3.10.17-yocto-standard/build SUBDIRS=/home/root/mt7601/src/os/linux modules

              make[1]: *** /lib/modules/3.10.17-yocto-standard/build: No such file or directory.  Stop.

              Makefile:394: recipe for target 'LINUX' failed

              make: *** [LINUX] Error 2

               

              The source is this git: porjo/mt7601 · GitHub

               

              The quality of this driver and build system makes it hard (for me at least) to build it using a recipe as part of building a Yocto distribution. Building works on my Ubuntu box and this is why I thought that I could build it directly on the Edison.

               

              What do I need to enable to get "/lib/modules/3.10.17-yocto-standard/build" directory on the Edison? Why is this directory not a part of the default install?

               

              Well, if you look at the /lib/modules/(kernelversion)/ directory on Ubuntu, you'll see that it is a symlink to the kernel headers.

               

              It doesn't look like there's a good way to get the kernel headers installed on the Edison (at least the current version), so your best bet is probably going to be writing a recipe.  See here: Yocto Project Linux Kernel Development Manual.

               

              Thanks,