Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
1,781 Views

How to build cdc_ether.ko?

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 http://wiki.openmoko.org/wiki/Network_Troubleshooting 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

0 Kudos
8 Replies
idata
Community Manager
162 Views

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.
idata
Community Manager
162 Views

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 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 = ":"

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

meta-intel-arduino = ":"

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...

idata
Community Manager
162 Views

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.
idata
Community Manager
162 Views

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

Because I followed the procedure introduced in the http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonbsp_ug_331188007.pdf 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 https://lists.yoctoproject.org/pipermail/yocto/2016-April/029314.html 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.

idata
Community Manager
162 Views

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.
idata
Community Manager
162 Views

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

idata
Community Manager
162 Views

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
lxiao17
Beginner
162 Views

"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