Difference between revisions of "How to build Linux kernel user space tools"

[quality revision] [quality revision]
m
 

1 Article purpose[edit]

This article provides the basic information needed to build the user space tools available on the Linux® kernel.

2 Introduction[edit]

The Linux kernel provides some user-space tools that are available in the tools directory [1] of the source tree.

These tools are not compiled by default when compiling the Linux kernel for the target board. They can be compiled independently, depending on the user's needs.

3 Installing the trace and debug tool on your target board[edit]

3.1 Using the STM32MPU Embedded Software distribution[edit]

3.1.1 Developer Package[edit]

Prerequisites, please ensure:

The available user space tools can be listed by using the following commands in the Linux kernel source root path:

PC $> cd <Linux_kernel_source_path>
PC $> make tools/help O="<Linux_kernel_build_dir>" (optional)
Possible targets:

 acpi                   - ACPI tools
 cgroup                 - cgroup tools
 cpupower               - a tool for all things x86 CPU power
 firewire               - the userspace part of nosy, an IEEE-1394 traffic sniffer
 freefall               - laptop accelerometer program for disk protection
 gpio                   - GPIO tools
 hv                     - tools used when in Hyper-V clients
 iio                    - IIO tools
 kvm_stat               - top-like utility for displaying kvm statistics
 leds                   - LEDs  tools
 liblockdep             - user-space wrapper for kernel locking-validator
 bpf                    - misc BPF tools
 perf                   - Linux performance measurement and analysis tool
 selftests              - various kernel selftests
 spi                    - spi tools
 objtool                - an ELF object analysis tool
 tmon                   - thermal monitoring and tuning tool
 turbostat              - Intel CPU idle stats and freq reporting tool
 usb                    - USB testing tools
 virtio                 - vhost test module
 vm                     - misc vm tools
 wmi			- WMI interface examples
 x86_energy_perf_policy - Intel energy policy tool

Note: some tools are made for specific platforms (ARM, x86, RISC, and so on), so cannot be used on STM32MPU systems

The following basic steps must be done :

  • Compiling the application:
- Refer to <Linux kernel installation directory>/README.HOW_TO.txt helper file to know how to compile (the latest version of this helper file is also available in GitHubthis user guide: README.HOW_TO.txt).
- Ensure at least that the kernel configuration file is generated (.config) (information available in README.HWO_TO file previously mentioned)
- Compile the expected tool (i.e. iio, spi...)
PC $> cd <Linux_kernel_source_path>/tools
PC $> make <tool> [O=<Linux_kernel_build_dir>]

Note: The 'O' option can be used to specify the output directory

  • Deploying the application on a board:
-The binary is generated in the directory path <Linux_kernel_build_dir>/<tool>
-Push it onto the board.
PC $> scp <tool_binary> root@<board ip address>:/<dest_path>

PS: please ensure that the <dest_path> is known in the $PATH to execute the tool binary from anywhere on the target board.

3.1.2 Distribution Package[edit]

There is currently no recipe to build the Linux kernel user space tools, so the Developer package has to be used.

4 References[edit]


== Article purpose ==
This article provides the basic information needed to build the user space tools available on the Linux<sup>&reg;</sup> kernel.

== Introduction ==
The Linux kernel provides some user-space tools that are available in the tools directory <ref>{{CodeSource | Linux kernel | /tools}}</ref> of the source tree.

These tools are not compiled by default when compiling the Linux kernel for the target board. They can be compiled independently, depending on the user's needs.

== Installing the trace and debug tool on your target board ==
===  Using the STM32MPU Embedded Software distribution ===
====  Developer Package ====
Prerequisites, please ensure:
* the [[STM32MP1 Developer Package#Installing the SDK|SDK is installed]] 
* the [[STM32MP1 Developer Package#Starting up the SDK|SDK is started up]]
* the [[STM32MP1 Developer Package#Installing the Linux kernel|Linux kernel is installed]]

The available user space tools can be listed by using the following commands in the Linux kernel source root path:
 {{PC$}} cd {{orange|''<Linux_kernel_source_path>''}}
 {{PC$}} make tools/help {{orange|''O&#61;"<Linux_kernel_build_dir>" (optional)''}}
 Possible targets:

  acpi                   - ACPI tools
  cgroup                 - cgroup tools
  cpupower               - a tool for all things x86 CPU power
  firewire               - the userspace part of nosy, an IEEE-1394 traffic sniffer
  freefall               - laptop accelerometer program for disk protection
  gpio                   - GPIO tools
  hv                     - tools used when in Hyper-V clients
  iio                    - IIO tools
  kvm_stat               - top-like utility for displaying kvm statistics
  leds                   - LEDs  tools
  liblockdep             - user-space wrapper for kernel locking-validator
  bpf                    - misc BPF tools
  perf                   - Linux performance measurement and analysis tool
  selftests              - various kernel selftests
  spi                    - spi tools
  objtool                - an ELF object analysis tool
  tmon                   - thermal monitoring and tuning tool
  turbostat              - Intel CPU idle stats and freq reporting tool
  usb                    - USB testing tools
  virtio                 - vhost test module
  vm                     - misc vm tools
  wmi			- WMI interface examples
  x86_energy_perf_policy - Intel energy policy tool

''Note: some tools are made for specific platforms (ARM, x86, RISC, and so on), so cannot be used on STM32MPU systems''

The following basic steps must be done :

* Compiling the application:

:- Refer to ''<Linux kernel installation directory>/README.HOW_TO.txt'' helper file to know how to compile (the latest version of this helper file is also available in GitHub: {{CodeSource | meta-st-stm32mp | recipes-kernel/linux/linux-stm32mp/this user guide: [[media:Linux.README.HOW_TO.txt | |README.HOW_TO.txt}}]]).
:- Ensure at least that the kernel configuration file is generated (.config) (information available in README.HWO_TO file previously mentioned)
:- Compile the expected {{highlight|''tool (i.e. iio, spi...)''}}
 {{PC$}} cd {{orange|''<Linux_kernel_source_path>/tools''}}
 {{PC$}} make {{highlight|''<tool>''}} ''[O&#61;{{orange|<Linux_kernel_build_dir>}}]''
''Note: The 'O' option can be used to specify the output directory''

* Deploying the application on a board:
:-The binary is generated in the directory path ''{{orange|<Linux_kernel_build_dir>/}}{{highlight|<tool>}}''
:-Push it onto the board.
 {{PC$}} scp {{highlight|''<tool_binary>''}} root@{{orange|''<board ip address>''}}:/{{orange|''<dest_path>''}}
''PS: please ensure that the {{orange|<dest_path>}} is known in the $PATH to execute the tool binary from anywhere on the target board.''

==== Distribution Package ====
There is currently no recipe to build the Linux kernel user space tools, so the [[#Developer package|Developer package]] has to be used.

== References ==<references />

<noinclude>

[[Category:How to build software]]
{{PublicationRequestId | 12270 | 2019-06-07}}</noinclude>
Line 50: Line 50:
 
* Compiling the application:
 
* Compiling the application:
   
:- Refer to ''<Linux kernel installation directory>/README.HOW_TO.txt'' helper file to know how to compile (the latest version of this helper file is also available in this user guide: [[media:Linux.README.HOW_TO.txt|README.HOW_TO.txt]]).
+
:- Refer to ''<Linux kernel installation directory>/README.HOW_TO.txt'' helper file to know how to compile (the latest version of this helper file is also available in GitHub: {{CodeSource | meta-st-stm32mp | recipes-kernel/linux/linux-stm32mp/README.HOW_TO.txt | README.HOW_TO.txt}}).
 
:- Ensure at least that the kernel configuration file is generated (.config) (information available in README.HWO_TO file previously mentioned)
 
:- Ensure at least that the kernel configuration file is generated (.config) (information available in README.HWO_TO file previously mentioned)
 
:- Compile the expected {{highlight|''tool (i.e. iio, spi...)''}}
 
:- Compile the expected {{highlight|''tool (i.e. iio, spi...)''}}