8 Replies Latest reply on Oct 14, 2016 8:09 AM by 立Q

    How to build cdc_ether.ko?

    dbaba

      I'm getting stuck with building a kernel module in Edison source version 3.5 (I guess it the latest code available from Intel Edison download site).

      I was able to launch the menuconfig by the following command:

         bitbake virtual/kernel -c menuconfig

      It worked on my Desktop version of Ubuntu 14.04 (but didn't work on Ubuntu 16.04 because of invalid gnome parameter -t).

      However, I failed to look up an item corresponding to CONFIG_USB_NET_CDCETHER.

       

      According to the site (wiki.openmoko.org), "CDC Ethernet support (smart devices such as cable modems)" is the item I must get but no luck so far.

       

      Is there any way to build the cdc kernel module? Any suggestions and help are appreciated.

      Thanks in advance.

      dbaba

        • 1. Re: How to build cdc_ether.ko?
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello dbaba,

          We will try to help you add this module to your image's kernel. Could you please explains us steps by step what you've tried so far? 

          If the building process has thrown any error messages, could you also post a screenshot of those error messages?

          Please be as detailed as possible, every detail you can provide us will be of much help.
          We will be waiting for your response.
          -Peter.

          • 2. Re: How to build cdc_ether.ko?
            dbaba

            Hi Peter,

             

            Discard my previous response, I was wrong. cdc_ether.ko is required as well.

             

            And with menuconfig, I couldn't find an option to create cdc_ether.ko. So I didn't do anything with it. I gave up to use menuconfig for now.

            I had tried another way, which caused an error when I ran bitbake command to create the module. So I'd like to share it with you and ask you to give me advices.

             

            - GOAL: I'd like to create a USB ethernet kernel module (cdc_ether.ko) for 3.10.98-poky-edison+ kernel

            - SOURCE CODE URL:

            http://iotdk.intel.com/src/3.5/edison/iot-devkit-yp-poky-edison-20160606.zip

            (from a Dockerfile at a SkulltronixTeam's GitHub repository.

            The reason why I picked it up from the Dockerfile is because I couldn't find a link to the source archive file at the official download site(https://downloadcenter.intel.com/download/25871). Where is it?)

            - OS: Ubuntu 16.04 (not desktop)

            I used vagrant with virtual box on my mac. The box I used is bento/ubuntu-16.04.

             

            Step1:

            SSH to Ubuntu and install required dependencies

            $ apt-get update

            $ apt-get install -y build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib curl python wget unzip

             

            Step2:

            Download the source code archive and expand it

            $ curl -L -o edison-src.zip http://iotdk.intel.com/src/3.5/edison/iot-devkit-yp-poky-edison-20160606.zip

            $ unzip edison-src.zip

            $ cd iot-devkit-yp-poky-edison-20160606/poky

             

            Step3:

            Prepare directories

            $ mkdir bitbake_download_dir

            $ mkdir bitbake_sstate_dir

            $ ./meta-intel-edison/setup.sh --dl_dir=./bitbake_download_dir --sstate_dir=./bitbake_sstate_dir

             

            Step4:

            Fix paho issue(https://communities.intel.com/thread/101849)

            $ vi ./out/linux64/poky/meta-intel-iot-middleware/recipes-connectivity/paho-mqtt/paho-mqtt_3.1.bb

            Go to line:14 and replace git://git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.c.git with git://github.com/eclipse/paho.mqtt.c.git

             

            Step5:

            Build an image without any configuration changes

            $ cd ./out/linux64/

            $ source poky/oe-init-build-env

            $ touch conf/sanity.conf

            $ bitbake edison-image # This takes 2+ hours long...

             

            Step6:

            Clean linux-externalsrc

            $ bitbake -f -c clean linux-externalsrc

            This will discard the local changes under "poky/linux-kernel" directory

             

            Step7:

            Modify kernel config in order for bitbake to create cdc_ether.ko by specifying CONFIG_USB_NET_CDCETHER=m (was # CONFIG_USB_NET_CDCETHER is not set).

            $ vi ../../../linux-kernel/arch/x86/configs/i386_edison_defconfig # This is a part of linux-externalsrc package

            Replace "# CONFIG_USB_NET_CDCETHER is not set" with "CONFIG_USB_NET_CDCETHER=m" and save it

             

            Step8:

            Build a kernel module

            $ bitbake -f -c configure linux-externalsrc

            $ bitbake -f -c compile linux-externalsrc

             

            Now I got the following error. How can I build a kernel module?

            ==============

             

             

            Loading cache: 100% |#######################################################################################################################################################################| ETA:  00:00:00

            Loaded 1367 entries from dependency cache.

            NOTE: Resolving any missing task queue dependencies

             

             

            Build Configuration:

            BB_VERSION        = "1.24.0"

            BUILD_SYS         = "x86_64-linux"

            NATIVELSBSTRING   = "Ubuntu-16.04"

            TARGET_SYS        = "i586-poky-linux"

            MACHINE           = "edison"

            DISTRO            = "poky-edison"

            DISTRO_VERSION    = "1.7.2"

            TUNE_FEATURES     = "m32 core2"

            TARGET_FPU        = ""

            meta             

            meta-yocto       

            meta-yocto-bsp    = "(HEADdetachedatyocto-1.7.2):29812e61736a95f1de64b3e9ebbb9c646ebd28dd"

            meta-intel-edison-bsp

            meta-intel-edison-distro = "<unknown>:<unknown>"

            meta-intel-iot-middleware = "(HEADdetachedatc6d6814):c6d681475e76107e6c04c5f7a06034dc9e772d1e"

            meta-intel-arduino = "<unknown>:<unknown>"

            meta-arduino      = "1.6.x:541b127163acb243109f07141bf249da2ecdcd9a"

             

             

            NOTE: Preparing runqueue

            NOTE: Tainting hash to force rebuild of task /home/vagrant/work/iot-devkit-yp-poky-edison-20160606/poky/meta-intel-edison/meta-intel-edison-bsp/recipes-kernel/linux/linux-externalsrc.bb, do_compile

            WARNING: /home/vagrant/work/iot-devkit-yp-poky-edison-20160606/poky/meta-intel-edison/meta-intel-edison-bsp/recipes-kernel/linux/linux-externalsrc.bb.do_configure is tainted from a forced run

            WARNING: /home/vagrant/work/iot-devkit-yp-poky-edison-20160606/poky/meta-intel-edison/meta-intel-edison-bsp/recipes-kernel/linux/linux-externalsrc.bb.do_compile is tainted from a forced run

            NOTE: Executing SetScene Tasks

            NOTE: Executing RunQueue Tasks

            NOTE: validating kernel config, see log.do_kernel_configcheck for details

            ERROR: Function failed: do_compile (log file is located at /home/vagrant/work/iot-devkit-yp-poky-edison-20160606/poky/out/linux64/build/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/temp/log.do_compile.19758)

            ERROR: Logfile of failure stored in: /home/vagrant/work/iot-devkit-yp-poky-edison-20160606/poky/out/linux64/build/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/temp/log.do_compile.19758

            Log data follows:

            | DEBUG: Executing shell function do_compile

            | NOTE: make -j 4 bzImage CC=i586-poky-linux-gcc  LD=i586-poky-linux-ld.bfd

            |   HOSTCC  scripts/basic/fixdep

            |   GEN     /home/vagrant/work/iot-devkit-yp-poky-edison-20160606/poky/out/linux64/build/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/Makefile

            |   HOSTCC  scripts/kconfig/conf.o

            |   SHIPPED scripts/kconfig/zconf.hash.c

            |   SHIPPED scripts/kconfig/zconf.lex.c

            |   SHIPPED scripts/kconfig/zconf.tab.c

            |   HOSTCC  scripts/kconfig/zconf.tab.o

            |   HOSTLD  scripts/kconfig/conf

            | scripts/kconfig/conf --silentoldconfig Kconfig

            | *

            | * Restart config...

            | *

            | *

            | * USB Network Adapters

            | *

            | USB CATC NetMate-based Ethernet device support (USB_CATC) [N/m/y/?] n

            | USB KLSI KL5USB101-based ethernet device support (USB_KAWETH) [N/m/y/?] n

            | USB Pegasus/Pegasus-II based ethernet device support (USB_PEGASUS) [N/m/y/?] n

            | USB RTL8150 based ethernet device support (USB_RTL8150) [N/m/y/?] n

            | Realtek RTL8152 Based USB 2.0 Ethernet Adapters (USB_RTL8152) [N/m/y/?] n

            | Multi-purpose USB Networking Framework (USB_USBNET) [Y/n/m/?] y

            |   ASIX AX88xxx Based USB 2.0 Ethernet Adapters (USB_NET_AX8817X) [Y/n/m/?] y

            |   ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet (USB_NET_AX88179_178A) [N/m/y/?] n

            |   CDC Ethernet support (smart devices such as cable modems) (USB_NET_CDCETHER) [M/n/y/?] m

            |   CDC EEM support (USB_NET_CDC_EEM) [N/m/y/?] n

            |   CDC NCM support (USB_NET_CDC_NCM) [Y/n/m/?] y

            |   CDC MBIM support (USB_NET_CDC_MBIM) [N/m/y/?] n

            |   Davicom DM9601 based USB 1.1 10/100 ethernet devices (USB_NET_DM9601) [N/m/y/?] n

            |   SMSC LAN75XX based USB 2.0 gigabit ethernet devices (USB_NET_SMSC75XX) [N/m/y/?] n

            |   SMSC LAN95XX based USB 2.0 10/100 ethernet devices (USB_NET_SMSC95XX) [N/m/y/?] n

            |   GeneSys GL620USB-A based cables (USB_NET_GL620A) [N/m/y/?] n

            |   NetChip 1080 based cables (Laplink, ...) (USB_NET_NET1080) [N/m/y/?] n

            |   Prolific PL-2301/2302/25A1 based cables (USB_NET_PLUSB) [N/m/y/?] n

            |   MosChip MCS7830 based Ethernet adapters (USB_NET_MCS7830) [N/m/y/?] n

            |   Host for RNDIS and ActiveSync devices (USB_NET_RNDIS_HOST) [N/m/y/?] n

            |   Simple USB Network Links (CDC Ethernet subset) (USB_NET_CDC_SUBSET) [Y/n/m/?] y

            |     ALi M5632 based 'USB 2.0 Data Link' cables (USB_ALI_M5632) [N/y/?] n

            |     AnchorChips 2720 based cables (Xircom PGUNET, ...) (USB_AN2720) [N/y/?] n

            |     eTEK based host-to-host cables (Advance, Belkin, ...) (USB_BELKIN) [N/y/?] n

            |     Embedded ARM Linux links (iPaq, ...) (USB_ARMLINUX) [N/y/?] n

            |     Epson 2888 based firmware (DEVELOPMENT) (USB_EPSON2888) [N/y/?] n

            |     KT Technology KC2190 based cables (InstaNet) (USB_KC2190) [N/y/?] n

            |   Sharp Zaurus (stock ROMs) and compatible (USB_NET_ZAURUS) [N/m/y/?] n

            |   Conexant CX82310 USB ethernet port (USB_NET_CX82310_ETH) [N/m/y/?] n

            |   Samsung Kalmia based LTE USB modem (USB_NET_KALMIA) [N/m/y/?] n

            |   QMI WWAN driver for Qualcomm MSM based 3G and LTE modems (USB_NET_QMI_WWAN) [N/m/y/?] n

            | Option USB High Speed Mobile Devices (USB_HSO) [N/m/y/?] n

            | Intellon PLC based usb adapter (USB_NET_INT51X1) [N/m/y/?] n

            | Apple iPhone USB Ethernet driver (USB_IPHETH) [N/m/y/?] n

            | USB-to-WWAN Driver for Sierra Wireless modems (USB_SIERRA_NET) [N/m/y/?] n

            | LG VL600 modem dongle (USB_VL600) [N/m/?] (NEW) aborted!

            |

            | Console input/output is redirected. Run 'make oldconfig' to update configuration.

            |

            | /home/vagrant/work/iot-devkit-yp-poky-edison-20160606/poky/linux-kernel/scripts/kconfig/Makefile:36: recipe for target 'silentoldconfig' failed

            | make[3]: *** [silentoldconfig] Error 1

            | /home/vagrant/work/iot-devkit-yp-poky-edison-20160606/poky/linux-kernel/Makefile:505: recipe for target 'silentoldconfig' failed

            | make[2]: *** [silentoldconfig] Error 2

            |   SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h

            |   SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h

            |   SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h

            |   SYSTBL  arch/x86/syscalls/../include/generated/asm/syscalls_32.h

            | make[1]: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/kernel.release'.  Stop.

            | make[1]: *** Waiting for unfinished jobs....

            | Makefile:130: recipe for target 'sub-make' failed

            | make: *** [sub-make] Error 2

            | ERROR: oe_runmake failed

            | WARNING: exit code 1 from a shell command.

            | ERROR: Function failed: do_compile (log file is located at /home/vagrant/work/iot-devkit-yp-poky-edison-20160606/poky/out/linux64/build/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/temp/log.do_compile.19758)

            ERROR: Task 8 (/home/vagrant/work/iot-devkit-yp-poky-edison-20160606/poky/meta-intel-edison/meta-intel-edison-bsp/recipes-kernel/linux/linux-externalsrc.bb, do_compile) failed with exit code '1'

            NOTE: Tasks Summary: Attempted 255 tasks of which 253 didn't need to be rerun and 1 failed.

             

             

            Summary: 1 task failed:

              /home/vagrant/work/iot-devkit-yp-poky-edison-20160606/poky/meta-intel-edison/meta-intel-edison-bsp/recipes-kernel/linux/linux-externalsrc.bb, do_compile

            Summary: There were 2 WARNING messages shown.

            Summary: There was 1 ERROR message shown, returning a non-zero exit code.

            1 of 1 people found this helpful
            • 3. Re: How to build cdc_ether.ko?
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              In step 3, why did you manually set the download and sstate directories? I noticed that you built your image following different steps from the normal procedure, which is specified in the file called README.edison that is included in the image's source. Is there a specific reason for that? I mean, I would like to understand everything you are doing before telling you that you're doing something wrong (when you might not be).

              Also, how are you adding the cdc_ether.ko module? I mean in step 7 I can see that you modified the kernel configuration but I did not see that you added a recipe or a layer for this module, is there a reason for this?

              I'll be waiting for your response.
              -Peter.

              • 4. Re: How to build cdc_ether.ko?
                dbaba

                In step 3, why did you manually set the download and sstate directories?

                Because I followed the procedure introduced in the document . But it seems to be a little bit old.

                In addition, the normal procedure described in README.edison didn't work for me. The process showed errors as shown below.

                I tried the normal procedure described in README.edison, here is a list of commands I ran.

                1. Start vagrant with Ubuntu 14.04 box (box-cutter/ubuntu1404-desktop)
                2. sudo apt-get update
                3. sudo apt-get install -y build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib curl python wget unzip
                4. unzip iot-devkit-yp-poky-edison-20160606.zip
                5. cd iot-devkit-yp-poky-edison-20160606/poky/
                6. source oe-init-build-env ../build_edison/
                7. touch conf/sanity.conf # This is required but not mentioned in README.edison. Without it, the procedure didn't work for me.
                8. bitbake edison-image u-boot
                9. Then I got an error saying "Install SDL devel" and I followed the advice introduced here, just disabling SDL stuff in local.conf
                10. bitbake edison-image u-boot # again after the saving local.cof
                11. Again, I got another error showing "Make sure to have the alsa libs and headers installed."

                 

                Like that, I couldn't make progress.

                 

                Could you please show me the correct way to build the image?

                This is off-topic. I'd like to know how do I build a kernel module in the 3.5 source code, in particular, cdc_ether.ko.

                 

                As shown in my previous post, bitbake edison-image worked in the NOT normal procedure. But with the normal procedure, not successful.

                 

                Also, how are you adding the cdc_ether.ko module? I mean in step 7 I can see that you modified the kernel configuration but I did not see that you added a recipe or a layer for this module, is there a reason for this?

                Adding the module to the edison image is not my primary goal. I'm going to copy the kernel module to the existing Edison image by running commands or a shell script on the edison console.

                 

                Any help and suggestions are appreciated.

                • 5. Re: How to build cdc_ether.ko?
                  Intel Corporation
                  This message was posted on behalf of Intel Corporation

                  I was checking the steps you took to compile the module. I noticed in step 7 that you use used the option "m", this might be affecting you. This is because "m" makes sense when you don't know exactly if you will need some feature of this module in the future. If you compile it as "m" and it turns out that this module is needed, it will be part of the image. Nevertheless, if there is no package that requires this module it will not bloat the kernel.
                  Could you please try it again changing the option to "y"?

                  Let us know how it goes.
                  -Peter.

                  • 6. Re: How to build cdc_ether.ko?
                    dbaba

                    Hi Peter,

                    I've finally built the cdc_ether.ko. Here I describe the step-by-step for people who have the same problem.

                    BTW, "m" is required for me as I need an independent file rather than a part of the kernel, which is brought by the option "m".

                     

                    Step1-Step5:

                    Same as above post.

                     

                    Step6:

                    Modify kernel config in order for bitbake to create cdc_ether.ko by specifying CONFIG_USB_NET_CDCETHER=m (was # CONFIG_USB_NET_CDCETHER is not set).

                     

                    $ cd tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0

                    $ vi .config

                     

                    Replace "# CONFIG_USB_NET_CDCETHER is not set" with "CONFIG_USB_NET_CDCETHER=m" and save it

                     

                    Step7:

                    Run make at the same directory.

                     

                    $ make oldconfig

                     

                    This outputs as follows.

                     

                    GEN    /home/vagrant/edison/edison-src/poky/out/linux64/build/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/Makefile

                    scripts/kconfig/conf --oldconfig Kconfig

                    *

                    * Restart config...

                    *

                    *

                    * USB Network Adapters

                    *

                    USB CATC NetMate-based Ethernet device support (USB_CATC) [N/m/y/?] n

                    USB KLSI KL5USB101-based ethernet device support (USB_KAWETH) [N/m/y/?] n

                      :

                      :

                      :

                    LG VL600 modem dongle (USB_VL600) [N/m/?] (NEW) n

                     

                    Then hit "n" and enter key. Then the make command ends with the following message.

                     

                    #

                    # configuration written to .config

                    #

                     

                    Step8:

                    Back to the build directory and run a command to build an entire image again.

                     

                    $ cd ../../../../../..

                    $ time bitbake edison-image

                     

                    You can remove "time". This is just showing the elapsed time.

                     

                    Step9:

                     

                    $ find -name "cdc_ether.ko"

                     

                    Will return a list of the file paths like this:

                     

                    ./tmp/work/edison-poky-linux/edison-image/1.0-r0/rootfs/lib/modules/3.10.98-poky-edison+/kernel/drivers/net/usb/cdc_ether.ko

                    ./tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/packages-split/kernel-module-cdc-ether/lib/modules/3.10.98-poky-edison+/kernel/drivers/net/usb/cdc_ether.ko

                    ./tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/package/lib/modules/3.10.98-poky-edison+/kernel/drivers/net/usb/cdc_ether.ko

                    ./tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/image/lib/modules/3.10.98-poky-edison+/kernel/drivers/net/usb/cdc_ether.ko

                    ./tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/drivers/net/usb/cdc_ether.ko

                    1 of 1 people found this helpful
                    • 7. Re: How to build cdc_ether.ko?
                      Intel Corporation
                      This message was posted on behalf of Intel Corporation

                      Those are great news! I'm glad you were able to build the driver. We appreciate that you shared the steps you took to build it, they might be of much help for other users.

                      -Peter

                      • 8. Re: How to build cdc_ether.ko?
                        立Q

                        "How to rebuild the latest image" shuld be a basic knowledge, Intel corporation as Official role,should update the document as soon as.

                        http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonbsp_ug_331188007.pdf

                        Please don't let your fans try their hard themself

                         

                        Sorry for my impolitei