Compile a module in the host (T2080RDB)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Compile a module in the host (T2080RDB)

Jump to solution
3,850 Views
manoloruiz
Contributor III

Hi,

I am try to compile a module in my t2080RDB working with the SDK 1.8 that is given by Freescale. However, I cannot succeed.

What do I want? I want to compile a module in the host.
What is the problem? I do not have the kernel headers in my host (T2080RDB) after a bitbake fsl-image-full and turn the T2080 on with the result files.

How can I get the kernel headers for my T2080RDB?

If this is not possible, how can I compile only a module  (not a full version of the system) in the yocto enviroment?

Thanks a lot.

Labels (1)
0 Kudos
Reply
1 Solution
2,157 Views
bpe
NXP Employee
NXP Employee

Please read carefully the recommended documentation, it will help you

to understand what you are doing. The suggestions given earlier in

this thread are for building a module on the _host_. This document

specifies clearly where to locate kernel sources after unpacking:

http://www.freescale.com/infocenter/topic/QORIQSDK/3069694.html

They are _not_ automatically transferred to the target root filesystem.

Your makefile is not valid for cross-compiling a module because it

sets a wrong path to the kernel source directory. Again, study the

modules.txt as recommended, and specify the unpacked kernel location

after -C option to make.

For building on the target, transfer the kernel sources to the

target by hand and follow the same procedure.


Have a great day,
Platon

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
7 Replies
2,157 Views
bpe
NXP Employee
NXP Employee

If you want to build an off-kernel module with Yocto, you need to

create a separate package that depends on the kernel. The 'cryptodev'

package is as an example.

External module build procedures are described in details in

Documentation/kbuild/modules.txt. The path is from the top kernel source directory.

Some additional information can be found here:

http://www.tldp.org/LDP/lkmpg/2.6/html/x181.html


Have a great day,
Platon

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
2,157 Views
manoloruiz
Contributor III

Thank for your answer. However, it does not work. When we build the de system with the comand  bitbake fsl-image-full, we cannot find the next directory:

/lib/modules/$(shell uname -r)/build

In this directory should be the kernel headers. But it is not. Where can I get the headers? Are there alternative procedure to build a module?

0 Kudos
Reply
2,157 Views
bpe
NXP Employee
NXP Employee

Use the commands specified in Section 2.1 of the first document, modules.txt. You need to build the kernel first:

Customizing Linux Kernel

0 Kudos
Reply
2,157 Views
manoloruiz
Contributor III

Thank for your answer. This are the steps I have followed:

1. I have reinstall sdk 1.8 freescale in my PC.

2. I  typed  ./poky/scripts/host-prepare.sh

3. I typed source ./poky/fsl-setup-poky -m t2080rdb

4. I typed . /home/user/QorIQ-SDK-V1.8-20150619-yocto/build_t2080rdb_release/SOURCE_THIS

5. I typed bitbake -c menuconfig virtual/kernel and safe ".conf"

6. I typed bitbake -c compile -f virtual/kernel

7. I typed bitbake virtual/kernel

With those steps I haved the  compiled kernel (no headers) in ../build_t2080rdb_release/tmp/deploy/images/t2080rdb/

Afterward, I came back to /home/user/build_t2080rdb_release.

8. I typed bitbake fsl-image-full

After a while, I get in the next directory : /home/user/QorIQ-SDK-V1.8-20150619-yocto/build_t2080rdb_release/tmp/deploy/images/t2080rdb/. I can find a root file system called "fsl-image-full-t2080rdb-20150907191330.rootfs.tar.gz". This is the root file system which is going to be in the t2080rdb.

After follow this steps, I cannot find the following directories:  /usr/src/header<version>/ or /lib/modules/$(shell uname -r)/build

Without this directory(usr/src/header<version> in ubuntu) or the soft link (/lib/modules/$(shell uname -r)/build) is not possible to compile a module in the target ( in the T2080rdb). What am I doing wrong? I want to compile in the target. If it is not possible, I would like to compile in the host, but I don't know how to do it.

I am using the next Makefile which works in ubuntu for example:

ifneq ($(KERNELRELEASE),)
# kbuild part of makefile
obj-m  :=new14.o
else
# normal makefile
  KDIR ?= /lib/modules/`uname -r`/build
default:
  $(MAKE) -C $(KDIR) M=$$PWD
endif

Thanks.

0 Kudos
Reply
2,157 Views
manoloruiz
Contributor III

I have kept on looking for solution. I haven't found yet. In the new realease of yocto (after daisy that is working in freescale sdk 1.8), there is a method:

Yocto Project Linux Kernel Development Manual


2.5.1. Building Out-of-Tree Modules on the Target:

# cd /usr/src/kernel
# make scripts

Because all SDK image recipes include dev-pkgs, the kernel-dev packages will be installed as part of the SDK image and thekernel-devsrc packages will be installed as part of applicable SDK images. The SDK uses the scripts when building out-of-tree modules. Once you have switched to that directory and created the scripts, you should be able to build your out-of-tree modules on the target.

However, I cannot find in my sdk image that works in the target (T2080rdb) the directory /usr/src/kernel.  What can I do?

thanks a lot.

0 Kudos
Reply
2,158 Views
bpe
NXP Employee
NXP Employee

Please read carefully the recommended documentation, it will help you

to understand what you are doing. The suggestions given earlier in

this thread are for building a module on the _host_. This document

specifies clearly where to locate kernel sources after unpacking:

http://www.freescale.com/infocenter/topic/QORIQSDK/3069694.html

They are _not_ automatically transferred to the target root filesystem.

Your makefile is not valid for cross-compiling a module because it

sets a wrong path to the kernel source directory. Again, study the

modules.txt as recommended, and specify the unpacked kernel location

after -C option to make.

For building on the target, transfer the kernel sources to the

target by hand and follow the same procedure.


Have a great day,
Platon

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
2,157 Views
c2357
Contributor I

I am having the same problem, but that article no longer seems to exist.  Could you update this answer?

0 Kudos
Reply