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

Compiling kernel modules

Hi,

I need to modify the code of the kernel driver (hsu/mfd_core for work with RS485). I learned how to make changes to the kernel, but Bitbake reloads source codes and compiles whole kernel anew. After that I have to create an image and reflash it. It is too long. Is there a possibility of separating the module from the image and its compilation as .ko? Can I read anything about it?

0 Kudos
12 Replies
idata
Community Manager
70 Views

Hello shmkv,

 

 

I will try to help you with this. To make a module of a driver you will have to make changes to the kernel while building it. You will have to modify the Linux kernel config file and on the specific driver you need, change its option to "m".

 

 

Could you please share with us the steps you have taken so far?

 

We will be waiting for your response.

 

-Peter.
idata
Community Manager
70 Views

Hello Peter,

I do a kernel cleanup:

bitbake -f -c clean virtual/kernel

after that I run compiling the kernel:

bitbake -f -c compile virtual/kernel

Before compiling the build script reloads the source code, and I am forced to replace the necessary files. I know what I'm doing wrong, but I don't know how to make a compile locally.

/.setup.sh --mode=devenv

command doesn't work (build environment 20160606)

 

idata
Community Manager
70 Views

You will have to modify the Linux kernel config file and on the specific driver you need, change its option to "m"

I need to replace in file i386_edison_defconfig "y" to"m" for the desired option (CONFIG_SERIAL_MFD_HSU=m)?

And can I then compile this module separately? If so, how do I do that?

idata
Community Manager
70 Views

Hi shmkv,

 

 

Yes, in order to create a module of a kernel driver, you have to use the option 'm' on the kernel configuration. When you finish building the image I'd suggest you to search for the modules using the command find -name mfd_core*.

 

 

Also, the user @dbaba has a thread very similar to yours in which he compiles a kernel driver into a module. I suggest you to check it out, I believe it would be of much help for you. It can be found in https://communities.intel.com/message/422223# 422223 https://communities.intel.com/message/422223# 422223.

 

 

I hope this helps.

 

-Peter.
idata
Community Manager
70 Views

Hello shmkv,

 

 

Do you have any updates about this?

 

 

-Peter.
idata
Community Manager
70 Views

Hello Peter,

I changed the configuration of the kernel, but when building having problems with unresolved symbols. Now I'm trying to understand the reason. I'll post more information later. I also do not understand how to build kernel modules separately. I found a similar topic ( ), but I have the same problem with the version of the kernel.

idata
Community Manager
70 Views

Thanks for the update shmkv, please do keep us updated.

 

 

Have you checked the thread I posted above? It explains how to create a kernel module I thought it might be of help for you.

 

 

-Peter.
idata
Community Manager
70 Views

Hello Peter,

Yes, I have read the thread. I do about the same thing.

It explains how to create a kernel module I thought it might be of help for you.

Yes, it explains how to create a module. I will have a lot of iterations correction code->compiling module->testing. I would like to find the most convenient and fastest way to do this.

 

I have still problems with kernel compilation. I am trying to understand what a hsu_register_board_info. See build console:

You can also run generated qemu images with a command like 'runqemu qemux86'

test@test-VirtualBox:~/iot-devkit-yp-poky-edison-20160606/build_edison$ bitbake virtual/kernel -c configure -f -v

WARNING: Host distribution "Ubuntu-16.04" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.

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

Loaded 2238 entries from dependency cache.

WARNING: No recipes available for:

/home/test/iot-devkit-yp-poky-edison-20160606/build_edison/../poky/meta-intel-iot-devkit/recipes-kernel/linux/linux-yocto-quark_3.8.bbappend

NOTE: selecting linux-externalsrc to satisfy virtual/kernel due to PREFERRED_PROVIDERS

NOTE: Resolving any missing task queue dependencies

NOTE: selecting pseudo-native to satisfy virtual/fakeroot-native due to PREFERRED_PROVIDERS

NOTE: selecting binutils-cross-i586 to satisfy virtual/i586-poky-linux-binutils due to PREFERRED_PROVIDERS

NOTE: selecting gcc-cross-i586 to satisfy virtual/i586-poky-linux-gcc due to PREFERRED_PROVIDERS

NOTE: selecting gcc-runtime to satisfy virtual/i586-poky-linux-compilerlibs due to PREFERRED_PROVIDERS

NOTE: selecting glibc to satisfy virtual/libc due to PREFERRED_PROVIDERS

NOTE: selecting linux-externalsrc to satisfy runtime kernel-base due to PREFERRED_PROVIDER_virtual/kernel = linux-externalsrc

NOTE: selecting linux-externalsrc to satisfy runtime kernel-image due to PREFERRED_PROVIDER_virtual/kernel = linux-externalsrc

NOTE: selecting glibc to satisfy runtime libsegfault due to PREFERRED_PROVIDER_virtual/libc = glibc

NOTE: selecting glibc to satisfy runtime glibc-dev due to PREFERRED_PROVIDER_virtual/libc = glibc

NOTE: selecting glibc to satisfy runtime glibc due to PREFERRED_PROVIDER_virtual/libc = glibc

NOTE: selecting glibc to satisfy virtual/i586-poky-linux-libc-for-gcc due to PREFERRED_PROVIDERS

NOTE: selecting linux-libc-headers to satisfy linux-libc-headers due to PREFERRED_PROVIDERS

NOTE: selecting gcc-cross-i586 to satisfy virtual/i586-poky-linux-g++ due to PREFERRED_PROVIDERS

NOTE: selecting libgcc to satisfy libgcc due to PREFERRED_PROVIDERS

NOTE: selecting gcc-cross-initial-i586 to satisfy virtual/i586-poky-linux-gcc-initial due to PREFERRED_PROVIDERS

NOTE: selecting glibc-initial to satisfy virtual/i586-poky-linux-libc-initial due to PREFERRED_PROVIDERS

NOTE: selecting linux-libc-headers to satisfy runtime linux-libc-headers-dev due to PREFERRED_PROVIDER_linux-libc-headers = linux-libc-headers

NOTE: selecting libgcc to satisfy runtime libgcc due to PREFERRED_PROVIDER_libgcc = libgcc

Build Configuration:

BB_VERSION = "1.24.0"

BUILD_SYS = "i686-linux"

NATIVELSBSTRING = "Ubuntu-16.04"

TARGET_SYS = "i586-poky-linux"

MACHINE = "edison"

DISTRO = "poky-edison"

DISTRO_VERSION = "1.7.3"

TUNE_FEATURES = "m32 core2"

TARGET_FPU = ""

meta

meta-intel-arduino

meta-intel-edison-bsp

meta-intel-edison-distro

meta-intel-iot-devkit

meta-intel-iot-middleware

meta-java

meta-oic

meta-filesystems

meta-networking

meta-oe

meta-python

meta-ruby

meta-webserver

meta-yocto

meta-yocto-bsp = ":"

NOTE: Preparing runqueue

NOTE: Marking Active Tasks

NOTE: Pruned 1262 inactive tasks, 253 left

NOTE: Assign Weightings

NOTE: Compute totals (have 1 endpoint(s))

NOTE: Invalidate task do_configure, /home/test/iot-devkit-yp-poky-edison-20160606/build_edison/../poky/meta-intel-edison/meta-intel-edison-bsp/recipes-kernel/linux/linux-externalsrc.bb

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

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

NOTE: Executing SetScene Tasks

NOTE: Executing RunQueue Tasks

+

cd /home/test/iot-devkit-yp-poky-edison-20160606/build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0

+ do_configure

+ cp /home/test/iot-devkit-yp-poky-edison-20160606/build_edison/../poky/linux-kernel/arch/x86/configs/i386_edison_defconfig /home/test/iot-devkit-yp-poky-edison-20160606/build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/.config

+ sed -i s/.*CONFIG_USB_SERIAL is not set.*/CONFIG_USB_SERIAL=y/ /home/test/iot-devkit-yp-poky-edison-20160606/build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/.config

+ sed -i s/.*CONFIG_USB_SERIAL_FTDI_SIO.*/CONFIG_USB_SERIAL_FTDI_SIO=m/ /home/test/iot-devkit-yp-poky-edison-20160606/build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/.config

+ sed -i s/.*CONFIG_USB_USBNET.*/CONFIG_USB_USBNET=y/ /home/test/iot-devkit-yp-poky-edison-20160606/build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/.config

+ sed -i s/.*CONFIG_USB_RTL8150.*/CONFIG_USB_RTL8150=m/ /home/test/iot-devkit-yp-poky-edison-20160606/build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/.config

+ sed -i s/.*CONFIG_USB_RTL8152.*/CONFIG_USB_RTL8152=m/ /home/test/iot-devkit-yp-poky-edison-20160606/build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/.config

+ sed -i s/.*CONFIG_USB_GSPCA_OV534 is not set.*/CONFIG_USB_GSPCA_OV534=m/ /home/test/iot-devkit-yp-poky-edison-20160606/build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/.config

+ sed -i s/.*CONFIG_USB_GSPCA_OV534_9 is not set.*/CONFIG_USB_GSPCA_OV534_9=m/ /home/test/iot-devkit-yp-poky-edison-20160606/build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/.config

+ ret=0

+ trap 0

+ exit 0

NOTE: Checking autotools environment for common misconfiguration

NOTE: linux-externalsrc: md5 checksum matched for file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7

NOTE: Tasks Summary: Attempted 253 tasks of which ...

idata
Community Manager
70 Views

The first thing that caught my eye was the following line:

 

 

"WARNING: Host distribution "Ubuntu-16.04" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution."

 

 

This tells me that you are using Ubuntu 16 and as it is stated in that line you might experience unexpected issues. So, if possible, I would suggest you to install an Ubuntu distribution that is compatible with the BSP. You can check the supported Linux distributions in section 1.3.1 of Yocto's Mega Manual ( http://www.yoctoproject.org/docs/1.7.3/mega-manual/mega-manual.html).

 

 

Have you been able to build the standard image? Or do you also have this issue when trying to build it?

 

 

Let me know.

 

-Peter.
idata
Community Manager
70 Views

Hi Peter

Have you been able to build the standard image? Or do you also have this issue when trying to build it?

Yes, standard image is well being built. Moreover, I added the modules in the kernel without any problems, but problems arise when using CONFIG_SERIAL_MFD_HSU=m.

I will try to use ubuntu 14. I didn't think that it can significantly affect the build process.

idata
Community Manager
70 Views

I understand. Please do try with Ubuntu 14 and let us know how it goes.

 

 

We'll be waiting for your response.

 

-Peter.
idata
Community Manager
70 Views

Hello shmkv,

 

 

Do you have any updates about this?

 

 

-Peter.
Reply