Wind River Linux User Guide
Wind River Linux User Guide
USER'S GUIDE
5.0.1
Copyright Notice
Corporate Headquarters
Wind River
500 Wind River Way
Alameda, CA 94501-1153
U.S.A.
Toll free (U.S.A.): 800-545-WIND
Telephone: 510-748-4100
Facsimile: 510-749-2010
For additional contact information, see the Wind River Web site:
www.windriver.com
For information on how to contact Customer Support, see:
www.windriver.com/support
15 Jan 2014
Contents
PART I: INTRODUCTION
1 Overview .................................................................................................................. 15
Wind River Linux Overview ............................................................................................... 15
Kernel and File System Components ................................................................. 16
Supported Run-time Boards ............................................................................... 18
Optional Add-on Products .................................................................................. 20
Product Updates ................................................................................................. 22
iii
Wind River Linux
User's Guide, 5.0.1
6 Localization ............................................................................................................. 91
About Localization ............................................................................................................. 91
Determining which Locales are Available ........................................................... 91
Setting Localization ............................................................................................ 93
7 Portability ................................................................................................................ 95
About Platform Project Portability ...................................................................................... 95
Copying or Moving a Platform Project .............................................................................. 96
Updating a Platform Project to a New Wind River Linux Installation Location ................... 96
8 Layers ...................................................................................................................... 99
About Layers ...................................................................................................................... 99
Layers Included in a Standard Installation ........................................................................ 100
Installed Layers vs. Custom Layers .................................................................................. 102
Layer Structure by Layer Type .......................................................................................... 103
About Layer Processing and Configuration ....................................................................... 105
About Processing a Project Configuration ......................................................... 105
Creating a New Layer ........................................................................................ 106
iv
Contents
v
Wind River Linux
User's Guide, 5.0.1
Adding an Application to a Root File System with fs_final*.sh Scripts ................ 141
Configuring a New Project to Add Application Packages ................................... 142
Verifying the Project Includes the New Application Package .............................. 143
Importing Packages ........................................................................................................... 144
About the Package Importer Tool (import-package) ........................................... 144
Importing a Sample Application Project as a Package ...................................... 144
Importing a Source Package from the Web (wget) ............................................ 146
Importing a SRPM Package from the Web ........................................................ 148
Listing Package Interdependencies ................................................................................... 151
13 Understanding the User Space and Kernel Patch Model ................................. 153
Patch Principles and Workflow .......................................................................................... 153
Patching Principles ............................................................................................................ 154
Kernel Patching with scc ................................................................................................... 155
vi
Contents
vii
Wind River Linux
User's Guide, 5.0.1
viii
Contents
ix
Wind River Linux
User's Guide, 5.0.1
x
Contents
xi
Wind River Linux
User's Guide, 5.0.1
xii
PA R T I
Introduction
Overview................................................................................ 15
Development Environment.................................................. 29
Build Environment............................................................... 41
13
Wind River Linux
User's Guide, 5.0.1
14
1
Overview
Wind River Linux is a software development environment that creates optimized Linux
distributions for embedded devices.
Wind River Linux 5.0.1 is based on the Yocto Project implementation of the OpenEmbedded Core
(OE-Core) metadata project. The Yocto Project uses build recipes and configuration files to define
the core platform project image and the applications and functionality it provides.
Wind River Linux builds on this core functionality and adds Wind River-specific extensions,
tools, and services to facilitate the rapid development of embedded Linux platforms. This
support includes:
• Straightforward platform project configuration, build, and deployment that simplifies Yocto
Project development
• A range of popular BSPs to support most embedded hardware platforms
• An enhanced command-line-interface (CLI) to the system
• Developer-specific layer for platform project development and management
• Platform project portability to copy or move platform projects, or create a stand-alone
platform project
• A custom USB image tool for platform project images
If you have experience with using the Yocto Project, Wind River Linux supports all Yocto Project
build commands, but also offers simplified configure and build commands based on the Wind
River Linux 4 build system. This functionality greatly reduces your development time. Wind
River Linux provides development environments for a number of host platforms and supports a
large and ever-growing set of targets, or the platform hardware you are creating your embedded
system for. For details on which development hosts are supported, refer to the Release Notes. For
supported target boards, refer to Wind River Online Support.
The build system consists of a complete development environment that includes a
comprehensive set of standard Linux run-time components, both as binary and source packages.
It also includes cross-development tools that can be used to configure and build customized run-
time systems and applications for a range of commercial-off-the-shelf (COTS) hardware.
15
Wind River Linux
User's Guide, 5.0.1
Wind River supports boards according to customer demand. Please contact Wind River if yours is
not yet officially supported.
Wind River Workbench is included as part of Wind River Linux to provide a robust development
and debugging environment.
For more information about Wind River Linux, see http://www.windriver.com/products
NOTE: Wind River Linux 5 uses a different build system than previous product releases. As a
result, the new Yocto Project-based build system may not directly support custom layers from a
previous release. Custom layers of this type will need to be migrated to the new build system.
For information on migrating these layers, see the Wind River Linux Migration Guide: About
Migrating Wind River Linux Projects.
Wind River Linux supports a range of kernel type profiles and file systems.
NOTE: Not all kernel feature and file system combinations are supported on any particular
board. For further information on validated combinations, contact your Wind River
representative.
NOTE: All features of the standard kernel profile work within any particular enhanced profile
for future Wind River Linux product releases.
16
1 Overview
Wind River Linux Overview
This option is available with the Wind River Linux Carrier Grade Profile add-on product. For
additional information, see Optional Add-on Products on page 20 .
preempt_rt
This kernel profile provides the PREEMPT_RT kernel patches to enable conditional hard real-
time support. Note that this profile does not imply deterministic pre-emption. For additional
information, see Introduction to Using the preempt-rt Kernel Type on page 205.
For detailed instructions on reconfiguring and customizing Wind River Linux kernels, see About
Kernel Configuration and Patching on page 177
17
Wind River Linux
User's Guide, 5.0.1
NOTE: Contact your Wind River representative for details on which kernel features and file
systems are supported for your board.
Kernel Features
Wind River Linux 5.0.1 supports the following, additional kernel features:
• Support for the Intel® Performance Counter Monitor (PCM) for Intel® Xeon® Core and Intel®
Atom® BSPs. The Intel® PCM provides sample C++ routines and utilities to estimate the
processor internal resource utilization to help developers gain significant performance boosts
for their platforms.
For information on using the Intel® PCM, see http://software.intel.com/en-us/articles/intel-
performance-counter-monitor.
• Support for turbostat, a Linux tool to observe the proper operation on systems that
use Intel® Turbo Boost Technology (http://www.intel.com/content/www/us/en/architecture-
and-technology/turbo-boost/turbo-boost-technology.html). For additional information
on turbostat, see http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?
id=103a8fea9b420d5faef43bb87332a28e2129816a.
For a list of additional kernel features, listed as configuration fragments you can add to any
platform project image, see Kernel Configuration Fragments in the Project Directory on page 51.
1
In some cases this combination may not be supported as it is not needed on equipment used for
networking only. Individual board README files contain details.
2
In cases where a board cannot support the cgl kernel profile it instead supports the standard kernel
profile and the glibc_cgl root file system with some features of the user space gracefully failing for
lack of kernel support.
18
1 Overview
Wind River Linux Overview
requires modification to work optimally with Wind River Linux. Any Wind River-provided
bootloader will be contained in the BSP template along with the README file for the board.
NOTE: Wind River strongly recommends that you read the README file for your board,
located within installDir/wrlinux-5/layers/wr-bsps/boardname. This file contains important
information on board bring-up, boot loaders, board features, and board limitations. The board
README and other README files can also be found in your projectDir/READMES
directory after you configure a project.
Information on setting up target servers and booting supported boards, as well as details on
booting with ISO, hard disk, and flash RAM, can be found in About Configuring and Building
Bootable Targets on page 265 and About Target-based Networking on page 329.
19
Wind River Linux
User's Guide, 5.0.1
intel_xeon_5520_ioh
intel_xeon_c600_pch
intel_xeon_core_dh89xx_pch
westmere_ep
Wind River Linux supports optional add-on products that extend the capability of the product to
meet your current and future development needs.
This version of Wind River Linux supports the following add-on products:
20
1 Overview
Wind River Linux Overview
support for remote management of the virtualized environment. Professional services, training,
and a comprehensive set of documentation complement the OVP to provide an open and high
performance virtualization solution.
For additional information, or to purchase Wind River Linux Open Virtualization Profile, contact
your Wind River sales representative.
21
Wind River Linux
User's Guide, 5.0.1
Product Updates
Wind River delivers new fixes, and occasionally new functionality, through the product installer.
Overview
When updates become available, they are posted to Wind River Customer Support. This includes
new Rolling Cumulative Patch Layer(RCPL) releases which may include new functionality and
documentation updates.
You can log into Wind River Customer Support at http://www.windriver.com/support/ to view
product information, or run the Wind River Maintenance Tool to obtain product updates specific
to your Wind River Linux license.
WARNING: The Experimental Feature Layer may contain up-revved versions of packages in
the standard product and/or additional packages which have not been fully regression tested.
While Wind River strives to maintain binary compatibility with the rest of the standard system,
including this layer may cause issues in non-standard environments. All related bugs reported
via Wind River Support channels will be accepted and investigated.
See Updating Wind River Linux on page 23 for details on installing the Experimental Feature
layer.
The Experimental Feature layer currently provides these four packages:
libedit-20121213-3.0
A BSD replacement for libreadline.
22
1 Overview
Updating Wind River Linux
fuse-2.9.3
FUSE (Filesystem in Userspace) is a simple interface for user-space programs to export a
virtual file system to the Linux kernel. FUSE also aims to provide a secure method for non
privileged users to create and mount their own file system implementations.
nmap-6.40
Nmap ("Network Mapper") is a free and open source utility for network discovery and
security auditing.
syslog-ng-logrotate
This is a package that adds logrotate capability to the syslog-ng package.
To obtain product and documentation updates, you will run the Wind River product
maintenance tool.
The updated product and documentation will be automatically placed at the correct locations in
your installation.
NOTE: The product maintenance tool can retrieve documentation updates and any additional
functionality you are entitled to. During the update process, you can select the specific features
you want to install.
NOTE: Before you exit Workbench, you can start the maintenance tool by selecting Help >
Update Wind River Products.
$ cd installDir/maintenance/wrInstaller/hostType
$ ./wrInstaller
23
Wind River Linux
User's Guide, 5.0.1
$ make upgrade
Once the command completes, the platform project is configured to use the latest product
update(s).
c) Rebuild the platform project.
$ make
Install the Experimental (Rolling) Feature Layer (RCFL) to use the additional features it provides
in your platform project build.
To install the Experimental Feature Layer, you must first install the latest RCPL product update
as described in Updating Wind River Linux on page 23. This update is required for the contents
of the Experimental Feature Layer to work.
$ installDir/maintenance/wrInstaller/x86-linux2/wrInstaller
Step 3 Add the Experimental Feature Layer location to the Product Maintenance Tool locations list.
a) Click Add to display the Add Site window.
b) Enter a name for the location.
For example, enter Wind River Experimental Feature Layer.
c) Enter the following location.
http://updates.windriver.com/repos/wrlinux/wrlinux-5.0/DVD-R180065.1-1-00.repos
d) Click OK to save the new location.
e) Click Apply to return to the main Product Maintenance Tool window.
f) Select Online Content and click Next to continue.
You can use the Experimental Feature layer to add extra features to a Wind River Linux project.
You can add packages from the Experimental Features Layer to a Wind River Linux project using
the Wind River configure command.
24
1 Overview
Wind River Linux Overview
Step 1 Run configure using the --enable-addons=wr-rcfl and --with-layer=rcfl options to add packages
from the Experimental Feature Layer to your project.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small \
--with-template=feature/debug,feature/analysis,features/syslog-ng-logrotate \
--with-layer=wr-intel-support \
--enable-addons=wr-rcfl
--with-layer=rcfl
Step 2 Include any of the packages provided by the Experimental Feature Layer.
To do this, you would use the make -C build packageName.addpkg command for each package
that you want to add.
For example:
• To include libedit:
• To include FUSE:
• To include nmap-6.40:
$ make fs
When these steps have completed successfully, the package(s) have been added to your project.
25
Wind River Linux
User's Guide, 5.0.1
26
2
Run-time Software Configuration
and Deployment Workflow
Use this information as a guideline for creating and deploying a complete run-time system.
Overview
In this context, run-time software refers to the platform project image and applications you create
as part of developing your complete target operating system. There are different workflows for
developing platform projects and/or application projects. For an overview with working examples of
these workflows, see:
• Wind River Linux Getting Started Guide: Platform Project Workflow
• Wind River Linux Getting Started Guide: Application Development Workflow
In this section, we provide a detailed workflow that includes the entire run-time system, with links
to relevant material to aid in your development. This includes planning the system, configuring and
building the run-time system, customizing the system and adding applications, deploying to a target, and
debugging with Workbench or some other tool.
Creating and deploying run-time software with Wind River Linux Platforms includes the following
development sequence of events:
NOTE: If you already know what your project requires, and want to start working with Wind
River Linux right away, see the Wind River Linux Getting Started Guide for information on
creating, modifying, and debugging a run-time software platform.
Workflow
1. Plan your platform and/or application projects for your own use or your customers' needs.
This includes choosing a board, kernel, and root file system and determining any special hardware/
software requirements your project may need.
2. Create the platform project directory.
The platform project directory is a directory that you create in the build environment, as opposed to
the development environment. For additional information, see: About Creating the Platform Project Build
Directory on page 62
For additional information on the build and/or development environments, see:
27
Wind River Linux
User's Guide, 5.0.1
NOTE: See the Wind River Linux Getting Started Guide: About Developing Platform Projects for
hands-on examples on modifying and debugging your platform project.
Updating may require adding and/or patching packages, debugging an application on the target, and
making necessary configurations for the host and target to communicate effectively.
Platform developers create a platform project and then produce a sysroot (with make export-sdk) for
application developers. See Exporting the SDK on page 136. The sysroot provides the target runtime
libraries and header files for use by the application developers on their development hosts. Because
the sysroot duplicates application dependencies of the eventual runtime environment, applications are
easily deployed after development.
Platform developers can also:
• Incorporate developed applications in a project. See About Application Development on page 127.
• Debug applications and the kernel. See Kernel Debugging on page 213 and the section Userspace
Debugging.
6. Optimize the platform project image.
In this context, optimization includes analyzing and optimizing the runtime footprint and/or boot
time.
For additional information, see About Optimization on page 305.
28
3
Development Environment
Directory Structure 29
Metadata 32
Configuration Files and Platform Projects 33
README Files in the Development Environment 39
Directory Structure
Learn about the structure and content of the development environment including the function
and contents of the prominent structural features of Wind River Linux and the BitBake build
system—layers, recipes, and templates.
The build environment, including the use of the configure script and the make command to
build runtime software, is described in Directory Structure for Platform Projects on page 43.
The Wind River Linux development environment can be installed anywhere on a supported
host. This document uses the convention that it is installed in the /opt/WindRiver/ directory.
Throughout this document, the installed location is referred to as installDir.
The Yocto Project BitBake build system relies on a system installDir path that does have any
of the following characters:
Character Description
+ Plus symbol
@ 'At' symbol
~ Tilde symbol
^ Carat symbol
# Pound symbol
Having any of these characters in the installDir path will cause project builds to fail.
29
Wind River Linux
User's Guide, 5.0.1
The structure shown in Development Environment Directories depicts a simplified view of the
development environment. When you compare this to the build environment in Directory
Structure for Platform Projects on page 43, you can see that the development environment
includes the layers (everything under layers/) necessary for configuring a platform project image.
NOTE: Not all layers are shown in the preceding figure and additional layers may be added.
The directories and executables shown in the figure, above, are discussed in the following
sections.
NOTE: This script and the following directories are only available when you purchase and
install Wind River Workbench.
30
3 Development Environment
Directory Structure
Not specifically shown in Development Environment Directories are several directories of interest to
Workbench users:
workbench-3.3/
Contains the Wind River Workbench installation.
docs/
Contains the documentation for the online help system. The .html and .pdf files may also
be accessed directly by browsing. See Wind River Linux Documentation on page 346 for
additional information.
31
Wind River Linux
User's Guide, 5.0.1
Metadata
The build system uses metadata, or “data about data”, to define all aspects of the platform project
image and its applications, packages, and features.
Metadata resides in the development and build environments. From a build system perspective,
metadata includes input from the following sources:
Configuration (.conf) files
These can include application, machine, and distribution policy-related configuration files. See
Configuration Files and Platform Projects on page 33
Recipes (.bb) files
See About Recipes on page 109.
Classes (.bbclass) files.
Appends (.bbappends) files to existing layers and recipes. See About Recipes on page 109.
32
3 Development Environment
Configuration Files and Platform Projects
The build system uses this metadata as one source of input for platform project image creation. In
the Wind River Linux development environment, other sources of input include:
• Project configuration information, such as BSP name, file system, and kernel type, entered
using the configure command. See Introduction on page 61, and About Building Platform
Project Images.
• Custom layers and/or templates with their own configuration, recipes, classes, and append
files. About Layers on page 99.
• Additional changes and additions that apply to the runtime file system only, and not the
platform project image. See Options for Adding an Application to a Platform Project Image on page
138.
It is important to organize your metadata in a manner that lets you easily create, modify, and
append to it. It is also important to understand what you are already working with so that you
can leverage existing metadata and reuse it as necessary.
Since metadata is included in over 800 existing recipes, knowing how the existing data impacts
your platform project build will help you understand what you already have. With this
knowledge, you are better prepared to plan the use of append (.bbappend) files to extend or
modify the capability, and only create new recipes when necessary.
The idea is to avoid overlaying entire recipes from other layers in your existing configuration,
and not simply copy the entire recipe into your layer and modify it.
For additional information on using append files, see The Yocto Project Development Manual:
Using .bbappend Files:
http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#using-bbappend-files
See also:
• Configuration Files and Platform Projects on page 33
• Creating a New Layer on page 106
• Creating a Recipe File on page 112
Learn about the various .conf files that define specific aspects of your platform project build.
LCONF_VERSION = "6"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
WRL_TOP_BUILD_DIR ?= "${TOPDIR}/.."
# resolve WRL_TOP_BUILD_DIR immediately with a canonical path
33
Wind River Linux
User's Guide, 5.0.1
BBLAYERS = " \
${WRL_TOP_BUILD_DIR}/layers/wrlinux \
${WRL_TOP_BUILD_DIR}/layers/wrlcompat \
${WRL_TOP_BUILD_DIR}/layers/wr-toolchain \
${WRL_TOP_BUILD_DIR}/layers/oe-core/meta \
${WRL_TOP_BUILD_DIR}/layers/oe-core-dl \
${WRL_TOP_BUILD_DIR}/layers/meta-downloads \
${WRL_TOP_BUILD_DIR}/layers/wr-kernel \
${WRL_TOP_BUILD_DIR}/layers/wr-bsps/qemux86-64 \
${WRL_TOP_BUILD_DIR}/layers/wr-base \
${WRL_TOP_BUILD_DIR}/layers/wr-features \
${WRL_TOP_BUILD_DIR}/layers/wr-tools-profile \
${WRL_TOP_BUILD_DIR}/layers/wr-tools-debug \
${WRL_TOP_BUILD_DIR}/layers/meta-networking \
${WRL_TOP_BUILD_DIR}/layers/meta-webserver \
${WRL_TOP_BUILD_DIR}/layers/wr-prebuilts \
${WRL_TOP_BUILD_DIR}/layers/local \
"
Note that layers are processed from top to bottom in the bblayers.conf file.
CONF_VERSION = "1"
#
# Distribution choice. Normally "wrlinux" but can be customized by
# the user with --with-custom-distro=<name>
#
DISTRO = "wrlinux"
WRLINUX_RCPLVERSION = ".6"
DL_DIR = "${WRL_TOP_BUILD_DIR}/bitbake_build/downloads"
#
# Parallelism Options
# These two options control how much parallelism BitBake should use. The first
# option determines how many tasks bitbake should run in parallel:
#
BB_NUMBER_THREADS ?= "3"
#
#
# The second option controls how many processes make should run in parallel when
# running compile tasks:
#
PARALLEL_MAKE ?= "-j 3"
#
# For a quad-core machine, BB_NUMBER_THREADS = 4, PARALLEL_MAKE = -j 4 would
# be appropriate for example.
MACHINE = "qemux86-64"
34
3 Development Environment
Configuration Files and Platform Projects
PREFERRED_PROVIDER_virtual/kernel_qemux86-64 = "linux-windriver"
KTYPE_ENABLED = "standard"
# Ucomment the following line if you want to build an SDK
# that will on a 32 bit host when your your host is 64 bit.
# against the native host compiler
#SDKMACHINE = "i686"
# Use the rpm package class by default, you can specify multiple
# package classes in the list
PACKAGE_CLASSES ?= "package_rpm"
BBINCLUDELOGS = "yes"
35
Wind River Linux
User's Guide, 5.0.1
U_CLASSES += "image-export-vars"
##-- Setup USER_CLASSES based on values above --##
USER_CLASSES ?= "${U_CLASSES}"
#
# SDK image filesystem normalization.
# If the SDK filesystem needs to be canonicalized (as in Win32/64 where case is
# insignificant and there are no symlinks) set NORMALIZE_SDK_FS to the type of
# normalization desired (or 'no' if none)
# Currently available normalizations:
# - winfs
NORMALIZE_SDK_FS ?= "no"
#
# Windows SDK ancilliary settings. If EXPORT_SYSROOT_HOSTS (named for backwards
# compatability with WB) contains a space-seperated token 'x86-win32', a second
# SDK archive will be constructed by normalizing the Linux SDK for Win32 as
# described above, and will be augmented with Win32 toolchain binaries.
# EXPORT_SYSROOT_HOSTS is expected to be set as an environment variable by WB.
# The variable TOOLCHAIN_WIN32_DIR can be set to point to the base directory
# of the Windows win32 toolchain directory hierarchy
# (e.g. ${WRL_TOP_BUILD_DIR}/layers/wr-toolchain/<vvvv-build>-other)
# if it is not installed as a peer to the normal toolchain layer
# TOOLCHAIN_WIN32_DIR is not currently imported from environment variables.
EXPORT_SYSROOT_HOSTS ?= "x86-linux2 "
#TOOLCHAIN_WIN32_DIR ?= ""
## Syslinux options for boot menus when using isolinux or linux live
SYSLINUX_LABELS = "boot"
SYSLINUX_TIMEOUT = "0"
SYSLINUX_SPLASH = "${WRL_TOP_BUILD_DIR}/layers/wrlcompat/data/syslinux/splash.lss"
AUTO_SYSLINUXMENU = "1"
36
3 Development Environment
Configuration Files and Platform Projects
# Specify the number of extra blocks of free space for an hdd image
# BOOTIMG_EXTRA_SPACE ?= "512"
# add/disable licenses
#
#LICENSE_FLAGS_WHITELIST += ""
#INCOMPATIBLE_LICENSE = ""
BBFILE_COLLECTIONS += "local"
BBFILE_PATTERN_local := "^${LAYERDIR}/"
BBFILE_PRIORITY_local = "10"
In general there is no need to modify this file since it incorporates everything that is needed to
process your local application recipes. Of particular interest are the following variables:
BBFILES
This variable tells the build system to source recipe files (.bb and .bbappend files) from any
directory named recipes-* inside the layer. In the default layer structure this would be the
directory recipes-sample. As long as you place your application-specific recipes in a folder
that begins with recipes-, they will be included in the build as defined by this variable.
BBFILE_PRIORITY
37
Wind River Linux
User's Guide, 5.0.1
This variable sets the processing priority of the layer. If another layer depends on the
configuration of this layer, or on recipes contained in this layer, then the priority should be
higher that the dependant layer.
PREMIRRORS_append
This variable specifies places where the build process can source your upstream package
sources from before the recipe specified URL is searched. Wind River Linux comes with all
supported packages in a pre-mirror or local file path URL location so it is not necessary to
access the internet in order to build a project. In particular, the source files can be retrieved
automatically from a source code repository, either git or subversion as indicated.
Learn how to assign an empty value to a variable in the Yocto Project BitBake build system.
Assigning an empty value in a platform project .conf file is different in BitBake than it is from
conventional syntax. With BitBake, you must enter a space between the declaration's double
quotes, while conventional syntax allows for double quotes with no spaces.
Assign Empty String
CONF_VALUE = " "
NOTE: Notice that the = " " declaration has a single space.
This assigns the empty string after BitBake strips the leading space. To retrieve this variable as
part of your code and prevent ndefined variable exceptions, use the following syntax:
pyvar = d.getVar("CONF_VALUE", True) or ""
Assign No Value
CONF_VALUE = ""
This assigns the empty string to the Python None value, and does not return an empty string
when you try to retrieve the variable's value.
Perform the following steps to insert an empty string and test that it returns an empty value.
Step 1 Assign an empty string to the projectDir/local.conf file.
Options Description
38
3 Development Environment
README Files in the Development Environment
Options Description
Edit local.conf file 1. Open the projectDir/local.conf file in an editor and add the
following line to it:
VIRTUAL-RUNTIME_dev_manager=" "
In this example, we use the VIRTUAL-RUNTIME_dev_manager variable. You may substitute this
for a variable that you wish to retrieve an empty string for.
$ make fs
$ VIRTUAL-RUNTIME_dev_manager=""
Wind River Linux provides multiple ways to view the README files that are part of your
installation.
README files located in your installation, such as the one located in the installDir/layers/
example/lemon_layer directory, actually reside in a git repository, and are not directly available
to open to review. The following sections provide information on viewing README files.
Use git show to open the README file directly for viewing only.
The following procedure uses the README file located in the installDir/wrlinux-5/layers/
examples/lemon_layer directory as an example. To view another README file, locate the path
to it before you begin.
Step 1 Navigate to the location where the README file resides.
$ cd installDir/wrlinux-5/layers/examples/lemon_layer
39
Wind River Linux
User's Guide, 5.0.1
Use git clone to clone a layer in the installation to a temporary directory to view or edit the
README file.
The following procedure uses the README file located in the installDir/wrlinux-5/layers/
examples/lemon_layer directory as an example. To clone another README file, locate the path
to it before you begin.
Step 1 Navigate to a location on the host system to clone the layer to.
In this example, you will navigate to the /tmp directory.
$ cd /tmp
Substitute the path as necessary to clone another layer to view a different README file.
Step 3 View the README file using the terminal, or open it in an editor.
Use git instaweb to browse all layer installation files, including README files, in a web browser.
The following procedure uses a web browser to view the files located in git in the installDir/
layers directory.
NOTE: To use this option, you must install and run lighttpd or httpd on your development host
prior to performing the procedure.
$ cd installDir/wrlinux-5/layers
$ git instaweb
The web browser will open with the installDir/layers directory at the top-level.
Step 3 Navigate to the examples/layers/lemon_layer location and open the README file in the tree
view.
40
4
Build Environment
The project directory, located in your build environment, maintains all files specific to your
platform project development.
You should keep your build environment separate from the development environment. Wind
River recommends you create a separate work directory with a project subdirectory holding the
build environment. This concept is explained in the Wind River Linux Getting Started Guide: About
Developing Platform Projects.
The main reason for this is that it is possible to corrupt your development environment by
running the configure script from inside it (see About the Configure Script on page 63).
CAUTION: Running configure from the Wind River Linux install directory may corrupt your
installation. Always run configure from the directory where your project resides.
41
Wind River Linux
User's Guide, 5.0.1
In this example, the general work directory is named workspace. Within workspace is the
qemux86-64 project directory which will hold the build environment, in this case for a common
PC board. Directory names have been chosen for clarity; you can name them as you like. In this
document, the variable projectDir refers to your project directory, which is qemux86-64 in the
example in the figure.
NOTE: When using Workbench to create a platform project, by default Workbench creates the
$HOME/WindRiver/workspace/projectName directory containing the Workbench specific
project files, and an additional adjacent directory with a _prj suffix that contains a complete
Wind River Linux platform project. The Workbench project directory contains select file system
links to elements in the Linux platform project_prj project. For the example shown in the figure
above, the Workbench project directory would be in
/home/user/WindRiver/workspace/qemux86-64_prj
A project directory or folder is the file system location where you configure and build your target
software.
You can create a project directory in any location for which you have permission; for example, in
a subdirectory of your home directory.
• Create a new directory for your project.
Options Description
Command line Create a new project directory with the mkdir command, for
example:
$ mkdir -p $HOME/workspace/qemux86-64
42
4 Build Environment
Directory Structure for Platform Projects
Options Description
Workbench If you are using Workbench, the project directory is created for you
when you click Finish in the configuration wizard. It is created as
a folder in your workspace folder (by default, $HOME/WindRiver/
workspace/) with the name you assign and a _prj suffix, for example
my_qemux86-64_prj
Wind River Linux automatically creates the build environment directory structure when you
configure and build a platform project.
The following illustration depicts some of the subdirectories the configure script creates within a
project directory.
Selected directories and their contents are described in further detail below. Note that these
directories are not present until you configure and build the platform project:
bitbake_build
The Yocto build systems working directory, many of the other directories contain file links to
elements in this directory.
bitbake_build/conf
The directory where the local.conf build configuration file is located. A soft link to this file is
created in the working directory for your convenience.
43
Wind River Linux
User's Guide, 5.0.1
bitbake_build/conf/bblayers.conf
A file listing the layers used to build the target images.
build
A directory that hosts soft links to the build directories for each package. The directory also
hosts a Makefile used to build special targets associated with the packages. Use the command
make -C build help for more details.
export
A convenience directory that hosts soft links to important build files, and the target filesystem
once it is built using the make command. Note that the name of the files are generated after
the project's configuration options.
export/qemux86-64-glibc-std-standard-dist.tar.bz2
A compressed tar file of the root file system.
export/dist
A directory containing the target's root file system. It is used by default as an NFS mount
when booting the Linux kernel image using QEMU.
export/images/bzImage-qemux86-64.bin
The Linux kernel image.
export/images/modules-version-WR5.0.1.0_standard-r0-qemux86-64.tgz
A compressed tar file containing the Linux kernel modules.
host-cross
The build tool chain that you can use to (cross-) compile programs for your target. Note that
the directories inside host-cross are soft links to corresponding directories in
bitbake_build/tmp/sysroots
layers
A directory that contains the layers for the platform project, including:
layers/local
A folder created specifically for developers to hold their project-specific files. For example,
if you add a sample project to your platform project, the build system adds a directory
with the required files to the layers/local/recipes-sample directory. See About the layers/local
Directory on page 54.
layers/oe-core
A folder that contains the core Open Embedded metadata in specific BitBake layers used to
configure the project. The default layer directories include:
meta
Contains the git clone from the installDir/wrlinux-5/git directory in the installation
development environment. See Directory Structure on page 29 .
meta-demoapps
Contains recipe files for demo applications provided with the Yocto Project.
meta-hob
44
4 Build Environment
Directory Structure for Platform Projects
Contains configuration and recipe files for the HOB, a GUI-based tool for creating
custom BitBake images. See https://wiki.yoctoproject.org/wiki/BitBake/GUI/Hob for
additional information.
meta-skeleton
Contains configuration and recipes for the platform projects base structure.
scripts
Contains macros and scripts for the build system.
layers/oe-core-dl
Contains downloaded packages and configuration files that comprise the package
offerings from the Yocto Project. The conf/layer.conf file defines the mirror sites and order
of locations that packages are retrieved from.
layers/wr-base
Contains the recipes and other configuration files that comprise the Wind River Linux
base offering and make it possible to use the configure script to generate a platform project
image. See About the Configure Script on page 63.
Additionally, this layer contains templates for adding additional features to your platform
project image. See Feature Templates in the Project Directory on page 47 for additional
information.
This layer does not include bug fixes.
layers/wr-bsps
Contains the BSP support files of the BSP that your platform project is configured for.
layers/wr-kernel
Contains recipes and machine configuration information for Wind River-supplied kernels
and kernel features. Additionally, this layer contains templates for adding additional
features to your platform project image. See Kernel Configuration Fragments in the Project
Directory on page 51 for additional information.
layers/wrlcompat
In a typical Yocto Project build environment, the build output creates a specific directory
structure. This structure is different than the Wind River Linux structure from previous
releases. The wrlcompat layer ensures that build output is consistent with previous Wind
River Linux (4.x) releases.
layers/wrlinux
Contains the recipes, configuration information, and files that support Wind River Linux
tools and enhance development with the Yocto Project build system.
The files directory includes licensing information.
The scripts directory includes the following Wind River Linux scripts that simplify and
enhance platform project image creation and development:
layers/oe-core-dl
Contains downloaded packages and configuration files that comprise the package
offerings from the Yocto Project. The conf/layer.conf file defines the mirror sites and
order of locations that packages are retrieved from.
layers/wr-base
45
Wind River Linux
User's Guide, 5.0.1
Contains the recipes and other configuration files that comprise the Wind River Linux
base offering and make it possible to use the configure script to generate a platform
project image. See About the Configure Script on page 63. Additionally, this layer
contains templates for adding additional features to your platform project image. See
Feature Templates in the Project Directory on page 47.
layers/wr-bsps
Contains the BSP support files of the BSP that your platform project is configured for.
layers/wr-kernel
Contains recipes and machine configuration information for Wind River-supplied
kernels and kernel features. Additionally, this layer contains templates for adding
additional features to your platform project image. See Kernel Configuration Fragments in
the Project Directory on page 51.
layers/wrlcompat
In a typical Yocto Project build environment, the build output creates a specific
directory structure. This structure is different than the Wind River Linux structure from
previous releases. The wrlcompat layer ensures that build output is consistent with
previous Wind River Linux (4.x) releases.
layers/wrlinux
Contains the recipes, configuration information, and files that support Wind River
Linux tools and enhance development with the Yocto Project build system.
The files directory includes licensing information.
The scripts directory includes the following Wind River Linux scripts that simplify and
enhance platform project image creation and development:
config-target.pl
Configures the target platform project from configure scripts input.
create-usb.pl
Creates a platform project image file suitable for deployment on a USB drive.
fs_changelist.lua
Creates a flie system changelist file. See Lua Scripting in Spec Files on page 369.
rsim
Launches a QEMU session from the command-line with a single make start-target
command.
layers/wr-toolchain
Contains files, recipes, configuration information and documentation to support the GNU
toolchain supplied by Wind River for development.
layers/wr-toolchain-shim
Provides configuration glue to allow selection of an automatically integrated toolchain
layer, which in turn contains both rules for building the toolchain from source, and rules
for using the pre-built binaries. This layer also provides tuning files and configuration
overrides for those layers.
layers/wr-tools-debug
46
4 Build Environment
Feature Templates in the Project Directory
Contains configuration information and files to support debugging and ptrace with
Workbench and Wind River tools. Additionally, this layer contains templates for adding
additional features to your platform project image. See Feature Templates in the Project
Directory on page 47.
layers/wr-tools-profile
Contains configuration information and files to support Wind River Linux development
tools, including: analysis, boot time, code coverage, Valgrind, and lttng. You can add
these features to your platform project using templates. See Feature Templates in the Project
Directory on page 47.
packages
A soft link to bitbake_build/downloads, a directory where you can find tar files of all
packages used in the build. Note that the tar files are soft links to the actual files in the Wind
River Linux installation path that are bundled with the distribution.
READMES
Contains README files for the Wind River Linux layers included in your platform project
image configuration and build.
scripts
Contains macros and scripts for the build system.
Each feature template consists of configuration files that add the required system settings and
packages necessary to add the feature to your platform project.
These templates can also include kernel or general file system changes that the respective feature
may require.
In the development environment for the installation, templates are located in the projectDir/
layers directory, in the following subdirectories:
wr-base/templates/feature/ benchmark
Adds benchmark packages.
debug
Adds debug-specific functionality, including the following
tools: elfutils, ltrace, memstat, strace, and the Wind River
LTTng trace daemon.
demo
Adds general purpose functionality for testing small file
system (glibc_small) target platforms.
gdb
Adds the GNU debugger for command-line debugging.
47
Wind River Linux
User's Guide, 5.0.1
wr-features/templates/ ipv6
feature/
Configuration file for enabling ipv6.
LAMP
Appends the following images to the build: mysql5, modphp,
phpmyadmin, apache2, and xdebug
lsbtesting
Adds recipes, tasks, images, and missing packages, as
necessary, for running the Linux Standard Base (LSB) tests on
your target platform.
mysql
Adds the mysql5 package.
mysql-odbc
Adds packages necessary to use MySQL over ODBC.
wr-kernel/templates/ compat-wireless
feature/
Provides a mechanism to build a compat-wireless out-of-tree
kernel module then install it on the target.
edac
Configuration file for edac
initramfs
Configures the build to create an initramfs image.
initramfs-integrated
Configures the build to create an initramfs image that will be
integrated with the kernel image.
kdump
Configuration file to enable kdump
kernel-debug
Configuration file to enable kernel debugging
kernel-tune
Configuration file to add necessary user land tools
kexec
Configuration file to enable kernel execution of a new kernel
over the currently running kernel.
kvm
48
4 Build Environment
Directory Structure for Platform Projects
wr-toolchain/templates/ target-toolchain
feature
Appends toolchain wrappers and symlinks to the Wind River
Linux build
wr-tools-debug/templates/ debug-wb
feature/
Adds required target agents to support command line and
Workbench debugging.
libwrsqtehelper
Adds a library of Qt object wrapper functions that can help
display Qt objects that are otherwise opaque when used with
Wind River Workbench.
wr-tools-profile/templates/ analysis
feature/
Adds support for Wind River Analysis tools, including
interfaces to Wind River Workbench for performance
profiling and memory analysis.
boottime
49
Wind River Linux
User's Guide, 5.0.1
wrlcompat/templates/ export-tar
feature/
Adds a step to recipe building that creates tarballs of SVN
and git repositories, and copies over tarballs to a common
directory (tmp/deploy/tar) to be used or copied over to other
directories.
ip-report
Adds an IP report to the BitBake parser environment.
package-report
Adds a package report to the BitBake parser environment
pseudo14
Sets the preferred pseudo version to 1.4.5
pseudo15
50
4 Build Environment
Kernel Configuration Fragments in the Project Directory
Each kernel configuration fragment includes a list of kernel feature descriptions that encapsulate
a change to the kernel tree, depending on the fragment's application.
Kernel tree changes consist of patches, or configuration fragments, that are applied to the branch,
or board/target-specific system kernel being built.
Currently, Wind River Linux 5.0.1 offers the following kernel configuration fragments:
51
Wind River Linux
User's Guide, 5.0.1
52
4 Build Environment
Directory Structure for Platform Projects
53
Wind River Linux
User's Guide, 5.0.1
To view a list of available template descriptions, use the Workbench Platform Project wizard.
See About Templates on page 115 for information on adding templates to your platform project
image.
Step 1 Start Workbench.
When you configure a platform project image, Wind River Linux automatically creates a sample
local layer for use as a location to contain your application projects.
The local layer lives in the layers/local directory and is created with the following structure:
54
4 Build Environment
Directory Structure for Platform Projects
Figure 4: Local Layer Directory Structure with Sample Hello World Application
The layers/local also contains the final recipe processed by the build system layers/local/recipes-
img/images/wrlinux-image-filesystem.bb. A link to this file called default-image.bb appears
in the root directory of the project. This file and the your local.conf file form the basis of your
project wide configuration.
In this example, the projectDir/layers/local directory also includes the recipes-sample/
hello subdirectory, which is added to the local directory when you add the sample Hello World
application project to your platform project image. See the Wind River Linux Getting Started Guide:
Developing an Application Project Using the Command Line.
When you add a sample application, the contents are automatically added to the layers/local/
recipes-sample directory.
When you import an application package using the import-package feature, the contents are
added to the layers/local/recipes-local directory. See About the Package Importer Tool (import-
package) on page 144.
The local layer is enabled by default. You can verify this by looking at the contents of the
projectDir/bitbake_build/conf/bblayers.conf file. The main components of the layer are the
layer configuration file (projectDir/layers/local/conf/layer.conf), and the application-specific
source code and associated metadata located in the recipes-sample/hello folder. Layers and layer
requirements are described in the following sections:
55
Wind River Linux
User's Guide, 5.0.1
Wind River Linux provides two options to view the README files that are part of your platform
project build.
README files located in your installation, such as the one located in the installDir/layers/
example/lemon_layer directory, actually reside in a git repository, and are not directly available
to open to review, even when you configure and build a platform project.
Use the --with-layer= configure option to add a layer to a platform project to make a README
file available for viewing or editing.
The following procedure uses the README file located in the installDir/wrlinux-5/layers/
examples/lemon_layer directory as an example. To use another README file from a different
layer, locate the layer path before you begin.
Step 1 Configure a platform project to include the layer with the README file.
In this example, you will use the --with-layer=examples/lemon_layer configure option to add the
layer.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_std \
--with-layer=examples/lemon_layer
Substitute the --with-layer= path as necessary to add a different layer to view a different
README file.
56
4 Build Environment
Adding All Layers to a Platform Project to View All README Files
Use the --enable-checkout-all-layers=yes configure option to add all layers to a platform project
to make all README files available for viewing or editing.
The following procedure checks out all project layers from the git repository and add them to the
projectDir/layers directory. Once you perform this procedure, the layer README files are
accessible and do not require a git command to view or edit.
Step 1 Configure a platform project.
In this example, you will use the --enable-checkout-all-layers=yes configure option to add all
layers.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_std \
--enable-checkout-all-layers=yes
57
Wind River Linux
User's Guide, 5.0.1
58
PA R T I I
Localization........................................................................... 91
Portability.............................................................................. 95
Layers.................................................................................... 99
Recipes.................................................................................. 109
Templates.............................................................................. 115
59
Wind River Linux
User's Guide, 5.0.1
60
5
Configuration and Build
Introduction 61
About Building Platform Project Images 72
Build-Time Optimizations 76
Examples of Configuring and Building 77
About Creating Custom Configurations Using rootfs.cfg 80
EGLIBC File Systems 85
Introduction
With Wind River Linux, you must configure and build a platform project image to develop it to
suit your needs.
For information on configuring and building platform projects in general, see the Wind River
Linux Getting Started Guide: Developing a Platform Project Image Using the Command-Line.
Before you begin, see:
• Directory Structure for Platform Projects on page 43
• Run-time Software Configuration and Deployment Workflow on page 27
Design Benefits
The design of the Yocto Project BitBake build system with Wind River Linux offers several
important benefits:
• If a pre-built kernel and file system are satisfactory for deployment, or current testing and
development, you can build a complete run-time file system in minutes using prebuilt kernel
and file system binaries.
• You can build specific parts from source files, saving time by building only the file system, or
only the kernel, or a specific package, whichever element is of current interest.
• Your builds cannot contaminate the original packages, layers, recipes, templates, and
configuration files, because the development environment is kept separate from the build
61
Wind River Linux
User's Guide, 5.0.1
environment. For additional information, see Directory Structure for Platform Projects on page
43 and Directory Structure for the Development Environment.
• You can include all of your project changes in the projectDir/layers/local directory to
simplify development. See About the layers/local Directory on page 54
• By using custom layers and templates (see About Layers on page 99 and About Templates
on page 115, you can add packages, modify file systems, and reconfigure kernels
for repeatable, consistent builds, yet still keep your changes confined for easy removal,
replacement, or duplication.
These last two features allow multiple builds, customized builds, and a strict version control
system, while keeping the development environment pristine and intact.
You create the build environment as a regular user with the configure script. For additional
information, see About the Configure Script on page 63. It is in this environment that you build
(make) Wind River Linux run-time system, either default or customized, using software copied
or linked from the development environment.
Although this information is oriented toward the command line, it will also give Workbench
users a better understanding of the process of creating a Wind River Linux platform project.
NOTE: The configure script checks for required host updates, and notes them in config.log, a
text file within your projectDir directory.
Before you configure and build a platform project image, you must first create the directory to
manage your build.
The platform project directory is a directory that you create in the build environment, as opposed
to the development environment. See Directory Structure for the Development Environment, for an
explanation of development environment in Wind River Linux.
You typically create a platform project within a work directory, called in this guide workdir.
Within workdir you create a subdirectory for the particular project, which will be referred to in
this guide as projectDir.
While you can name your projectDir anything you like, in this guide, we use examples that
indicate the system configuration and contents of the project, for example common_pc_small, to
indicate an x86 common pc target platform with a small file system. Another example is to use
the BSP name and file system, such as qemux86-64_small. This example indicates the project is
configured with the 64-bit QEMU x86 platform with a glibc_small file system.
After you create your project directory, you can define the shared state cache (sscache) and ccache
environment variables to significantly help speed up your build process. See the Wind River Linux
Getting Started Guide: Creating a Platform Project from the Command-Line, for information on setting
these variables.
For information on the project directory, see
• About the Project Directory on page 41
• Directory Structure for Platform Projects on page 43
62
5 Configuration and Build
Initializing the Wind River Linux Environment
Project configuration is the actual creation of the project files based on the using the configure
script with options to define the platform project.
Minimum configure options include the board support package (BSP), kernel, and rootfs (file
system). Additionally, you can use layers, profiles, and templates to add additional features to
your platform project, depending on your requirements.
The configure script accepts many optional arguments besides board, kernel, and root file
system. For example you can specify additional features, build optimizations, restrict it to kernel
builds, request different kinds of images from the build and more. See the configure command
help (-h or --help option), Configure Options Reference on page 66, and additional examples in
this guide for details.
When you have configured your project, you can build it, as described in About Building Platform
Project Images.
Learn how to initialize the development environment and create an environment variable to
simplify platform project configuration.
This procedure is optional, but can help save time when you configure platform projects.
Step 1 Navigate to the Wind River installation directory.
$ cd installDir
$ ./wrenv.sh -p wrlinux-5
You will then have an environment variable for the Wind River configure script, named
WIND_LINUX_CONFIGURE.
$ $WIND_LINUX_CONFIGURE options…
The configure script is the most important of several key configuration files—it initiates the entire
configuration process.
It creates a subdirectory structure within the project directory and populates it with the script
framework, configuration files and tools necessary to build the run-time system. It processes
board templates and initial package files, and copies basic run-time file system configuration files
(for the etc and root directories), from the development environment.
The script is always run with options. Which options you supply depend on which kernel and file
system you wish to build for your board, which features you want to include, and whether you
wish to build a complete run-time system, or only a kernel or only a file system.
The configure script produces a plain text log file, config.log, within the project directory, in this
case, workspace/qemux86-64. This is a very useful file, recording configure options, automatic
checking of host RPM updates, and so on. Workbench saves a similar log file, creation.log which
contains the screen output of the configure command.
63
Wind River Linux
User's Guide, 5.0.1
NOTE: Do not run configure, builds (make target), or Workbench as root because this may
interfere with the operations of the build system.
The examples in this documentation show running the configure script relative to an
installDir of /opt/WindRiver/wrlinux-5/wrlinux, for example:
$ configDir/configure options…
If your installation is in a different location, replace configDir with the location of your
installation. If you are using Workbench, you run the configure script by clicking Finish in the
new project wizard.
To help simply using the configure script, you may wish to create an environment variable for it.
NOTE: You should not alias configure to be the full path to the configure script, or add the
path to configure in your PATH, because this could cause problems. If, for example, you install
or update a local host package that requires running the host operating system's configure
command, the Wind River Linux configure script could be called instead. You could, however,
alias a different name, for example wrconfig, to be the full path to the Wind River Linux
configure script.
See Examples of Configuring and Building on page 77 for instructions on configuring and
building various project types, kernels and packages.
As a minimum, you must specify at least a board, kernel, and root file system to the configure
script.
To configure a platform project image, you must first create a project directory in the build
environment. For additional information, see About Creating the Platform Project Build Directory on
page 62.
Step 1 Navigate to the platform project directory (projectDir).
$ cd projectDir
$ configDir/configure \
--enable-board=qemux86-64 \
64
5 Configuration and Build
About Configure Options
--enable-kernel=standard \
--enable-rootfs=glibc_std
NOTE: The board parameter, qemux86-64 in this case, is also referred to as the board support
package, or BSP.
While this configuration does not include any build time optimizations, Wind River recommends
using them to speed up platform project builds. For additional information, see Build-Time
Optimizations on page 76.
Use configure script options to tailor your platform project to your specific development needs.
The configure script requires that you specify a board (BSP), kernel type, and rootfs. These
options provide the information necessary for the build system to create a complete runtime
system.
To configure a build of a complete run-time system, the necessary options are:
--enable-board=bspName
--enable-kernel=kernelType
--enable-rootfs=rootfsType
After the project configures successfully, use the make command to build everything. See About
Building Platform Project Images.
NOTE: With the exception of the glibc_small file system, the configure script creates file systems
that by default contain debugging functionality. See Examples of Configuring and Building on
page 77 for details on adding debugging capabilities to small file systems. The glibc_small
+debug feature template adds additional debug support to small file systems.
Do not repeat arguments to the configure script, because only the last one will be used. For
example, if you specify:
--enable-build=production --enable-build=profiling
The configure script sets the version to profiling. If you want to specify multiple non-exclusive
features, use comma-separated lists, for example:
--with-template=template1,template2
or add features to the root file system with the “+” shorthand such as”
--enable-rootfs=glibc_small+feature1+feature2+feature3.
65
Wind River Linux
User's Guide, 5.0.1
The configure script can be run with a large number of options, as explained in this section.
You can display a complete list with the following command:
$ configDir/configure --help
This section describes some of the more commonly used configure options.
Option Description
Option Description
66
5 Configuration and Build
Introduction
Option Description
image. Once complete, the image resides in
the projectDir/export/ directory. See About
Configuring and Building Bootable Targets on
page 265.
67
Wind River Linux
User's Guide, 5.0.1
Option Description
flow may be reordered, and only limited
stack tracing information is available.
productiondebug
Use to include production optimizations,
but also install all symbols and debug
info packages on the target system image.
This option does enable on-target debug
packages. This is the equivalent of building
the production filesystem image and
then the production fs-debug image and
combining them.
profiling
Use profiling to compile programs and
binaries with stack frames to enable use of
profiling tools. The binaries are production
optimized, but are not stripped (the debug
information is in the binary, not a .debug
directory).The on-target debug packages
are also included. The following profiling
optimizations are added to package
compilation:
• -fno-omit-frame-pointer
• -fvisbility=default
68
5 Configuration and Build
Introduction
Option Description
scenario. Your development workstation must
have ccache installed.
For additional information on using ccache,
see the Wind River Linux Getting Started Guide:
Configuring a Platform Project
69
Wind River Linux
User's Guide, 5.0.1
Option Description
INHERIT += "rm_work"
70
5 Configuration and Build
Introduction
Option Description
71
Wind River Linux
User's Guide, 5.0.1
Option Description
Platform Projects
After you have configured a project as described in About Configuring a Platform Project Image on
page 62, you can build it using the make command. The build produces the target software
such as the kernel and file system for a particular board, depending on how you configured it.
When you run make, make fs, or make all, it builds (or rebuilds) the platform project using
the specified options. If source changes are detected, the binary packages associated with those
changes are automatically rebuilt. Like many Wind River Linux make targets, this is a wrapper to
an equivalent of Yocto build command, in this case: bitbake wrlinux-image-filesytem-type; for a
cross reference see Yocto Project Equivalent make Commands on page 73.
NOTE: Build times will differ depending on the particular configuration you are building, the
amount of data that can be retrieved from sstate-cache, and on your development host resources.
When you build the platform project, this generates and extracts the root file system for the
platform project initially. If you run one of the make commands again, it will only regenerate and
extract the file system if something has changed.
To force a file system generation, simply touch the image *.tar file before running the make
command. For example, from the projectDir:
$ touch export/*.tar*
In many cases you can reduce the amount of time required for project builds by specifying
various caching and parallelizing options to configure or make. In addition, there are
environment variables you can set if you want to always use these options, or only selectively not
use them. Refer to Build-Time Optimizations on page 76 for more information on improving
project build times.
72
5 Configuration and Build
Yocto Project Equivalent make Commands
In addition to the basic make commands that build the platform project and generate the root file
system and kernel images, Wind River Linux provides commands to help simplify development
tasks, such as generating the software development kit (SDK) for application development,
and launching simulated QEMU or Simics target platforms. For a list of make commands, see
Common make Command Target Reference on page 351.
Wind River Linux is compatible with the Yocto project. Learn about the Yocto BitBake equivalents
for common make commands.
73
Wind River Linux
User's Guide, 5.0.1
DEFAULT_IMAGE = "wrlinux-image-glibc-
std"
74
5 Configuration and Build
About Build Logs
When you build package recipes, the build system creates symlinks to separate build output logs
for each package in projectDir/build/packageName/temp/.
Generally speaking, the BitBake build system generates one log per task, and a typical package
build runs four or more tasks. For example, the logs created for the hello package are located in
projectDir/build/hello-1.0-r1/temp directory, and include:
• log.do_compile
• log.do_package_write_rpm
• log.do_configure
• log.do_patch
• log.do_fetch
• log.do_populate_sysroot
• log.do_install
• log.task_order
• log.do_package
75
Wind River Linux
User's Guide, 5.0.1
See also the online output of the make help command (not make -help) in your project build
directory after you have configured a project.
Build-Time Optimizations
There are several options you can use that can reduce your total build time and save build
environment disk space.
You can do this with environment variables so that you can “set it and forget it”, or you can
add command line options to your configure script or make command to perform the same
optimizations. Using the command-line options will override your environment variable settings.
Use the examples in this section to implement the available configure and build optimization
options. Note that you can control these settings through Workbench as well, as described in
Wind River Workbench by Example, Linux 5 Version.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_std \
--enable-jobs=5 \
--enable-parallel-pkgbuilds=5
To allow multiple instances of gcc when a package is building, use the --enable-jobs option.
To allow multiple packages to build simultaneously, specify --enable-parallel-pkgbuilds.
In this example, the build system will build up to five packages at once with up to five instances
of gcc per package, resulting in a maximum of up to 25 parallel operations occurring.
NOTE: In practice, that is very atypical since most packages cannot support nearly that level
of parallelism and only the build stage can typically be parallelized at all. Because of that, the
parallelism provided by building separate packages in parallel generally offers a much larger
performance improvement than building individual packages in parallel.
In addition, the actual parallelism achieved depends on the dependency lists of the packages.
For example, if you are building glibc and all of your other packages depend on glibc, those
other packages must wait for glibc to be completed before they can be built.
The numbers shown in the example are not unreasonable for, for example, a dual-core
workstation. For more powerful configurations, a rule of n+1 operations might be a reasonable
configuration. For example, on an eight-core machine, you could set the two values to 9 for a
maximum total of 81 concurrent build operations. Note that these are just suggestions, and you
should find optimal settings for your specific environment.
76
5 Configuration and Build
Examples of Configuring and Building
INHERIT += "rm_work"
This line erases the staging area used to compile a package when the package is successfully
built. This can also save a significant amount of disk space when you consider a few packages
in the glibc-std build take between 200MB to 300MB each to compile.
Follow examples to learn various strategies for configuring and building platform projects and
packages using Wind River Linux.
All configure script examples assume you are in a project directory that you have created as an
ordinary user (not root). Running the following command in your build directory would create a
project directory and navigate to it:
Use this configure script example as a basis to create your platform-project image.
The following example procedure assumes you are in a project directory that you have created as
an ordinary user (not root).
A full project configuration requires you to specify a board (BSP), a kernel type, and a root file
system type at a minimum. The options may be entered in any order, but the basic syntax is:
$ configDir/configure \
--enable-board=BSP \
--enable-kernel=kernel_type \
--enable-rootfs=rootfs_type
Step 1 Specify the configuration for your run-time system with the configure command.
77
Wind River Linux
User's Guide, 5.0.1
The following example configures the complete target software for a qemux86-64 BSP with a
standard kernel and a small glibc-based file system:
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small
$ make
NOTE: In this example, no debug or demo templates have been added to the small file system
configuration, which makes for a smaller run time, but it is one that does not have debug tools,
such as the usermode-agent, built in. See Configuring and Building Complete Debug-Capable Run-
time. for an example in which debug capabilities are added. By default, Workbench builds small
file systems with debug and demo tools included.
Use these example make commands as a basis to configure and build a kernel.
Build the kernel You can build the kernel by specifying the linux target:
Configure the kernel To configure Wind River Linux kernel options, you can use
standard Linux tools such as xconfig or menuconfig, for
example:
Use the following example configure script to create your flash-capable platform-project image.
You can configure a complete run-time system (kernel and file system) with subsequent creation
of a flash file system enabled, using the --enable-bootimage= configure option.
78
5 Configuration and Build
Configuring and Building a Debug-capable Run-time
$ configDir/configure \
--enable-board=bsp \
--enable-kernel=standard \
--enable-rootfs=glibc_small \
--enable-bootimage=jffs2
While this configuration does not include any build time optimizations, Wind River recommends
using them to speed up platform project builds. For additional information, see Build-Time
Optimizations on page 76.
$ make
For additional supported images, see About Configuring and Building Bootable Targets on page
265.
Use the following configure script examples to create a debug-capable platform-project image.
Use this example procedure to configure a complete run-time system (kernel and file system)
with subsequent debugging enabled.
Step 1 Configure a platform project with debug features enabled.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small+debug \
--enable-build=debug
This configure example uses two options to provide debug capability to the platform project:
--enable-build=debug
Adds application debugging features to the file system. See Configure Options Reference on
page 66.
--enable-rootfs=glibc_small+debug
Adds the feature/debug template, which adds debug-specific functionality to the target file
system, including the following tools: elfutils, ltrace, memstat, strace, and the Wind River
LTTng trace daemon.
NOTE: This example provides a shorthand method for adding a template using the configure
command. The standard method is to use the --with-template= configure option, which in this
example would be --with-template=feature/debug.
79
Wind River Linux
User's Guide, 5.0.1
Similarly, to add demo capability (basic graphics capabilities) to a glibc_small file system, you
could either include the --with-template=feature/demo option to the configure command, or just
specify the file system as --enable-rootfs=glibc_small+demo as follows:
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small+demo
$ make
For more information on the features provided by the debug and demo templates, see the
installDir/wrlinux-5/layers/wr-base/templates/feature/demo and *debug directories.
After you have configured a platform project, you can build a particular target package, for
example after making changes to its source code.
Use the following procedure to build a target package.
Step 1 Extract and patch the package source.
This extracts and patches the package source and places it under build/package-version/
directory.
The package, and any packages that are dependant on it, will be rebuilt.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small \
--with-template=feature/debug,feature/analysis \
--with-layer=meta-selinux,wr-intel-support
80
5 Configuration and Build
About Creating Custom Configurations Using rootfs.cfg
In this example, even while using simplified --with-layer and --with-template options to specify
additional layers and templates on the same line, the overall configuration requires five different
command options.
By creating a new, custom projectDir/myLayer/templates/rootfs.cfg file based on
projectDir/layers/wr-base/templates/rootfs.cfg, you can automatically include the options
above. The result is a simplified configure script command that requires only three options, for
example:
$ configDir/configure \
--with-layer=path_to_myLayer \
--enable-board=qemux86-64 \
--enable-rootfs=glibc-custom
If you frequently use the same templates or layers as part of your platform development, or
need to specify a different or custom kernel type, you can create a rootfs.cfg file, and define a
new root file system, with other options, in the file, such as the glibc-custom rootfs option in the
example above. Once created, the new file is available for use by the configure script as long as
you specify the file's location using the --with-layer=path_to_myLayer in the configure script
command.
[rootfs]
glibc-custom = image
[glibc-custom "image"]
default-ktype = standard
compat = wrlinux-*
default = wrlinux-image-glibc-core
allow-bsp-pkgs = 0
[glibc-custom "distro"]
default = wrlinux
compat = wrlinux
[glibc-custom "vars"]
layers = meta-selinux,wr-intel-support
templates = feature/debug,feature/analysis
Depending on your project requirements, you can define a custom rootfs name, the kernel
type, and add the layers and templates that you require.
NOTE: The kernel types, layers, and templates you include in this file must be part of your Wind
River Linux installation. Missing layers and templates, or misspelled kernel type, layer, and
template names, will return an error and halt the configure script.
81
Wind River Linux
User's Guide, 5.0.1
$ configDir/configure \
--with-layer=/home/user/myLayer \
--enable-board=qemux86-64 \
--enable-rootfs=glibc-custom
5. Build the platform project, and verify that the options, such as layers, templates, and kernel
types, are included in the build.
As long as you specify the location of the layer that contains the rootfs.cfg file, you can reuse the
new custom rootfs in any platform project configuration.
[rootfs]
glibc-core = image
glibc-small = image
glibc-std = image
glibc-std-sato = image
[ktypes]
standard = ktype
preempt-rt = ktype
[glibc-small "image"]
default-ktype = standard
compat = wrlinux-*
default = wrlinux-image-glibc-small
allow-bsp-pkgs = 0
[glibc-small "distro"]
compat = wrlinux
default = wrlinux
[glibc-core "image"]
default-ktype = standard
compat = wrlinux-*
default = wrlinux-image-glibc-core
allow-bsp-pkgs = 0
[glibc-core "distro"]
default = wrlinux
compat = wrlinux
[glibc-std-5.0 "image"]
default-ktype = standard
compat = wrlinux-*
default = wrlinux-image-glibc-std-5.0
[glibc-std "image"]
default-ktype = standard
compat = wrlinux-*
default = wrlinux-image-glibc-std
[glibc-std "distro"]
default = wrlinux
compat = wrlinux
[glibc-std-sato "image"]
default-ktype = standard
compat = wrlinux-*
default = wrlinux-image-glibc-std-sato
[glibc-std-sato "distro"]
default = wrlinux
compat = wrlinux
82
5 Configuration and Build
About Creating Custom Configurations Using rootfs.cfg
This example includes entries for the root file system and kernel options described in Kernel and
File System Components on page 16, and includes the following:
[rootfs]
This section lists the names of the available root file systems. Each entry in this section
requires its own separate image and distro entry in the file.
To create a new custom rootfs configuration, enter a name for it in this section on a separate
line.
NOTE: Do not use underscores (_) in your [rootfs] entries. These are not recognized by the build
system and can cause the build to fail.
[ktypes]
This section includes the available kernel types. Once defined, you can specify the kernel type
in the image section if you want it to be used automatically when you specify the rootfs. If you
have a custom kernel type, and want to make it available for platform project configuration,
you would enter it here.
[rootfsName "image"]
The image entry lets you specify the following options:
default-ktype
This entry is optional, and is used to automatically include a specific kernel type when you
use the rootfs name in your configure command. It must be a valid name defined in the
[ktypes] section of the rootfs.cfg file.
compat
Specifies compatibility with Wind River Linux recipe file names that begin with wrlinux.
default
Specifies the recipe *.bb file name used to create the image. If you create a custom rootfs
entry, you can use an existing recipe name, or create a new recipe. the name used must
match an existing recipe file, located in a layer that's included in the projectDir/
bitbake_build/conf/bblayers.conf file.
allow-bsp-pkgs=0
This optional entry prevents the addition of additional packages being added to the root
file system that originate from the BSP. Exclude this entry to accept the default and allow
BSP packages. In the example above, this entry is only added to the [glibc-small "image"]
entry, to keep the footprint small.
[rootfsName "distro"]
The distro entry specifies the following options as wrlinux only. Currently, there is nothing
you can change in these entries.
compat
The default entry is wrlinux.
default
The default entry is wrlinux.
[rootfsName "vars"]
83
Wind River Linux
User's Guide, 5.0.1
The optional vars entry, not shown in the example above, lets you specify layers and templates
to be automatically included when you specify the rootfs during project configuration. Valid
entries include:
layers
Enter each layer name, separated by a comma. Only the layer name is required, you do not
have to specify the path. For example:
[rootfsName "vars"]
layers = meta-selinux,wr-intel-support
templates
Enter each template name as you would in the configure script command, for example:
[rootfsName "vars"]
templates = feature/debug,feature/analysis
[rootfs]
glibc-custom = image
[glibc-custom "image"]
default-ktype = standard
compat = wrlinux-*
default = wrlinux-image-glibc-core
allow-bsp-pkgs = 0
[glibc-custom "distro"]
default = wrlinux
compat = wrlinux
[glibc-custom "vars"]
layers = meta-selinux,wr-intel-support
templates = feature/debug,feature/analysis
Depending on your project requirements, you can define a custom rootfs name, the kernel
type, and add the layers and templates that you require.
NOTE: The kernel types, layers, and templates you include in this file must be part of your Wind
River Linux installation. Missing layers and templates, or misspelled kernel type, layer, and
template names, will return an error and halt the configure script.
84
5 Configuration and Build
EGLIBC File Systems
• Refer to the new name you gave your rootfs in the --enable=rootfs= configure option.
For example:
$ configDir/configure \
--with-layer=/home/user/myLayer \
--enable-board=qemux86-64 \
--enable-rootfs=glibc-custom
5. Build the platform project, and verify that the options, such as layers, templates, and kernel
types, are included in the build.
As long as you specify the location of the layer that contains the rootfs.cfg file, you can reuse the
new custom rootfs in any platform project configuration.
Embedded GLIBC (EGLIBC) is a variant of GLIBC which is designed with embedded systems in
mind.
EGLIBC strives to be source and binary compatible with GLIBC with as few changes as possible.
The goals of EGLIBC include reduced footprint, configurable components, and better support for
cross-compilation.
See http://www.eglibc.org for details on the project.
The GLIBC package used in the Wind River Linux build system is, in fact, EGLIBC (eglibc 2.15).
EGLIBC can be configured to provide the smallest functional configuration of EGLIBC, while
being comparable to the feature set and footprint uCLibc project (http://www.uclibc.org), while
being more compatible with GLIBC. By default, the supported version of ELIBC is a pre-built
version that comes with the pre-built toolchain, and is Linux Standard Base (LSB)- and GLIBC-
compatible.
85
Wind River Linux
User's Guide, 5.0.1
For instructions on creating an EGLIBC platform project image, see Creating and Customizing
EGLIBC Platform Project Images on page 86.
NOTE: While it is possible to modify and use the wrlinux.conf file for this purpose, it is not
recommended. The wrlinux.conf file is used as a basis for all project configuration in Wind
River Linux, and modifying it in this manner could cause your builds to fail and your platform
projects to become corrupt.
• The WRL_GLIBC_MODE = variable, when used with the standard configuration, should be set
to its default value of "wrl-glibc-prebuilt". If you wish to change the EGLIBC configuration,
it should be set instead to "wrl-glibc-rebuild"; this is set automatically by the custom-
distro.conf file.
You can create an EGLIBC image at configure time or from an existing platform project image,
and customize it using the information in this section.
To create and customize an EGLIBC platform project image:
Step 1 Select one of the following options for creating an EGLIBC platform project image:
Options Description
New platform project Configure the platform project using the --with-custom-
distro=distroName option. For example, a minimal configure
command might be:
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_std \
--with-custom-distro=distroName
DISTRO = "my-eglibc"
Notice that you do not need to specify the exact file location, or even
use the .conf filename extension.
86
5 Configuration and Build
EGLIBC File Systems
Performing either of these actions enables the customization features for EGLIBC platform project
images, and creates an alternate EGLIBC distro configuration file in your projectDir/layers/
conf/distro directory for you to use to set your EGLIBC features.
Step 2 Optionally, choose the features to add to, or remove from, your EGLIBC distribution, by editing
the projectDir/layers/local/conf/distro/distroName file's EGLIBC DISTRO_FEATURES_LIBC
variables. Once you open the file, the default configuration includes the following options:
#
# These available eglibc features may be conditionally disabled simply
# by commenting out the lines below. Note that some packages may fail
# to build or fail to work correctly at runtime without required libc
# functionality.
#
# Note that there are dependencies between features that are not
# captured at this level. Needed features may be re-enabled even if
# they are commented out here. See
# layers/oe-core/meta/recipes-core/eglibc/eglibc-options.inc (and
# libc/option-groups.def in the eglibc source) for details.
#
# The selections below correspond to the features needed to build and
# boot the WRLinux "glibc-core" rootfs.
#
DISTRO_FEATURES_LIBC = ""
#DISTRO_FEATURES_LIBC += "ipv6"
#DISTRO_FEATURES_LIBC += "libc-backtrace"
#DISTRO_FEATURES_LIBC += "libc-big-macros"
DISTRO_FEATURES_LIBC += "libc-bsd"
#DISTRO_FEATURES_LIBC += "libc-cxx-tests"
#DISTRO_FEATURES_LIBC += "libc-catgets"
#DISTRO_FEATURES_LIBC += "libc-charsets"
DISTRO_FEATURES_LIBC += "libc-crypt"
DISTRO_FEATURES_LIBC += "libc-crypt-ufc"
#DISTRO_FEATURES_LIBC += "libc-db-aliases"
#DISTRO_FEATURES_LIBC += "libc-envz"
DISTRO_FEATURES_LIBC += "libc-fcvt"
#DISTRO_FEATURES_LIBC += "libc-fmtmsg"
#DISTRO_FEATURES_LIBC += "libc-fstab"
DISTRO_FEATURES_LIBC += "libc-ftraverse"
DISTRO_FEATURES_LIBC += "libc-getlogin"
#DISTRO_FEATURES_LIBC += "libc-idn"
DISTRO_FEATURES_LIBC += "ipv4"
#DISTRO_FEATURES_LIBC += "libc-inet-anl"
DISTRO_FEATURES_LIBC += "libc-libm"
DISTRO_FEATURES_LIBC += "libc-libm-big"
#DISTRO_FEATURES_LIBC += "libc-locales"
DISTRO_FEATURES_LIBC += "libc-locale-code"
#DISTRO_FEATURES_LIBC += "libc-memusage"
DISTRO_FEATURES_LIBC += "libc-nis"
#DISTRO_FEATURES_LIBC += "libc-nsswitch"
DISTRO_FEATURES_LIBC += "libc-rcmd"
DISTRO_FEATURES_LIBC += "libc-rtld-debug"
DISTRO_FEATURES_LIBC += "libc-spawn"
#DISTRO_FEATURES_LIBC += "libc-streams"
DISTRO_FEATURES_LIBC += "libc-sunrpc"
DISTRO_FEATURES_LIBC += "libc-utmp"
DISTRO_FEATURES_LIBC += "libc-utmpx"
#DISTRO_FEATURES_LIBC += "libc-wordexp"
DISTRO_FEATURES_LIBC += "libc-posix-clang-wchar"
DISTRO_FEATURES_LIBC += "libc-posix-regexp"
DISTRO_FEATURES_LIBC += "libc-posix-regexp-glibc"
DISTRO_FEATURES_LIBC += "libc-posix-wchar-io"
87
Wind River Linux
User's Guide, 5.0.1
Using a text editor, uncomment and tailor the features include in your distribution. To specify
individual items, refer to the mapping table at: EGLIBC Option Mapping Reference on page 88.
NOTE: This list of options has been tested to create a reasonably small footprint platform project
file system. Not all option combinations are tested or supported. It is possible to uncomment
features and create a platform project file system that does not function as a result. You may
need to test feature option combinations as a result.
$ make
Once the build completes, the platform's system images and kernel will be located in the
projectDir/export directory.
For information on testing your platform image on a target system, see QEMU Targets on page
241.
Use this reference to map components in the option-groups.def file to facilitate component
selection for an EGLIBC build.
Feature to Map Option to Map to
ipv4 OPTION_EGLIBC_INET
ipv6 OPTION_EGLIBC_ADVANCED_INET6
libc-big-macros OPTION_EGLIBC_BIG_MACROS
libc-bsd OPTION_EGLIBC_BS
libc-tests OPTION_EGLIBC_CXX_TESTS
libc-catgets OPTION_EGLIBC_CATGETS
libc-charsets OPTION_EGLIBC_CHARSETS
libc-crypt OPTION_EGLIBC_CRYPT
libc-crypt-ufc OPTION_EGLIBC_CRYPT_UFC
libc-db-aliases OPTION_EGLIBC_DB_ALIASES
libc-envz OPTION_EGLIBC_ENVZ
libc-fcvt OPTION_EGLIBC_FCVT
libc-fmtmsg OPTION_EGLIBC_FMTMSG
libc-fstab OPTION_EGLIBC_FSTAB
libc-straverse OPTION_EGLIBC_FTRAVERSE
88
5 Configuration and Build
EGLIBC File Systems
libc-getlogin OPTION_EGLIBC_GETLOGIN
libc-idn OPTION_EGLIBC_IDN
libc-inet-anl OPTION_EGLIBC_INET_ANL
libc-libm OPTION_EGLIBC_LIBM
libc-libm-big OPTION_EGLIBC_LIBM_BIG
libc-locales OPTION_EGLIBC_LOCALES
libc-locale-code OPTION_EGLIBC_LOCALE_CODE
libc-memusage OPTION_EGLIBC_MEMUSAGE
libc-nis OPTION_EGLIBC_NIS
libc-nsswitch OPTION_EGLIBC_NSSWITCH
libc-rcmd OPTION_EGLIBC_RCMD
libc-rtld-debug OPTION_EGLIBC_RTLD_DEBUG
libc-spawn OPTION_EGLIBC_SPAWN
libc-streams OPTION_EGLIBC_STREAMS
libc-sunrpc OPTION_EGLIBC_SUNRPC
libc-utmp OPTION_EGLIBC_UTMP
libc-utmpx OPTION_EGLIBC_UTMPX
libc-wordexp OPTION_EGLIBC_WORDEXP
libc-posix-clang-wchar OPTION_POSIX_C_LANG_WIDE_CHAR
libc-posix-regexp OPTION_POSIX_REGEXP
libc-posix-regexp-glibc OPTION_POSIX_REGEXP_GLIBC
libc-posix-wchar-io OPTION_POSIX_WIDE_CHAR_DEVICE_IO
89
Wind River Linux
User's Guide, 5.0.1
90
6
Localization
About Localization 91
About Localization
Localization support allows you to develop projects for speakers of different languages.
Locales make geographic and language specific settings available to software users via its user
interface. These include character set, number format, date and time formats, currency, collation
rules, paper size, phone number format and others.
Wind River Linux provides varying levels of support for locales depending on the file system
selected for your build. You can use the locale command to view details about the current locale.
See Also:
• http://en.wikipedia.org/wiki/Locale
for a general discussion of locales.
• http://www.loc.gov/standards/iso639-2/php/English_list.php
for a list of language codes.
• http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm
for a list of 2-digit country codes.
Different file system options offer varying support for language locales. Knowing which are
available allows you to plan internationalization support for your project.
A list of locales supported by your file system is provided in your project.
Step 1 View the list of supported locales in the file installDir/build/eglibc/eglibc-2.18/libc/
localedata/SUPPORTED
91
Wind River Linux
User's Guide, 5.0.1
For example:
$ more installDir/build/eglibc/eglibc-2.18/libc/localedata/SUPPORTED
# This file names the currently supported and somewhat tested locales.
# If you have any additions please file a glibc bug report.
SUPPORTED-LOCALES=\
aa_DJ.UTF-8/UTF-8 \
aa_DJ/ISO-8859-1 \
aa_ER/UTF-8 \
aa_ER@saaho/UTF-8 \
aa_ET/UTF-8 \
af_ZA.UTF-8/UTF-8 \
af_ZA/ISO-8859-1 \
am_ET/UTF-8 \
an_ES.UTF-8/UTF-8 \
an_ES/ISO-8859-15 \
ar_AE.UTF-8/UTF-8 \
ar_AE/ISO-8859-6 \
...
en_US.UTF-8/UTF-8 \
en_US/ISO-8859-1 \
en_ZA.UTF-8/UTF-8 \
en_ZA/ISO-8859-1 \
en_ZM/UTF-8 \
en_ZW.UTF-8/UTF-8 \
en_ZW/ISO-8859-1 \
es_AR.UTF-8/UTF-8 \
es_AR/ISO-8859-1 \
es_AR.UTF-8/UTF-8 \
indicates 8 bit Universal Transformation Format (UTF) support for Argentinian Spanish.
es_AR/ISO-8859-1 \
92
6 Localization
Setting Localization
Setting Localization
Adding a locale to your project provides internationalization support for speakers of different
languages.
GLIBC_GENERATE_LOCALES += "en_GB.utf8"
IMAGE_LINGUAS = "en-gb.utf8"
NOTE: Observe the differences in case and use of underscore versus dash to construct the values
for GLIBC_GENERATE_LOCALES and IMAGE_LINGUAS.
The += operator in the example above keeps us from preventing any default locales from
being generated for glibc. To include additional locales in the image, use the += operator when
assigning to IMAGE_LINGUAS as well.
$ make fs
Support for the locale has been added when the build completes successfully.
93
Wind River Linux
User's Guide, 5.0.1
94
7
Portability
It is possible to move a platform project for comparison or development, or configure it for stand-
alone portability.
Basic Portability
In this context, basic portability refers to the functionality included for moving or copying
platform projects by default, with no special configure script options.
When you configure and build a platform project, the project's contents reside in the project
directory (projectDir). Aside from the content in the projectDir/layers/local directory,
much of the project contents are actually symbolic links to relevant git repositories located in
the development environment. This creates a requirement for the development environment to
know the location of the projectDir, so that it can populate the directories in alignment with
the project configuration options.
Wind River Linux uses the ${WRL_TOP_BUILD_DIR} variable to define the platform project's
location, and make it possible to copy or move a platform project on the same build host to
another location to meet your development needs. This variable is defined in the projectDir/
bitbake_build/conf/bblayers.conf file. For additional information, see Configuration Files and
Platform Projects on page 33.
95
Wind River Linux
User's Guide, 5.0.1
NOTE: If you relocate the product install directory you must reconfigure any platform projects
created using the original installation location. For additional information, see Updating a
Platform Project to a New Wind River Linux Installation Location on page 96.
If you move a platform project, you must clear up all temporary files that comprise absolute
paths. For additional information, see Copying or Moving a Platform Project on page 96.
Stand-alone Portability
In this context, stand-alone portability refers to a platform project that is not dependant on the
Wind River Linux installation, or development environment, for project build and development.
To create a stand-alone platform project, add the --enable-stand-alone-project=yes configure
script option when you configure your project.
When you configure a platform project with this option, the symbolic links between the
development environment and projectDir are replaced with copies of the directories and files
from the git repositories. This can consume a significant amount of disk space.
$ rm -rf bitbake_build/tmp
This is required because the OE-core performs a sanity check to verify the physical location of
the projectDir/bitbake_build/tmp directory. If it fails, the build process will halt, and you will
receive an error message. Removing the directory causes the build system to update the path to
the new location.
$ make
Learn how to update a platform project when the Wind River Linux installation (installDir)
changes.
The following procedure requires a previously configured platform project, and a new or
changed installDir.
Step 1 Obtain the configure script command used to create the project.
96
7 Portability
Updating a Platform Project to a New Wind River Linux Installation Location
NOTE: In this example, configDir refers to the path to your Wind River Linux configure
script, for example, /home/user/WindRiver/wrlinux-5/wrlinux/.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-rootfs=glibc_small \
--enable-kernel=standard \
--enable-bootimage=iso
c) Modify the path to the configure script to match the new Wind River Linux installation
(configDir) location.
d) Add the --enable-reconfig=yes option to the script command, and rerun it.
$ new_configDir/configure \
--enable-board=qemux86-64 \
--enable-rootfs=glibc_small \
--enable-kernel=standard \
--enable-bootimage=iso \
--enable-reconfig=yes
The configure script will reconfigure the platform project to use the new installation location.
$ make
Once complete, the platform project will be symbolically linked to the new installation's location.
Step 4 Optionally, verify that the platform project is symbolically linked to the new installation location.
If the build from the previous step fails, or you want to verify the location of the git repositories
that your platform project point to, perform this step.
Run the following command from the platform project directory:
$ ls -l git
97
Wind River Linux
User's Guide, 5.0.1
98
8
Layers
About Layers 99
Layers Included in a Standard Installation 100
Installed Layers vs. Custom Layers 102
Layer Structure by Layer Type 103
About Layer Processing and Configuration 105
About Layers
99
Wind River Linux
User's Guide, 5.0.1
Each layer has a layerDir/conf/layer.conf file that the BitBake build system uses to process the
layer on project configuration and build. See Configuration Files and Platform Projects on page 33 .
CAUTION: The following layers are part of the Wind River Linux installation and are required
by the build system. It is recommended that you do not modify these layers, as it may render
your installation and development environment unusable. For additional information, see
Installed Layers vs. Custom Layers on page 102.
CAUTION: Depending on your platform project configuration options, some of these layers may
not be present.
examples
Contains fully-working layer examples that provide functionality to a platform project image.
These layer examples include:
fs-final
Provides an example of how a template can impact on the generation process of the file
system.
hello-world
Adds the classic “Hello World” application to your platform project image.
kernel-config-example
Provides an example of how to use a template to change a global kernel parameter.
lemon_layer
Adds a simple multi-threaded web server called the lemon_server to your platform project
image. You can use the examples provided in the README file located in this directory to
use the lemon_server to analyze memory leaks and debug the lemon_server application.
To add the layer functionality described above to your platform project image, refer to the
README file located in the directory containing the layer. For information on viewing
README files, see README Files in the Development Environment on page 39 and About
README Files in the Build Environment on page 56.
meta-downloads/
Contains copies of components referenced from external layers. The items are provided in a
way to avoid having to download them from the network. An associated configuration file is
also provided to inform the build system to use this as a pre-mirror.
meta-networking/
Contains networking-related packages and configuration. It should be useful directly on top
of oe-core and compliments meta-openembedded.
100
8 Layers
Layers Included in a Standard Installation
meta-selinux/
Enables SELinux support when used with Poky. The majority of this layer's work is
accomplished in .bbappend files, used to enable SELinux support in existing Poky packages.
meta-webserver/
Provides support for building web servers, web-based applications, and related software.
git/oe-core/
Contains the core metadata for current versions of OpenEmbedded. It is distro-less (can
build a functional image with DISTRO = "") and contains only emulated machine support.
The Yocto Project has extensive documentation about OpenEmbedded included a reference
manual, which can be found at http://yoctoproject.org/community/documentation.
oe-core-dl/
Contains downloaded packages and configuration files that comprise the package offerings
from the Yocto Project. The conf/layer.conf file defines the mirror sites and order of locations
that packages are retrieved from.
python-rhel5/
Contains Python binaries and source required by BitBake and Poky for the build process.
wr-base/
Contains the recipes and other configuration files that comprise the Wind River Linux base
offering and make it possible to use the configure script to generate a platform project image.
See About the Configure Script on page 63.
wr-bsps/
Contains recipes and machine configuration information for Wind River-supplied BSPs. See
the Wind River Linux Release Notes for a list of available BSPs.
wr-features/
Provides many of the base components for Wind River Linux. It is required by most other
layers that Wind River provides.
wr-fixes/
Provides bug fixes for other layers in the system. This layer requires oe-core.
wr-freescale_qoriq_dpaa/
Contains recipes and configuration information for using the Freescale User Space Datapath
Acceleration architecture.
wr-installer/
Contains a target-based installed for Wind River Linux. This layer requires most of the layers
that Wind River Linux provides.
wr-intel-support/
Contains software support in Wind River Linux for Intel technologies such as Intel
QuickAssist, DPDH, and AMT.
wr-kernel/
Contains recipes and machine configuration information for Wind River-supplied kernels
and kernel features. This includes a git repository for the Wind River Linux kernel and kernel
tools.
101
Wind River Linux
User's Guide, 5.0.1
wr-kvm-binary-guest-images/
Contains configuration information and directories for guest images.
wr-kvm-compile-guest-kernels/
Contains configuration information and directories for guest kernels.
wrlcompat/
In a typical Yocto Project build environment, the build output creates a specific directory
structure. This structure is different than the Wind River Linux structure from previous
releases. The wrlcompat layer ensures that build output is consistent with previous Wind
River Linux (4.x) releases.
wrlinux/
Contains the recipes, configuration information, and files that support Wind River Linux tools
and enhance development with the Yocto Project build system.
wr-simics/
Contains configuration information for using the Wind River Linux Simics system simulator.
wr-prebuilts/
Contains configuration information and files to support using pre-built binaries to create
platform project images.
wr-toolchain/
Contains files, recipes, configuration information and documentation to support the GNU
toolchain supplied by Wind River for development.
wr-toolchain-shim/
Provides configuration glue to allow selection of an automatically-integrated toolchain
layer, which in turn contains both rules for building the toolchain from source, and rules
for using the prebuilt binaries. This layer also contains tuning files and configuration
overrides for those layers.
wr-tools-debug/
Contains configuration information and files to support debugging and ptrace with
Workbench and Wind River tools.
wr-tools-profile/
Contains configuration information and files to support Wind River Linux development tools,
including: analysis, boot time, code coverage, Valgrind, and lttng.
See Templates in the Development Environment. for additional information.
When the installed layers do not meet your development needs, you can customize them or
create new layers.
Layers Included in a Standard Installation on page 100 provides a description of the installed
layers that comprise your Wind River Linux build system. These layers include support for
creating and developing platform project images and applications with Wind River Linux, and
also include support for add-on products, such as Wind River Simics.
102
8 Layers
Layer Structure by Layer Type
It is possible to modify these layers, but is not recommended. If you discover that the supplied
layers do not meet your development needs, you can create a custom layer that does. One
example might be to add support for new hardware that is not included in the wr-bsps layer.
Custom layers let you add additional functionality and extend the capabilities of your
development environment, as well as your build environment and the platform target you are
developing for. The Wind River Linux build system makes it possible to do the following:
• Create a new, custom layer and include it by default with all new platform project image
creation, or specify it for a single project.
See Creating a New Layer on page 106 for additional information.
• Extend the capabilities of an existing layer with append files (.bbappend) and save those
extensions as a new layer.
See About Recipes on page 109 for additional information.
• Include or exclude layers as necessary to meet your development needs.
See Enabling a Layer on page 107 and Disabling a Layer on page 108 for additional
information.
Application-specific Layers
The following figure provides an example of a minimum layer requirements for an application-
specific layer:
103
Wind River Linux
User's Guide, 5.0.1
In this example, the layer includes a conf/ directory with the layer.conf file, and a
recipes-appName folder with a recipe file (.bb), application source (.c), and an append file
(.bbappend) that extends the capability of an existing recipe file.
Note that the only minimum requirements for an application-specific layer are the conf/
layer.conf file and a recipe file (.bb). You can organize the information and content in any manner
you need to meet your development requirements.
Machine-specific Layers
The following figure provides an example of a minimum layer requirements for a machine-
specific layer:
A machine-specific layer requires the same layerDir/conf/layer.conf file as all layers do, but
also includes the layerDir/conf/machine/machineName.conf file to differentiate this as a
machine (BSP) layer type.
Distro-specific Layers
The following figure provides an example of a minimum layer requirements for a distro-specific
layer:
104
8 Layers
About Layer Processing and Configuration
A distribution-specific layer requires the same conf/layer.conf file as all layers do, but also
includes the conf/distro/distroName.conf file to differentiate this as a distribution (distro) layer
type.
• Creating a New Layer on page 106
• Creating a Recipe File on page 112
Learn how a project configuration is processed when you run the configure and make
commands.
105
Wind River Linux
User's Guide, 5.0.1
In Wind River Linux, processing your project configuration occurs in the following manner:
1. You run the configure script to specify your target platform options. See Introduction on page
61. This script automatically includes certain default layers in your project configuration,
along with any configure options that you specify.
2. You run the make command to build your project. This process takes into account all the
metadata of your platform project, including default and specified layers, templates, and the
recipes and .conf files that are associated with the metadata. For additional information, see:
• About Layers on page 99
• Metadata on page 32
• Configuration Files and Platform Projects on page 33
Part of the build process is processing the bblayers.conf file (see The bblayers.conf File). Layers
are processed from top to bottom in this file. Additionally, the layers.conf file has a variable
called BBFILE_PRIORITY, which sets the processing priority of the layer, so that a developer
can specify a higher priority to layers that other layers depend on.
3. After all of the layers and metadata are processed, and just before the actual file system
image for the platform project is created, the build system processes the fs_final*.xml and the
changelist.xml files. These files specify additional features or actions to be done on the target.
See Introduction to Managing Target Platforms.
Options Description
Machine support If the layer is adding support for a machine, add the machine
configuration in
conf/machine/
Distro policy If the layer is adding distro policy, add the distro configuration in
conf/distro/
New recipes If the layer introduces new recipes, put the recipes you need in recipes-
* subdirectories of the layer directory.
106
8 Layers
Enabling a Layer
Enabling a Layer
To enable a layer, add your layer's path to the BBLAYERS variable in your bblayers.conf file .
Step 1 Open the projectDir/bitbake_build/conf/bblayers.conf file in an editor.
For additional information, see Directory Structure for Platform Projects on page 43.
LCONF_VERSION = "5"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
WRL_TOP_BUILD_DIR ?= "${TOPDIR}/.."
# resolve WRL_TOP_BUILD_DIR immediately with a canonical path
# to satisfy the bitbake logger
WRL_TOP_BUILD_DIR := "${@os.path.realpath(d.getVar('WRL_TOP_BUILD_DIR', True))}"
BBLAYERS = " \
${WRL_TOP_BUILD_DIR}/layers/wrlinux \
${WRL_TOP_BUILD_DIR}/layers/wrlcompat \
${WRL_TOP_BUILD_DIR}/layers/wr-toolchain \
${WRL_TOP_BUILD_DIR}/layers/oe-core/meta \
${WRL_TOP_BUILD_DIR}/layers/oe-core-dl \
${WRL_TOP_BUILD_DIR}/layers/meta-downloads \
${WRL_TOP_BUILD_DIR}/layers/wr-kernel \
${WRL_TOP_BUILD_DIR}/layers/wr-bsps/qemux86-64 \
${WRL_TOP_BUILD_DIR}/layers/wr-base \
${WRL_TOP_BUILD_DIR}/layers/wr-features \
${WRL_TOP_BUILD_DIR}/layers/wr-tools-profile \
${WRL_TOP_BUILD_DIR}/layers/wr-tools-debug \
${WRL_TOP_BUILD_DIR}/layers/meta-networking \
${WRL_TOP_BUILD_DIR}/layers/meta-webserver \
${WRL_TOP_BUILD_DIR}/layers/wr-prebuilts \
${WRL_TOP_BUILD_DIR}/layers/local \
${WRL_TOP_BUILD_DIR}/layers/myLayer
$ make reconfig
This command reconfigures your platform project to include the new layer changes. The build
system parses each conf/layer.conf file as specified in the BBLAYERS variable. During the
processing of each conf/layer.conf file located in the path of the layer, the build system adds the
recipes, classes and configurations contained within the particular layer to your platform project
image (see Directory Structure for Platform Projects on page 43). Once the command completes, the
newly-updated target file system located in the projectDir/export/dist directory will include
the newly added layer
$ make
After the command completes, the newly-updated target file system located in the projectDir/
export/dist directory will include the newly added layer.
107
Wind River Linux
User's Guide, 5.0.1
Disabling a Layer
To disable a layer, remove the associated path from the bblayers.conf file
Step 1 Open the projectDir/bitbake_build/conf/bblayers.conf file in an editor.
For additional information, see Directory Structure for Platform Projects on page 43.
Step 2 Comment out or remove the code line with the layer's name.
$ make reconfig
$ make
108
9
Recipes
About Recipes
The Wind River Linux installation and build environments include recipes for use in specifying
build instructions, similar to a Makefile.
A recipe file provides instructions for building required packages. It describes:
• library dependencies
• where to get source code
• what patches to apply
• dependencies on other recipes
• configuration and compilation options
• the logical sequence of execution events
• what software and/or images to build
Recipes use the .bb file extension, and are typically located in an a recipes-appName directory:
109
Wind River Linux
User's Guide, 5.0.1
If you want to include your application or package in your platform project build, you must have
a recipe file associated with it. You can copy and modify an existing recipe file, or create one from
scratch.
See also:
• Creating a Recipe File on page 112
• Metadata on page 32
• The Yocto Project Development Manual: Using .bbappend Files
http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#using-bbappend-files
• The Yocto Project Wiki Recipe and Patch Style Guide
https://wiki.yoctoproject.org/wiki/Recipe_%26_Patch_Style_Guide
• Creating a Recipe File on page 112
• Metadata on page 32
SECTION = "sample"
PR = "r2"
SRC_URI = "file://hello.c"
S = "${WORKDIR}" do_compile() {
${CC} ${CFLAGS} -o hello hello.c
}
do_install() {
install -d ${D}${bindir}
110
9 Recipes
About Recipe Files and Kernel Modules
Note that the SRC_URI = element defines the location of the application's source file. You
would need to modify this location to match your own applications source, in relation to the
location of the recipe file.
See Creating a Recipe File on page 112 for details on required recipe elements and licensing
information.
When a recipe produces a kernel-module, it is necessary to configure the recipe to prefix the
name of the generated packages with kernel-module-. The easiest way to do this is by specifying:
PKG_name = "kernel-module-name"
The following works in most cases, where only one module is generated in a package that has the
same name as the recipe:
PKG_name = "kernel-module-${PN}"
In this example, name is the package name being generated by the recipe. If the package name
already begins with kernel-module-, then no further changes are required.
You can extend, rather than replace, recipes using .bbappend files
It is not always necessary to recreate entire recipe files from scratch. Instead, you , providing that
the original information (recipe, or .bb file) resides in an existing layer.
NOTE: .bbappend files do not just relate to recipes, they also relate to layers, and existing conf/
layer.conf, conf/machine/machineName.conf, and conf/distro/distroName.conf files.
For an example of using a .bbappend file to extend kernel features, see Configuring Kernel Modules
With Fragments
Step 1 Create .bbappend files to supplement an existing recipe file with new information.
For .bbappend files to work successfully, they must have the same name as the original recipe
file. See Layer Structure by Layer Type on page 103 for an example of a recipe (.bb) filename and an
append (.bbappend) filename for the same application.
111
Wind River Linux
User's Guide, 5.0.1
Learn how to create a recipe file for an application package in your platform project.
Recipe files are necessary if you want your application package to be included in your platform
project image each time the project is configured, reconfigured, or built. See About Recipes on page
109.
After a new package is added to a layer in your platform project, it requires a recipe file to match
the new package contents.
Step 1 Copy an existing recipe file into the same layer and directory where your package resides.
Step 2 Change the name of the recipe file to match the package name for the application.
For example, if your application is named my-app.1.0, name the recipe file to match it,my-
app_1.0.bb for example.
NOTE: If you use the Package Importer tool to add a package to your platform project, it
generates a recipe automatically for you. See About the Package Importer Tool (import-package) on
page 144.
See About Recipes on page 109 for the required minimum recipe file contents.
$ vi layers/local/recipes-local/my-app/my-app_1.0.bb
LIC_FILES_CHKSUM = "file://LICENCE.TXT;md5="
LIC_FILES_CHKSUM = "file://LICENSE;md5=f27defe1e96c2e1ecd4e0c9be8967949"
NOTE: If you do not know your packages md5 checksum value, see Identifying the
LIC_FILES_CHKSUM Value on page 113.
112
9 Recipes
Identifying the LIC_FILES_CHKSUM Value
The shell will display the build output. If you receive build errors for incorrect license checksum,
see Identifying the LIC_FILES_CHKSUM Value on page 113.
In this case, you may need to perform steps 2 through 4 to update the LIC_FILES_CHECKSUM
value.
Each time you add a new package to your platform project image either using the Package
Importer tool or manually, you must update the package's recipe file LIC_FILES_CHKSUM to
match the value of the package.
The syntax for the LIC_FILES_CHKSUM value is follows:
LIC_FILES_CHKSUM = "file://license_info_location;md5=md5_value"
license_info_location
This is the name of the file that contains your license information. This could be a separate
license file, the application's Makefile, or even the application's source file itself, for example,
my-app.c.
md5_value
The numerical checksum value of the file called out in license_info_location.
When you add an application package to the system, or build a platform project that includes
applications with recipe files, this value is checked, and returns a build failure if the md5
checksum value does not match the value that the build system expects.
If you do not know this value, or your build fails with the following warning, you must obtain
the correct checksum value, and update the recipe's LIC_FILES_CHKSUM variable with it.
Options Description
Use the md5sum 1. Run the md5sum command on the license file.
command
$ md5sum layers/local/recipes-local/my-app/LICENSE
2ebc7fac6e1e0a70c894cc14f4736a89 LICENSE
2. Enter the numerical value only in the md5= section. For example:
LIC_FILES_CHKSUM = "file://
LICENSE;md5=f27defe1e96c2e1ecd4e0c9be8967949"
113
Wind River Linux
User's Guide, 5.0.1
Options Description
Use the build system 1. Run the make command to build the package recipe.
- The first line states that the md5 checksum from the package's
recipe file is incorrect.
- The second line provides the correct md5 checksum value. Use
this value to update the LIC_FILES_CHKSUM md5= value.
114
10
Templates
About Templates
The Wind River Linux installation and build environments include templates for specifying
system-wide configuration values.
Templates are Wind River extension to the Yocto build system. The template feature is
implemented in a bitbake compatible way, using Yocto compatible syntax, but you will not find
templates in other Yocto based distributions.
By enabling one or more settings, templates can do the following:
• define the supporting files and/or packages required by a specific architecture
• add new functionality, such as a web server or debugging tools to your platform project image
• add or modify hardware support to the kernel or BSP
• many more, depending on your end-system requirements
At its most basic form, a template is simply a directory containing a collection of text
configuration files. Templates can include other templates, be included in a layer, and also
supplement an existing template or layer.
Wind River Linux provides feature and kernel templates to simplify development. Once you
configure a platform project, templates are added to your platform project directories. See Feature
Templates in the Project Directory on page 47 and Kernel Configuration Fragments in the Project
Directory on page 51
A template may contain any of the following types of configuration files:
recipe (.bb) files
See About Recipes on page 109
class (.bbclass) file
115
Wind River Linux
User's Guide, 5.0.1
A file that defines the inheritance of build logic as denoted by the class type, and packaging
requirements.
configuration (.conf) files
See Configuration Files and Platform Projects on page 33
extension (.bbappend) files
See About Recipes on page 109.
In addition, the directory for template configuration files may contain:
• packages required by the template
• git repository
• source and binaries
• other files required by the feature
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small \
--enable-parallel-pkgbuilds=4 \
--enable-jobs=4 \
--with-template=feature/debug
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small \
--enable-parallel-pkgbuilds=4 \
--enable-jobs=4 \
--with-template=feature/debug,feature/analysis
$ make
For additional information on the available kernel configuration fragments, see Feature Templates
in the Project Directory on page 47.
116
10 Templates
Adding Kernel Configuration Fragments
Use kernel configuration fragments, (similar to templates) to add additional functionality to your
platform project.
You can add kernel configuration fragments when you initially configure a platform project using
the --enable-kernel=kernelType+type/templateName.scc configure option.
The type in this example refers to the kernel option, either cfg, features, or small.
Step 1 Configure the platform project to include the kernel option.
In this example, the platform project will be configured and built with the features/debugfs/
debugfs-config.scc template.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-rootfs=glibc_small \
--enable-parallel-pkgbuilds=4 \
--enable-jobs=4 \
--enable-kernel=standard+features/debugfs/debugfs-config.scc
$ make
For additional information on the available kernel configuration fragments, see Kernel
Configuration Fragments in the Project Directory on page 51.
117
Wind River Linux
User's Guide, 5.0.1
118
11
Finalizing the File System Layout
with changelist.xml
The file system layout feature has been designed to allow you to view the contents of the target
file system in Workbench as it will be generated by the platform project build system.
You can add custom files to a file system. These files are then placed in the resulting filesystem
RPM. See Wind River Workbench by Example (Linux Version) for using the File System Configuration
Layout tool in Workbench to do the following:
• Examine file meta properties
• Add files and directories to the file system
• View parent packages and remove packages
• Add devices to /dev and change their ownership
• View files and directories that have been “touched” or accessed on the target
You can manage your file system with the changelist.xml file.
119
Wind River Linux
User's Guide, 5.0.1
Any device added in changelist.xml in the default filesystem will be ignored. By default, Linux
devices are now created in a dynamic file system, devtmpfs, mounted at runtime on /dev. As a
result, any device nodes created statically are ignored.
The following tables show required and optional fields for adding a device to the system using
the filesystem/changelist.xml file.
Required Fields
120
11 Finalizing the File System Layout with changelist.xml
Directory Options Reference
Optional Fields
Examples
Required and optional fields for adding a directory to the file system using the filesystem/
changelist.xml file.
Required Fields
Optional Fields
121
Wind River Linux
User's Guide, 5.0.1
Examples
Required and optional fields for adding a file to the file system using the filesystem/
changelist.xml file.
Required Fields
Optional Fields
122
11 Finalizing the File System Layout with changelist.xml
Pipe Options Reference
Examples
Required and optional fields for adding a pipe to the file system using the filesystem/
changelist.xml file.
Required Fields
Optional Fields
Examples
Required and optional fields for adding a symlink to the file system using the filesystem/
changelist.xml file.
123
Wind River Linux
User's Guide, 5.0.1
Required Fields
Examples
This section provides information on the XML for the file system layout touched.xml file. You can
custom-generate and import such a formatted file using any name.
There is only one entry definition and one action (action="touched"). If a file name is in this list,
then that file was directly or indirectly touched or accessed on the target. This file is generated by
a script that runs on the target, and by default populated with all files touched since first boot.
See and the Wind River Linux Workbench by Example, Linux Version for more information on the use
of this tool.
124
PA R T I I I
Userspace Development
125
Wind River Linux
User's Guide, 5.0.1
126
12
Developing Userspace Applications
Introduction 127
Creating a Sample Application 132
Exporting the SDK 136
Adding Applications to a Platform Project Image 138
Importing Packages 144
Listing Package Interdependencies 151
Introduction
You can use the Wind River Linux SDK to develop applications and cross-compile them for the
intended target.
The Wind River Linux SDK is a development environment which provides all the necessary tools
to cross-compile and deploy your application in the intended target. The SDK is generated from
a working Wind River Linux Platform project and is therefore associated with the particular
architecture and build options of the project.
In a typical scenario you cross-compile your application and run it on an emulator such us
QEMU first to verify its core functionality. As your development process proceeds, it is likely
that you will need to cross-compile and deploy the application binaries to a NFS root file system,
which is mounted by the real target, to proceed with further testing. Finally you integrate your
application binaries with the build system so that they are automatically deployed on the target's
image.
127
Wind River Linux
User's Guide, 5.0.1
NOTE: Creating a build environment on the target does install some GPLv3 software. If you
want to produce a GPLv2 target with the new applications you developed, you could build your
applications on the target, and then add the binaries to subsequent builds that do not include the
build tools.
Also note that while Wind River does support the target compiler for product development, it
does not support the compiler on shipped products.
See also:
• Wind River Workbench by Example, Linux Version
Use the GNU toolchain to cross-compile applications for your target system.
Wind River Linux 5 is based on the Yocto Project (http://www.yoctoproject.org) implementation
of the OpenEmbedded Core (OE-Core) metadata project. The Yocto Project uses build recipes
and configuration files to define the core platform project image, as well as the applications and
functionality it provides.
This build system uses metadata contained in the recipes and configuration files to define and
create a Linux kernel and a root file system with all necessary configuration and initialization
files for a deployed Linux platform. You can add or remove source RPM and traditional
tar archive packages for customized solutions. You can also add or remove RPM binary
packages from the target file system, automatically checking dependencies, flagging missing
libraries, components, or version mismatches. The build system provides a version-controllable
development environment, separate from the host file system which is protected from
inadvertent damage.
Cross-development is supported by the inclusion of the GNU cross-toolchain, and enhanced by
the addition of Wind River Workbench.
NOTE: The build toolchain required to cross-compile programs for your target system is located
in the projectDir/host-cross directory. See Directory Structure for Platform Projects on page 43.
Workbench supports kernel mode debugging through the Kernel GNU Debugger (KGDB), and
user mode debugging through the ptrace agent.
For detailed information on using Wind River Workbench, see the Wind River Workbench User’s
Guide, and the Wind River Workbench by Example, Linux Version.
Application developers use sysroots provided by the platform developer to build applications.
Once the application is built, it can be incorporated into platform project images.
128
12 Developing Userspace Applications
Enabling Multilib Support in Platform Projects
In general pre-built libraries and toolchain wrappers are not provided for application
development because they may not well reflect the actual platform prepared by the platform
developer. Instead, the platform developer generates and exports a sysroot for the configured
platform project.
Architecture-specific sysroots are generated with the make export-sdk command. See Exporting
the SDK on page 136. To use these sysroots, you must generate the SDK, uncompress it, and
source the sysroot file as described in that section.
Once sourced, these sysroots enable application developers to get started developing for the
platform target configuration.
Multilib Targets
Wind River supports multiple libraries on certain targets. With these multilib targets, it is
possible, for example, to compile an application against both 32- and 64-bit libraries, and not just
one or the other.
In cases where a board supports multilibs, a reasonable default library has been chosen, but
you may need a different library. For example, qemux86-64 targets may include the x86_64 or
x86_32 CPU types, with x86_64 being the default. If you want to provide for development with
the x86_32 CPU type on a qemux86-64 target, you need to take additional action to be sure the
appropriate packages are included in the sysroot you export.
In this example, x86 (32-bit), x86-64 (64-it), and x86-64-x32, a combination of both, are available
tuning options for multilib support.
129
Wind River Linux
User's Guide, 5.0.1
NOTE: Not all available tunings are necessarily supported in projects, for example x86-64-x32.
To perform this procedure, you must have a previously configured platform project.
Step 1 Open the projectDir/local.conf file in an editor.
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
$ make
Once you have enabled multilib support in a platform project, you can add multilib packages.
This procedure requires that you have previously configured a platform project that has been
enabled to support multilib packages. For additional information, see Enabling Multilib Support in
Platform Projects on page 129.
Step 1 Navigate to the projectDir.
$ cd projectDir
The build system will automatically add the multilib variants of the dependencies for this
package, for example the lib32-glibc and other libraries, and include them in the final file system
image. All packages for all default and alternate multilibs will have links in the project's build
directory, using the naming convention to distinguish the variants.
130
12 Developing Userspace Applications
Adding Multilib Support for All Libraries to the SDK
TARGET_CC_ARCH="-m32"
$
NOTE: Performing this procedure will only add support to the SDK for use on the development
host, and not to the target file system.
The first line is the default setting, and the second line adds the specific multilib libraries to the
image.
$ make export-sdk
NOTE: For additional information on creating SDK images, see Exporting the SDK on page
136.
After the command finishes processing, it creates a shell script for extracting the SDK in the
projectDir/export/ directory. The exact name includes components of the project settings. Look
for a file name that ends with -sdk.sh, for example:
projectDir/export/wrlinux-5.0.1.0-glibc-x86_64-qemux86_64-wrlinux-image-glibc-small-
sdk.sh
131
Wind River Linux
User's Guide, 5.0.1
When you build the file system and generate the SDK, the SDK does not include support for
static libraries. This is intentional in that most applications should be using the shared libraries
for linking. If you require specific static libraries for your development needs, you can add a
single static library, or all static libraries.
Step 1 Choose an option for adding static libraries.
Options Description
Single library Update the projectDir/local.conf file with the following information:
All static libraries Update the projectDir/local.conf file with the following information:
NOTE: For additional information on creating SDK images, see Exporting the SDK on page
136.
$ make export-sdk
After the command finishes processing, it creates a shell script for extracting the SDK in the
projectDir/export/ directory. The exact name includes components of the project settings. Look
for a file name that ends with -sdk.sh, for example:
projectDir/export/wrlinux-5.0.1.0-glibc-x86_64-qemux86_64-wrlinux-image-glibc-small-
sdk.sh
Learn to develop a sample C application that calculates a specified number of terms in the
Fibonacci series.
The Fibonacci series takes the number of terms as a command-line parameter.
This application provides a good example of a typical C application, and includes the following:
• Two source files
• A header file
• A Make file to provide guidance for building the final binary and clean up the working
directory
• A license file for association with the platform project
132
12 Developing Userspace Applications
Creating a Sample Application
This example shows how to work with applications that are not part of your existing platform
project image, and do not automatically build when you run the make command in the platform
project directory. You can use this procedure for any stand-alone application that you want to
develop and test apart from your platform project image.
If you wish to add an application project to your platform project image that builds automatically
with each subsequent project build, you can use the Package Importer tool. See About the Package
Importer Tool (import-package) on page 144.
To develop and compile an application to match your platform project’s architecture, you must
first export the SDK and source the sysroot. See Exporting the SDK on page 136.
NOTE: If you have previously exported the SDK, you can simply source the associated env.sh
file located in the sysroot directory.
$ mkdir ~/Builds/qemux86-64_small/Fibonacci
$ cd ~/Builds/qemux86-64_small/Fibonacci
$ vi main.c
/*
* Copyright 2012 Wind River Systems, Inc.
*/
#include <stdio.h>
#include "math.h"
if (argc >= 2)
count = atoi(argv[1]);
return 0;
}
$ vi math.c
/*
* This is public domain software
133
Wind River Linux
User's Guide, 5.0.1
*/
int fibonacci(int n)
{
if (n <= 0)
return 0;
else if (n == 1)
return 1;
else
return (fibonacci(n-1) + fibonacci(n-2));
}
$ vi math.h
/*
* This is public domain software
*/
$ vi makefile
#
# Copyright 2012 Wind River Systems, Inc.
#
VERSION := 1.0
DEPS := math.h
SRC := main.c math.c
OBJ := $(SRC:.c=.o)
all: fibonacci
archive: fibonacci.tar.bz2
fibonacci: $(OBJ)
$(CC) -o $@ $^ $(LIBS)
.PHONY: clean
clean:
@rm -f fibonacci *.o *~
$ vi LICENSE
134
12 Developing Userspace Applications
Creating a Sample Application
$ make
After the make command completes, it creates a fibonacci binary file in the working directory,
compiled to match the sourced development environment.
$ ./fibonacci 5
0
1
1
2
3
If your host workstation is not compatible, go to the next step to test your application on the
target.
$ fibonacci ~/Builds/qemux86-64_small/export/dist/usr/bin
$ cd ..
$ make start-target
Step 10 Optionally, add your application project to the platform project image
This step is recommended if you plan to include your application as part of your platform project
image. See Options for Adding an Application to a Platform Project Image on page 138.
135
Wind River Linux
User's Guide, 5.0.1
After you have successfully configured and built a platform project, you can export the SDK for
application development.
The following procedure requires that:
• You have a previously configured and built platform project—see Introduction on page 61
and the Wind River Linux Getting Started Guide: Developing a Platform Project Image Using the
Command-line.
• You have read/write privileges to the /opt directory on your host workstation.
NOTE: These privileges are necessary for the project toolchain to install and work properly.
$ make export-sdk
After the command finishes processing, it creates a shell script for extracting the SDK in the
projectDir/export/ directory. The exact name includes components of the project settings.
Look for a file name that ends with -sdk.sh, for example:
projectDir/export/wrlinux-5.0.1.0-glibc-x86_64-qemux86_64-wrlinux-image-glibc-small-
sdk.sh
This script will install the SDK with the toolchain for your project that you need for cross-
compiling applications. Note that the file is named after the architecture and file system
of your configured project. This example uses a qemux86-64 BSP and glibc_small root file
system.
$ cd export
$ ./wrlinux-5.0.1.0-glibc-x86_64-qemux86_64-wrlinux-image-glibc-small-sdk.sh
Step 3 Enter the target directory path, or accept the default /opt/windriver/wrlinux/5.0-qemux86-64.
Step 5 Rebuild the file system to incorporate the SDK for development.
136
12 Developing Userspace Applications
Exporting the SDK for Windows Application Development
$ make fs
After you have successfully configured and built a platform project, you can export the SDK for
application development on a Windows host.
Use the following instructions create and extract a SDK suitable for developing applications on a
Microsoft Windows host.
Step 1 There are three possibilities for generating the SDK:
Option Description
Configure a new 1. Enter the following command from the projectDir to configure
project using the -- the platform project:
enable-sdk-winfs=yes
configure option. $ configDirconfigure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_std \
--enable-win-sdk=yes \
--enable-parallel-pkgbuilds=4 \
--enable-jobs=4
$ make export-sdk
$ make export-sdk
After the command finishes processing, it creates an archive in the projectDir/export/ folder
containing the SDK. The exact name includes components of the project settings, such as the
architecture and file system. Look for a file name that ends with a .zip extension. For example:
projectDir/export/wrlinux-5.0.1.0-glibc-x86_64-qemux86_64-wrlinux-image-glibc-small-sdk-
win32.zip
This compressed file contains the toolchain for your project that you need for cross-compiling
applications.
137
Wind River Linux
User's Guide, 5.0.1
Step 2 Copy the .zip file containing the SDK to your Windows host.
Step 5 Navigate to the location of the SDK you extracted previously, and select the sysroots sub-
directory.
Once you have selected the directory, the SDK Information fields will populate with related
information.
There are several options available for you to add an application to an existing platform project
image.
The following options are available in Wind River Linux for adding an application to your
platform project image:
Use the make command
This option lets you specify the addition of a single package using the make command. For
example:
For information on using this command, see Adding New Application Packages to an Existing
Project on page 139.
Import the application tree as a package
This option imports the application tree as a package, and creates a recipe file for it, thereby
including it as part of the platform project image. See About the Package Importer Tool (import-
package) on page 144.
Use a fs_final*.sh script
This option automatically installs the application's binary to the root file system each time
the platform project is built. While the application is automatically built and installed in the
root file system, it is not linked to the platform project. See Adding an Application to a Root File
System with fs_final*.sh Scripts on page 141.
138
12 Developing Userspace Applications
Adding New Application Packages to an Existing Project
Learn how to add the gdb package to an existing, previously configured and built, platform
project.
The following procedure provides instructions to add gdb to an existing, previously configured
and built, platform project. This procedure uses the following example configure script
command to create the platform project that the gdb package will be added to:
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small
This example assumes that you do not already have gdb included with your platform project.
For additional information, see: Introduction to Configuring and Building Platform Projects.
Step 1 Add the gdb package to the platform project build.
a) Navigate to the projectDir.
$ cd projectDir
$ cat layers/local/recipes-img/images/wrlinux-image-glibc-small.bb
The system will return the following output, after the line that declares #### END Auto
Generated by configure ####:
139
Wind River Linux
User's Guide, 5.0.1
IMAGE_INSTALL += "gdb"
Building the package takes a couple of minutes, during which you will see the progress on your
terminal.
$ make
Rebuilding the file system should take just a couple of minutes this time, because only the newly
added elements need to be built.
After you have created an application, you can use the changelist.xml file to add it to a platform
project image root file system.
If you place a file named changelist.xml in the projectDir/layers/local/conf/image_final
directory, then the contents of the file are executed after all the other root file system packages
have been processed, but before the final root file system’s tar file is created. Though this section
provides instructions for adding an application to a platform project root file system, there are
many more possibilities with the changelist.xml file. See Managing Files and Directories with XML.
The location of the script file is inside the projectDir/layers/local directory (see About the
layers/local Directory on page 54. This location is meant to simplify development by keeping your
project configuration changes and additions in one location.
This approach provides the option of running commands that impact the target file system only,
and not the platform project build.
In the following procedure, you will create a changelist.xml file to add the Fibonacci binary
created in Creating a Sample Application on page 132.
Step 1 Create the changelist.xml file.
a) Navigate to the platform project top-level directory.
$ cd ~Builds/qemux86-64_small
$ layers/local/conf/image_final/changelist.xml
140
12 Developing Userspace Applications
Adding an Application to a Root File System with fs_final*.sh Scripts
</layout_change_list>
If your application project has more specific requirements, such as setting permissions, and so
on, you can add those requirements to your script file. See Managing Files and Directories with
XML for additional information.
d) Save the file.
$ make
After the project rebuilds, the changelist.xml file will run automatically to update the fibonacci
binary.
$ ls export/dist/usr/bin/fibonacci
export/dist/usr/bin/fibonacci
After you have created an application, you have a number of options to add it to the root file
system of your platform project image.
When you place a script file named fs_final*.sh (fs_final_script_use.sh) in the projectDir/
layers/local/conf/image_final directory, the contents of the script are executed after all the other
root file system packages have been processed, but before the final root file system’s tar file is
created.
The location of the script file is inside the projectDir/layers/local directory (see About the
layers/local Directory on page 54). This location is meant to simplify development by keeping your
project configuration changes and additions in one location.
This approach provides the option of running script commands that impact the target file system
only, and not the platform project build.
In the following procedure, you will create a fs_final*.sh script for the fibonacci binary created
in Creating a Sample Application on page 132, to add the application to the target's root file
system.
Step 1 Create the fs_final*.sh script for the application.
141
Wind River Linux
User's Guide, 5.0.1
$ ~Builds/qemux86-64_small
$ vi layers/local/conf/image_final/fs_final_fibonacci.sh
#
# Add the fibonacci binary to the root file system
#
make -C /home/revo/Builds/qemux86-64_small/Fibonacci
cp /home/revo/Builds/qemux86-64_small/Fibonacci/fibonacci usr/bin
$ make
After the project rebuilds, the fs_final_fibonacci.sh script will run automatically to update the
fibonacci binary.
$ ls export/dist/usr/bin/fibonacci
The system should return the following output to confirm the fibonacci binary exists:
export/dist/usr/bin/fibonacci
142
12 Developing Userspace Applications
Verifying the Project Includes the New Application Package
NOTE: The functionality (the target-resident debugger) added in this example is currently only
supported on targets with the x86 architecture (32- and 64-bit), but the workflow for adding a
non-default layer and templates is the same with all architectures and BSPs.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small \
--enable-parallel-pkgbuilds=4 \
--enable-jobs=4 \
--with-package=gdb
NOTE: To add an application to a previously configured platform project, add the --enable-
reconfigure option to your configure command.
In addition to the standard configuration arguments of a board, kernel, and file system, this
configuration adds the gdb package.
When you configure a project with a specific package, that package is added to the platform
project, and available for use once the project is built and deployed to a target.
$ make
This will take from minutes to hours, depending on your development resources. When it is
finished, you will have a kernel and file system that includes gdb.
Learn how to verify that a package was added successfully to the platform project.
The procedure in this section illustrates how to verify that a package was added successfully to
the platform project.
This procedure assumes you previously added the gdb package from Configuring a New Project to
Add Application Packages on page 142 or Adding New Application Packages to an Existing Project
on page 139.
Step 1 Verify that the gdb is available now by looking at the generated root file system.
From the project directory, enter:
$ ls export/dist/usr/bin/gdb
143
Wind River Linux
User's Guide, 5.0.1
The system should return the following output to confirm that the gdb executable exists:
export/dist/usr/bin/gdb
Step 2 Verify that the gdb command is available on the running target.
a) Deploy the platform project on a target.
For additional information, see Using QEMU from the Command Line.
b) Run the gdb command on the target:
# gdb
The system should return the following and display the (gdb) prompt to confirm gdb is
working:
Importing Packages
Use the Package Importer tool to add application packages in various forms to your platform
project image.
For concepts and information on the interface for the Package Importer tool, see the Wind River
Workbench by Example, Linux 5 version: About the Package Importer Tool (import-package).
There are three approaches to importing a package detailed in this guide:
• Importing an existing sample project
• Importing a source package from the web (wget)
• Importing a SRPM package from the web
Use this Package Importer Tool example procedure to learn how to import a Wind River sample
application package.
In this procedure, you will learn to import the mthread sample application.
This procedure requires a previously configured and built platform project. If you do not have an
existing platform project, this procedure was created using the following configure options:
$ configDir/configure \
--enable-board=qemux86-64 \
144
12 Developing Userspace Applications
Importing Packages
--enable-kernel=standard \
--enable-rootfs=glibc_small \
--enable-parallel-pkgbuilds=4 \
--enable-jobs=4
$ make import-package
The GUI of the tool displays and the Progress field displays the installDir and projectDir
locations in the host file system.
For additional information, see the Wind River Workbench by Example, Linux 5 version: About the
Package Importer Tool (import-package).
$ installDir/wrlinux-5/samples/mthread
c) Click Update.
The Package Name, Package Version, and Progress fields automatically populate.
d) Click Import to import the package to your platform project.
The Progress field will indicate that the import is successful.
e) Click Close to close the Package Importer tool.
Step 3 Update the recipe file license checksum and build the package.
After a new package is imported into your platform project, you must update the recipe file to
match the new package contents.
a) Open the recipe file for the package.
In the project directory, open the recipe file located at: projectDir/layers/local/recipes-local/
mthread/mthread_1.0 in an editor. For example:
$ vi layers/local/recipes-local/mthread/mthread_1.0.bb
LIC_FILES_CHKSUM = "file://LICENCE.TXT;md5="
This value is checked at build time, and will cause a build error if it is not correct. As a result,
you need to obtain it.
c) Update the LIC_FILES_CHKSUM value.
For purposes of this example, the mthread application does not include a Makefile, so this
example uses the application's name:
LIC_FILES_CHKSUM = "file://mthread.c;md5=numerical_checksum_value".
145
Wind River Linux
User's Guide, 5.0.1
to:
do_compile() {
${CC} ${CFLAGS} -lpthread -o mthread mthread.c
}
The -lpthread option is required for multi-threaded packages, and must be placed prior to the
output (-o) option.
f) Save the file.
g) Build the package.
The shell displays the build output. If you receive a build error for an incorrect license
checksum, see Identifying the LIC_FILES_CHKSUM Value on page 113 to obtain the packages
md5 checksum value.
h) Update the md5 checksum value.
After you have the new md5 checksum value, perform 3.c on page 145, above, again, this
time entering the new md5 checksum in the LIC_FILES_CHECKSUM value. For example:
LIC_FILES_CHKSUM = "file://Makefile;md5=2ebc7fac6e1e0a70c894cc14f4736a89"
With the correct md5 checksum, the package should build successfully.
$ ls build/mthread-1.0-r0/image/usr/bin/
If the package was added to the build, the list of files includes the mthread file.
Use this Package Importer Tool example procedure to learn how to import a source application
package.
In this procedure, you will learn to import the bc application package. Note that the bc package
is used as an example only, and that you may use this procedure to import other source packages
required for your project.
146
12 Developing Userspace Applications
Importing Packages
This procedure requires a previously configured and built platform project. If you do not have an
existing platform project, this procedure was created using the following configure options:
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small \
--enable-parallel-pkgbuilds=4 \
--enable-jobs=4
$ make import-package
The GUI of the tool displays and the Progress field displays the installDir and projectDir
locations in the host file system.
See the Wind River Workbench by Example, Linux 5 version: About the Package Importer Tool (import-
package), for additional information.
$ vi layers/local/recipes-local/bc/bc_1.06.bb
LIC_FILES_CHKSUM = "file://LICENCE.TXT;md5="
This value is checked at build time, and will cause a build error if it is not correct. As a result,
you need to obtain it.
c) Modify the LIC-FILES_CHKSUM value.
From:
LIC_FILES_CHKSUM = "file://LICENCE.TXT;md5="
to:
LIC_FILES_CHKSUM = "file://COPYING;md5="
147
Wind River Linux
User's Guide, 5.0.1
For purposes of this example, the application was retrieved from the web, and does not
include a LICENSE.txt file. Instead, this application uses the COPYING file, which stores the
license information for all the source code files for the application. This is why you changed
the name from LICENSE.TXT to COPYING.
In addition, you are leaving the md5 checksum value empty. This will cause the build to fail
in the next step, but that is okay. When it does, the build system will provide the correct md5
checksum value to enter here.
d) Build the package.
$ make -C build bc
The shell displays the build output. Since we left the checksum value empty, you will receive
a build error for an incorrect license checksum. Scan the build output for the correct checksum
value. See Identifying the LIC_FILES_CHKSUM Value on page 113.
e) Update the LIC_FILES_CHKSUM value.
Enter the md5 value the build system provides in the previous step, for example:
LIC_FILES_CHKSUM = "file://COPYING;md5="94d55d512a9ba36caa9b7df079bae19f
#inherit autotools
and remove the comment character (#) so that the line reads:
inherit autotools
$ make -C build bc
The shell displays the build output. With the correct md5 checksum, the package builds
successfully.
$ ls build/bc-1.06-r0/image/usr/bin/
Use this Package Importer Tool example procedure to learn how to import a source RPM (SRPM)
package.
148
12 Developing Userspace Applications
Importing Packages
If you have standardized on SRPM for your integration of applications into Wind River Linux,
this procedure provides a way to migrate that infrastructure into Wind River Linux. SRPMs were
the preferred package format in Wind River Linux 4.x. In Wind River Linux 5.0.1, we suggest that
you use whatever format the upstream source provides, which is typically not SRPM.
In this procedure, you will learn to import the dos2unix SRPM package and integrate it into your
platform project. Note that the dos2unix package is used as an example only, and that you may
use this procedure to import other SRPM packages required for your project.
This procedure requires a previously configured and built platform project. If you do not have an
existing platform project, this procedure was created using the following configure options:
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small \
--enable-parallel-pkgbuilds=4 \
--enable-jobs=4
$ make import-package
Note that the GUI of the tool displays and the Progress field displays the installDir and
projectDir locations in the host file system.
See the Wind River Workbench by Example, Linux 5 version: About the Package Importer Tool (import-
package), for additional information.
$ vi layers/local/recipes-local/dos2unix/dos2unix_6.0.3-2.fc19.bb
b) Append the SRC_URI line with the name of the embedded tar ball in the SRPM package.
From:
SRC_URI = http://www.your_company_here.com/downloads/
dos2unix-6.0.3-2.fc19.src.rpm;extract="
149
Wind River Linux
User's Guide, 5.0.1
to:
SRC_URI = http://www.your_company_here.com/downloads/
dos2unix-6.0.3-2.fc19.src.rpm;extract=${BPN}-6.0.3.tar.gz"
c) Confirm that the S= macro definition also matches the embedded tar ball.
In this example, the default is correct: and does not require updating.
S="${WORKDIR}/${BPN}-6.0.3"
The shell displays the build output. Since we left the LIC_FILES_CHKSUM md5 checksum
value in the recipe file empty, you will receive a build error for an incorrect license checksum.
Scan the build output for the correct checksum value. See Identifying the LIC_FILES_CHKSUM
Value on page 113.
f) Update the LIC_FILES_CHKSUM value.
Enter the md5 value the build system provides in the previous step, for example:
LIC_FILES_CHKSUM = "file://Makefile;md5=1ba513be50142c911e7971a6f4d47e89"
The shell displays the build output. With the correct md5 checksum, the package builds
successfully.
$ ls build/dos2unix-6.0.3-2.fc19-r0/dos2unix-6.0.3
150
12 Developing Userspace Applications
Listing Package Interdependencies
choose to move the package's directory, you must also relocate the projectDir/layers/local/
downloads/dos2unix/dos2unix-6.0.3-2.fc19.src.rpm source package that it processes.
$ make bbs
$ ../layers/oe-core/scripts/contrib/list-packageconfig-flags.py -a -p | less
The command options in this example list preferred versions of all packages. Run list-
packageconfig-flags.py with the -h option for a full list of options:
OPTION:
-h, --help display this help and exit
-f, --flag list available PACKAGECONFIG flags and all affected pkgs
-a, --all list all pkgs and PACKAGECONFIG information
-p, --prefer list pkgs with preferred version
NOTE: Running the script with no arguments outputs basic package dependency information
similar to what can be obtained with make fs-expand for the IMAGE_INSTALL contents.
The script may take several minutes to parse the recipe information before giving any output.
From the output in this example we can observe that the cups-1.6.3 recipe is built differently
because the acl and avahi packages are present in the project.
lib32-quagga-0.99.21
virtual:multilib:lib32:/opt/Builds/glib_std/layers/meta-networking/recipes-protocols/
quagga/quagga_0.99.21.bb
151
Wind River Linux
User's Guide, 5.0.1
PACKAGECONFIG None
PACKAGECONFIG[cap] --enable-capabilities,--disable-capabilities,libcap
lib32-coreutils-8.21
virtual:multilib:lib32:/opt/Builds/glib_std/layers/oe-core/meta/recipes-core/coreutils/
coreutils_8.21.bb
PACKAGECONFIG None
PACKAGECONFIG[acl] --enable-acl,--disable-acl,acl,
gtk+3-3.8.2
/opt/Builds/glib_std/layers/oe-core/meta/recipes-gnome/gtk+/gtk+3_3.8.2.bb
:
152
13
Understanding the User Space and
Kernel Patch Model
Understanding the patch workflow will help you resolve patch-related issues if and when they
arise.
Understanding the patch principles and workflow used for development helps facilitate
changes to your project as they arise. This section discusses the workflow from a command line
perspective, using command line tools. For an example of how to use the Workbench patch
manager GUI, refer to Wind River Workbench by Example, Linux Version.
There are two main principles Wind River Linux uses in applying patches:
• Wind River Linux keeps its source code pristine. Patches are only applied to project code,
when building a project.
• Patch lists are rigorously maintained.
Patch workflow for Wind River developers follows this pattern:
1. Product designers first decide on where—which template or layer—to insert the patch.
2. The individual developer configures a project for the specific product, specifying the relevant
layer or template in the configure command.
3. The individual developer then works locally, developing new code and new patches to extend
existing code.
4. The developer then validates their local work with the central code base before folding back
changes and patches. The more general the layer in which the patch is placed, the greater the
scope of testing required to justify the acceptance of these changes. Automated test tools and
procedures for the individual contributor help in keeping the code base correct.
5. After successful validation, the developer checks in the changes.
153
Wind River Linux
User's Guide, 5.0.1
Patch Deployment
Kernel patches and package patches can be deployed in:
• custom layers
• custom templates
• the installed development environment.
Wind River suggests that custom patches be deployed within a custom template or layer, thereby
leaving the development environment intact. For more information and examples, see About
Kernel Configuration and Patching on page 177 and Introduction to Patching Userspace Packages on
page 159
Patching Principles
154
13 Understanding the User Space and Kernel Patch Model
Kernel Patching with scc
After rejects are resolved in this manner, you can always introduce an intermediate patch that
takes the source to this adjusted state, allowing the original source and the acquired patch to be
preserved, if that is required or desired.
Wind River Linux uses the scc script to patch the kernel.
The scc script is the logic that controls the selection of the kernel patches passed to the build
system during the kernel patching phase. The following describes basic scc functionality.
The patches are largely self documenting. The .scc files document the overall patch strategy for
the kernel or feature. The patches themselves have a header that describes the specifics of the
patch.
Normally all interactions with the scc script are handled by the build system and it should rarely
be invoked from the command line. The rich feature set of scc is primarily used in constructing
the git tree from the kernel cache. Typical end users will, at most, simply list some of their custom
add-on patches and configuration changes in a simple .scc file they create in their project or
custom template.
To patch a kernel with an .scc file, see Patching the Kernel With SCC Files on page 193.
155
Wind River Linux
User's Guide, 5.0.1
kernel patching complexity. Additionally, a direct mapping between BSPs and profiles can be
easily made, increasing maintainability.
The scc script has been implemented to control the process of patch list generation and feature-
based patching.
In the most simple example, .scc files look very similar to the patches.list of earlier releases. One
notable difference is that the metadata concerning the license, source and reviewers of the patch
are contained inside the patch itself and not in the .scc file. This information can be in the .scc file,
but only as a secondary source of information.
# scc.section section_name
Any variable passed to scc with the -D=macro option is available in individual feature scripts. To
see what variables are available, locate the invocation of scc and search for defines.
The following built-in functions are available:
dir
Changes the current working patch directory, and subsequent calls to patch use this as their
base directory.
patch
156
13 Understanding the User Space and Kernel Patch Model
Kernel Patching with scc
Outputs a patch to be included in the feature's patch set. Only the name of the patch is
supplied, and the path is calculated from the currently set patch directory.
include
Indicates that a particular feature should be included and processed in order. There is an
optional parameter after feature_name to indicate that the order of processing should not
be used and a feature must be included after feature_name. Include paths are relative to the
root of the directories passed with -I.
Note that changing the default order of large feature stacks by forcing a different order with
after can result in a significant work effort in order to rebase the patches of the features, if they
are touching the same source files.
set_kernel_version
Takes a new kernel version as its argument. This allows a feature to change the effective
kernel version and allows other features to test this value with the KERNEL_VERSION
variable.
$ scc --help=scc
For an example of an scc file that specifies a normal node, refer to the following code example:
Configuration files and patches in a .scc file are specified as shown (with comments):
# patches
patch 0002-atl2-add-atl2-driver.patch
patch 0003-net-remove-LLTX-in-atl2-driver.patch
patch 0004-net-add-net-poll-support-for-atl2-driver.patch
157
Wind River Linux
User's Guide, 5.0.1
158
14
Patching Userspace Packages
Learn about the requirements for patching userspace packages for your platform projects.
Patches for packages are delivered with the recipe in a directory with the same name as the
package. For example, for the busybox package, there are a few patches in projectDir/layers/
oe-core/meta/busybox/busybox-version, and couple of additional patches in another layer in
projectDir/layers/wr-base/recipes-core/busybox/busybox
This is just a convention; the recipe specifies the location of the patches, for example:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://umount-make-d-always-active-add-D-to-suppress-it.patch \
file://move-ip-to-sbin-to-make-it-more-FHS-and-LSB.patch"
The build system identifies the files as patches by their .patch extension and applies them in the
patch build stage when you use the default do_patch build rule.
When multiple patches need to be applied; the order in which they are applied can be important,
to manage the order you will find in the package build directory a subdirectory called patches.
This contains all the patches gathered from all the layers in the project and file named series,
which lists the order in which they will be applied.
159
Wind River Linux
User's Guide, 5.0.1
B921600.patch
busybox-appletlib-dependency.patch
busybox-cross-menuconfig.patch
busybox-mkfs-minix-tests_bigendian.patch
busybox-udhcpc-no_deconfig.patch
fix-for-spurious-testsuite-failure.patch
get_header_tar.patch
move-ip-to-sbin-to-make-it-more-FHS-and-LSB.patch
move-ip-to-sbin-to-make-it-more-FHS-and-LSB.patch~
run-parts.in.usr-bin.patch
series
sys_resource.patch
umount-make-d-always-active-add-D-to-suppress-it.patch
watch.in.usr-bin.patch
wget_dl_dir_fix.patch
The tool that allows you to manage patches and add additional patches to a package is called
quilt. It is not required that you use quilt, but recommended. In Wind River Linux, quilt is
configured to use the package's projectDir/build/packageName-revision/packageName/
patches directory and series file, by the .pc/.quilt_patches and .pc/.quilt_series hidden build
director.
Quilt is a general-purpose patching mechanism that you can use whenever you are working with
patches—with packages as well as custom applications. The Wind River Linux build system uses
it for patching packages as described in this section.
160
14 Patching Userspace Packages
Create an Alias to exportPatches.tcl to save time
Quilt is especially useful for dealing with a series of patches and with patches that contain
multiple files. Open source packages typically contain the package source as well as multiple
patches to be applied to that source to produce the binary in a package. In addition, you may be
modifying the source to make your own changes.
The proper way to modify the source is to add one or more patches, rather than modifying
original source files or patches. This keeps your changes distinct and allows you to carry your
custom patches with you as you upgrade to newer versions of Wind River Linux.
Use of the quilt tool facilitates your work with patches. As detailed in this manual, you can patch
a package using quilt, and then export the patches from your project directory to a custom layer,
for use in other platform projects.
Setting an alias for the exportPatch command can save you time.
If you frequently work with patches, a common command you will run is exportPatches.tcl,
which is found in installDir/wrlinux-5/scripts/exportPatches.tcl.
• Set a command-line alias.
Refer to your host documentation for setting an alias.
NOTE: Note that exportPatches.tcl sources the wish interpreter that is provided by Workbench.
For information on preparing your host for patching, see Preparing the Development Host for
Patching on page 161.
Before you begin patching userspace packages, use this procedure to prepare your host.
Using the exportPatches.tcl script to patch packages requires that the wish interpreter, part of the
tk package, be installed and working properly on the development host.
Step 1 Prepare the host for patching packages with Workbench.
$ cd installDir
$ wrenv -p workbench
Step 2 Prepare the host for patching packages from the command line.
If your installation does not include Workbench, run one the following commands to install the tk
package, required to run the wish interpreter and exportPatches.tcl script:
Options Description
161
Wind River Linux
User's Guide, 5.0.1
Use this procedure to understand the steps necessary to patch a package in your platform project
image.
The following steps use the which package to describe how to create and export a patch with
Wind River Linux.
If you do not already have a platform project, the following configure script command was used
to create the project in this procedure:
$ cd projectDir
Step 3 Add the toolchain to your path, and make quilt available to your platform project.
$ export PATH=$PATH:$PWD/bitbake_build/tmp/sysroots/x86_64-linux/usr/bin
In this example, x86_64 is specific to the qemux86-64 BSP used to create the platform project
image. This may change for your specific project, depending on your BSP and architecture.
Step 4 Navigate to the new build directory for the patch and display its contents.
$ cd build/which-2.20-r3/which-2.20
$ ls patches
remove-declaration.patch series
162
14 Patching Userspace Packages
Patching and Exporting a Package to a Layer
Open the which.c file in a text editor, and change the following line:
to read:
$ quilt diff
Index: which-2.20/which.c
===================================================================
--- which-2.20.orig/which.c
+++ which-2.20/which.c
@@ -27,7 +27,7 @@ static const char *progname;
Step 10 Refresh the patch and save all current changes to the patch file created in 5 on page 162.
$ quilt refresh
Until you perform this refresh step, none of your changes are written to your patch file, so this
refresh step is normally your last step before finally writing your patch file to a custom layer for
later use.
$ installDir/wrlinux-5/scripts/exportPatches.tcl \
EXPORT_PATCH_PATCH=full_path_to_patch \
EXPORT_PATCH_LAYER=path_to_layer \
EXPORT_PATCH_DESCR=" text "
Where:
EXPORT_PATCH_PATCH
Represents the full path to your generated patch file:
projectDir/build/ package /wrlinux_quilt_patches/ patch_name.
EXPORT_PATCH_LAYER
163
Wind River Linux
User's Guide, 5.0.1
Represents the path to an existing or new layer directory. The layer infrastructure for the patch
and the patch itself will be created for you if it does not already exist.
EXPORT_PATCH_DESCR
Your description to be included in the patches.list file
For example, the following command:
$ ~/WindRiver/wrlinux-5/scripts/exportPatches.tcl \
EXPORT_PATCH_PATCH=$PWD/patches/example.patch \
EXPORT_PATCH_LAYER=~/layers/which-test-layer/ \
EXPORT_PATCH_DESCR="This is a test"
will create a new layer for your patch in the layers/which_test_layer, in your home directory.
The exportPatches.tcl script displays a confirmation dialog to indicate the export results:
Once you have patched a package, use this procedure to verify the content and structure of the
patch.
Perform the following steps to verify the contents of your patch.
Step 1 Navigate to the file system location where you exported your patch to from Patching and
Exporting a Package to a Layer on page 162.
$ tree
164
14 Patching Userspace Packages
Incorporating a Patch into a Platform Project Image
Step 3 Display the contents of the recipe information created to apply the patch.
$ cat ~/layers/which-test-layer/recipes-local/which/which_2.20.bbappend
Note that this recipe append file includes the new example.patch file.
$ cat ~/layers/which-test-layer/recipes-local/which/files/example.patch
Index: which-2.20/which.c
===================================================================
--- which-2.20.orig/which.c
+++ which-2.20/which.c
@@ -27,7 +27,7 @@ static const char *progname;
Note that this is similar to the output of the quilt diff command, if you ran the command prior to
refreshing and exporting the patch.
Once you create and export a patch to a layer, you can include the layer (and patch) in an existing
or new platform project.
The following procedure requires that you have previously created and exported a patch to a
layer as described in Patching and Exporting a Package to a Layer on page 162.
Step 1 Choose a platform project option to add the layer (and patch) to:
165
Wind River Linux
User's Guide, 5.0.1
Options Description
$ cd projectDir
New platform project To add the layer to a new platform project, include the --with-
layer=path_to_layer configure option when you create your project.
For example:
$ configDir/configure --enable-board=qemux86-64 \
--enable-rootfs=glibc_std \
--enable-kernel=standard \
--enable-build=production \
--enable-parallel-pkgbuilds=4 \
--with-layer=path_to_layer \
--enable-jobs=4
$ make
166
15
Modifying Package Lists
Use the Package Manager tool to manage the analysis and removal of packages in your platform
project image.
Overview
When you configure and build a platform project image, a number of packages are included
automatically, depending on your project configuration. Including additional layers and
templates in your configuration often adds additional packages and their dependencies to your
platform project image.
As you continue to develop your target system, you may want to remove packages to help
decrease your platform's file system footprint. The Package Manager helps simplify the process of
package removal with an interface that displays a package's state and any other dependencies the
package requires.
The package removal feature works by creating a modified package list and appending it to
the projectDir/default-image.bb file. The tool uses the build system's tools that identify the
dependent packages and generate the revised package list.
167
Wind River Linux
User's Guide, 5.0.1
Use this procedure to start the Package Manager and obtain package information from your
platform project image.
NOTE: You may launch the Package Manager on a configured, but not built, platform project,
but doing so will provide limited package data, as this information is compiled by the build
system as it builds the platform project image.
$ make package-manager
168
15 Modifying Package Lists
Removing Packages
When the tool initially displays, it will read the package state for the platform project and
update the Status, Mode, and Installed columns accordingly.
Removing Packages
Once the Package Manager is running, you can select packages and remove them.
Step 1 Select a package in the Package column.
169
Wind River Linux
User's Guide, 5.0.1
Information for the package displays in the bottom field. In this example, the kernel-module-
floppy package depends on the kernel-base package.
170
15 Modifying Package Lists
About the Package Manager
171
Wind River Linux
User's Guide, 5.0.1
If the package selected has a hard dependency from another package in the file system, you will
receive a warning in the bottom field. If this occurs, you will not be able to remove the package
with the Package Manager.
$ make
Step 6 Optionally open the Package Manager to display the new package information.
See Launching the Package Manager on page 168 for additional information.
172
15 Modifying Package Lists
Adding a Package
see As described in Analyzing and Optimizing Runtime Footprint on page 307 and the section
Finalizing the File System Layout with changelist.xml.
The Wind River front-end or wrapper to the Yocto/bitbake build system implements the concept
of templates and individual packages that can be added (and some cases removed) from a
project. This is in addition to the packages specified in the bitbake recipes in the various layers
which make up the project. This section discusses the use of these features in customizing a
platform project configuration and as a result, scaling your file system to include the minimal set
of components for your application.
The glibc_small and glibc_core file systems are designed to contain a minimal amount of
packages, for a busybox and bash based file systems respectively. The suggested workflow is to
start with one of these file systems and add packages and templates as needed.
Removing packages specified by a layer is more problematic, as often there removal breaks some
basic functionality required to boot the board. There are many package dependencies within
the base filesystem layer, and while some packages may be removed, often it is necessary to
modify the configuration of other components in order to keep them functional. The tools to
visualize and understand the complete package dependencies are still under development, so the
procedure described later in this chapter is provided as an interim solution until the bitbake build
system evolves and richer set of tools is developed.
Adding a Package
Feature templates are a mechanism that appends the project recipe with additional packages or
other configuration options.
In many cases feature templates will add one or more packages to the project by defining an
include file which is a list of added packages in a text file with the file extension .inc. Thus, every
package mentioned in the template is included with all the dependent and optional packages in
its recipe.
Feature templates are added at project creation time using the --with-template argument to the
configure command. Layers, including BSP layers, may include a default template that adds
packages to your project as a side effect of including the layer.
173
Wind River Linux
User's Guide, 5.0.1
Removing a Package
NOTE: If the package you wish to remove has been included as part of a layer, or is a package
that is included by package dependency specified in another package recipe, this procedure will
not work. Wind River Linux provides the Package Manager tool for removing these types of
packages. For additional information, see About the Package Manager on page 167.
174
PA R T I V
Kernel Development
175
Wind River Linux
User's Guide, 5.0.1
176
16
Patching and Configuring the
Kernel
Use the procedures in this section to learn how to configure the Linux kernel to add or remove
options by applying patches directly to the source code.
Customizing the Linux kernel to better fit the particular details of a hardware implementation is
almost always a required step in an embedded software development cycle.
Kernel customization can take the form of simply enabling or disabling kernel configuration
options; this is typically done to enable specific drivers and to shrink the final kernel image and
run-time load by removing unneeded functionality. Customization can also come in the form or
patches applied to the source code, either in-house or third party patches, to modify specific areas
of kernel behavior.
You can reconfigure kernels in one of the following manners:
• Configuring the Linux Kernel with menuconfig on page 185
• Configuring Kernel Modules With Make Rules on page 183
• Kernel Module Configuration and Patching with Fragments on page 179
Alternatively, you can patch and/or extend kernel capabilities:
• Patching the Kernel on page 195
• Patching the Kernel With SCC Files on page 193
177
Wind River Linux
User's Guide, 5.0.1
Configuration
Use kernel configuration options to add or remove features to your platform project.
Depending on end-user requirements for your platform project image, you may need to make
changes to the existing kernel configuration. Use the examples in this section to configure a
kernel module with fragments or make rules.
178
16 Patching and Configuring the Kernel
Kernel Module Configuration and Patching with Fragments
The path to the .config file is based on the selection of your BSP and kernel type when you
configure your platform project, and will change based on your selections.
$ mkdir -p layers/local/recipes-kernel/linux/linux-windriver
The basic directory structure necessary to support configuration fragments is dictated by the
content of the BBFILES variable inside the projectDir/layers/local/conf/layer.conf file. See
Directory Structure on page 29.
More specifically, the element ${LAYERDIR}/recipes-*/*/*.bbappend in this variable
determines where the .bbappend files will be searched for. The part of the command line
above that reads: recipes-kernel/linux complies with this pattern.
The linux-windriver subdirectory is used to further localize kernel configuration files for the
kernels provided by Wind River and it is named after the Linux kernel package itself.
Create the Kernel's BitBake Append (.bbappend) File
Create a BitBake append file as part of configuring the Linux kernel with fragments
179
Wind River Linux
User's Guide, 5.0.1
This procedure requires that you have populated the projectDir/layers/local directory with
the subdirectories required for patching the kernel as described in Populate the Local Layer with the
Required Subdirectories on page 179.
Step 1 Create the BitBake append (.bbappend) file of the kernel.
Run the following command to create the kernel’s .bbappend file:
$ vi layers/local/recipes-kernel/linux/linux-windriver_3.4.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://config_baseline.cfg"
$ vi layers/local/recipes-kernel/linux/linux-windriver/config_baseline.cfg
The configuration fragment(s) in this example have the same syntax as the .config file for the
kernel. Note that we added the statement:
CONFIG_INPUT_MISC=y
180
16 Patching and Configuring the Kernel
Clean up the Linux Kernel Package and Optionally Configure the Package
At this moment the layer structure to support kernel configuration fragments should look like
this:
Clean up the Linux Kernel Package and Optionally Configure the Package
Clean up the Linux kernel package as part of configuring the Linux kernel with fragments
This procedure requires that you have previously created a kernel configuration fragment as
described in Create the Kernel's Configuration Fragment on page 180.
Step 1 Clean up the Linux kernel package.
Cleaning up the linux-windriver kernel package first is a necessary step to force the build system
to subsequently reload all associated configuration files. You should do this every time you make
changes to your kernel configuration fragments and prior to rebuilding the kernel package.
Configuring the Linux kernel package is an optional step in that configuration will happen
automatically when later on you get to rebuild the package. However, configuration is done
much faster than rebuilding. Therefore the advantage of doing the configuration step manually
is that you can verify very quickly that the changes specified in the configuration fragment are
correct by inspecting the generated configuration file of the kernel located at:
projectDir/build/linux-windriver-version/linux-qemux86-64-standard-build/.config
Once complete, the new linux-windriver package is available containing the modified kernel
image to be used in the target.
$ make
This command updates the root file system to include the new structure of kernel modules to
be loaded on the target. Note that if your configuration fragments do not modify the current or
default kernel modules then you do not need to rebuild the root file system.
For example, if the only line in the configuration fragment above had been
CONFIG_PRINTK_TIME=y then only the kernel image would have been modified when
rebuilding the kernel package but the root file system would have remained the same.
181
Wind River Linux
User's Guide, 5.0.1
$ make start-target
Step 3 Verify that status of the floppy, parport, and pcspkr modules:
root@qemux86-64: ~# lsmod
Not tainted
pcspkr 2030 0 - Live 0xffffffffa0002000
The module list shows that the floppy and parport modules are no longer present and that the
pcspkr module is active now.
DRIVERS=="pcspkr",ENV{.INPUT_CLASS}="spkr"
minix
Support for the minix file system is still available but this time it is built into the Linux kernel
image itself.
root@qemux86-64: ~# halt
182
16 Patching and Configuring the Kernel
Configuring Kernel Modules With Make Rules
The make command provides a simplified means to add or remove selected kernel modules as
needed.
After you build your project, all configured kernel modules become available for use with the
make command, as detailed in this section.
In this topic, the pcspkr module will be added as a project package and not directly as a kernel
option as was done before.
To perform this procedure, you must have the following pre-requisites met:
A working platform project
If you can configure and build a platform project successfully, then the make command is
working and you have a platform project to perform this procedure. For an example of the
platform project configure options used to create this procedure, see Configuring and Building a
Complete Run-time on page 77.
The pcspkr module
The following procedure assumes the pcspkr module is available at this point because it was
built previously in Kernel Module Configuration and Patching with Fragments on page 179
The result will be an alphabetically sorted list of all available modules already pre-compiled and
ready to be used. Kernel modules are packaged as individual files in the following directory:
projectDir/bitbake_build/tmp/deploy/rpm
Their file names all start with the kernel-module- prefix.
183
Wind River Linux
User's Guide, 5.0.1
$ cat layers/local/recipes-img/images/wrlinux-image-file-system.bb
In this example, file-system refers to the rootfs used to configure your platform project.
If you used the instructions from Configuring and Building a Complete Run-time on page 77, the
command would be:
$ cat layers/local/recipes-img/images/wrlinux-image-glibc-small.bb
The system will return the following output, after the line that declares #### END Auto
Generated by configure ####:
make
make start-target
b) Once the emulator finishes booting, login as user root with password root.
c) Verify that the pcspkr module was added to the target.
root@qemux86-64: ~# lsmod
The system should return the following, indicating that the pcspkr module was added:
Not tainted
pcspkr 2030 0 - Live 0xffffffffa0002000
DRIVERS=="pcspkr",ENV{.INPUT_CLASS}="spkr"
184
16 Patching and Configuring the Kernel
Configuring the Linux Kernel with menuconfig
This updates the set of available kernel modules, removing the pcspkr module in the process.
$ make start-target
b) After the emulator finishes booting, login as user root with password root.
c) Verify that the pcspkr module is removed from the target.
Run the following command on the target:
root@qemux86-64: ~# lsmod
The system should return the following, indicating that the pcspkr module was added:
Not tainted
root@qemux86-64: halt
Perform the procedure in this section to use menuconfig to access and change the different kernel
options.
menuconfig is a basic configuration mechanism provided by the Linux kernel build system that
provides a menu-based access to the different kernel options.
In this section, you will learn to reconfigure the Linux kernel to make some changes on the kernel
modules which are installed by default.
The changes you will make include:
• Removing the floppy and parport (parallel port) modules, assuming that they are not
necessary for the intended target.
• Turning the minix kernel module into a static kernel feature, so that its functionality is
provided by the kernel image itself.
• Add the pcspkr (PC speaker) module.
Once complete, you will rebuild the kernel and file system, reboot the emulated target, and verify
that your changes have been applied.
The following procedures require a configured and built platform project. See About Kernel
Configuration and Patching on page 177.
Step 1 Boot the emulated quemux86-64 target that you have built in the previous sections.
a) Launch the target.
From the platform project’s directory, run the following command:
$ make start-target
185
Wind River Linux
User's Guide, 5.0.1
You should have now access to the command line shell on the target.
root@qemux86-64:~# lsmod
Not tainted
parport 23894 1 parport_pc, Live 0xffffffffa0017000
floppy 60578 0 - Live 0xffffffffa0022000
parport_pc 18367 0 - Live 0xffffffffa0038000
minix 29971 0 - Live 0xffffffffa0042000
This output represents the list of kernel modules loaded in the system. In this example, we will
assume that floppy and parport (parallel port) modules are not required, so we will remove
them. We will also integrate the minix module into the kernel image itself.
The console should return the following output to indicate support for the minix file system:
minix
Note that since the minix module is already loaded, it is expected that the kernel supports it.
root@qemux86-64:~# halt
This will cleanly shutdown the console window so you can make changes to the kernel’s
configuration.
186
16 Patching and Configuring the Kernel
About Kernel Configuration and Patching
Enter one of the following commands from the platform project directory to launch the kernel
configuration menu:
Options Description
After a few seconds, a new terminal window displays with the kernel configuration menu.
Step 6 Remove the floppy and parport modules from the kernel configuration.
a) From the top kernel configuration menu, select `Device Drivers > Block devices > Normal
floppy disk support .
Normal floppy disk support should be listed with a letter M marker indicating that it is to be
compiled as a module.
b) Press SPACE twice to remove this module from the build.
The marker is now blank indicating that the floppy module is not selected.
c) Select Exit at the bottom menu twice, using TAB or left/right arrow keys, to return to the top
level list of configuration options.
d) From the top kernel configuration menu, select Device Drivers > Parallel port support .
Parallel port support should be listed with a letter M marker indicating that it is to be
compiled as a module.
e) Press SPACE twice to remove this module from the build.
f) Select Exit at the bottom menu to return to the top level list of configuration options.
187
Wind River Linux
User's Guide, 5.0.1
Step 9 Save the new kernel configuration and rebuild the image and modules.
a) From the top kernel configuration menu, select Exit.
b) When prompted to save your new configuration, select Yes to finish the configuration session.
c) Run the following command from the platform project directory to rebuild the kernel image
and modules:
d) Run the following command from the platform project directory to rebuild the root file system
and update the kernel modules as necessary:
$ make
Step 10 Boot the emulated target to test your new kernel configuration.
a) Launch the target.
Run the following command from the platform project directory:
$ make start-target
b) After the target window boots, login as user root with password root.
c) Verify that status of the floppy, parport, and pcspkr modules:
root@qemux86-64:~# lsmod
Not tainted
pcspkr 2030 0 - Live 0xffffffffa0002000
The module list shows that the floppy and parport modules are no longer present and that the
pcspkr module is active now.
d) See how the pcspkr module loads.
The udev infrastructure manages automatic module loading.
On your qemux86-64 target, type the following command:
DRIVERS=="pcspkr",ENV{.INPUT_CLASS}="spkr"
minix
188
16 Patching and Configuring the Kernel
Patching
Support for the minix file system is still available but this time it is built into the Linux kernel
image itself.
Patching
Use kernel patching to apply kernel changes directly to the kernel source code.
Depending on end-user requirements for your platform project image, you may need to
customize the kernel source code, either to make changes to the Wind River kernel, or third-party
modules or patches. Use the examples in this section to patch a kernel.
Use audit reporting to identify potential issues with your Linux kernel configuration.
Wind River provides an informational audit that takes place when the configuration (.config) file
is generated that looks for the following:
1. Non-hardware specific settings in the BSP fragments.
2. Settings specified in the BSP fragments that it is necessary to change or remove in the final
.config to satisfy the dependency information of LKC.
3. Settings that were duplicated in more than one fragment.
4. Settings that simply do not match any currently available option.
The intent of this on-the-fly-audit of the fragment content and the generated .config file is to
warn you when it looks like a BSP may be doing things it should not be doing.
For example, filtering is performed to identify duplicate entries, and warnings are issued when
options appear to be incorrect due to being unknown or being ignored for dependency reasons.
Because there are many kernel options available and many kernel configuration fragments, the
auditing mechanism provides summary output to the screen and collects detailed information in
a folder relevant to kernel configuration fragment processing. The warnings are captured in files
in the audit data directory
projectDir/build/linux-windriver/linux/.meta/cfg/kernel_type/bsp_name/*.
For example, the following directory would apply to an Intel BSP with a standard kernel type:
projectDir/build/linux-windriver/linux/.meta/cfg/standard/intel-x86-64
Kernel options are all sourced from Kconfig files placed in various directories of the kernel tree
that correspond to the locations of the code that they enable or disable. The logical grouping
has the effect of making each the content of each Kconfig either primarily hardware specific (for
example, options to enable specific drivers) or non-hardware specific (for example, options to
choose which file systems are available.)
Auditing is implemented by the kconf_check script, from the Yocto Project kernel tools recipes.
The auditing takes place in two steps, since the input first needs to be collated and sanitized, and
then the final output in the .config file from the LKC must be compared to the original input
in order to produce warnings about dropped or changed settings. This script is responsible for
assembling the fragments, filtering out duplicates, and auditing them for hardware and non-
hardware content.
The files of interest under the projectDir/build/linux-windriver/linux/.meta/
cfg/kernel_type/bsp_name/ directory include the following:
189
Wind River Linux
User's Guide, 5.0.1
hardware.kcf
The list of hardware Kconfig files.
non-hardware.kcf
The list of non-hardware Kconfig files.
By the end of this process, Wind River has sorted all the existing Kconfig files into hardware and
non-hardware, and this forms the basis of the audit criteria.
Audit Reporting
The audit takes place at the Linux configuration step and reports on the following:
• Items in the BSP that do not look like they are really hardware related.
Having a non-hardware item in a BSP is not treated as an error, since there may be
applications where something like a memory-constrained BSP wants to turn off certain non-
hardware items for size reasons alone.
• Items in one fragment that are re-specified again in another fragment or even in the same
fragment later on.
Again this is not treated as an error, since there are several use cases where an over-ride is
desired (e.g. the customer-supplied fragment described below). Normally there should be no
need for doing this -- but if someone does this, the usual rule applies, that is, the last set value
takes precedence.
• Hardware-related items that were requested in the BSP fragment(s) but not ultimately present
in the final .config file.
Items like this are of the highest concern. These items output a warning as well as a brief
pause in display output to enhance visibility.
• Invalid items that do not match any known available option.
This is for any CONFIG_OPTION item in a fragment that is not actually found in any of
the currently available Kconfig files. Usually this reflects a use of data from an older kernel
configuration where an option has been replaced, renamed, or removed.
See the following section for a commented example of auditing output.
...
$ cat build/linux-windriver/temp/log.do_kernel_configcheck
190
16 Patching and Configuring the Kernel
About Kernel Configuration and Patching
Duplicate instances of options, whether across fragments or in the same fragment, will generate a
warning. You can view the indicated fragment_errors.txt file to see the specific options.
$ cat build/linux-windriver/linux/.meta/cfg/standard/intel-x86-64/fragment_errors.txt
Whenever duplicate options are encountered, only the last instance is included in the final
configuration file.
The contents of the invalid.cfg file indicate which options are not being recognized. It may be
that the options are incorrect or obsolete. An option that is spelled incorrectly may also trigger
this warning. Note that any mis-spelled syntax, for example CONFIG_OPTION=y is ignored and
unreported.
$ cat build/linux-windriver/linux/.meta/cfg/standard/intel-x86-64/invalid.cfg
CONFIG_MULTICORE_RAID456
CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
CONFIG_SND_HDA_POWER_SAVE
CONFIG_WIRELESS_EXT_SYSFS
CONFIG_USB_SUSPEND
The non-hardware options are meant to be in the domain of the platform, not the BSP. The
provided BSP options are found to be non-hardware-related and so they are reported here.
$ cat build/linux-windriver/linux/.meta/cfg/standard/intel-x86-64/invalid.cfg
CONFIG_MULTICORE_RAID456
CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
CONFIG_SND_HDA_POWER_SAVE
CONFIG_WIRELESS_EXT_SYSFS
CONFIG_USB_SUSPEND
The mismatch.cfg file will indicate the option(s) causing this message. An example of a mismatch
is a case where you have requested CONFIG_OPTION=y and you get the message:
$ cat build/linux-windriver/linux/.meta/cfg/standard/intel-x86-64/mismatch.cfg
191
Wind River Linux
User's Guide, 5.0.1
In most cases, the option is not used because it is not valid for the input you provided.
The first example provides a case where you have an option CONFIG_OPTION=m, but you
have not enabled modules. In this case, LKC would provide CONFIG_OPTION=y, assuming
that was a valid option.
If you make changes to the layer content in your Linux platform project and wish to rerun the
kernel audit portion of the build, it is first necessary to rerun the patch stage of the build to gather
the kernel fragments from the layers.
...
After fragments are gathered into the kernel build directory, you can rerun the audit process with
the kernel_configme command, and observe the results in log files as shown earlier.
192
16 Patching and Configuring the Kernel
Patching the Kernel With SCC Files
...
NOTE: Tasks Summary: Attempted 20 tasks of which 19 didn't need to be rerun and all
succeeded.
make: Leaving directory `/mnt/Linux_build/Build/intel-x86-64-glibc_std/build'
Use this procedure to conveniently maintain kernel configuration changes and patches in a local
layer in a single .scc file.
This procedure:
• Requires a configured and built platform project. See Example Platform Project Configure for the
Examples in this Chapter on page 177.
• Requires the use of a single .scc script file to instruct BitBake to apply the kernel configuration
fragment and the patch that were applied in Patching the Kernel on page 195.
• Assumes that you already have the required directory structure in the projectDir/layers/
local directory.
An .scc file is a script file that provides information to the BitBake build system about what
kernel changes to apply, and how to apply them. Use .scc files for grouping kernel changes,
configuration fragments and patches. .scc files are a convenient way to track changes to the stock
kernel provided by Wind River.
193
Wind River Linux
User's Guide, 5.0.1
In this procedure, you will use a single .scc script file to instruct BitBake to apply the kernel
configuration fragment and the patch that were applied in Patching the Kernel on page 195.
Note that the instructions assume that you already have the required directory structure in the
projectDir/layers/local directory.
For concepts related to using series configuration compiler (.scc) files, see Kernel Patching with scc
on page 155.
Step 1 Update the .bbappend file to tell BitBake about the the location of the .scc file.
a) Open the linux-windriver_3.4.bbappend file in an editor, for example:
$ vi layers/local/recipes-kernel/linux/linux-windriver_3.4.bbappend
b) Update the following line, beginning with SRC_URI declaration, to add the location and name
of the new patch file:
SRC_URI += "file://kernel_baseline.scc"
Here we modified the SRC_URI variable to include the file kernel_baseline.scc, and to let
BitBake know that this file has to be processed at build time.
c) In projectDir/layers/local/recipes-kernel/linux/linux-windriver layer directory, use a text
editor to create the .scc file.
$ vi layers/local/recipes-kernel/linux/linux-windriver/kernel_baseline.scc
The file kernel_baseline.scc contains the instructions needed to apply the kernel
configuration changes and the 0001-init-add-WR-to-the-boot-label.patch kernel patch
previously applied in Patching the Kernel on page 195.
.scc files provide you with more control on how the kernel changes are applied. For additional
information, see Kernel Patching with scc on page 155.
Step 2 Clean up and rebuild the Linux kernel package and file system.
a) Clean up the package.
Do this every time you make changes to the patches that you want to apply to the Linux
kernel. This step forces the build system to subsequently reload all associated configuration
files.
b) Rebuild the Linux kernel package.
Once complete, a new linux-windriver package is available containing the modified kernel
image to be used in the target.
c) Rebuild the file system.
$ make
This command updates the root file system to include the new structure of kernel modules to
be loaded on the target.
194
16 Patching and Configuring the Kernel
Patching the Kernel
Step 3 Verify that the .scc file changes were successfully applied to the target.
$ make start-target
Note the early boot message from the kernel console. It should read something similar to the
following:
Use this procedure to maintain patches in a local layer that will be applied to the Linux kernel at
build time.
• The following procedures require a configured and built platform project. See Example
Platform Project Configure for the Examples in this Chapter on page 177.
• This exercise is an extension of the configuring kernel modules with fragments procedure in
Kernel Module Configuration and Patching with Fragments on page 179 and assumes that you
already have the required directory structure in the projectDir/layers/local directory.
• The following procedure assumes that you have initialized your git environment already
using the command git config --global to setup the user.name and user.email variables.
For additional information, see http://git-scm.com/book/en/Getting-Started-First-Time-Git-
Setup#Your-Identity.
Maintaining individual kernel patches in a layer is one way in which you can track changes to
the stock kernel provided by Wind River. In this procedure, you will apply a single patch to the
kernel to modify the label used to display the kernel version during early booting.
Step 1 Update the .bbappend file to tell BitBake about the patch file.
a) Open the linux-windriver_3.4.bbappend file in an editor, for example:
$ vi layers/local/recipes-kernel/linux/linux-windriver_3.4.bbappend
b) Update the following line to add the location and name of the new patch file:
SRC_URI += "file://config_baseline.cfg \
file://0001-init-add-WR-to-the-boot-label.patch"
$ cd build/linux-windriver-3.4-r0/linux
$ vi init/version.c +48
195
Wind River Linux
User's Guide, 5.0.1
$ git format-patch -s -n \
-o projectDir/layers/local/recipes-kernel/linux/linux-windriver \
origin/standard/common-pc-64/base
Once applied, this patch modifies the banner message displayed in the Linux console early in
the boot process. Instead of displaying:
$ cd ../../..
Do this every time you make changes to the patches that you want to apply to the Linux
kernel. This step forces the build system to subsequently reload all associated configuration
files.
b) Rebuild the Linux kernel package:
Once complete, a new linux-windriver package is available containing the modified kernel
image to be used in the target.
196
16 Patching and Configuring the Kernel
About Kernel Configuration and Patching
$ cd build/linux-windriver/linux
$ git log
commit 4250412525031d95c3d60f4ccac00ea098ce6920
Author: Revo User <[email protected]>
Date: Wed Sep 26 10:16:35 2012 -0400
$ cd ../../..
The Linux kernel is deployed as a git repository in your working directory. BitBake has
therefore committed the change using the message you entered in 3 on page 196, above, to
commit the change.
$ make start-target
Note the early boot message from the kernel console. It should read something similar to the
following:
197
Wind River Linux
User's Guide, 5.0.1
198
17
Creating Alternate Kernels from
kernel.org Source
Wind River provides the capability to build arbitrary git-based kernel sources using a development-
only recipe. This recipe uses the Yocto infrastructure to clone and build directly from the desired kernel
repository, starting from a user-specified tag and complete configuration.
NOTE: Only the kernel version supplied with Wind River Linux is validated and supported.
Using any other kernel version is not covered by standard support.
This procedure is therefore suitable only for projects that are not under Wind River standard support,
such as a Proof of Concept. It is expected that this procedure will build without errors with most BSPs,
but it is unlikely the resulting kernel will boot without further configuration and patches.
Step 1 Update the platform project's bblayers.conf file to add kernel development support.
In a previously created Wind River Linux Platform project based on a standard kernel, (that is
without CGL, RT-Linux or similar profile), add projectDir/layers/wr-kernel/kernel-dev to the
file projectDir/bitbake_build/conf/bblayers.conf. This makes the linux-windriver-custom
recipe available to the build.
For example:
$ cd projectDir/layers/local
$ mkdir -p recipes-kernel/linux
$ cd recipes-kernel/linux/
$ echo 'FILESEXTRAPATHS := "${THISDIR}/${PN}"' >> linux-windriver-custom.bbappend
Step 3 Update the SRCREV for the kernel version being built.
This is the git hash of a tag in the kernel.org tree. The kernel will be cloned from the kernel.org git
repository so it is necessary to have downloading enabled in your local.conf file.
199
Wind River Linux
User's Guide, 5.0.1
For example, to build the Linux 3.6 kernel the tag is:
$ mkdir -p linux-windriver-custom
$ cp /path/to/my/custom_defconfig linux-windriver-custom/defconfig
$ echo 'SRC_URI += " file://defconfig"' >> linux-windriver-custom.bbappend
Step 6 Move to the root of your project and edit your local.conf file.
Change your PREFERRED_PROVIDER_virtual/kernel_BSP_name definition so it selects your
custom kernel. For example:
PREFERRED_PROVIDER_virtual/kernel_qemuppc = "linux-windriver-custom"
If you are reasonably sure your kernel is compatible, you can build it into your file system image
using:
$ make fs
NOTE: This procedure only replaces the kernel and not the file system components. Most
notably the kernel-headers package that is exported to the SDK sysroot remains unchanged.
200
18
Exporting Custom Kernel Headers
Append files or directories to the KERNEL_INSTALL_HEADER variable each time the kernel is
rebuilt as shown in these examples
This procedure is a supplement to Exporting Custom Kernel Headers on page 202.
201
Wind River Linux
User's Guide, 5.0.1
Each entry in the KERNEL_INSTALL_HEADER variable is expected to exist in the Linux kernel
source include/ directory. To add a file or directory to be exported each time you rebuild the
kernel, use KERNEL_INSTALL_HEADER_append to add to the variable as illustrated in the
following example.
This variable is not configuration file-specific, and can be added to any of your layer
configuration files, such as
projectDir/layers/local/conf/layers.conf
Step 1 Open the projectDir/layers/local/conf/layers.conf file in a text editor.
KERNEL_INSTALL_HEADER_append += "myfiles/myfile.h"
KERNEL_INSTALL_HEADER_append += "myfiles"
Use this procedure to export custom kernel headers for application development cross-
compilation
This procedure requires a previously configured platform project. For additional information,
see About Configuring a Platform Project Image on page 62. It also requires that any custom kernel
header files that you want to export be located in the projectDir/build/linux-windriver-3.4-r0/
linux/include directory or a subdirectory. For additional information, see About Exporting Custom
Kernel Headers for Cross-compile on page 201.
Step 1 Unpack the Linux kernel.
Run the following command in the root of the projectDir.
$ cd build/linux-windriver-3.4-r0/linux
Step 4 Add and commit your file to the git repository for the kernel.
For the commit message, you can enter anything you like, specific to your custom header file.
202
18 Exporting Custom Kernel Headers
Exporting Custom Kernel Headers
Step 6 Add the header file to the projectDir/layers/local/conf/layers.conf file and save the file.
$ KERNEL_INSTALL_HEADER_append += "myfile.h"
This will include your custom header file in the build. For additional information on adding
header files, see Adding a File or Directory to be Exported when Rebuilding a Kernel on page 201.
This can take some time to complete. When it finishes, your custom header file will be located in
the projectDir/bitbake_build/tmp/sysroots/BSP_name/usr/include directory.
For a qemux86-64 BSP, the path would be projectDir/bitbake_build/tmp/sysroots/
qemux86-64/usr/include/myfile.h. This places your custom header file in the appropriate
directory for user space cross-compiling.
203
Wind River Linux
User's Guide, 5.0.1
204
19
Using the preempt-rt Kernel Type
Wind River Linux provides a conditional real-time kernel type, preempt-rt, for certain board and
file system combinations.
The default scheduler for preempt-rt is the Completely Fair Scheduler (CFS). For information on
configuring preemption levels, see About Preemption Model Configuration.
The preempt-rt kernel type provides four levels of preemption to suit most platform
project requirements, as described in this section. These options are available in the Kernel
Configuration > Processor type and features > Preemption model (Fully Preemptible Kernel
(RT)) menu as described in Configuring preempt-rt Preemption Level on page 207.
NOTE: The Processor type and features selection is specific to using an x86 architecture.
Different architectures may have different wording for this selection. Refer to Kernel
Configuration documentation specific to your architecture for additional information.
205
Wind River Linux
User's Guide, 5.0.1
206
19 Using the preempt-rt Kernel Type
Enabling Real-time
Testing indicates that with this mode selected, a system can be in an immediately preemptible
state more than 95% of the time, even during kernel-intense workloads.
Applications running on a CONFIG_PREEMPT_RT_FULL kernel need to be aware that in some
cases they may be competing with kernel services running in scheduled task context. Various
legacy test suites exercising privileged real-time scheduling policies at high priorities have also
been found to fail, and in some cases have caused system lockup due to the changed scheduling
dynamics in the kernel.
These conditions are a result of kernel code which had been running in hard-exception context
now running in task-scheduled context. The cause of this issue is the ability of a privileged
application or test task to elevate its scheduling priority above system daemons. The potential
exists for such a task to halt system scheduling if it does not relinquish the CPU.
The work-around is to assure system daemons schedule with a priority greater than any
application task. This may be accomplished by either a chrt of the system daemons above the
expected priority range of application usage, or constraining the application to use priorities
below that of system daemons.
Enabling Real-time
To enable the preemptible real-time feature, configure your project with the preempt-rt kernel
option.
This procedure requires that you have previously created a platform project build directory. For
additional information, see About Creating the Platform Project Build Directory on page 62.
Step 1 Configure the platform project with the --enable-kernel=preempt-rt option.
For example, to configure a qemux86-64 board with a standard file system and conditional real-
time, enter:
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=preempt-rt \
--enable-rootfs=glibc_std
See About Configure Options on page 65 for additional information on configure script options.
$ make
You may configure the real-time kernel to run in one of four levels of increasingly aggressive
preemption behavior.
This section explains how to launch menuconfig to configure preempt-rt kernel parameters, and
make changes to your preemption levels.
NOTE: These instructions describe command-line procedures for configuring your preemption
levels. See the Wind River Workbench by Example Guide (Linux version) for instructions on using
Workbench to configure preemption.
207
Wind River Linux
User's Guide, 5.0.1
To perform the following procedure, you must have a platform project image configured and
built using the --enable-kernel=preempt-rt configure option. See Enabling Real-time on page
207.
Step 1 Build and open a kernel development shell (kds).
Run the following command from the projectDir:
$ make kds
Once the command completes, it will launch a new kds in a separate window.
$ make menuconfig
NOTE: The first selection, Processor type and features, is specific to using an x86 architecture.
Different architectures may have different wording for this selection. Refer to Kernel
Configuration documentation specific to your architecture for additional information.
208
19 Using the preempt-rt Kernel Type
Configuring preempt-rt Preemption Level
Step 6 Optionally, set the debug functionality you want to include in your kernel.
Select Kernel hacking from the main menu, then highlight Debug preemptible kernel and press
SPACE to select it. Press ESC twice to return to the main menu.
This option enables the kernel to detect preemption count underflows, track critical
section entries, and emit debug assertions should an illegal sleep attempt occur. Unsafe
use of smp_processor_id( ) is also detected. The text configuration entry for this option is
CONFIG_DEBUG_PREEMPT.
Step 7 Press ESC and select Yes at the prompt to save your configuration.
Step 10 Rebuild the platform project and add the new kernel module changes.
$ make
209
Wind River Linux
User's Guide, 5.0.1
210
PA R T V
211
Wind River Linux
User's Guide, 5.0.1
212
20
Kernel Debugging
Kernel Debugging
213
Wind River Linux
User's Guide, 5.0.1
KGDBOE permits KGDB debugging operations over an Ethernet port. By default, KGDBOE is
available as a module in the WR Linux kernel.
Perform the procedure in this topic to use KGDB debugging operations over an Ethernet port
using gdb.
Step 1 Launch a platform project image on a hardware target.
See the kernel documentation for the full details on the option syntax.
NOTE: KGDBOE is only available on Ethernet drivers that support the Linux Netpoll API. If this
is not the case for your board the modprobe command above will fail with the message:
$ cd projectDir
This makes it easier to provide the path to the vmlinux symbol file
b) Run the cross-compiled version of on your vmlinux image.
$ ./scripts/gdb export/images/vmlinux-symbols-qemux86-64
For some boards, you need to assert the architecture for gdb.
• For the 8560, for example, it is necessary to specify:
NOTE: Without this setting, gdb may continually respond with errors such as the following and
other errors.
214
20 Kernel Debugging
Debugging with KGDB Using an Ethernet Port (KGDBOE)
NOTE: You may see various warnings and exceptions that you can ignore. If, however, gdb
informs you that the connection was not made, review your configuration, command syntax,
and the IP addresses used.
Note that after issuing this command, and if the connection to the target is successful, the target
will halt.
(gdb) where
You should see a backtrace stack of some depth. If you see only one or two entries, or a ??, then
you are observing an error.
Step 6 Enter the info registers command, and note the output.
a) Type the following gdb command:
NOTE: If the do_fork location as a breakpoint does not work on this installation, note it and
choose another kernel entry point. See Wind River Workbench by Example, Linux Version: Debugging
Kernel Space for more information.
(gdb) c
Step 9 On the host, verify that the program stopped at the do_fork breakpoint.
a) On the target, type ls then press RETURN.
The host displays the status of the do_fork breakpoint:
215
Wind River Linux
User's Guide, 5.0.1
NOTE: You may wish to build the kernel with CONFIG_DEBUG_INFO=y if you want more
debugging info.
(gdb) disconnect
(gdb) quit
WARNING: If you quit gdb without first disconnecting from the target, you may have to reboot
the target before you can reconnect.
You may also lose Telnet and other communication, especially if the target was stopped at a
breakpoint.
The following procedure illustrates the use of KGDB debugging operations from a serial console.
KGDBOC permits KGDB debugging operations using the serial console. The serial console
operates in two modes-the usual mode in which you use the serial console to login and so on, and
a mode that allows you to enter the KGDB debugger.
If your hardware does not support the line break sequence or agent-proxy is connected to
your target as a debug splitter, you will have to start the agent-proxy with the -s003 option.
(Workbench users set the Work Bench Linux KGDB Connection properties to select Use
character based break.) If your target continues to run after sending a break command, you most
likely need to employ one of these methods.
The following example assumes that he board's console port is connected to the development
workstation through a serial-to-USB adapter which can be accessed through the /dev/ttyUSB0
device:
Step 1 Launch the agent-proxy from within your project's directory.
Step 3 Find the device file used as console by inspecting the kernel's boot command line.
Run the following command on the target:
216
20 Kernel Debugging
Disabling KGDB in the Kernel
SysRq : DEBUG
Entering kdb (current=0xde63da40, pid 543) due to Keyboard Entry
kdb>
kgdb: Registered I/O driver kgdboc.
kdb> kgdb
$ ./scripts/gdb export/images/vmlinux-symbols-beagleboard
You can start now your debugging session using all available gdb commands.
You can use the gdb command c (for continue) followed by CTRL+C to resume and stop
execution on the target.
217
Wind River Linux
User's Guide, 5.0.1
A new kernel is built and vmlinux symbol table file created in the export directory.
Remember these files for Workbench and the command line testing.
Learn how to start QEMU from the command line and load the KGDB kernel modules.
The following example procedure assumes you have built a platform project for one of the
supported boards.
When you have created the platform project, you can start QEMU from the command line and
load the KGDB kernel modules shown in the following procedure.
After the module is loaded you can, for example, connect to the kernel using Workbench as
described in Workbench by Example, Linux Version.
Step 1 Launch a QEMU target.
Run the following command from the projectDir:
$ make start-target
$ ./scripts/gdb export/images/vmlinux-symbols-qemux86-64
From this moment on, you can use the gdb command c (for continue) followed by CTRL+C to
resume and stop execution on the target.
NOTE: Refer to Wind River Workbench by Example, Linux Version for details on loading Ethernet as
well as Serial KGDB target modules on physical targets.
218
21
Userspace Debugging
Learn how to add debugging symbols to your binaries for debugging on the target.
Whether you are debugging on the target directly or remotely from the development
workstation, you will want to have debugging symbols for your binaries. The easiest method to
use to add debugging symbols is to use the --enable-build=debug configure script option when
you create your platform project.
Once you build the project with the make command, this option installs debug symbols in the
form of a *.debuginfo archive file, located in the projectDir/export folder. For example:
projectDir/export/qemux86-64-glibc-small-standard-dist-debuginfo.tar.bz2
If you use this option, the *.debuginfo file and symbols are automatically added to the target root
file system, so there is no need to extract this file on the target to perform local debugging.
These symbols are located in .debug subdirectories, along with the location of the corresponding
binaries. For example, the debug information for binaries in /usr/bin is in the directory
/usr/bin.debug
If you used the --enable-build=profiling configure script option, note that this also adds symbols
in your file system for debugging, but requires you to manually extract the symbols to the target
file system to perform debugging.
Step 1 Verify whether debugging symbols have been built for your platform project.
219
Wind River Linux
User's Guide, 5.0.1
Navigate to the projectDir/export folder to see whether the *.debuginfo archive exists. For
example:
projectDir/export/qemux86-64-glibc-small-standard-dist-debuginfo.tar.bz2
The full name of the archive is based on the BSP, root file system, and kernel type, amd may differ
depending on your platform project configuration. If your platform project includes this archive,
it is ready to perform userspace debugging. If not, you can add them in the following step.
Options Description
$ make fs-debug
Once the command completes, it creates the *.debuginfo archive in the project export directory.
Depending on your development needs, you may only need to create debugging symbols for a
specific package, and not the entire platform project.
For platform projects with the glibc_small rootfs, you can pre-configure or add symbols after the
root file system has built.
• To add symbols to the root file system, take one of the following actions:
Options Description
220
21 Userspace Debugging
Dynamic Instrumentation of User Applications with uprobes
There are number of tracing options provided with Wind River Linux. This example focuses
on uprobes. The 'u' indicates "user," and uprobes are designed to trace applications and user
libraries, whereas many other types of Linux instrumentation are focused on the kernel.
Other instrumentation libraries provided with Wind River Linux that examine applications are:
ptrace
Used by GDB and Wind River user mode agent for debugging
LTTng (The Linux trace toolkit)
Records system calls for the workbench System Viewer
Wind River Profiler
Periodically records the contents of both user and kernel stacks
In the following examples, we will be doing profiling. It is far more convenient to use the Wind
River Profiler than the following method, and the Profiler is functional with striped binaries on
the target file system because it obtains debug information though object path mapping on the
host. However, the uprobes method has the advantage of being entirely target based and has no
dependence on development host tool connectivity.
The uprobe library provides a mechanism for a kernel function to be invoked whenever a process
executes a specific instruction location. An interface to uprobes is provided through the perf
events subsystem, accessed from the shell with the perf probe command.
When a uprobe is inserted in a program, a special copy is made of the page containing the probe.
In that copy the instruction is replaced by a breakpoint. When the breakpoint is hit by a running
process, the event is recorded and the program continues normal operation.
While the kernel event tracing system is the default user of uprobes; there is also a published
interface you can use for your own custom tools. At the core of uprobes is this function:
#include <linux/uprobes.h>
The inode structure points to an executable file; the probe is placed at offset bytes from the
beginning. The uprobe_consumer structure provides the callback mechanism for when the
process encounters the probe; it looks like:
struct uprobe_consumer {
int (*handler) (struct uprobe_consumer *self, struct pt_regs *regs);
bool (*filter) (struct uprobe_consumer *self, struct task_struct *task);
struct uprobe_consumer *next;
};
The filter() function is optional; if it exists, it determines whether handler() is called for each
specific hit on the probe. The handler returns an int, but the return value is ignored in the current
code.
uprobe Syntax
The uprobe syntax is similar the kprobe syntax, but because only minimal process symbol
information is available to the kernel, it is typical to specify the probe location with an offset.
221
Wind River Linux
User's Guide, 5.0.1
Parameter Definition
This comes from the Linux kernel documentation directory of your platform project in the file:
projectDir/build/BSP_name-wrs-linux/linux-windriver-version/linux/ Documentation/
trace/uprobetracer.txt
The format of the perf probe command is not consistent across versions of Linux. The version in
Wind River Linux supports the following options:
222
21 Userspace Debugging
Dynamically Obtain User Application Data with uprobes
uprobes requires the perf package. By default, uprobes are already included in your kernel
configuration if your BSP supports this functionality in the Kernel Hacking > Tracers section of
the kernel configuration.
Figure 5: CONFIG_UPROBE_EVENT=y
• Enter the following commands from the root of your project directory tree.
These commands have no negative side effect if the package is already present in your
platform project.
Use uprobe to dynamically obtain application and library data on the perf application.
This procedure requires the following for successful completion:
• Previously configured and built platform project with debugging symbols. See Adding
Debugging Symbols to a Platform Project on page 219.
• The perf package included in your platform project build. For additional information on
adding packages, see Adding Debugging Symbols to a Platform Project on page 219.
• The CONFIG_UPROBE_EVENT=y kernel configuration parameter enabled in the kernel.
By default, uprobes are included in your kernel configuration, but may not be supported
by all BSPs. To see whether your BSP supports this functionality, refer to the Kernel
Configuration > Kernel Hacking > Tracers section of the utility. For example:
223
Wind River Linux
User's Guide, 5.0.1
• The platform project is launched on a hardware target and you are logged in.
Step 1 Confirm that the virtual debug file system is mounted.
$ ls /sys/kernel/debug/
bdi kprobes memblock sched_features usb
hid ltt powerpc tracing
$ perf top
Step 4 Press q to stop and return to the prompt once you have seen enough:
224
21 Userspace Debugging
Dynamically Obtain Object Data with uprobes
Run the following command in the background for an extended period of time to obtain data:
$ top
tar -czf this.tar /etc/*
When the background task is complete, a message displays in the console, for example:
$ perf report
Use uprobe to dynamically obtain data on a specific object, created as a new probe, in the perf
application.
This procedure requires the following for successful completion:
• Previously configured and built platform project with debugging symbols. See Adding
Debugging Symbols to a Platform Project on page 219.
• The perf package included in your platform project build. For additional information on
adding packages, see Options for Adding an Application to a Platform Project Image on page 138.
• The CONFIG_UPROBE_EVENT=y kernel configuration parameter enabled in the kernel.
By default, uprobes are included in your kernel configuration, but may not be supported
by all BSPs. To see whether your BSP supports this functionality, refer to the Kernel
Configuration > Kernel Hacking > Tracers section of the utility. For example:
225
Wind River Linux
User's Guide, 5.0.1
• The platform project is launched on a hardware target and you are logged in.
To debug an object file effectively, you can use the following procedure to examine the symbols
visible to perf probe.
Step 1 Confirm which symbols are available to perf in a specific object file.
This step uses the F option, for example:
malloc
malloc@plt
malloc_info
memalign@plt
You can now use it in all perf command-line tools, such as:
226
21 Userspace Debugging
Dynamic Instrumentation of User Applications with uprobes
Step 4 In this example we have added the g option to the command; this enables a call tree in the
recorded results. Enter some random commands to generate data. For example:
$ top
tar -czf this.tar /etc/*
Events: 3K probe_libc:malloc
86.37% tar libc-2.15.so [.] malloc
5.33% perf libc-2.15.so [.] malloc
4.73% tcf-agent libc-2.15.so [.] malloc
2.30% top libc-2.15.so [.] malloc
1.28% gzip libc-2.15.so [.] malloc
Step 6 Select a line and press ENTER to observe the call tree if perf report is interactive.
Not all functions are displayed. On a typical embedded system, the libraries will be stripped of
debug information and only public APIs will be shown.
227
Wind River Linux
User's Guide, 5.0.1
Using gcore When using gdb with Wind River Linux, note that
gdb has an internal gcore command that provides
functionality that in other systems is provided by a
separate gcore executable.
This topic explains how to add the gdb package to your build.
In order to debug programs on the target, you will need to add the gdb package to your build.
This can be done at configuration time with the --with-package=gdb configure option (see
Configuring a New Project to Add Application Packages on page 142) or after the project is built with
the make -C build gdb.addpkg command (see Adding New Application Packages to an Existing
Project on page 139).
You will also want the debugging symbol files on your target using one of the methods described
in Adding Debugging Symbols to a Platform Project on page 219.
The following is an example of on-target debugging commands on a glibc-small system. The
debugging target is /bin/busybox, and specifically the ls command implementation.
Step 1 Start gdb.
# gdb
228
21 Userspace Debugging
Debugging Packages on the Target Using gdbserver
NOTE: To debug other functionality implemented by busybox, change the arguments of the set
args option command.
Step 6 Run under the debugger until you reach the breakpoint.
(gdb) run
NOTE: You can then step over the implementation details of the ls command within the
busybox binary.
Use this procedure to debug a package by running gdbserver on the target and gdb on the
development host.
You can debug target binaries remotely by running gdbserver on the target and gdb on the
development host.
The following example illustrates how to debug the ls command remotely on a qemux86-64
target with a glibc_small root file system.
In order to debug programs on the target using gdbserver, you will need to add the gdb package
to your build. This can be done at configuration time with the --with-package=gdbserver
configure option (see Configuring a New Project to Add Application Packages on page 142) or
after the project is built with the make -C build gdbserver.addpkg command (see Adding New
Application Packages to an Existing Project on page 139).
This procedure assumes that you are already connected to the target.
Step 1 Launch the gdbserver.
$ cd projectDir
$ ./scripts/gdb
(gdb) file bin/busybox
(gdb) target remote localhost:4441
(gdb) break main
(gdb) continue
You can then proceed with the debugging session as if it were being performed locally.
b) Change the gdbserver command arguments to debug other BusyBox programs.
229
Wind River Linux
User's Guide, 5.0.1
For example:
Note that in this case, the selection of port number 23 is entirely arbitrary. Any value will do.
230
22
Analysis Tools Support
Use analysis tools with Workbench as documented in online Analysis Tools and Workbench
documentation.
NOTE: Analysis tools are primarily used with Workbench as documented in online Analysis
Tools and Workbench documentation.
Like other Wind River Linux configuration commands, you can perform the following through
Workbench or the command line. Note that if you create projects through the command line, you
then have to import them into Workbench for them to become visible.
Backtracing, which is used by the analysis tools, is performed differently by MIPS boards than
by non-MIPS boards, so the following presents two examples of configuring builds for analysis
tools.
If you are not interested in memory allocations invoked in libraries called by your application,
then you can use the production stripped versions of the library object files and simply build
your application in Workbench with the Debug build specification. Workbench Memory Analysis
will resolve addresses to functions, files and line numbers for addresses in your main application
object file but report the addresses in your samples that reside in stripped library objects as
“unknown” functions.
The dynamic kprobes feature is an extension of the Linux kernel ftrace function tracer.
Currently, x86 is the only platform supported, and the format is instruction-dependent. For more
information about supported instructions, please refer to the document
231
Wind River Linux
User's Guide, 5.0.1
arch/x86/lib/x86-opcode-map.txt
Unlike the function tracer, the kprobes tracer can probe instructions inside of kernel functions. It
allows you to check which instruction has been executed. And unlike the Tracepoint-based events
tracer described in tracepoints.txt the kprobes tracer can add new probe points on the fly.
One of the design goals of kprobes is to allow their insertion and deletion from the command-
line without the need for any specialized user tools. So the manipulation of kprobes is done via
the proc and sys virtual file systems. The syntax is complex and probably best implemented in a
script for processes that are more complex than this example.
The kernel tracing infrastructure is documented in the ../Documentation/trace/ directory
found at http://www.kernel.org/doc/Documentation/trace/ and in your platform project projectDir/
build/BSP_name-wrs-linux/linux-windriver-version/linux/Documentation/trace directory.
The ftrace.txt file describes the basic kernel tracing facility. The dynamic kprobes extension is
described in the kprobetrace.txt file.
Configuration
There are no user packages required to use dynamic kprobes. The required features are already
enabled in the kernel on supported Wind River Linux BSPs in the Kernel Hacking > Tracers
section of the kernel configuration.
There are two kernel options:
• CONFIG_KPROBE_EVENT=y
• CONFIG_DYNAMIC_FTRACE=y
232
22 Analysis Tools Support
Preparing to use a kprobe
Parameter Definition
Resources
Documentation/trace/kprobetrace.txt in your installation.
Documentation/trace/ftrace.txt in your installation.
http://lwn.net/Articles/343766/
3
Only for return probe
4
This is useful for fetching a field of data structures
233
Wind River Linux
User's Guide, 5.0.1
Ftrace uses the debugfs file system to hold the control files as well as the files to display output.
Setting up a kprobe
The steps in this procedure show you how to set up a kprobe for kernel debugging and confirm
that it is working.
NOTE: Ensure that the entire quoted section of the command is on the same line when you enter
it at the terminal prompt.
Additional examples.
234
22 Analysis Tools Support
Enabling and Using a kprobe
This sets a kprobe on the top of the do_fork() function with recording 1st to 5th arguments as
doforkprobe event. Note also that whichever register/stack entry is assigned to each function
argument depends on arch-specific ABI.
# cat /sys/kernel/debug/tracing/kprobe_events
p:kprobes/doforkprobe 0xc102e680 clone_flags=%ax stack_start=%dx regs=%cx
parent_tidptr=+4($stack) child_tidptr=+8($stack)
root@d610:/sys/kernel/debug/tracing> ls -l events/kprobes/
total 0
drwxr-xr-x 2 root root 0 May 26 13:44 doforkprobe
-rw-r--r-- 1 root root 0 May 26 13:44 enable
-rw-r--r-- 1 root root 0 May 26 13:44 filter
root@d610:/sys/kernel/debug/tracing> ls -l events/kprobes/doforkprobe/
total 0
-rw-r--r-- 1 root root 0 May 26 13:45 enable
-rw-r--r-- 1 root root 0 May 26 13:44 filter
-r--r--r-- 1 root root 0 May 26 13:44 format
-r--r--r-- 1 root root 0 May 26 13:44 id
The steps in this procedure show you how to enable and use a kprobe to trace kernel debugging
data.
235
Wind River Linux
User's Guide, 5.0.1
doforkprobe 26 0
The first column is the event; the second is the number of probe hits; and the third is the
number of probe miss-hits.
# cat /sys/kernel/debug/tracing/trace#
# tracer: nop
#
# entries-in-buffer/entries-written: 2/2 #P:1
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
sh-518 [000] d..2 1679.804579: doforkprobe: (do_fork+0x0/0x310)
clone_flags=1200011 stack_start=bfc6c7d0 regs=d6689fb4 parent_tidptr=0 child_tidptr=0
sh-518 [000] d..2 2068.342909: doforkprobe: (do_fork+0x0/0x310)
clone_flags=1200011 stack_start=bfc6c7d0 regs=d6689fb4 parent_tidptr=0 child_tidptr=0
Disabling a kprobe
The steps in this procedure show you how to disable a kprobe after using it to debug a kernel.
236
22 Analysis Tools Support
Analysis Tools Support Examples
Use the examples in this section to configure a platform project to add analysis tools support
from the command line.
Additional Reading
Refer to the analysis tools documentation for specifics on using the Wind River Analysis Tools.
These instructions show you how to add analysis tool support to MIPS targets.
$ .../configure --enable-board=qemumips \
--enable-rootfs=glibc_std \
--enable-kernel=standard \
--with-template=feature/analysis
NOTE: MIPS boards use a different method for backtracing. A production build along with a
make fs-debug (which places the symbolic information on the host) is fine for use with oprofile,
but if you are using mpatrol, you should specify the --enable-build=profiling argument to
your configure command. This is necessary because mpatrol requires the presence of additional
symbols to analyze target memory on the target. Note that oprofile can fetch these symbols from
the host.
$ make
These instructions show you how to add analysis tool support to non-MIPS targets.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-rootfs=glibc_std \
--enable-kernel=standard \
--with-template=feature/analysis \
--enable-build=profiling
237
Wind River Linux
User's Guide, 5.0.1
NOTE: The --enable-build=profiling option enables frame pointers for the backtrace code. (The
--enable-build=debug option also enables frame pointers which enables backtrace functionality.)
$ make
238
PA R T V I
239
Wind River Linux
User's Guide, 5.0.1
240
23
QEMU Targets
QEMU Targets
QEMU is a processor simulator for supported boards. (Refer to your Release Notes for a list of
supported boards.) Using QEMU for simulated deployment, no actual target boards are required,
and there are no networking preliminaries.
QEMU and Workbench are compatible both in User Mode and Kernel Mode. QEMU deployment,
for the supported boards, offers a suitable environment for application development and
architectural level validation. User-space and kernel binaries are compatible with the real
hardware.
When started, QEMU runs in a pseudo-root environment and starts the NFS server with alternate
RPC ports. The simulated target is given a hard-coded IP address of 10.0.2.15, and localhost is
visible from the simulated target as 10.0.2.2.
See QEMU Target Deployment Options on page 241.
QEMU Prerequisites
To deploy a QEMU simulation, you must have built a platform project for one of the QEMU-
enabled BSPs, which are named after their architecture. For example, qemux86-64 represents a
64-bit x86 board. See the Wind River Linux Release Notes for a list of QEMU-enabled BSPs.
Use the examples in this section to configure, monitor, and specify launch options for QEMU
from the command line.
The Wind River Linux Getting Started Guide: Deploying a Platform Project Image provides an example
of how to deploy a QEMU target for user mode debugging. You can also use QEMU to perform
kernel mode debugging (KGDB) of supported Wind River Linux targets as described in this
section.
241
Wind River Linux
User's Guide, 5.0.1
After you have built a platform project for one of the QEMU-supported boards and then built the
file system (make), you can start an instance of QEMU for that target.
Note that after a building a platform project using the make command, the pre-built kernel is
automatically copied to the export subdirectory of the project directory. The QEMU simulator
loads and executes the kernel found within the export subdirectory, and NFS-mounts the export/
dist subdirectory as its root file system.
This procedure shows you how to access and change QEMU configuration options
$ make config-target
NOTE: You need to build graphics support into your kernel, change the bootline, or use the
TOPTS="-gc" option, which does both for you.
242
23 QEMU Targets
Accessing the QEMU Monitor
Learn how to access the QEMU Monitor to manipulate QEMU from within a running simulation
The QEMU Monitor provides QEMU-specific commands from within the simulation.
Step 1 Start QEMU.
$ make start-target
(qemu) help
help|? [cmd] -- show the help
commit device|all -- commit changes to the disk images (if -snapshot is used) or
backing files
info subcommand -- show various information about the system state
q|quit -- quit the emulator
.
.
.
(qemu) CTRL+A,C
root@localhost:/root>
• quit
243
Wind River Linux
User's Guide, 5.0.1
Commands:
start Start target, NFS server and proxy (if needed)
stop Stop the target and NFS server...
nfs-start Start the NFS server
nfs-stop Stop the NFS server
net-start Start the network server (TUN/TAP)
net-stop Stop the network server (TUN/TAP)
kqemu-start Load the KQEMU kernel module
kqemu-stop unload the KQEMU kernel module
allstop Stop target, NFS server and proxy
config Display or change the default configuration
QEMU Targets
$ make start-target
Use this information as a guideline for resolving errors that occur while staring QEMU.
If there is an error because you have a former session still running that you no longer want, you
will have to close those sessions.
• Enter the following command:
$ pkill rpc
Use this information as a guideline for running multiple QEMU sessions simultaneously.
244
23 QEMU Targets
Starting a QEMU Session From a .iso File
To run am additional QEMU session, you could also use -i option to automatically increment port
numbers by the specified amount.
• Issue the following command to start a new session with the port number incremented by 2:
Use this information as a guideline for starting a QEMU session from an ISO file.
In some circumstances you may need to boot a CDROM image in QEMU.
• To boot a CDROM image (.iso file) in QEMU, enter:
Use this information as a guideline for starting a QEMU session from a disk image.
Under some circumstances you may need to start a QEMU session from a disk image.
• To boot a USB or hard disk image in QEMU, enter:
See About Configuring and Building Bootable Targets on page 265 for more on creating and
booting .iso images.
Use this information as a guideline for starting a QEMU session with a graphics console.
Your development efforts may involve a graphics console such as X Windows.
• To boot with a graphics console in your simulation, enter:
245
Wind River Linux
User's Guide, 5.0.1
Use this information as a guideline for using port mapping to access a QEMU target simulation.
By default QEMU is launched with NAT (Network Address Translation) by default. QEMU with
NAT does not require root privileges on the host. The tap option avoids network routing issues
associated with NAT but requires root privileges. The usual host ports are mapped to new port
numbers so that you can access the features through the new port numbers. For example, KGDB
is usually accessed at port 6443, but you use port 4445 when you connect to the simulation.
Telnet port 23 has been mapped to port 4441, and ssh port 22 has been mapped to port 4440. You
can access the running simulation through those ports with the appropriate tools.
• Log in to the running simulation.
Enter the following command to use ssh to log in to the running simulation from another
terminal window on the same host:
CTRL+A,X
# halt
246
23 QEMU Targets
Configure TUN/TAP in the Wind River Workbench New Target Wizard
TUN and TAP are virtual network kernel drivers used to implement network devices that are
supported entirely in software, making them ideal for use with a QEMU deployment.
TAP, for network “tap”, simulates an Ethernet device and works with layer 2 packets such as
Ethernet frames.
TUN, short for network “tunnel”, simulates a network layer device. It works with layer 3 packets,
such as IP packets. Once enabled, TAP creates a network bridge while TUN provides the routing.
You can use TUN/TAP networking to configure a network on your host that connects to the
QEMU target simulation. If you wish to connect two or more QEMU simulations for testing and
debugging, TUN/TAP lets you specify the networking parameters for each simulation.
NOTE: Configuring TUN/TAP networking on the host requires root privileges—you can start
the emulation as the root user, or start it as another user and you will be prompted for the root
password.
NOTE: You must configure the TUN/TAP interface once for each system boot.
Use this information as a guideline for configuring TUN/TAP using the Wind River Workbench
New Target Wizard.
TUN/TAP can be set up from within Wind River Workbench.
Step 1 Start Wind River Workbench.
Step 2 Click the New Connection button in the Remote Systems window to launch the New Connection
Wizard.
247
Wind River Linux
User's Guide, 5.0.1
Step 5 Complete the wizard process in accordance with your target connection requirements.
Use this information as a guideline for configuring TUN/TAP for use with an existing target
connection.
In some circumstances, you may need to configure TUN/TAP for use with an existing target
connection.
Step 1 Start Wind River Workbench.
Use this information as a guideline for configuring TUN/TAP from the command line.
In some circumstances, you may need to configure TUN/TAP from the command line.
Step 1 Enter the following at the command line:
NOTE: This command must be run as root. If you are not logged in as root, sudo will
automatically run and prompt you for the root password.
Step 2 When your simulation is running, view the routing information on the simulation:
root@localhost:/root> route
248
23 QEMU Targets
QEMU Targets
root@localhost:/root>
host_$ route
Notice that 192.168.200.1 is assigned to the host and 192.168.200.15 is assigned to the target.
249
Wind River Linux
User's Guide, 5.0.1
250
24
Wind River Simics Targets
Use Wind River Simics to simulate real world hardware target platforms.
Wind River Simics is a fast, functionally-accurate, full system simulator. Simics creates a high-
performance virtual environment in which any electronic system – from a single board to
complex, heterogeneous, multi-board, multi-processor, multicore systems – can be defined,
developed and deployed.
Simics enables companies to adopt new approaches to the product development life cycle
resulting in dramatic reduction in project risks, time to market, and development costs while also
improving product quality and engineering efficiency. Simics allows engineering, integration and
test teams to use approaches and techniques that are simply not possible on physical hardware.
To purchase Wind River Simics, contact your Wind River sales representative.
To use Simics as a platform project image target, see Using Simics from the Command Line on page
251.
Use the basic procedures in this section to launch and/or configure a Simics target from the
command-line.
You can enter make help at any time from your project directory to view a full listing of Simics
options.
251
Wind River Linux
User's Guide, 5.0.1
To use Wind River Simics successfully, ensure the prerequisites in this section are met.
Before you can use Simics, you must first install it. See the Wind River Simics Installation Guide for
detailed instructions.
Step 1 Set up the environment.
Add the following lines of code to your .bashrc file or the equivalent configuration file for your
shell environment. Adjust the paths and Simics version number to match your installation.
export SIMICS_BIN_HOME=customer_path_to_simics_install/simics-x.x/bin
export SIMICS_LICENSE_FILE=customer_path_to_license_file
$ cd projectDir
$ make start-simics
$ make stop-simics
$ cd projectDir
252
24 Wind River Simics Targets
Enabling Simics Acceleration for x86 BSPs
$ make stop-simics
Refer to the Wind River Simics Hindsight User’s Guide for additional information on using the full
capabilities of Simics.
Use this information as a guideline for using Simics acceleration for x86 BSPs.
Simulated targets can be accelerated for x86 BSPs with Simics.
This procedure requires a previously configured and built platform project based on an x86 BSP
and a Wind River Simics installation. For additional information, see Meeting Simics Prerequisites
on page 252.
Step 1 Change to your project directory.
$ cd projectDir
# make start-simics-vmp
NOTE: You only need to run this command once on the development host.
Refer to the Wind River Simics Hindsight User’s Guide for additional information on the VMP
acceleration feature.
$ make stop-simics
253
Wind River Linux
User's Guide, 5.0.1
$ make config-target-simics
For additional information on configuring Simics, see the Wind River Simics Hindsight User’s
Guide.
254
PA R T V I I
Deployment
255
Wind River Linux
User's Guide, 5.0.1
256
25
Managing Target Platforms
You can modify the password and group file construction process to produce custom password
and group files using several methods as described in this section.
Overview
The default contents of the Wind River Linux file system contain only one login for the root
user. In any secure system you will want to create additional logins for the various roles that are
implemented in your security policies. Creating these logins can be problematic as the operations
require privileged access.
It is important to note that there is a preferred method for making these modifications. The other
methods are described in case the preferred method does not suit your needs, but you should
take care when using these other methods for reasons discussed below.
257
Wind River Linux
User's Guide, 5.0.1
CAUTION: This caution applies if you are not using the preferred method (Adding an Application
to a Root File System with fs_final*.sh Scripts on page 141) of modifying these files.
Individual package configurations, file system owners and groups, and other items may be
affected if the numeric IDs do not match the password and group files as originally installed.
Modifying or removing password or group file entries may cause adverse behavior to occur
within the system.
It is important to look at the file system installation logs, as RPM automatically sets the user
and group ID to root for files that have an owner or group ID that is not in the password or
group files. This can introduce a security flaw in specific cases, but will more likely cause an
application to not work as intended.
You should also be aware of the fact that some configuration files may have specific user ID or
group ID numbers defined in them. Changing these numbers in the password or group files
could then cause application behavior to be affected.
The following topics provide different options for customizing system password and group files:
Use this information as a guideline for editing password and group files using an fs_final.sh
script.
This method of modifying the password and group files is preferred because it preserves the
default password and group settings, along with any additions for individual packages that may
have occurred during file system generation. This is important because file owner and group ID
numbers are defined as individual files are created in the target file system.
Step 1 Create an fs_final.sh script in a layer that contains your desired modifications.
Once set up, the script will run each time the platform project is built using the make command.
258
25 Managing Target Platforms
Using an fs_final_sh Script to Overwrite the Password and Group File
projectDir/layers/local/recipes-local/myusermods/fs_final.sh
...
cat <<EOF > etc/passwd
custom passwd file contents
EOF
...
About ldconfig
ldconfig is a utility that indexes shared object names to simplify loading on shared object
libraries by executables.
It scans standard directories and those found in the ld.so.conf configuration file and stores its
index in ld.so.cache. Although not generally used on embedded systems, there are a couple of
circumstances where it may be useful as a work-around on Wind River Linux:
• In situations where an executable binary lacks an RPATH.
• When a library such as libfoo.so provides a shared object name (soname) of libbar.so, the
filesystem convention requires a symbolic link from libbar.so to libfoo.so. However, broken
applications, filesystems, or images can fail to create the link.
ldconfig is not enabled by default. See Enabling ldconfig Support on page 259 for installation
instructions.
The ldconfig utility may be required for executables to successfully load shared objects under
unusual circumstances.
ldconfig support is not enabled by default. In exceptional circumstances, it may be required for
executables to load properly.
Step 1 Run configure to create your project.
You will need to include the option --enable-ldconfig=yes in the project definition.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
259
Wind River Linux
User's Guide, 5.0.1
--enable-rootfs=glibc_small \
--with-template=feature/debug,feature/analysis \
--enable-ldconfig=yes
NOTE: If you are adding ldconfig support to an existing project, you must also specify the --
enable-reconfig option.
$ make
After rebuilding, ldconfig and an empty ld.so.conf file will be included in your project. The
USE_LDCONFIG environment variable is automatically enabled (set to USE_LDCONFIG=1). You
can disable ldconfig at any time by setting it to 0 in your project's local.conf file.
Connecting to a LAN
Use this procedure to connect your target platform to a local area network.
To perform the following procedure, you will need
• An IP address on your local network
• A platform built with the glibc_std file system
• Optionally, a resolv.conf file for name service
Step 1 Assign an IP address on your running target.
bash-3.2# ifconfig
bash-3.2# route
260
25 Managing Target Platforms
Adding an RPM Package to a Running Target
Your routing table should include the default gateway and, if you configured name service,
you should be able to access hosts by their hostname.
c) Test connectivity to an external network.
You must install packages with the correct architecture for your target when installing on the
running target.
--17:24:45--
http://dag.wieers.com/rpm/packages/dash/dash-0.5.4-1.el5.rf.i386.rpm
=> `dash-0.5.4-1.el5.rf.i386.rpm'
Resolving dag.wieers.com... 62.213.193.164
Connecting to dag.wieers.com|62.213.193.164|:80...
connected.
HTTP request sent, awaiting response... 302 Found
Location:
http://rpmforge.sw.be/redhat/el5/en/i386/rpmforge/RPMS/dash-0.5.4-1.el5.rf.i386.rpm
[following]
--17:24:46--
http://rpmforge.sw.be/redhat/el5/en/i386/rpmforge/RPMS/dash-0.5.4-1.el5.rf.i386.rpm
=> `dash-0.5.4-1.el5.rf.i386.rpm'
Resolving rpmforge.sw.be... 130.133.35.16
Connecting to rpmforge.sw.be|130.133.35.16|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85,914 (84K) [application/x-rpm]
100%[====================================>] 85,914
98.07K/s
261
Wind River Linux
User's Guide, 5.0.1
[85914/85914]
NOTE: If there are problems with the URL to access the RPM, you can also retrieve the RPM
with wget first, then install it using the following:
$ wget http://dag.wieers.com/rpm/packages/dash/dash-0.5.4-1.el5.rf.i386.rpm
rpm -ivh dash-0.5.4-1.el5.rf.i386.rpm dash-0.5.4-1.el5.rf.i386.rpm
Step 2 Use the rpm command to install the package on the running target.
dash-0.5.4-1.el5.rf.i386.rpm dash_0.5.5.1-2_i386.deb.1
bash-3.2# rpm -ivh dash-0.5.4-1.el5.rf.i386.rpm
warning: dash-0.5.4-1.el5.rf.i386.rpm: Header V3 DSA
signature: NOKEY, key ID 6b8d79e6
Preparing...
########################################### [100%]
1:dash
########################################### [100%]
bash-3.2#
Step 3 Verify that the installation of the dash shell was successful.
bash-3.2# dash
# exit
bash-3.2#
This topic illustrates the installation of the packages for the man command onto a running target,
then demonstrates the use of the installed man command
Reference manual pages can enhance the usability of your platform project image. Use the
following procedure to add the man command for manual page support.
Step 1 Configure the project.
Add the option --enable-doc-pages=target to the project
NOTE: The --enable-doc-pages configure option only applies to the glibc_std file system.
The option automatically adds the required man package to your platform project image.
262
25 Managing Target Platforms
Using Pseudo
$ make
$ make start-target
# ls /usr/share/man/man1/
# man man
man(1) man(1)
NAME
man - format and display the on-line manual pages
manpath - determine user's search path for man pages
SYNOPSIS
man [-acdfFhkKtwW] [--path] [-m system] [-p string] [-C config_file]
Using Pseudo
TBD
Concept definition.
Use this information as a guideline for examining files on the target file system using Pseudo.
To examine a file with its settings as they will appear on the target, you can supply the ls
command to pseudo using fakestart.sh. For example:
• $ scripts/fakestart.sh ls -l export/dist/bin/sh
The system responds with output similar to the following:
263
Wind River Linux
User's Guide, 5.0.1
Use this information as a guideline for viewing target file systems with Pseudo.
You can enter a pseudo shell to move around the target file system and view multiple settings.
Step 1 Start the pseudo shell.
$ scripts/fakestart.sh sh
Notice that the shell prompt changes to sh 4.2 to indicate you are using the pseudo shell.
sh 4.2# cd export/dist/bin
sh 4.2# ls -l s*
sh 4.2#exit
The exit command closes the pseudo shell and return to your normal shell.
264
26
Deploying Flash or Disk Target
Platforms
To create a single, bootable image from which to boot a target device, specify the enable-
bootimage option.
A bootimage option will construct bootable disk or DVD image with the selected file system type,
and if necessary multiple partitions, and place the image as single file in the export directory
of the project. When you create a single, bootable image from which to boot a target device, the
platform project configure options must include --enable-bootimage=bootimageType, where
bootimageType is one of ext3, iso, jffs2, ubifs, tar.gz or tar.bz2 (with tar.bz2 being the default).
265
Wind River Linux
User's Guide, 5.0.1
For information on creating USB boot images, see Creating Bootable USB Images on page 275.
For additional information on configuring ubifs boot images, see Creating ubifs Bootable Flash
Images on page 278.
The following is a sample configure command to create an ISO-enabled image:
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_std \
--enable-bootimage=iso
If you need to use additional bootable image options, you can use a comma to add and separate
them. For example:
--enable-bootimage=iso,jffs2
After the platform project is configured, use the make command to build the target platform
image and create a single image with which to boot a target device. The image is placed in the
projectDir/export directory.
About Configuring a Boot Disk with a USB/ISO Image (Two Build Directories)
To create a self-contained, host-installable image from a reference platform project, you must first
have a previously built platform project, or create one.
The following sections describe how to boot from a USB or ISO image so that you can configure a
disk that will be your boot disk.
To create a bootable USB directly from a platform project, see About Configuring and Building
Bootable Targets on page 265.
Preliminaries
The following example shows how to use Wind River Linux to configure a common PC to boot
Wind River Linux from hard disk. With this method you do not use the server installer and must
configure the hard drive manually.
(See Host-Based Installation of Wind River Linux Images on page 266 for using the installer to
automate this procedure).
You can boot and configure your target using either an ISO or USB image as described in this
section. The basic procedure is the following:
1. Configure and Build the Standalone Image
2. Prepare the Target's Hard Drive
3. Place the File System and Kernel on the Hard Disk
4. Configure the Target System Files and Boot
Wind River Linux provides options for creating a distribution for installing a platform project
image on a host (server) hard disk.
266
26 Deploying Flash or Disk Target Platforms
Host-Based Installation of Wind River Linux Images
These options allow for a flexible configuration in which you can create a standalone platform
project image or specify a different Wind River Linux platform project image to create your
installation disk from. Once complete, the installer lets you specify or accept default sizes for the
boot, swap, and root partitions.
Using the Wind River Linux build system, you can create an image to burn to a CD, DVD, or
USB device, and then use that image to boot up the target, format the local disk, and install the
runtime on the disk. At that point, you can remove the CD, DVD, or USB device and boot the
target directly from the local disk. You can also test your build using QEMU as shown in Booting
and Installing with QEMU on page 269.
There are two options, and three methods, to create a host-based installation:
• Self-contained in a single build directory.
In the self-contained installation, the build creates a /RPM directory in the root file system,
where it puts all the RPM packages that will be used to install the runtime on the target from
the same platform project configure options. This installation type requires a single build.
• Using two build directories with a reference platform project for the runtime to install on the
target, and one for the install image itself.
Use the --with-installer-target-build= configure script option to specify the location of a built
platform project's projectDir/export/images/*.ext3 root file system image file that will be
used to create an installable Wind River Linux distribution. So, you first build the project you
want to use as a basis to create the installer, specify the location of the project's *.ext3 file using
the --with-installer-target-build= configure option, and then perform another build to build
everything in your project directory.
This installation type uses one or two builds, depending on whether you have previously
configured a platform project image using the --enable-bootimage=iso or (ext3) and --enable-
target-installer=yes configure options.
NOTE: Wind River Linux only supports *.ext3 root file system files for the target installer
feature.
Use this option for a minimal installer that creates an installable image from an existing
platform project image.
The related options for the configure command are as follows:
--enable-bootimage=iso
--enable-target-installer=yes
--with-installer-target-build=otherprojectDir/export/images/*.ext3
Once the build is finished, you will find the ISO image in, for example, projectDir/export/
images/wrlinux-image-glibc-small-qemux86.iso. This is the file that contains the bootable
system image that you will to copy to a USB memory stick.
The --enable-bootimage=iso option builds an image that you can use to boot from CD, DVD, or
USB devices. With this image, you boot directly from a read-only root on the device. Whether you
specify iso or usb (or both) to the --enable-bootimage option, the result is a hybrid image that
supports booting from both ISO and USB.
267
Wind River Linux
User's Guide, 5.0.1
The difference between the build types is just a question of where those packages come from—
either the same build in which you create the bootable image, or from another build. If you do not
specify the --with-installer-target-build option, the build system will use the RPMs that are in
export/RPMS/ in your project directory for the installer image.
Use this procedure to place an installable image on a USB or ISO device and install it on a target.
In the following example, you will place the installer on a USB device such as a thumb drive, or
on an ISO device such as a CD-ROM, and then install on a target.
Step 1 Create a boot image of the desired type.
For information about creating boot images, see:
• Configuring and Building the Host Install (Self-Contained Option) on page 273
• Configuring and Building the Host Install (Two Build Directories Option) on page 274
Options Description
USB Insert the device and determine the USB device assigned to the drive.
268
26 Deploying Flash or Disk Target Platforms
Booting and Installing with QEMU
Options Description
Step 8 Follow the rest of the procedure as described in Installing a Bootable Image to a Disk on page 279.
Once you create an installable Wind River Linux disk image, you can test it using QEMU before
you burn it to disk or install it on a hardware device.
After building the file system and boot image, perform the following procedure to use QEMU to
create, install to, and then boot from a virtual disk.
Step 1 Create the virtual QEMU disk.
Use the qemu-img host tool to create and size the virtual disk.
$ cd projectDir
$ host-cross/usr/bin/qemu-img create -f qcow hd0.vdisk 5000M
Step 2 Boot the ISO image and install Wind River Linux.
a) Boot the .iso image you created in Configuring and Building the Host Install (Self-Contained
Option) on page 273.
In this case we will use the graphics console (option -gc) with QEMU. Omit this option if you
want to use the serial console.
$ make start-target \
TOPTS="-cd export/qemux86-64-glibc-small-standard-dist.iso -no-kernel -disk
hd0.vdisk -gc"
NOTE: The -gc options starts the QEMU session in graphics mode. Omit this option to perform a
serial-based, non-graphical installation.
Press CTRL+ALT at any time to exit from the boot window. You can click in the window to
return control to it.
You can exit the menus entirely by pressing the ESC key at the initial menu.
At the boot prompt (boot:) you can get help by pressing F1 (or CTRL+F1). The help information
documents the commands available at the prompt.
269
Wind River Linux
User's Guide, 5.0.1
When the boot loader starts, it presents a series of menus which you use to select a console
type, a boot device type, and a specific boot device.
b) Select Graphics console and press ENTER.
NOTE: If you did use the -gc option in step 2 on page 269, above, select Serial console, and
refer to the instructions at Installing a Bootable Image to a Disk on page 279. Once the hard disk
installation completes, go to step 3 on page 272, below.
270
26 Deploying Flash or Disk Target Platforms
Booting and Installing with QEMU
271
Wind River Linux
User's Guide, 5.0.1
Once you select the drive option, the installation will begin automatically. For instructions on the
installation itself, see Installing a Bootable Image to a Disk on page 279.
Do not enter the -gc option if you are using the serial console.
b) Press any key if you are prompted to do so, and then you see the grub bootloader menu.
272
26 Deploying Flash or Disk Target Platforms
Configuring and Building the Host Install (Self-Contained Option)
Step 4 Press ENTER to boot from the installed Wind River Linux.
Step 5 At the localhost login: prompt, enter root and press ENTER to continue.
To create a self-contained, host-installable image, you must first configure and build the platform
project.
Perform the following procedure to configure and build a single project that will furnish the boot
image and the packages for your target(s).
To test the installation, you can use QEMU to create, configure, and boot the installation from a
virtual disk as described in Booting and Installing with QEMU on page 269.
Step 1 Configure the bootable image of the server installation.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small \
--enable-bootimage=iso \
--enable-target-installer=yes
$ make fs
273
Wind River Linux
User's Guide, 5.0.1
When you build the file system after specifying the --enable-bootimage=iso configure option, it
creates a bootable iso image in the platform project's /export directory, named after the platform
project name, for example: projectDir/export/qemux86-64-glibc-small-standard-dist.iso. This
is the image you will use to boot and install Wind River Linux on a target system.
The resulting installer will contain the packages from and match the settings of this project's
configuration.
Once the build system creates your image, you will want to burn it to a disk. See Burning and
Installing the ISO or USB Image
Configuring and Building the Host Install (Two Build Directories Option)
To create a self-contained, host-installable image from an existing platform project, you can use
an existing platform project, or create one to specify the installable image's configuration and
packages.
The two build directories option requires two builds to create the image:
• One platform project to provide the packages you want to install on your target systems. If
you already have an existing reference platform project to use, you can go to step 3 on page
274, and specify the path to your existing platform project directory using the --with-
installer-target-build configure script option. If not, you will need to create one.
• One project that will furnish the boot image for your targets
Step 1 Configure and build a platform project.
The packages assembled in this project are the ones you will install on your target(s).
For example:
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-bootimage=iso \
--enable-rootfs=glibc_std
$ make
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small
--enable-bootimage=iso \
--enable-target-installer=yes \
274
26 Deploying Flash or Disk Target Platforms
Creating Bootable USB Images
--with-installer-target-build=otherprojectDir/export/images/wrlinux-image-glibc-small-
qemux86-64-2013807210107.rootfs.ext3
In this example, you must provide the actual file name of the *.ext3 file above. This name differs
depending on your BSP and root file system configure script options, and the date the image was
built.
NOTE: If you do not specify a project directory with the --with-installer-target-build option, the
project itself will be used to create the target file system.
$ make
The result is a bootable image in the export subdirectory of your project build directory, for
example
projectDir/export/qemux86-64-glibc-small-standard-dist.iso
Wind River Linux provides make command options for creating bootable USB images.
The following procedure describes how to create a bootable USB image and launch it on a target
system. Wind River Linux provides three methods for creating bootable USB images to meet most
development needs.
See About Configuring and Building Bootable Targets on page 265 for concepts related to
deploying target images.
Step 1 Choose an option to create a bootable image.
275
Wind River Linux
User's Guide, 5.0.1
Options Description
Method 1: ISO The image you create with this option is called an ISO hybrid because
Hybrid Boot with you can burn it to a CDR, DVD, or USB flash for the purpose of booting
make fs an x86 system. The boot menu that displays on the target provides two
options: serial or graphics.
To use this option, you must configure a platform project image with
the --enable-bootimage=iso option. For example:
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-rootfs=glibc_small \
--enable-kernel=standard \
--enable-bootimage=iso
Method 2: Two- This option creates a bootable USB image from any existing platform
Partition USB Boot project image. The image includes two partitions:
with make usb-image
16 FAT
The first is a small 16 FAT file system for syslinux, the kernel, and a
static BusyBox initrd
ext2
The second is an ext2 file system to mount the root partition for the
operating system
This method has the following advantages over Method 1: ISO Hybrid:
• Does not require any specific configure options, so you can create a
USB file system from any x86-based platform project.
• Does not require extra packages on the target file system
• You may mount the file system as read/write to provide persistent
changes.
• You can later update the file system, instead of entirely re-writing it
because you can simply mount it on your host.
• Works with older BIOS which do not support the ISO hybrid boot.
Additionally, it is not necessary to configure the kernel to support USB
flash devices, or the ext2 file system in order to use this feature, since
this is generally the default for all BSPs.
276
26 Deploying Flash or Disk Target Platforms
Creating Bootable USB Images
Options Description
Method 3: Two- This option works in the same manner as Method 2: Two-Partition USB
Partition USB Boot Boot, but saves you a step by writing the image directly to the USB
Directly to Disk with device. This method allows you to avoid reformatting the USB device if
make usb-image-burn you already have a partition layout you are happy with.
Step 2 In the platform project directory, enter one of the following commands to create the boot image:
Options Description
When you build the file system after specifying the --enable-
bootimage=iso configure option, it creates a bootable iso image in the
platform project's /export directory, named after the platform project
name, for example:
projectDir/export/qemux86-64-boot.iso
When you run this command, it creates a bootable image file in the
following location:
projectDir/export/usb.img
This option requires that you have inserted a USB device with no
mounted partitions. For an example output of this script, see make usb-
image-burn Example Output. Once you run this command, go to Step 5,
below.
With the Method 1 and 2 commands, you have the option of pressing ENTER at each prompt to
select the default. For Method 2, you may optionally choose to mount the file system read/write,
to provide persistent storage to the USB flash device.
The following example output displays make usb-image options once you run the command:
Step 3 Find the device name of your USB device and make sure it is unmounted. For this example we'll
assume it is /dev/sdc.
277
Wind River Linux
User's Guide, 5.0.1
Step 4 Run one of the following commands to write the image to the USB character device:
Options Description
NOTE: For the Method 3: Two-Partition USB Boot Directly to Disk option, once the command
finishes, the disk is written to automatically in the same manner as in this step for the other
options.
Step 5 Run the following command to unmount and eject the USB:
Step 6 Optionally launch the USB flash drive on a target. You can use the new USB flash device to boot a
hardware device. To test your new image using QEMU, enter one of the following commands:
• For Method 1:
$ make start-target \
TOPTS="-disk export/qemux86_64-boot.iso" \
TARGET_QEMU_KERNEL=""
• For Method 2:
$ make start-target \
TOPTS="-disk export/usb.img" \
TARGET_QEMU_KERNEL=""
When the QEMU session begins, you will be prompted to choose a console option. Select serial to
continue loading the image.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_std \
--enable-bootimage=ubifs \
--with-mkubifs-args="-m 2048 -e 129024 -c 1996"
In this configure example, the --with-mkubifs-args= option specifies the following ubifs
parameters:
-m
The minimum-I/O-unit-size.
-e
278
26 Deploying Flash or Disk Target Platforms
Enforcing Read-only Root Target File Systems
The logical-eraseblock-size.
-c
The maximum-logical-eraseblock-count.
Step 2 Build the target platform image and create a single image with which to boot a target device.
$ make
Postrequisites
See About Configuring and Building Bootable Targets on page 265 for concepts related to
deploying target images.
Learn how to build your target with a read-only root file system.
This feature causes the root filesystem to be mounted read-only with writable data (directories
under /var) located on a ram disk. It is designed to be used on glibc_small and glibc_standard
root file systems. Read only file systems are useful in situations in which you want the
environment to revert to a pristine state at each boot, such as a terminal or consumer electronics.
Read only root file systems can also be faster to boot since they don't need to be checked.
Packages added either by SATO or manually may need to be updated by hand to work with a
read-only root filesystem.
In the following example, we will create an ISO boot image.
Step 1 Configure the platform project to make the root file system read-only.
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_std \
--enable-bootimage=iso \
--with-template=feature/readonly-root
$ make fs
Postrequisites
Depending on the type of image you create, additional steps are required. Refer to the
instructions for each and add --with-template=feature/readonly-root to the configure command
as illustrated above.
Once you create an installable Wind River Linux image using the --enable-target-installer=yes
configure option, use this procedure to install it.
279
Wind River Linux
User's Guide, 5.0.1
This procedure works to install either to a hard disk, or when using QEMU to test an installation
using a virtual disk, as described in Booting and Installing with QEMU on page 269.
This procedure assumes that you have previously created an installable .iso disk image as
described in Creating Bootable USB Images on page 275 or About Configuring a Boot Disk with a
USB/ISO Image (Two Build Directories) on page 266.
Step 1 Press ENTER, or modify the values to meet your specifications for the following.
Step 3 Remove the boot device (USB or ISO) from the server and reboot from the hard disk.
If you are using a virtual disk such as in the example described in Booting and Installing with
QEMU on page 269, just close the graphics window (or press CTRL-A, X if you are using the
serial console).
Add INHERIT_append = "kernel-grub" to your local.conf file to allow fallback boot options.
This procedure assumes that the boot partition is writable and has at least 5 MB of free space.
Complete the following steps to allow your current kernel to be preserved as a fall-back boot
option during updates.
Step 1 Download a new kernel image rpm file to the target.
280
26 Deploying Flash or Disk Target Platforms
Installing or Updating bzImage
# ls /boot/
grub vmlinuz
# cat /boot/grub/grub.cfg
menuentry "Linux" {
set root=(hd0,1)
linux /vmlinuz root=/dev/hdb2 rw console=tty0 quiet
# rpm -i kernel-image-3.10.11-yocto-standard-3.10.12+git0+285f93bf94_702040ac7c-
r0.qemux86_64.rpm
Installing the same rpm more than once with the --force option will result in multiple kernel
images in the boot directory and grub menu.
WARNING: Updating the bzImage file can adversely affect compatibility with the kernel-
module.
# ls /boot/ -al
# cat /boot/grub/grub.cfg
281
Wind River Linux
User's Guide, 5.0.1
set root=(hd0,1)
linux /bzImage-3.10.11-yocto-standard root=/dev/hdb2 rw console=tty0 quiet
}
menuentry "Linux" {
set root=(hd0,1)
linux /vmlinuz root=/dev/hdb2 rw console=tty0 quiet
}
Notice that both the new and original boot entries exist.
Update bzImage-3.10.11-yocto-standard-3.10.12+gitAUTOINC+285f93bf94_702040ac7c
282
27
Deploying initramfs System Images
Wind River Linux expands on the initramfs support found in the Yocto Project by providing the
ability to specify the contents of the image and also bundle the image with a kernel image.
With Wind River Linux, you have the option of creating a basic initramfs image, or an image that
is bundled with the kernel image. The idea behind using a bundled initramfs image is that a cpio
archive can be attached to the kernel image itself. At boot time, the kernel unpacks the archive
into a RAM-based disk, which is then mounted and used as the initial root filesystem. The
advantage of bundling (building) an image into the kernel is that the rootfs in already provided
in the archive, so you do not require one.
NOTE: Bundling the initramfs may cause boot issues if the image size becomes too large.
When you create an initramfs image, it is important to note that because the image does not
include a kernel, you cannot have packages that depend on the kernel in the image, otherwise it
will create a circular dependency when you run make to build the platform project image. The
circular dependency occurs because the kernel is waiting for the image and vice-versa. In this
case, the build output will display the following error message, in a loop:
283
Wind River Linux
User's Guide, 5.0.1
You can create a basic image, or one bundled with a kernel, depending on your development
needs.
Use the procedures in this section to create an initramfs platform project image. For information
on initramfs images in general, see: About initramfs System Images on page 283.
After the build is complete, your image will be available in the projectDir/export/images
directory. For example:
projectDir/export/images/wrlinux-image-initramfs-qemux86-64.cpio.gz
Step 1 Create a platform project directory and navigate to it.
For example:
$ mkdir qemux86-64-glibc-small-initramfs
$ cd qemux86-64-glibc-small-initramfs
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-rootfs=glibc_small \
--enable-kernel=standard \
--with-template=feature/initramfs
NOTE: It is important that you specify glibc_small as the root file system. Using glibc_core in
this example will cause boot failures.
Step 3 Build the file system and create the initramfs image(s).
$ make
This command can take some time to complete, depending on your host system configuration.
Once complete, your image(s) are available in the projectDir/export/images directory. These
images include the main initramfs image and a separate rootfs image. For example:
• wrlinux-image-initramfs-qemux86-64.cpio.gz
• wrlinux-image-initramfs-qemux86-64-20130219204726.rootfs.cpio.gz
Images bundled with a kernel include the kernel image with initramfs, and one without. For
example:
• bzImage-initramfs-x86-64.bin
• bzImage-x86-64.bin
284
27 Deploying initramfs System Images
Adding Packages to initramfs Images
Once you create an initramfs image, you may need to add packages to it to meet your specific
development requirements.
Use the procedures in this section to add packages to an initramfs image created using the
procedures in Creating initramfs Images on page 284. For information on initramfs images in
general, see: About initramfs System Images on page 283.
Step 1 Open the projectDir/layers/local/recipes-img/images/wrlinux-image-file-system.bb file in
an editor.
In this example, file-system represents the name of the rootfs used to configure the platform
project. If you configured your platform project using the instructions in Creating initramfs Images
on page 284, the file name would be
projectDir/layers/local/recipes-img/images/wrlinux-image-glibc-small.bb
When adding packages, it is important to keep track of the package's footprint, since adding
too many, or too large a package may make the initramfs image too large to function on your
hardware. Refer to your hardware manufacturer's documentation for memory footprint
limitations.
$ make
Once the project build completes, the initramfs images located in the projectDir/export/
images directory will include the new packages. For specific information the initramfs image
names, see Creating initramfs Images on page 284.
285
Wind River Linux
User's Guide, 5.0.1
286
28
Deploying KVM System Images
Learn about the requirements for deploying and networking a Linux guest system using the
kernel virtual machine (KVM)-enabled x86_64_kvm_guest BSP and virtio.
287
Wind River Linux
User's Guide, 5.0.1
288
28 Deploying KVM System Images
Create the Host and Guest Systems
Use the following procedure to create a KVM host and guest system for deployment.
The following procedure creates QEMU KVM host and guest target platforms ready for
deployment. Before you begin, if you want to test the network performance between the host and
guest, you will need to obtain the netperf 2.6.0 package from http://www.netperf.org.
Step 1 Configure a platform project image for the KVM host system.
Run the following configure command on the build host:
$ configDir/configure \
--enable-kernel=standard \
--enable-rootfs=glibc_std \
--enable-board=intel-xeon-core \
--with-template=feature/kvm
LICENSE_FLAGS_WHITELIST += "non-commercial"
$ make fs
The build process can take some time. Once it completes, your KVM host is ready for
deployment.
Step 6 Configure a platform project image for the KVM guest system.
$ configDir/configure \
--enable-kernel=standard \
--enable-rootfs=glibc_std \
--enable-board=x86-64-kvm-guest
289
Wind River Linux
User's Guide, 5.0.1
LICENSE_FLAGS_WHITELIST += "non-commercial"
$ make fs
The build process can take some time. Once it completes, your KVM host is ready for
deployment.
$ make usb-image
Accept the defaults to create the image, with the exception of the ext type. Choose ext 3 when
prompted.
Also, if you wish to make changes to the root file system on the guest, enter n (no) when
prompted to make the root file system readonly.
Step 10 Copy the KVM guest image to the root directory of the KVM host platform project.
For example, you would copy the guest projectDir/export/usb.img image file to the host
platform project's projectDir/export/dist directory.
You now should have a KVM host and KVM guest platform project image ready for deployment.
Once you have configured and built KVM host and guest images, use this procedure to deploy
them and set up networking.
To perform this procedure, you must have a previously built KVM host and guest platform
project image as described in Create the Host and Guest Systems on page 289.
Step 1 Boot the KVM host platform and log in as root.
This process differs, depending on your hardware target board setup. Refer to your board
manufacturer's procedures for additional information.
290
28 Deploying KVM System Images
Deploying a KVM Host and Guest
Step 4 Verify that the MacVTap driver is included in the KVM host kernel.
The expected result displays immediately after the command:
With the virtio device nodes set up and MacVTap configured, the KVM host is ready to boot the
KVM guest.
$ ssh root@qemu0
root@qemu0 #netserver
Step 10 Start netperf to display network throughput between the KVM host and guest.
Run the following command on the KVM guest:
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to host_ip port 0 AF_INET
291
Wind River Linux
User's Guide, 5.0.1
When the netperf command runs successfully, the very presence of bytes sent and received
indicates that the KVM host and guest are networked correctly.
292
PA R T V I I I
Testing
293
Wind River Linux
User's Guide, 5.0.1
294
29
Running Linux Standard Base
(LSB) Tests
Understand the requirements and preparation necessary to run the LSB tests on your hardware
target platform.
295
Wind River Linux
User's Guide, 5.0.1
There are some prerequisites for the test suites to be able to run as listed in the /opt/lsb-test/
manager/README file. If they are not met, an error message will display when you try to run
the test(s). If this occurs, you must resolve the problem(s) and run the tests again.
NOTE: Local storage is necessary, as running the LSB tests over a NFS-based root file system it is
not recommended.
NOTE: Running sshd on the standard port should not cause any conflicts.
Learn how to download and install LSB tests directly to a pre-built target
If your hardware target platform is already up and running, and you do not want to reconfigure
and build it to add the LSB tests with the lsbtesting feature template, you can download the tests
directly to your platform.
Step 1 Download and install tests.
Wind River recommends using the --with-template=feature/lsbtesting configure option over
downloading it directly. This option adds extra, required packages to the target platform image's
root file system, and configures other packages as necessary to enable LSB testing.
a) Download the tests.
Download the tests directly to your platform at http://ftp.linuxfoundation.org/pub/lsb/snapshots/
distribution-checker
b) Install for the architect of your test platform.
Run the included install.pl script as root.
296
29 Running Linux Standard Base (LSB) Tests
Disabling Grsecurity Kernel Configurations on CGL Kernels
root@target>~# /opt/lsb/test/manager/bin/dist-checker-start.pl
This starts an HTTP web server with a web interface where you can select and run the various
tests from.
Learn how to check if Grsecurity is enabled for your kernel, and disable it if necessary for LSB
testing
For target platforms with a standard kernel type, Grsecurity must be disabled for the LSB core
tests to run successfully.
Step 1 Start the Kernel Configuration tool.
NOTE: This step only applies to target platforms with a CGL-enabled kernel type.
Use the following procedure to run the LSB distribution tests on your hardware target platform.
Before you begin, make sure that your target system meets the requirements in About the LSB
Tests on page 295.
Step 1 Launch the hardware target platform from the host system.
root@target~# sh /usr/bin/LSB_Test.sh
297
Wind River Linux
User's Guide, 5.0.1
The script will begin downloading the required files, and will start the tests once complete.
Step 5 Select the tests you want to run and click Run Selected Tests.
The Execution page loads to provide details for each test as it is run. Required components are
downloaded to facilitate test completion. To see test results, select the Results link. You can toggle
between the Execution and Results page as much as you. This does interrupt the tests.
298
29 Running Linux Standard Base (LSB) Tests
Running LSB Application Tests
Should a failure occur in a given test, the LSB Distribution Tester provides summaries and logs to
help you troubleshoot the problem. In addition, a history of previous LSB tests can be retrieved,
as each test run is stored as a tar file on the target platform.
For additional information on the LSB tests, go to the Linux Foundation's website located at:
http://www.linuxfoundation.org/collaborate/workgroups/lsb.
In addition to the LSB distribution tests, you can use the LSB application tests to verify that an
application meets LSB requirements.
This procedure uses the Hello World application included with Wind River Linux to demonstrate
how to verify LSB application compliance. Before you begin, make sure that your target
system meets the requirements in About the LSB Tests on page 295. In addition, you must
download and install the LSB Application Checker that matches your architecture from the Linux
Foundation website at: http://ispras.linuxbase.org/index.php/Linux_App_Checker_Releases on the
target platform. You can use the installable or the local all-in-one version.
NOTE: For PPC 64-bit target platforms, the default userspace is 32-bit. As a result, the correct
architecture to download is ppc32.
Refer to the README file located in the main directory where the LSB Application Checker is
extracted or installed to. This file provides information on the prerequisites for running each test.
If these prerequisites are not met, the tests will most likely fail.
Step 1 Add the Hello World application to your target system's root file system.
For instructions, see the Wind River Linux Getting Started Guide: Creating and Deploying an
Application.
Where port_number is optional. The default port is 8889. If another application or process uses
the default, you may specify another port.
The script will locate your system's web browser and launch the interface.
299
Wind River Linux
User's Guide, 5.0.1
If the script cannot locate the system's web browser, you may start the browser manually and
specify the address http://localhost:8889. If you specified a different port to start the interface,
replace 8889 with that port number.
Optionally, you can connect the LSB Application Checker from any remote computer with
network connectivity to the target system. To do so, enter the URL to the target system in the
remote computer's web browser:
http://targetIP:8889
To enable this remote feature, modify the AcceptConnections option in the server configuration
file and restart the server. This configuration file is located in one of the following locations:
• /etc/opt/lsb/app-checker/app-checker-server.conf for the installable version running system-
wide
• ./config/app-checker-server.conf for the non-installable version
300
29 Running Linux Standard Base (LSB) Tests
Running LSB Application Tests
Step 6 Enter application-specific information for the application you want to test.
a) In the Name field, enter a name for your test report.
b) In the Components field, enter the file path to the application, for example: /usr/bin/hello
c) Click Select Application Components to specify the components associated with the
application. This includes:
• Individual files
• Whole directories
• Installed RPM packages (prepended with pkg)
• RPM and DEB package files
• TAR.GZ and TAR.BZ2 archives
The tool will unpack archive files, but only test the following file types: ELF executables
and shared libraries, Perl, Python, and Shell scripts.
301
Wind River Linux
User's Guide, 5.0.1
Navigate to the location of your application's components and select each component to add
it.
NOTE: The Hello World (hello) application is a standalone binary. As a result, there is nothing
additional to select.
d) Once component selection is complete, click Finish to add them to the Components field.
e) Optionally, select additional options.
Click Additional options to display the advanced test options where you can specify the LSB
version and enter comments about the test.
f) To save the test for future use, enter a name in the User Profile Management section of the
page and click Save.
Step 7 Once all test parameters are set, click Run the Test.
Once the test completes, the results will display on the Test Report page. Review your results,
and take appropriate action to correct any issues that arise. In addition, if your test does not
identify any compatibility issues, click the Apply for Certification link to be directed to the
Certification System.
302
PA R T I X
Optimization
303
Wind River Linux
User's Guide, 5.0.1
304
30
About Optimization
This section provides information on optimizing your platform project image to prepare it for product
deployment.
Reducing Footprint
Reducing the footprint of the platform image to fit on smaller memory footprint devices. See:
• About BusyBox on page 313
• About devshell on page 314
Analyzing Boot-time
Analyzing boot-time (system startup) and using the data to reduce it. See:
• Analyzing and Optimizing Boot Time on page 317
• About Reducing Early Boot Time on page 321
• Reducing Network Initialization Time with Sleep Statements on page 321
• Reducing Device Initialization Time on page 323
• Removing Unnecessary Device Initialization Times on page 323
305
Wind River Linux
User's Guide, 5.0.1
306
31
Analyzing and Optimizing Runtime
Footprint
Use the fetch-footprint.sh tool to gather information that can help you reduce the size of your
target image (footprint).
The fetch-footprint.sh tool is a bash script that recurses through a file system and captures
runtime information on file and directory access and modification times. It outputs results based
on the kind of information you request and the output format you desire, including output that
can be used by Workbench or other tools.
You can build your runtime from Workbench or the command line. But note that if you want to
use the output to analyze your platform project in Workbench, you must view the output from
the project in which you created the runtime. If you build the project from the command line and
want to view fetch-footprint.sh XML output in Workbench to analyze that project, you must
import the project into Workbench. Note that fetch-footprint.sh is designed to ignore the /proc/
and /sys/ directories.
The fetch-footprint.sh script recognizes touched files based on the clock minute and second. If
you are using an NFS file system or a QEMU session, you may notice that the target and its file
system may be slightly out-of-sync with system time. If the time difference is small, you may be
missing the most immediately changed files, and if the difference is radical, then you may not get
any samples at all. If this occurs, obtaining an accurate time difference between the host and the
target system, plus extending your sample session, will help you adjust timestamps accordingly.
307
Wind River Linux
User's Guide, 5.0.1
Learn how to configure a platform project to collect footprint data, and to optionally use
Workbench to analyze that data.
Collecting footprint data requires that you configure a platform project with the --with-
template=feature/footprint configure option, and run the fetch-footprint.sh script once the
project's file system is built. Optionally, you can create an XML footprint file for use with
Workbench, to view the results and manage your target platform accordingly.
Step 1 Configure and build a platform project with the footprint feature template.
a) Create a platform project directory and navigate to it if needed.
If you do not already have a platform project to check the footprint on, run the following
command on your development host to create a platform project directory and navigate to it
$ configDir/configure \
--enable-kernel=standard \
--enable-rootfs=glibc_std \
--enable-board=qemux86-64 \
--with-template=feature/footprint
NOTE: To configure an existing platform project, add the following configure options to your
existing platform project's configure command:
--enable-reconfig --with-template=feature/footprint
$ make fs
$ make start-qemu
root@qemu0:~# cd /
root@qemu0:~# /opt/windriver/footprint/fetch-footprint.sh
308
31 Analyzing and Optimizing Runtime Footprint
Collecting Platform Project Footprint Data
Options:
[Mandatory - use one]
-a Display all files
-b Select files accessed/modified/changed since last boot time
-f Display files that have future timestamps
[Optional]
-s Print disk usage statistics
-d Include directories also
-S Start date should follow this option <yyyy.mm.dd-HH:MM:SS>
-E End date should follow this option <yyyy.mm.dd-HH:MM:SS>
Note: Start Date can not be greater than the end date
Format:
[Optional]
-I Prints files in a format that fetch_host_footprint understands [Execute
from the target's /]
-R Displays accessed, modified & changed timestamps
-X Displays the data in an XML format
-T Run in Busybox mode [Display all timestamps in seconds from Epoch]
Usage Scenarios:
Display timestamps of files ONLY `fetch-footprint.sh -a`
NOTE: When you run the script, you my see more files than you expect in the output—for
example, running daemons may touch files which will then appear in command output.
Step 5 Create an XML file for Workbench to use to help you view and managed touched files.
This step is optional.
a) Create XML output.
To produce XML output, use the -X option. To produce output on files touched since boot
time, use the -b argument. For example, the following command creates a XML file named
touchfile.xml that includes all files touched since boot time:
Once created, you can use Workbench to view the touchfile.xml file and list of all files
"touched" while the target boots. Use this information to determine which files are not being
used on the target.
b) Copy the output to your development host where you built the runtime.
Alternately, when using the NFS mounted file system, (which is the default for
simulators), the file will be found locally, in the NFS root, typically: projectDir/export/dist/
touchfile.xml
309
Wind River Linux
User's Guide, 5.0.1
c) Launch Workbench.
If you created the platform project using Workbench, go to the next step. If you created the
platform project from the command line, you must import it to Workbench.
To import the platform project, right-click in the Project Explorer view and select File > Import
> Wind River Linux > Existing Wind River Linux Platform Project into Workspace and click
Next.
Select the directory for the platform project (where you created the footprint's XML file) and
click OK.
d) Expand the platform project in Project Explorer and double-click on User Space
Configuration.
If prompted, click OK to rebuild the package database.
e) Import the XML file.
In the Filesystem tab, right-click and select Import the Touch Footprint. Browse to the XML
file you copied to your development host in step 5.b on page 309 and click OK.
you might perform), now have a hand icon decorator indicating that they were accessed.
The remaining files in the system may be removed to reduce the footprint of your file system.
For example, in the lib directory, you might decide after viewing the touch, like the one below,
that you will need libc-2.15.so, but not libBrokenLocale-2.15.so. Right click the file you wish
to remove, and select Remove.
310
31 Analyzing and Optimizing Runtime Footprint
Footprint (fetch-footprint.sh) Command Option Reference
Perform this action for any and all files you wish to remove, to help reduce your platform
project's footprint.
Use this command reference to learn about the available options for running fetch-footprint.sh to
obtain platform project footprint data. Run the script without any options to view online help.
Mandatory Options- Use only one mandatory option when you run the command
Optional Command Options - Not required to run the command, these options let you specify
report information and output
-d Include directories
311
Wind River Linux
User's Guide, 5.0.1
312
32
Reducing the Footprint
About BusyBox
You can use BusyBox to reduce the footprint of your platform project image.
BusyBox merges tiny versions of standard Linux utilities into a single small executable. These
utilities include a shell, compression utilities, a DHCP server, login utilities, archiving utilities
like tar and rpm, core utilities like cat, df and ls, networking utilities like ping and tftp, system
administration utilities like mount and more, and process utilities like free, ps, and kill.
These utilities have reduced functionality compared to their standard Linux counterparts, but
they also have a much smaller footprint, and merging them into a single executable results in a
smaller footprint still.
313
Wind River Linux
User's Guide, 5.0.1
About devshell
The devshell is a terminal shell that runs in the same context as the BitBake task engine.
You can run devshell directly, or it may spawn automatically, depending on your development
activity. The devshell is automatically included when you configure and build a platform project.
For additional information on using devshell, see: The Yocto Project Reference Manual: Development
Within a Development Shell.
Static linking can improve the performance and portability of your code by including all library
files required by a package or application into a single executable module.
314
32 Reducing the Footprint
About the Library Optimization Option
Library references are more efficient because the library procedures are statically linked to the
program, instead of dynamically linked to library or libraries located elsewhere within the
system. Unlike dynamic linking, the overhead required to manage links from applications and
packages to their library sources and any network-related issues is not required.
Because the library files are no longer shared by other applications or packages, using static
linking can increase file size and project footprint, but offers significant gains by simplifying
development and deployment. If your project uses a few core applications, then static linking can
save resources and simplify development and portability.
See http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#including-static-library-files
for details on enabling static linking with your platform project image.
Use this feature to optimize Glibc and libm by removing library functions not required by the
applications installed into the run-time file system.
Library optimization works only with glibc_small file systems. Library optimization also rebuilds
libraries to relink them with only the object files necessary for chosen applications.
You enable library optimization with the enable-scalable=mklibs option in the platform project
configure command. See Configure Options Reference on page 66.
Like static linking (see About Static Linking on page 314), library optimization offers the
greatest savings in run-time file system size when very few applications are included. Although
library optimization may not offer as great initial savings in size as static linking, the savings
should not tail off quite so rapidly as more applications are added. As with static linking, the
savings realized will depend on the run-time file system.
315
Wind River Linux
User's Guide, 5.0.1
316
33
Analyzing and Optimizing Boot
Time
Understanding the factors that impact your platform project image's boot process can help you
make decisions to improve and optimize it.
There are two distinct phases of system boot time:
Early boot time
The time from when the kernel is launched to the time the init process (usually /sbin/init) is
launched
Late boot time
The time from when the init process is launched until the last start-up script is executed.
For Wind River Linux 5, this manual focuses on early boot time analysis and optimization.
The bootlogger script collects data on both of these phases of boot time. The script uses the Linux
kernel’s ftrace feature to capture profiling data from the Wind River Linux boot sequence.
The bootlogger script overrides the regular /sbin/init as the first process and copies the early
boot time data in /debug/tracing/trace to /home/root/kernel-init.log and then configures ftrace
to trace init processes. When the final init process is executed (/etc/rcS.d/S999stop-bootlogger),
bootlogger copies the late boot time data to /var/log/post-kernel-init.log. The names and
locations of these files are configurable in the /export/dist/sbin/bootlogger/bootlogger.conf
file of the target (projectDir/export/dist/sbin/bootlogger/bootlogger.conf). As a final step,
bootlogger launches the regular init process.
317
Wind River Linux
User's Guide, 5.0.1
NOTE: The bootlogger script is designed to be used in development and is not intended to be
deployed in production systems.
Before you can collect boot-time data with bootlogger, you must configure a platform project to
include the feature.
To collect boot time data with bootlogger, do the following:
Step 1 Configure and build your platform project for boot logging.
a) Create a project directory and navigate to it.
b) Run the configure command.
To configure your platform project for boot logging, specify the feature/boottime template, for
example
$ configDir/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_small \
--enable-jobs=4 \
--enable-parallel-pkgbuilds=4 \
--with-template=feature/boottime
$ make
When you build your project, you will have an /sbin/bootlogger script, an /etc/
bootlogger.conf configuration file, and a stop-bootlogger script configured as the last init
script to run.
$ make config-target
....
53: TARGET0_QEMU_KERNEL=bzImage
54: TARGET0_QEMU_CPU=
55: TARGET0_QEMU_INITRD=
56: TARGET0_VIRT_DISK=
57: TARGET0_VIRT_DISK_UNIT=
58: TARGET0_VIRT_CDROM=
59: TARGET0_VIRT_ROOT_MOUNT=rw
60: TARGET0_QEMU_BOOT_DEVICE=
61: TARGET0_QEMU_KERNEL_OPTS=clock=pit oprofile.timer=1
62: TARGET0_VIRT_UMA_START=yes
63: TARGET0_QEMU_OPTS=
64: TARGET0_VIRT_EXT_WINDOW=no
65: TARGET0_VIRT_EXT_CON_CMD=xterm -T Virtual-WRLinux -e
66: TARGET0_VIRT_CONSOLE_SLEEP=5
318
33 Analyzing and Optimizing Boot Time
Analyzing Early Boot Time
67: TARGET0_QEMU_HOSTNAME=
68: TARGET0_VIRT_DEBUG_WAIT=no
69: TARGET0_VIRT_DEBUG_TIMEOUT_DEFAULT=40
Enter number to change (q quit)(s save): 61
$ host-cross/usr/bin/analyze-boottime -c -s -i \
export/dist/home/root/kernel-init.log
319
Wind River Linux
User's Guide, 5.0.1
NOTE: If you are using QEMU and run analyze-boottime in your projectDir, you do not
have to enter the -i path_to/kernel-init.log portion of the command.
With analyze-boottime you can find which functions are taking most of the time:
Time Delta
This column provides the time each function takes. For example, in the output shown,
ip_auto_config takes the most time.
Context Switch
This column indicates where the kernel takes control of a function, performs its task, and
returns control to the function.
Function Name
This column provides the name of the kernel function. Totals are summarized at the bottom.
The example shown is for a QEMU boot.
Refer to the following sections for information on optimizing your project based on the two most
time-consuming aspects of the example output:
• ip_auto_config—see Reducing Network Initialization Time with Sleep Statements on page 321
• pty_init—see Reducing Device Initialization Time on page 323
$ host-cross/usr/bin/analyze-boottime -g early_bootgraph.png
NOTE: The analyze-boottime command uses gnuplot, which requires the GDFONTPATH and
GNUPLOT_DEFAULT_GDFONT environment variables to be set appropriately.
Step 5 Optionally set the environment variables for gnuplot for bash shell users.
320
33 Analyzing and Optimizing Boot Time
About Reducing Early Boot Time
Run the following commands in the projectDir, or add them to your .bashrc file:
$ export GDFONTPATH=/usr/share/fonts/liberation
$ export GNUPLOT_DEFAULT_GDFONT=LiberationSans-Regular
Once you've analyzed your platform project image's boot-time, the next step is to reduce it.
The process of reducing early boot time is an iterative one. It includes identifying where time can
be reduced on a kernel function, making modifications, examining the results, and then repeating
the process for some new function.
Where you can reclaim time from particular functions depends on the requirements of your
particular end-system. For an example, the instructions here refer to analyzing a single user
system with known hardware and a fixed IP address. The results for a multi-user system with
more complex networking requirements will be different, and also pose different challenges to
overcome.
Reducing early boot time is accomplished by analyzing and optimizing the following aspects:
• Reducing network initialization time
In the example output from Analyzing Early Boot Time on page 319, it shows that the largest
single amount of time was spent in the ip_auto_config( ) function. One way to reduce this
time is to assign a static IP address to the device so that it does not spend time in DHCP
negotiation.
You can assign a static IP address in QEMU with make config-target and setting the
TARGET_VIRT_IP setting to, for example, 10.0.2.15.
With known hardware that does not require time to stabilize, it is possible to remove sleeps
from the startup time. To do so, remove sleep statements in build/linux-windriver-3.4-r0/
linux/net/ipv4/ipconfig.c. See Reducing Network Initialization Time with Sleep Statements on page
321.
• Reducing device initialization time
• Removing unnecessary device initialization times
Once you have analyzed your boot-time, you can improve network boot time using the
information in this section.
The steps in this section require the following prerequisites:
• A platform project image has been configured and built with the feature/boottime template—
see Creating a Project to Collect Boot Time Data on page 318
• You have run the analyze-boottime command to establish a baseline for how long your
network initialization (ip_auto_config) is taking—see Analyzing Early Boot Time on page
319.
Once you have established a baseline, perform the following steps to set a fixed IP address for
your QEMU session to help reduce network initialization time:
321
Wind River Linux
User's Guide, 5.0.1
msleep(CONF_PRE_OPEN);
...
ssleep(1);
...
ssleep(CONF_POST_OPEN);
//msleep(CONF_PRE_OPEN);
...
//ssleep(1);
...
//ssleep(CONF_POST_OPEN);
Step 4 Reboot.
Step 5 Analyze the new boot logs as you did the first time in Analyzing Early Boot Time on page 319.
For example, look at the difference between the first QEMU early boot, and the second which
used a fixed IP address and with sleep states removed:
$ host-cross/usr/bin/analyze-boottime -c -s \
-i /tmp/initial/kernel-init.log |tail
0.223721 acpi_pci_root_init
0.266659 * acpi_init
0.275421 * dm_init
0.292454 serial8250_pnp_init
1.384742 * pty_init
1.597498 * ip_auto_config
$ host-cross/usr/bin/analyze-boottime -c -s \
-i /tmp/w_fixedIP_no_sleeps/kernel-init.log |tail
0.093698 slab_sysfs_init
0.108006 * ip_auto_config
0.120562 * e100_init_module
0.142908 * acpi_init
0.151690 * dm_init
0.397953 pty_init
Note the significant improvement in total boot time, as well as the fact that ip_auto_config is now
not taking the most time. Time to look at the next function that takes the most time, pty_init.
322
33 Analyzing and Optimizing Boot Time
Reducing Device Initialization Time
Once you have analyzed your boot-time, you can improve device-related initialization times
using the information in this section.
The steps in this section require the following prerequisites:
• A platform project image has been configured and built with the feature/boottime template—
see Creating a Project to Collect Boot Time Data on page 318.
• You have run analyze-boottime command to obtain metrics on your device initialization time
—see Analyzing Early Boot Time on page 319
In the following procedure, we are going to help you reduce the pty_init time. This initialization
includes busywaits, locks and mutexes for PTY initialization that can be greatly reduced in this
single-user system.
In this example, you will learn to modify a kernel option as follows:
Step 1 Change the value of the kernel config option to 5.
Use the Workbench Kernel Configuration tool, a command-line tool such as make -C build
linux-windriver.menuconfig, or edit build/linux-windriver-3.4-r0/linux-qemux86-64-
standard-build/.config directly and change the value of the kernel config option
CONFIG_LEGACY_PTY_COUNT from 256 to 5.
Step 4 Analyze the new boot logs as you did the first time in Analyzing Early Boot Time on page 319.
For example, here is a difference between the pty_init time for two QEMU early boots with the
CONFIG_LEGACY_PTY_COUNT set from 256 to 5:
$ host-cross/usr/bin/analyze-boottime -c -i \
/tmp/w_fixedIP_no_sleeps/kernel-init.log|grep pty_init
0.397953 pty_init
$ host-cross/usr/bin/analyze-boottime -c -i \
/tmp/w_pty_5/kernel-init.log|grep pty_init
0.018961 pty_init
To optimize your platform project image on an embedded device with known hardware, you
may want to remove device initializations for devices that you do not use.
In this example, you remove ATA, MD, and USB device initialization as follows:
Step 1 Edit quirks.c.
Edit build/linux-windriver-3.4-r0/linux/drivers/pci/quirks.c and comment out the following two
lines:
323
Wind River Linux
User's Guide, 5.0.1
Change:
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441,
quirk_passive_release);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441,
quirk_passive_release);
to:
//DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441,
quirk_passive_release);
//DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441,
quirk_passive_release);
TARGET0_QEMU_DEBUG_PORT=0
TARGET0_QEMU_KERNEL_OPTS="initcall_debug ftrace=initcall \
init=/sbin/bootlogger quiet acpi=off lpj=11501568"
The additional arguments keep all messages from being displayed (quiet), turn off the
advanced configuration and power interface (acpi=off), and presetting the loops per jiffy value
(lpj=11501568) turns off the loops per jiffy calibration with each boot. If, of course, you want to
see the messages, use power management, or determine your loops per jiffy, only turn off the
features that you do not need.
Step 6 Analyze the new boot logs as you did the first time in Analyzing Early Boot Time on page 319.
For example, here is the difference in total boot time showing the improvement given by this last
set of optimizations versus the initial boot:
$ host-cross/usr/bin/analyze-boottime -c -i /tmp/initial/kernel-init.log \
|tail -3
Total : 325 Functions
Boottime: 13.434060 sec
$ host-cross/usr/bin/analyze-boottime -c -i /tmp/lessdevs/kernel-init.log \
| tail -3
Total : 301 Functions
Boottime: 2.751994 sec
324
33 Analyzing and Optimizing Boot Time
About Reducing Early Boot Time
Note the reduction in total time as well as total number of kernel functions.
325
Wind River Linux
User's Guide, 5.0.1
326
PA R T X
Target-based Networking
327
Wind River Linux
User's Guide, 5.0.1
328
34
About Target-based Networking
When you deploy Wind River Linux on a networked board, the boot loader on the board can get a kernel
and file system from the network, providing you have a properly configured boot loader and network
server setup.
For this to work properly, you must configure your network server(s) to supply the kernel and file system
to your board through its network connection. The steps throughout this section assume that you have
previously built a file system and have either built a kernel or are using the default kernel provided when
you built your platform project.
NOTE: Boot loader and network configuration are somewhat different for boards that use the
PXE boot protocol. Refer to About Configuring PXE on page 334 for details on network booting
with PXE.
329
Wind River Linux
User's Guide, 5.0.1
The following image depicts these servers in an networked, embedded development environment. Note
that the DHCP, TFTP, and NFS servers that you must configure may physically reside on one machine, or
may be on different machines depending on your network environment.
NOTE: You will typically need root (superuser) privileges when configuring network services.
330
35
Setting Target and Server Host
Names
You may want to map your target and server IP addresses to host names for ease of reference.
Context for the current task
Step 1 Configure /etc/hosts file of your server to include both the host name and IP address of the target
and the server
$ make
331
Wind River Linux
User's Guide, 5.0.1
332
36
Connecting a Board
port serial0_38400
type direct
device /dev/ttyS0
speed 38400
hardflow false
system S0@38400
333
Wind River Linux
User's Guide, 5.0.1
port serial0_38400
time any
You can find instructions on the serial port device name and baud rate in the README for each
board.
# cu S0@38400
Configure a Workbench terminal emulator to connect to the board over a serial connection
This procedure provides access to the board so you can set boot loader parameters.
Step 1 Set the port.
Within the Workbench Terminal view, click the Settings icon. Set the port number.
You can configure the Pre-boot Execution Environment (PXE) boot loader on most x86 boards
with Wind River Linux board support packages (BSPs).
334
36 Connecting a Board
About Configuring PXE
To use PXE, you must copy the kernel and root file system to their download and export
directories.
The default TFTP download directory is /tftpboot. In the examples provided here, the NFS export
directory for the root file system is
/home/nfs/export
You may configure TFTP and NFS to use the same directory if you prefer.
335
Wind River Linux
User's Guide, 5.0.1
Configuring PXE
This procedure illustrates the procedure needed to configure the Pre-boot Execution
Environment (PXE) boot loader on most x86 boards with Wind River Linux board support
packages (BSPs)
The information referenced here describes a typical development example of bringing up a board
using PXE, TFTP, and NFS.
For DHCP and PXE boot, the following components are required:
• DHCP
• NFS
• TFTP
• The Syslinux package, which contains the PXELinux boot loader
• The TFTP and PXELinux packages must be installed.
Step 1 Copy the kernel and root file system to their download and export directories.
The default TFTP download directory is /tftpboot. In the examples provided here, the NFS export
directory for the root file system is
/home/nfs/export
You may configure TFTP and NFS to use the same directory if you prefer.
Step 2 Copy the PXELinux boot loader file /usr/lib/syslinux/pxelinux.0 to the TFTP download directory.
/tftpboot is the default TFTP download directory.
# mkdir /tftpboot/pxelinux.cfg
# touch /tftpboot/pxelinux.cfg/default
netboot
prompt 1
display
pxeboot.msg
timeout 300
label netboot
kernel bzImage
append ip=dhcp root=/dev/nfs nfsroot=/home/nfs/export
bzImage represents the kernel’s actual filename. It has been given the label netboot, which is
also the default kernel to load.
336
36 Connecting a Board
Configuring DHCP
Setting up the target requires that network boot using PXE is enabled. This is generally done
within the BIOS setup routine. Configure the boot parameters and sequence in your BIOS to
enable the PXE boot loader and to boot from it first (or only).
NOTE: You may be able to find PXE boot images on the Web, for example at http://www.rom-o-
matic.net/.
When your target boots you should see the target go through the following sequence:
1. broadcast MAC address and receive IP address
2. download PXE Boot Loader and configuration file
3. download bzImage
4. boot bzImage
5. get IP address again
6. mount NFS file system
NOTE: If you cannot get through the first two steps in this sequence, verify your dhcpd.conf file
settings. If you cannot download the bzImage file, verify that your TFTP server is enabled and
xinetd has been restarted. If your bzImage boots but cannot mount the file system, verify that
the NFS daemon (nfsd) is running and that the targets root file system exists in
/usr/nfs/export
Configuring DHCP
This procedure illustrates how to configure a DHCP server to provide your board with an IP
address at boot time.
On the DHCP/BOOTP server, you must configure the dhcpd.conf configuration file, and you
must create a dhcpd.leases file if one does not already exist, as described in this section.
The DHCP configuration file is /etc/dhcpd.conf. A sample file is presented below. It provides a
basic example of this file for a DHCP server called server1.lab.org. The IP address of the server is
192.168.10.1. The configuration file identifies server1.lab.org as the TFTP server and the target is
assigned a static IP addresses.
In this example the DHCP server is version 3.0.1 from the Internet Software Consortium’s (ISC).
Refer to the documentation for your DHCP server for specific configuration file settings.
Step 1 Edit the /etc/dhcpd.conf file.
It should look similar to the following:
authoritative;
ddns-update-style ad-hoc;
default-lease-time 21600;
max-lease-time 21600;
option routers 192.168.10.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.10.255;
option domain-name "lab.org"; # Substitute your domain name
option domain-name-servers 192.168.10.1; # substitute your DNS server address
337
Wind River Linux
User's Guide, 5.0.1
Notice that the static IP address of the target is within the subnet of the DHCP server, but outside
the range of the dynamic IPs.
a) Provide your board's MAC address as the value for hardware Ethernet.
b) Adjust values in the sample /etc/dhcpd.conf to match your environment.
Edits may include values for:
• domain-name
• domain-name-servers
• the board's host name and fixed-address
ls /var/lib/dhcp/dhcpd.leases
touch /var/lib/dhcp/dhcpd.leases
This topic describes the correct configuration changes to support DHCP for PXE
allow booting;
allow bootp;
host target.lab.org {
hardware ethernet 00:20:ED:6E:82:3D;
fixed-address 192.168.10.2;
next-server 192.168.10.1;
filename "pxelinux.0";
option root-path "192.168.10.1:/home/nfs/export";
338
36 Connecting a Board
Configuring DHCP for PXE
NOTE: Substitute the correct MAC address for the sample hardware Ethernet address provided.
authoritative;
ddns-update-style ad-hoc;
default-lease-time 21600;
max-lease-time 21600;
option routers 192.168.10.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.10.255;
option domain-name "lab.org";
option domain-name-servers 192.168.10.1;
allow booting;
allow bootp;
# Next section PXE boot static IPs for the target; an example MAC address
# (hardware ethernet address) is provided.
host target.lab.org {
hardware ethernet 00:20:ED:6E:82:3D; # Replace this address as appropriate
fixed-address 192.168.10.2;
next-server 192.168.10.1;
filename "pxelinux.0";
option root-path "192.168.10.1:/home/nfs/export";
}
In this example, dhcpd.conf has been configured to support BOOTP, and the PXE target is
configured with a static IP address and supplied the following:
fixed address
The address of the PXE server.
filename
Provides the file name of the PXE file in /tftpboot to download,pxelinux.0 in this case .
next-server
The address of the NFS server.
option root-path
Provides the path on the NFS server for the exported PXE files.
339
Wind River Linux
User's Guide, 5.0.1
Configuring NFS
This procedure explains how to configure NFS to provide a root file system for your board when
the target kernel boots.
Refer to your host documentation for details on installing and enabling NFS if it is not already
available.
You will need to have root permission and have created an export directory such as
/nfsroot/
Step 1 Make the root file system available for export.
Copy and uncompress the compressed run-time file system file to the NFS export directory.
For example, you could use the command line as root as follows:
$ su -
Password:
# mkdir /nfsroot
# cd /nfsroot
# tar -xjvpf projectDir/export/*dist.tar.bz2
/nfsroot 192.168.10.2/255.255.255.0(rw,sync,no_subtree_check,no_root_squash)
This makes /nfsroot available for mounting to the machine with network address 192.168.10.2
only.
# exportfs -ra
340
36 Connecting a Board
Configuring TFTP
Configuring TFTP
This procedure illustrates how to provide your board with a kernel at boot time by configuring a
TFTP server on your network. When the board boots, it downloads the kernel.
Context for the current task
Step 1 Make the kernel available for download.
The default TFTP download directory is typically /tftpboot. If a download directory for TFTP is
not already created, you must create it. Refer to your server documentation for the name of your
TFTP download directory and for instructions if you want to change the default.
For example, assuming a TFTP download directory of /tftpboot you could copy the kernel to the
TFTP download directory as follows:
# cd projectDir/export
# cp -L *uImage* /tftpboot/uImage
This copies the kernel from your export directory to the file with the shorter name (for
convenience) of uimage in the TFTP download directory. The -L option covers both a prebuilt
kernel and scenario a symlink to a kernel you have explicitly built.
341
Wind River Linux
User's Guide, 5.0.1
342
PA R T X I
Reference
343
Wind River Linux
User's Guide, 5.0.1
344
37
Additional Documentation and
Resources
Document Conventions
Use this information to understand the formatting used throughout Wind River Linux
documentation.
In this document, placeholders that you must substitute a value for are shown in italics. Literal
values are shown in bold.
For example, this document uses the placeholder installDir to refer to the location where
you have installed Wind River Linux. By convention, this is typically C:\WindRiver on Windows
hosts and /opt/WindRiver on Linux hosts.
The placeholder projectDir refers to the project directory in which much of your work takes
place. For example, if you maintain your project files in /home/user/workspace/qemux86-64
(qemux86-64_prj in Workbench), this manual uses projectDir to represent that file location.
Menu choices are shown in bold, for example File > New > Project means to select File, then
New, then Project.
Commands that you enter on a command line are also shown in bold and system output is
shown in typewriter text, for example:
$ pwd
/home/mary/Builds/qemux86-64_prj
$
345
Wind River Linux
User's Guide, 5.0.1
Long command lines that would normally wrap are shown using the backslash (\) followed by
ENTER, which produces a secondary prompt, at which you may continue typing. The secondary
prompts are not shown to make it easier to cut and paste from the examples.
In the following example you would enter everything literally except the $ prompt:
$ /opt/WindRiver/wrlinux-5/wrlinux/configure \
--enable-board=qemux86-64 \
--enable-kernel=standard \
--enable-rootfs=glibc_std
Understanding the full range of documentation available is invaluable to helping you find the
information you need to work effectively in Wind River Linux.
The following is a list of the documentation provided by Wind River that supports development
of Linux targets. Much of this documentation is available through the “start” menu of the
installation host, for example under Applications > Wind River > Documentationin the Gnome
desktop for Linux.
Product Installation and Licensing Guides
For information on installing Wind River Linux and other products from Wind River, refer
to the online product installation and licensing guides at http://www.windriver.com/licensing/
documents/
Wind River Linux User’s Guide (this document)
This guide describes Wind River Linux—how to configure it, and customize it for your
needs. It is primarily oriented toward command line usage, but it is also useful to Workbench
developers who want to understand some of the underlying design and implementation of the
build system. It provides both explanatory and procedural use case material.
Wind River Linux Getting Started
The Getting Started guide provides a few brief procedures that you can perform on the
command line or with Workbench. Its primary purpose is to orient you in the primary ways to
use Wind River Linux and point to the documentation areas that focus most on the way you
will be using the product.
Wind River Linux Migration Guide
This guide provides background information, instructions, and procedures for migrating
Wind River Linux 4.x projects to Wind River Linux 5.0.1.
Wind River Workbench User’s Guide
This guide describes how to use Workbench to develop projects, manage targets, and edit,
compile, and debug code.
Wind River Workbench by Example, Linux Version
This guide is for Linux-specific use of Workbench, and provides examples on how to
configure and build application, platform, and kernel module projects
Wind River Workbench Online Help
346
37 Additional Documentation and Resources
Additional Resources
Wind River Workbench provides context-sensitive help. To access the full help set, select Help
> Help Contents in Wind River Workbench. To see help information for a particular view or
dialog box, press the help key when in that view or dialog box. See Document Conventions on
page 345 for details on the help key.
Wind River Workbench User Interface Reference
This guide describes the Workbench user interface for all supported Wind River products.
Look here for specific information such as interface dialogs, fields and their uses.
Wind River Analysis Tools documentation
This is a set of documents that describe how to use the Wind River Analysis Tools that are
provided with Workbench. The tools include a memory use analyzer, an execution profiler,
and System Viewer, a logic analyzer for visualizing and troubleshooting complex embedded
software. The Wind River System Viewer API Reference is also included.
Wind River Workbench Host Shell User's Guide
The host shell is a host-resident shell provided with Workbench that provides a command line
interface for debugging targets.
Most of the documentation is available online as PDFs or HTML accessible through Wind
River Workbench online help. Links to the PDF files are available by selecting Wind River >
Documentation from your operating system start menu.
From a Workbench installation you can view the documentation in a Web browser locally (Help
> Help Contents) or by launching the help browser independently of Workbench with the
wrhelp.sh script as described in Wind River Workbench, By Example, Linux Version.
The documentation is also available below your installation directory (called installDir)
through the command line as follows:
• PDF Versions—To access the PDF, point your PDF reader to the *.pdf file, for example:
installDir/docs/extensions/eclipse/plugins/com.windriver.ide.doc.wr_linux_version/
wr_linux_users_guide/wr_linux_users_guide_5.pdf
• HTML Versions—To access the HTML, point your web browser to the index.html file, for
example:
installDir/docs/extensions/eclipse/plugins/com.windriver.ide.doc.wr_linux_version/
wr_linux_users_guide/html/index.html
Additional Resources
Online Support
Wind River Online Support provides updates and enhancements to packages as they become
available, which can be downloaded and added to Wind River Linux.
Tutorials designed to illustrate Wind River integration with Workbench, as well as sample
configuration files to simplify the target board boot process, are also available.
347
Wind River Linux
User's Guide, 5.0.1
Workbench Tutorials
Detailed Workbench tutorials are available in the Wind River Workbench User’s Guide and Wind
River Workbench by Example, Linux Version.
Use the links and information in this section to learn about Linux open source development.
The main source for information referenced throughout this section is the Linux Documentation
Project (http://tldp.org). As with all documentation, proprietary or otherwise, open source
documentation, while valuable, must always be scrutinized for relevance. It is sometimes written
specifically for a certain Linux distribution (which may not always be obvious), and sometimes
even for a specific version. It is often out-of-date. It is a good idea to compliment, where possible,
the provided resources with resources from vendors, mailing lists, and from the maintainers
themselves.
Linux Development
348
37 Additional Documentation and Resources
Open Source Documentation
Networking
Security
OpenSSH http://www.openssh.com
349
Wind River Linux
User's Guide, 5.0.1
External Documentation
Use external documentation to enhance your developer knowledge and capabilities. The
following table lists open source documentation related to the Yocto Project and Wind River
Linux:
350
38
Common make Command Target
Reference
This section provides a summary of common build arguments for the make command from the
command-line and with Workbench.
351
Wind River Linux
User's Guide, 5.0.1
352
38 Common make Command Target Reference
353
Wind River Linux
User's Guide, 5.0.1
Image Deployment
354
38 Common make Command Target Reference
Application Deveopment
355
Wind River Linux
User's Guide, 5.0.1
356
38 Common make Command Target Reference
357
Wind River Linux
User's Guide, 5.0.1
358
38 Common make Command Target Reference
Kernel Development
359
Wind River Linux
User's Guide, 5.0.1
PR Server Usage
360
39
Build Variables
The list and description of config.sh build variables shown in the following table is provided for
informational purposes only—you would not typically change config.sh files directly. These are
constructed and inherited during the configure process from the templates.
Note that many of the items are also copied into the config.properties file which is used to initialize
Workbench with it is project information, and a few of the fields are also copied into the toolchain
wrappers. Therefore, even if you modify config.sh, your modifications may not be carried forward to
other components using the fields.
Variable Description
The following items should be prefixed with the VARIANT name as specified in
AVAILABLE_CPU_VARIANTS. VARIANT is replaced with the specific variant, for example
VARIANT_TARGET_ARCH=powerpc becomes ppc_TARGET_ARCH=powerpc.
361
Wind River Linux
User's Guide, 5.0.1
Variable Description
a multilib. Equivalent of CFLAGS=... in the
environment or in a makefile.
VARIANT_TARGET_LIB_DIR The name of the library directory for the ABI - lib,
lib32, lib64.
BSP-Specific Variables
362
39 Build Variables
Variable Description
Endianess (-b/-l), erase block size (-e), and image
padding (-p) are commonly passed.
QEMU-related variables
Refer to the release notes for details on QEMU-supported targets. Enter make config-target in
projectDir for additional information.
TARGET_QEMU_BIN The QEMU host tool binary to use, if this BSP can
be simulated by QEMU.
363
Wind River Linux
User's Guide, 5.0.1
Variable Description
TARGET_QEMU_KERNEL_OPTS These are any extra options you might want to pass
to the kernel boot line to override the defaults.
Generic Optimizations
364
39 Build Variables
• TARGET_CPU_VARIANT
• TARGET_ARCH
• TARGET_OS
• TARGET_FUNDAMENTAL_CFLAGS
• TARGET_FUNDAMENTAL_ASFLAGS
• TARGET_FUNDAMENTAL_LDFLAGS
• TARGET_SYSROOT_DIR
• TARGET_LIB_DIR
• TARGET_USERSPACE_BITS
• TARGET_ENDIAN
• TARGET_RPM_TRANSACTION_COLOR
• TARGET_RPM_PREFER_COLOR COMPATIBLE_CPU_VARIANTS
• TARGET_ROOTFS—only specify in a ROOTFS template
• TARGET_COPT_LEVEL, TARGET_COMMON_COPT, TARGET_COMMON_CXXOPT - specify
either ROOTFS or board template, do not specify CPU or Multilib.
The best way to determine what to do in a custom template is use wrll-wrlinux as an example, with the
information provided here in order to create custom templates.
365
Wind River Linux
User's Guide, 5.0.1
366
40
Package Variable Listing
The tables in this section provide a list of the package variables in Wind River Linux.
The following variables are fixed, and identify specific information about the package:
Variable Description
367
Wind River Linux
User's Guide, 5.0.1
Variable Description
368
41
Lua Scripting in Spec Files
Lua is a scripting language with an interpreter built into rpm. This allows you to write %pre and %post
lua scripts to be run at pre- and post-installation.
The wrs library is included in the lua interpreter from Wind River. It consists of three functions:
• wrs.groupadd( )
• wrs.useradd( )
• wrs.chkconfig( )
The following provides an example of a post-install section that creates a group and user named named:
%wrs_post -p <lua>
wrs.groupadd('-g 25 named')
wrs.useradd('-c "Named" -u 25 -g named -s /sbin/nologin -r -d /var/named named')
Each function takes one argument, which is the string you would enter at the shell prompt if you were
running the Linux command of the same name.
Spec file macros are expanded within the string, so the following works as expected:
%wrs_pre -p <lua>
wrs.groupadd('-g %{uid} -r %{gname}')
wrs.useradd('-u %{uid} -r -s /sbin/nologin -d /var/lib/heartbeat/cores/hacluster -M -c
"heartbeat user" -g %{gname} %{uname}')
As can be seen from the file names, when the lua script executes, the “root” directory is the root of the
target file system.
The base, table, io, string, debug, loadlib, posix, rex, and rpm libraries are also built-in to the lua
interpreter. Their use, and general lua programming is not covered here. For more information on the Lua
scripting language, see http://www.lua.org.
369
Wind River Linux
User's Guide, 5.0.1
370
42
Kernel Audit Directory Contents
File Description
known.kcf List of Kconfig files for which the build system has
already information on whether to be classified as
hardware or not
371
Wind River Linux
User's Guide, 5.0.1
File Description
372