docs/manual: update the linux tools section

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Romain Naour <romain.naour@openwide.fr>
[Thomas:
 - Adjust the Config.in example to show that we now need to "select
   BR2_PACKAGE_LINUX_TOOLS"
 - Adjust the .mk file example to use $(LINUX_DIR) instead of $(@D)]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
Yann E. MORIN 2016-09-06 16:29:15 +02:00 committed by Thomas Petazzoni
parent 20b1446669
commit 73a6401606

View File

@ -12,33 +12,36 @@ hooks for building Linux kernel tools or/and building Linux kernel extensions.
Buildroot offers a helper infrastructure to build some userspace tools Buildroot offers a helper infrastructure to build some userspace tools
for the target available within the Linux kernel sources. Since their for the target available within the Linux kernel sources. Since their
source code is part of the kernel source code, it is not very source code is part of the kernel source code, a special package,
practical to use separate packages for them as they often need to be +linux-tools+, exists and re-uses the sources of the Linux kernel that
built with the same kernel version as the kernel being used on the runs on the target.
target. The small Linux kernel tools infrastructure is a simplified
packaging mechanism based on the generic package infrastructure to
help building those tools.
Let's look at an example of a Linux tool. For a new Linux tool named Let's look at an example of a Linux tool. For a new Linux tool named
+foo+, create a new menu entry in the existing +foo+, create a new menu entry in the existing
+linux/Config.tools.in+. This file will contain the option +package/linux-tools/Config.in+. This file will contain the option
descriptions related to each kernel tool that will be used and descriptions related to each kernel tool that will be used and
displayed in the configuration tool. It would basically look like: displayed in the configuration tool. It would basically look like:
------------------------------ ------------------------------
01: config BR2_LINUX_KERNEL_TOOL_FOO 01: config BR2_PACKAGE_LINUX_TOOLS_FOO
02: bool "foo" 02: bool "foo"
03: help 03: select BR2_PACKAGE_LINUX_TOOLS
04: This is a comment that explains what foo kernel tool is. 04: help
05: 05: This is a comment that explains what foo kernel tool is.
06: http://foosoftware.org/foo/ 06:
07: http://foosoftware.org/foo/
------------------------------ ------------------------------
The name of the option starts with the prefix +BR2_LINUX_KERNEL_TOOL_+, The name of the option starts with the prefix +BR2_PACKAGE_LINUX_TOOLS_+,
followed by the uppercase name of the tool (like is done for packages). followed by the uppercase name of the tool (like is done for packages).
Then for each linux tool, add a new +.mk+ file named +linux/linux-tool-foo.mk+. .Note
It would basically look like: Unlike other packages, the +linux-tools+ package options appear in the
+linux+ kernel menu, under the `Linux Kernel Tools` sub-menu, not under
the `Target packages` main menu.
Then for each linux tool, add a new +.mk+ file named
+package/linux-tools/linux-tool-foo.mk+. It would basically look like:
------------------------------ ------------------------------
01: ################################################################################ 01: ################################################################################
@ -52,19 +55,19 @@ It would basically look like:
09: FOO_DEPENDENCIES = libbbb 09: FOO_DEPENDENCIES = libbbb
10: 10:
11: define FOO_BUILD_CMDS 11: define FOO_BUILD_CMDS
12: $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools foo 12: $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools foo
13: endef 13: endef
14: 14:
15: define FOO_INSTALL_STAGING_CMDS 15: define FOO_INSTALL_STAGING_CMDS
16: $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \ 16: $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
17: DESTDIR=$(STAGING_DIR) \ 17: DESTDIR=$(STAGING_DIR) \
18: foo_install 18: foo_install
19: endef 19: endef
20: 20:
21: define FOO_INSTALL_TARGET_CMDS 21: define FOO_INSTALL_TARGET_CMDS
22: $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \ 22: $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
23: DESTDIR=$(@D) \ 23: DESTDIR=$(TARGET_DIR) \
24: foo_install 24: foo_install
25: endef 25: endef
-------------------------------- --------------------------------
@ -84,7 +87,7 @@ used only when the +foo+ tool is selected. The only supported commands are
.Note .Note
One *must not* call +$(eval $(generic-package))+ or any other One *must not* call +$(eval $(generic-package))+ or any other
package infrastructure! Linux tools are not packages by themselves, package infrastructure! Linux tools are not packages by themselves,
they are part of the +linux+ package. they are part of the +linux-tools+ package.
[[linux-kernel-ext]] [[linux-kernel-ext]]
==== linux-kernel-extensions ==== linux-kernel-extensions