kernel-dev: Edits to the "Incorporating Out-of-Tree Modules" section.
Removed the original text. (From yocto-docs rev: 0f3e89c7e6b8249cd643822f33c8168ca7cd83c9) Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
b34a14014c
commit
a0ac336801
|
@ -659,73 +659,6 @@
|
||||||
a <filename>RDEPENDS</filename> variable, the build will not fail
|
a <filename>RDEPENDS</filename> variable, the build will not fail
|
||||||
if this module is not available to include in the image.
|
if this module is not available to include in the image.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
|
||||||
Original Text:
|
|
||||||
<literallayout class='monospaced'>
|
|
||||||
While it is always preferable to work with sources integrated into the Linux
|
|
||||||
kernel sources, if you have need of an external kernel module, the hello-mod
|
|
||||||
recipe is available as a template to create your own out-of-tree Linux kernel
|
|
||||||
module recipe. It is available in the poky repository at:
|
|
||||||
|
|
||||||
meta-skeleton/recipes-kernel/hello-mod/hello-mod_0.1.bb
|
|
||||||
|
|
||||||
To get started, copy this recipe to your layer and provide it with a meaningful name, such as
|
|
||||||
mymodule_1.0.bb. In the same directory, create a directory named "files" where
|
|
||||||
you can store any source files, patches, or other files necessary for building
|
|
||||||
the module which do not come with the sources. Finally, update the recipe as
|
|
||||||
appropriate for the module. Typically you will need to set the following
|
|
||||||
variables:
|
|
||||||
|
|
||||||
o DESCRIPTION
|
|
||||||
o LICENSE*
|
|
||||||
o SRC_URI
|
|
||||||
o PV
|
|
||||||
|
|
||||||
Depending on the build system used by the module sources, you may need to make
|
|
||||||
adjustments. For example, a typical module Makefile will look much like that
|
|
||||||
provided with hello-mod:
|
|
||||||
|
|
||||||
obj-m := hello.o
|
|
||||||
|
|
||||||
SRC := $(shell pwd)
|
|
||||||
|
|
||||||
all:
|
|
||||||
$(MAKE) -C $(KERNEL_SRC) M=$(SRC)
|
|
||||||
|
|
||||||
modules_install:
|
|
||||||
$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
|
|
||||||
...
|
|
||||||
|
|
||||||
The important point to note here is the KERNEL_SRC variable. The module bbclass
|
|
||||||
class sets this, as well as KERNEL_PATH, to ${STAGING_KERNEL_DIR} with the
|
|
||||||
necessary Linux kernel build information to build modules. If your module
|
|
||||||
Makefile uses a different variable, you may want to override the do_compile()
|
|
||||||
step, or create a patch to the Makefile to work with the more typical KERNEL_SRC
|
|
||||||
or KERNEL_PATH variables.
|
|
||||||
|
|
||||||
After you have prepared the recipe, you will likely want to include the module
|
|
||||||
in your images. To do this, see the documentation for the following variables in
|
|
||||||
the Yocto Project Reference Manual and set one of them as appropriate in your
|
|
||||||
machine config file:
|
|
||||||
|
|
||||||
MACHINE_ESSENTIAL_EXTRA_RDEPENDS
|
|
||||||
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS
|
|
||||||
MACHINE_EXTRA_RDEPENDS
|
|
||||||
MACHINE_EXTRA_RRECOMMENDS
|
|
||||||
|
|
||||||
As modules are often not required for boot and may be excluded from certain
|
|
||||||
build configurations, the following allows for the most flexibility:
|
|
||||||
|
|
||||||
MACHINE_EXTRA_RRECOMMENDS += "kernel-module-mymodule"
|
|
||||||
|
|
||||||
Where the value is derived by appending the module filename without the .ko
|
|
||||||
extension to the string "kernel-module-".
|
|
||||||
|
|
||||||
As it is an RRECOMMENDS (and not an RDEPENDS) variable, the build will not fail
|
|
||||||
if this module is not available to include in the image.
|
|
||||||
</literallayout>
|
|
||||||
</para>
|
|
||||||
</section>
|
</section>
|
||||||
</chapter>
|
</chapter>
|
||||||
<!--
|
<!--
|
||||||
|
|
Loading…
Reference in New Issue