Академический Документы
Профессиональный Документы
Культура Документы
BY EXAMPLE
3.1
Linux 3 Version
Copyright 2009 Wind River Systems, Inc. All rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means without the prior written permission of Wind River Systems, Inc. Wind River, the Wind River logo, Tornado, and VxWorks are registered trademarks of Wind River Systems, Inc. Any third-party trademarks referenced are the property of their respective owners. For further information regarding Wind River trademarks, please see: http://www.windriver.com/company/terms/trademark.html This product may include software licensed to Wind River by third parties. Relevant notices (if any) are provided in your product installation at the following location: installDir/product_name/3rd_party_licensor_notice.pdf. Wind River may refer to third-party documentation by listing publications or providing links to third-party Web sites for informational purposes. Wind River accepts no responsibility for the information provided in such third-party documentation.
Corporate Headquarters Wind River Systems, Inc. 500 Wind River Way Alameda, CA 94501-1153 U.S.A. toll free (U.S.): (800) 545-WIND telephone: (510) 748-4100 facsimile: (510) 749-2010 For additional contact information, please visit the Wind River URL: http://www.windriver.com For information on how to contact Customer Support, please visit the following URL: http://www.windriver.com/support
Wind River Workbench By Example, 3.1 (Linux 3 Version) 18 Feb 09 Part #: DOC-16432-ND-00
Contents
PART I: INTRODUCTION
1 Overview ..............................................................................................
1.1 1.2 Introduction ............................................................................................................. How to Use this Guide .......................................................................................... 1.2.1 1.2.2 1.2.3 1.2.4 1.3 How is this Guide Organized? ............................................................... When is the Table of Contents Most Helpful? ..................................... What if You Just Know Your Major Role? ............................................ How Do You Set Up Your Development Environment? ....................
3
3 4 4 5 5 5 6 6 6 7 8 8 9 9 9 10
Introducing Wind River Workbench and Linux .............................................. 1.3.1 1.3.2 Cross Development Environment ......................................................... The Wind River Build System ................................................................ Layers ......................................................................................................... Standard Product Layers ......................................................................... Optional Content with Feature Templates ........................................... When to Use Layers or Templates ......................................................... Sysroots ...................................................................................................... 1.3.3 1.3.4 Accessing the Sample Projects ................................................................ Migrating Projects Forward ....................................................................
iii
1.4
Notes about Installing Workbench ..................................................................... 1.4.1 1.4.2 1.4.3 1.4.4 Installation and Licensing ....................................................................... Shared Installations .................................................................................. Building across NFS ................................................................................. Reporting Issues and Enhancements to Wind River ...........................
11 11 11 11 12 12 13 13
1.5
Finding Related Documentation ......................................................................... 1.5.1 1.5.2 Online Wind River Workbench for Linux Documentation ................ Other Online Wind River Workbench Documentation ......................
iv
Contents
3.4
Producing a File System and Kernel .................................................................. 3.4.1 3.4.2 3.4.3 Configuring Projects ................................................................................ Building the File System .......................................................................... Finding the File System and Default Kernel ........................................
27 27 28 28 28 29 29 29 30 30 31 32 32 32 33 33
3.5
Accessing the File System and Kernel on a Target .......................................... 3.5.1 3.5.2 3.5.3 Real and Simulated Targets .................................................................... Communicating with Targets ................................................................. Exploring File Systems on Targets .........................................................
3.6
Debugging and Analyzing on a Target .............................................................. 3.6.1 3.6.2 3.6.3 Debuggers ................................................................................................. Dynamic printf Statements ..................................................................... Analyzers and Profilers ...........................................................................
3.7
Productizing ............................................................................................................ 3.7.1 3.7.2 3.7.3 The Role of Your Application, Platform, or Kernel ............................. Working in a Team ................................................................................... Patching and Updating ...........................................................................
35
36 36 37 38 39 40 41
41 42 43
Creating Projects Using Workbench or the Command Line .......................... 5.2.1 5.2.2 Creating Platform Projects in General ................................................... Creating an ARM Versatile Target, for Example .................................. Example Data for You to Use .................................................................. Creating the By-Example Platform Project ........................................... 5.2.3 Verifying Your Project Build ...................................................................
5.3
Building a Target File System .............................................................................. 5.3.1 5.3.2 Verifying Your Build Directory ............................................................... Building the Example ARM Versatile File System ..............................
5.4 5.5
Introducing the User Space Configuration Node ............................................ Exploring the Target File System ......................................................................... 5.5.1 5.5.2 5.5.3 5.5.4 5.5.5 Examining File Meta Properties ............................................................. Adding Files and Directories to Your File System ............................... Removing Files According to Pattern Filters ....................................... Viewing Parent Packages and Removing Packages ............................ Adding a Device .......................................................................................
vi
Contents
5.6
Using the Package Manager for RPMs ............................................................... 5.6.1 5.6.2 5.6.3 5.6.4 5.6.5 5.6.6 5.6.7 Introducing the Package Controls ......................................................... Viewing and Editing the pkglist File ..................................................... Installing Packages ................................................................................... Using Force Install .................................................................................... Installing Multi-lib Packages .................................................................. Importing Packages ................................................................................. Building Packages .................................................................................... Including Builds with Runtime Dependencies .................................... Turning Package Debugging On or Off ................................................ 5.6.8 Removing Packages .................................................................................
63 65 66 66 67 67 68 69 69 71 72 73 75 76 77 78 79 80 81 82
5.7 5.8
Creating a Project from a Package ....................................................................... Customizing Builds with Layers, Templates, and Profiles ............................ 5.8.1 Adding Templates .................................................................................... Adding Custom Templates ..................................................................... 5.8.2 Working with Layers ............................................................................... Adding Layers .......................................................................................... Reloading Changes ................................................................................... 5.8.3 5.8.4 Exporting Layers ...................................................................................... Specifying Profiles ....................................................................................
83
83 84 85 87 87 88
Prepopulating LKM Projects ................................................................................ Adding Kernel Modules to the Platform ........................................................... 6.4.1 Creating a Custom Kernel Module ........................................................
vii
6.4.2
89
Creating Applications in General .......................................................... 100 By Example: Building hello_world ........................................................ 100 By Example: Building Penguin .............................................................. 101 By Example: Importing Source Code for Penguin .............................. 103
Running Applications ........................................................................................... 106 8.3.1 8.3.2 By Example: Running hello_world, a Native Application ................. 106 Running Non-Native Mode Applications ............................................ 108
8.4
viii
Contents
10
Importing Source RPM Packages from the Web .............................................. 121 10.4.1 10.4.2 Updating the Package Spec File ............................................................. 121 Building New Packages ........................................................................... 122
10.5
ix
11.1.4 11.2
Patching and Exporting Patches to Layers ......................................................... 131 11.2.1 11.2.2 11.2.3 Patching and Exporting Classic Packages (General Steps) ................ 132 By Example: Patching and Exporting Classic Packages to a Layer .. 132 By Example: Patching and Exporting SRPM Source File to a Layer . 133
11.3
Using Quilt Basics .................................................................................................. 135 11.3.1 11.3.2 11.3.3 11.3.4 11.3.5 Configuring Quilt to Manage Patches ................................................... 135 Applying Patches ..................................................................................... 135 Importing Patches .................................................................................... 137 Creating a New Top Patch File ............................................................... 137 Viewing Patch Annotations .................................................................... 138
11.4
Patching SRPM Packages ...................................................................................... 139 11.4.1 11.4.2 Manually Patching SRPM Spec Files ..................................................... 139 Patching SRPM Source Files ................................................................... 140 Modifying SRPM Package Files ............................................................. Saving SRPM Patch Files ......................................................................... Adding the SRPM Patch .......................................................................... Saving the Updates as a Patch to the Spec File .................................... 11.4.3 11.4.4 141 141 142 143
Testing the Patches ................................................................................... 143 By Example: Viewing the SRPM Patch List .......................................... 144
11.5
Manually Patching Classic Source Files ............................................................ 144 11.5.1 11.5.2 11.5.3 11.5.4 Creating a New Top Patch File ............................................................... 144 Modifying Package Files ......................................................................... 145 Exporting a Patch ..................................................................................... 146 Testing a Patch .......................................................................................... 147
12
Contents
12.2
Working with Kernel Modules on the Target ................................................... 149 12.2.1 12.2.2 Installing Kernel Modules to the Target ............................................... 150 Removing Kernel Modules from the Target ......................................... 150
12.3
Working with RPMs on the Target ...................................................................... 151 12.3.1 12.3.2 12.3.3 Launching RPMs Straight to the Target ................................................ 151 Removing Running RPMs ...................................................................... 152 Replacing Running RPMs ....................................................................... 152
14
Connecting to Targets in General ........................................................................ 162 14.3.1 Defining a New Connection ................................................................... 162
xi
Connecting and Disconnecting .............................................................. 163 Modifying Connection Properties ......................................................... 164
Connecting to Emulated Targets .......................................................................... 164 Connecting with KGDB ........................................................................................ 167 14.5.1 Using Object Path Mapping .................................................................... 168 Pathname Prefix Mappings ..................................................................... 169 Basename Mappings ................................................................................ 169 14.5.2 Using Target State Refresh Page ............................................................. 169
Using Advanced KGDB Options ........................................................................ 170 Using Target Server Options ................................................................................ 171 Using the Connection Summary Page ................................................................ 172
Debugging Using GDB ......................................................................................... 178 Stepping Through Your Output .......................................................................... 178 Using Dynamic printf Breakpoint Statements ................................................. 180 Sending Signals to Processes ............................................................................... 181 15.6.1 15.6.2 Configuring a Signal ................................................................................ 181 Terminating a Process .............................................................................. 182
xii
Contents
16
Preparing the Target for KGDB ........................................................................... 190 16.3.1 16.3.2 Option 1: Using a UDP Connection on a Non-PCD Target ................ 190 Option 2: Using a UDP Connection on a PCD Product ...................... 191 Statically Configuring KGDBOE for PCD (uclibc_small+small) ...... 191 Dynamically Configuring KGDBOE for PCD (uclibc_small+small) 191 16.3.3 Option 3: Using a Serial/Telnet Connection ........................................ 192
16.4
Connecting with KGDB from Workbench ........................................................ 192 16.4.1 16.4.2 16.4.3 16.4.4 Option 1: Making an Ethernet Connection ........................................... 192 Option 2: Making a Telnet Connection ................................................. 194 Option 3: Making a Serial Cable Connection ....................................... 195 Troubleshooting a KGDB Connection .................................................. 195
16.5
Attaching and Debugging the Kernel from Workbench ................................ 196 16.5.1 16.5.2 16.5.3 If the Compilation Unit Source Is Not Found ...................................... 196 If the Targets Terminal Is Stopped ........................................................ 197 Setting and Removing a Sample Breakpoint ........................................ 197
16.6
Debugging User-Supplied Kernel Modules ..................................................... 198 16.6.1 16.6.2 16.6.3 Building the Sample User-Supplied Kernel Module .......................... 198 Debugging a Running User-Supplied Kernel Module ....................... 199 Stepping into User-Supplied Kernel Module init from module.c ..... 200
xiii
Placing Breakpoints in Modules Not Yet Loaded ................................ 202 Providing Object Path Mappings to All Modules ............................... 203 Using the testmod Enhanced Sample Kernel Module ........................ 204
Creating a Custom Kernel Module .................................................................... 205 Using QEMU for KGDB Kernel Debugging .................................................... 206 Enabling and Disabling KGDB in the Kernel ................................................. 209
17
xiv
Contents
18
20
xv
20.3
Providing Layers to Teams and External Customers ....................................... 238 20.3.1 20.3.2 20.3.3 Making a Layer Available ....................................................................... 238 Telling Recipients How to Import and Use the Layer ........................ 239 By Example: Importing File System Change Lists from Layers ........ 239
xvi
Contents
Setting the Environment with wrenv .................................................... 260 Setting the Environment with Workbench ........................................... 260 Executing Workbench Build Commands .............................................. 261 Executing Shell Commands in Workbench .......................................... 262
Setting the Environment Without Starting a Sub-shell .................................. 263 C.3.1 C.3.2 Exporting Environment Settings to the Current Shell ........................ 263 Extracting Environment Settings ........................................................... 264
xvii
xviii
PAR T I
Introduction
1 2 3 4 Overview ............................................................. 3
Getting Started with Workbench ....................... 15 Workbench Basics for Linux Developers ......... 23 Life Cycle Development ..................................... 35
1
Overview
1.1 Introduction 3 1.2 How to Use this Guide 4 1.3 Introducing Wind River Workbench and Linux 6 1.4 Notes about Installing Workbench 11 1.5 Finding Related Documentation 12
1.1 Introduction
Wind River Workbench is an integrated development environment (IDE) that lets you develop Linux target kernels and embedded applications. Workbench runs on Windows, Solaris, and Linux host operating systems, as detailed in the release notes.
Setup Using profiles, templates, layers, packages, and so on. Some of these are created by other people in your project. For example, someone else may develop layers and profiles that you use. Development Configuring, editing, and compiling within Workbench running on a host. Diagnosis Deploying to the target, debugging, and testing, involving both the target itself and the on-host Workbench. Optimization Using static analysis OProfile, mpatrol, and other tools such as the file system layout tool and views within Workbench to examine the footprints of your project. Delivery Providing kernels, platforms, layers, and so on for use by other project team members and/or your final customers.
If you know which areas within this life cycle apply to you, you can use the Table of Contents to locate what is relevant. Look especially for the Part divisions.
Wind River Linux projects in general Your programming environment, toolchain, and so on Producing a file system and kernel Accessing the file system and kernel on your target
Debugging and analyzing whats on the target Making a product out of what you have done
Source RPM compatible Installs and runs as a non-root user Provides complete integration with Workbench/Eclipse Enables efficient workflow and ecosystem using layers Allows a simplified board support package (BSP) model
Figure 1-1
Layers
Targets
Layers
Layers provide a framework for managing device software components independently. Layers are abstractions of the Wind River Linux installation; they can be as big as a new kernel version, or as small as a single, one-line patch. The layers framework provides modular functionality, which you can modify or add to. You can then place your your modifications and additions as one or more layers on top of the core installation, with each layer contributing specific content, all without changing the core installation itself.
Layers provide both required and optional content for a target project, which allow you to: 1. 2. 3. 4. 5. Select and optimize the content first at the package level Further optimize the content to develop runtime components Generate the intermediate binaries (for example, the collection of generated RPM files from which the file system is assembled) Trim and optimize those binaries (for example, stripping out debug information or adding pre-linking) Generate the kernel and file system for the target
Add new components or modules Change the behavior of components Share configurations among members Manage change from one release to the next (for example, when migrating to the next version of a project, or up-revving to the next kernel version)
The core layer contains templates, host tools, and target packages (distributions and RPMs). The kernel layer contains common kernel source and patches. The toolchain layer contains core toolchain executables and packages. The build layer lets you configure a build directory that is also a layer.
Feature templates allow a layer to contribute many feature sets from which developers can select to further customize and extend their projects. For example, you can choose specific board, root file system (rootfs), and kernel values to include the respective board, rootfs, and kernel templates.
You can also place content in optional template sub-directories, and configure your projects to add that content.
Layers and templates are optional configuration techniques you can use with Wind River Linux platform projects. You might, for example:
Use templates to cause relatively small changes at the end of the configuration process. Use layers to control larger configuration issues, such as reconfiguring and patching the kernel, modifying system files, and including one or more templates.
You plan to combine the work of different internal or external groups. You wish to share work with multiple projects or groups. You are making a step to a new kernel, release, or product version.
Sysroots
Sysroots can source one or more build specs for Workbench application projects. They provide the libraries, header files, and other files and directories that are essential to the infrastructure of these projects. They also provide the capability of cross building.
To make sure that you can access these examples, use the following steps.
1. 2. 3.
Open Workbench. Choose File > New > Example. Choose one of the following, as appropriate for what you want to develop. This guide uses the following examples in particular:
Wind River Linux Module Sample Project (version 1.4 or newer) > Next > An Example Kernel Module Demonstration Wind River Linux Application Sample > Next > The Client/Server Demonstration Program
4.
Click Finish.
Doing a build-all in the project to build a complete system from source. For small file systems (glibc_small or uclibc_small) that have been built in previous versions, using the templates features to migrate debugging and graphics capabilities. Specifying templates in the configure screen to specify debug and gdb templates. Using the new kernel profile templates to migrate kernels. (You still have to import kernel patches manually, to account for kernel changes.) Package makefiles that use package_RPM_DEFAULT, package_RPM_DEVEL, and package_RPM_ALL variables in place of the obsolete package_RPM_NAME. Sysroots that provide a portable application environment containing necessary library and header files as well as toolchain wrappers.
Wind River Linux Release Notes: Workbench Issues Wind River Linux Migration Guide: Wind River Workbench
10
11
Access Wind River Online Support Obtain person-to-person support Track your support requests, whether TSRs (technical support requests) or SPRs (software problem reports) Escalate problems Provide feedback
Wind River Workbench Users Guide A guide to using the Workbench GUI to do tasks that are common between Linux and VxWorks.
NOTE: The common guides introduction contains an extensive guide to documentation related to Wind River Workbench. The guide also contains a glossary. We assume that you are familiar with the contents, and that you have worked your way through enough of it so that you can continue here. Be sure to step through the ball example chapter.
Wind River Workbench Online Help Accessible from the Help menu, from platform-specific help keys, or by clicking the ? mark in dialog boxes. Wind River Workbench for Linux DocumentationSee the next sections.
12
Wind River Workbench Tutorial, Linux Version Developing user mode applications, configuring Wind River Linux, kernel mode debugging, and using the QEMU target emulator.
Help > Contents > Wind River Documentation > Guides > Host Tools
Wind River Workbench by Example (Linux Version) (this document) This guide describes how to configure your Workbench host and a Wind River Linux target to debug applications and kernel objects on the target. It describes how to use Workbench to develop projects, manage targets, and edit, compile, and debug code. Wind River Linux Users Guide The Wind River Linux development environment, which encompasses Wind River Workbench and the Linux command-line environment, helps you develop Linux target kernels and embedded applications. Wind River development environments are available on a number of host platforms, and support a large number of targets.
Eclipse Workbench User Guide Sections on using Workbench, editing files, and using CVS in a team environment.
Help > Contents > Wind River Developer Network
Access to the Wind River web site for Workbench developers: http://www.windriver.com/developers/workbench, containing videos on
13
Workbench analysis tools, the Linux patch manager, System Viewer, diagnostics, customer education, white papers, blogs, and so on. See especially the white paper titled The Power of Wind River Linux Layers. (This site contains material appropriate for the current release as well as earlier releases.)
Help > Cheat Sheets
Step-by-step instructions in a Help window that you can follow in Workbenchs perspectives and views, to accomplish tasks related to C/C++ development; using CVS in a team environment; Wind River Linux build specs, sysroots, linked resources, imports, patching, and using the file system layout tool; as well as Wind River Workbench tools such as the code coverage analyzer, the data monitor, memory analyzer, and the performance profiler.
14
2
Getting Started with Workbench
2.1 Introduction 15 2.2 What Type of Developer Are You? 16 2.3 If You Develop Applications... 16 2.4 If You Import and Modify Source Packages... 18 2.5 If You Develop Middleware... 19 2.6 If You Develop or Provide Kernels... 20 2.7 If You Are a Platform Integrator... 21
2.1 Introduction
Where and how do you start using Workbench? This depends on what kind of development you do, whether its application development, middleware, platform integration, kernel modules, and so on. You can use this chapter as a springboard to jump into the appropriate sections of this guide. (For Workbench basics such as file systems, kernels, toolchains, programming environment, et cetera, see 3. Workbench Basics for Linux Developers.)
15
Application developers typically use Workbench-managed make and sample projects; they run and debug directly to the target; and they add their binaries to the platform project using file system layout tools. None of the example applications, such as mthread, client-server, and Penguin, is a package (see below): they are open applications, just source code in a tree that you build into one or more output files. Application developers can also include locally developed applications that have their own Makefiles. They typically bring these applications into Workbench as a user-defined project, which allows them to use Workbench facilities and features.
Package developers work with user space, divided into packages, typically including local applications with open source and non-local code. Examples of packages include tarballs, RPMs, SRPMs, and so on. Middleware developers work with plug-ins (for example, to develop Java code, or database queries, or PHP pages) and then make sure their products are in the targets file system and that they work on the target. Kernel developers do the kernel configuration, modules, and drivers. Platform developers put everything together, creating a platform from the user space packages and kernel configurations. Often, the kernel developer is also the platform developer.
You are writing primarily native applications, generally in C or C++ (maybe with some assembly).
16
You may develop applications from internal code bases. These applications may not be in a package form, and they may normally use your company's configuration management system. You are primarily interested in building applications that are your own. You normally do not work with RPMs or SRPMs, or open source. You use source control for your code. You dont need a file system or kernel until youre ready to test your software. You dont need to create rules for unpacking, or patching. If you use managed Workbench projects, you use the build commands that are in Workbench. If you have your own makefile, you bring it in as a user-defined project and then use Workbench to run your makefile for you. You have experience with traditional tools such as C/C++ debuggers and profilers.
See the following table for pointers to the parts of this users guide (or elsewhere) that may help you the most.
Table 2-1 Application Development Tasks, Tools, and Document Links
Tasks
Where Documented
Develop managed and sample projects Develop user-defined projects Edit, develop code Debug Analyze Add binaries to platform projects
8. If Youre an Application Build commands provided by Developer; Workbench Users Guide Workbench Creating User-Defined Using your own makefile; Projects, Workbench Users Guide telling Workbench how to build your source Workbench Users Guide 15. Debugging User Space; also, Workbench Users Guide Memory Analyzer and Performance Profiler guides 5.5.2 Adding Files and Directories to Your File System, p.61 Using file system layout tool Using GDB and/or the Workbench debugger
17
You work with user space, divided into packages. You are likely to import and/or modify open source packages, generally in tarball or SRPM form, and you likely have to modify them so they fully cross-compile. You may modify or update wrlinux-supplied packages, which are generally managed by the wrlinux patch system (for example, by using Quilt).
See the following table for pointers to the parts of this users guide (or elsewhere) that may help you the most.
Table 2-2 Package Development Tasks, Tools, and Document Links
Tasks
Where Documented
Import open source 10.4 Importing Source RPM packages Packages from the Web, p.121 Import local packages Develop, capture patches to layers Enhance, investigate, work with code and code-related tools 10.5 Importing Wind River Linux Packages, p.123 11. Patching Packages 12. Managing Packages on Live Targets
RPM archives with source Also see 10.3 Importing Classic Packages from the Installation, p.119 Also see 20. Delivering Layers For example, find whats wrong with open source, or MIPS vs. ARM, or 386 vs. 64-bit, or speed issues; if you touch open source packages, it means youre fixing someone elses code. Static analysis, moving into package, debugging/tracing; general fixing of open source; get object path mapping and source code path mappings so you can do breakpoints and do source code debugging
Debug
18
Table 2-2
Tasks
Where Documented
Analyze
Memory Analyzer and Performance Static Indexer analysis for Profiler guides relationship between structures and files, for RPMs 20. Delivering Layers Layering changes to existing apps lets you maintain pristine source while providing external, or local patches, or fixing broken package contents, while allowing you to keep and track such changes separately
Deploy as layer
You may typically work with plug-ins such as for Java development, or PHP, for which Workbench provides a robust and supportive environment. Youre not really into doing packages: youre developing Java code, or DB queries, or PHP pages (for example). You may bring in middleware components such as PHP, SQL, or X into your file systems so you can develop on top of them. You may bring in open source packages to develop your middleware content, plus. You likely work with the developers who import and modify source packages to make sure your middleware is on the target and is configured correctly for your requirements. You are likely very familiar with commercial and open source Eclipse plug-ins for your development tools and SDKs.
See the following table for pointers to the parts of this users guide (or elsewhere) that may help you the most.
19
Table 2-3
Tasks
Where Documented
Documented by the community, for example at Eclipse.org Click location to put binaries, click on add, browse to files.
You are the primary developer of the kernel, drivers, and kernel modules. You provide the kernel for the application developers.
See the following table for pointers to the parts of this users guide (or elsewhere) that may help you the most.
Table 2-4 Kernel Development Tasks, Tools, and Document Links
Tasks
Where Documented
You can also import projects configured on the command line into Workbench
12.2 Working with Kernel Modules Sample kernel modules are on the Target, p.149; 19.5 Providing provided Kernels and Modules for Platforms, p.232
20
You put user space packages together with kernel configurations from the kernel developers. You integrate the file system content from the package and application developers with the kernel. You perform optimizations on the resulting image. You may wrap content into layers to share back with the group. You prepare BSPs (board support packages).
See the following table for pointers to the parts of this users guide (or elsewhere) that may help you the most.
Table 2-5 Platform Integration Tasks, Tools, and Document Links
Tasks
Where Documented
Create single and Site Configuration Guide; Also shared installations D. Installing on Network Servers Integrate layers 5.8 Customizing Builds with Layers, Templates, and Profiles, p.75 Adding Layers, p.79 in 5.8.2 Working with Layers, p.78; 4.6 Working with the File System Layout Tool, p.40 17. Optimizing 14. Deploying to Targets 20. Delivering Layers; 20.2.2 Tailoring and Exporting a Layer, p.237
Shared installations can be placed on NFS servers Custom layers can also be generated and shared across the team If there are kernel flags, you can capture them into a layer using the export layer feature. Summary and pointers to other books Emulated and hardware Using export-layer to capture the project's changes and share them with other projects and team members
Integrate applications, packages, kernels Optimize Deploy to target Deploy projects back as a layer
21
Table 2-5
Tasks
Where Documented
20.3.2 Telling Recipients How to Import and Use the Layer, p.239
If you encapsulate completed projects into a layer for the next product version (which may have a newer wrlinux and kernel), you can port the product layer forward and may need only to match any kernel changes.
Configure BSPs
Wind River Linux BSP Developers Working with components Guide: Creating a BSP that make up a BSP, in view of the requirements for a Wind River Linux Platform BSP Wind River Linux BSP Developers Using Linux Test Project Guide: Validating Boards (LTP), and the Open POSIX Test Suite (OPTS) operational tests and software test package, plus BSP Validation Suite
Validate BSPs
22
3
Workbench Basics for Linux Developers
3.1 Introduction 23 3.2 Wind River Linux Projects 24 3.3 Your Programming Environment 26 3.4 Producing a File System and Kernel 27 3.5 Accessing the File System and Kernel on a Target 28 3.6 Debugging and Analyzing on a Target 30 3.7 Productizing 32
3.1 Introduction
This chapter sets the stage for the next chapter, which will take you through the main flow of creating a product within a generalized lifecycle of development. In the following sections, you will find answers to introductory questions about using Wind River Workbench, with an emphasis on basic concepts such as:
Does it matter which host you use for Workbench? What compilers and debuggers do you have available? Can you just use the command line instead?
23
What do you really make when you develop something in Workbench? What is a target, how big is it, and where do you get one? How can you put your file system and kernel onto a target, or access it otherwise? How can you change whats on the targets file system? How do you debug whats on the target? What can you do with what youve created?
If you are looking for help on how to use Workbench, how to open views, perspectives, tabs, and so on, and for tutorials and procedures that step you through working with code, compiling, attaching to targets, debugging, and so forth, see the Wind River Workbench Users Guide.
They allow you to manage your source code files by collecting them into logical, and, if necessary, hierarchical, structures. They allow you to create build targets with different build-related settings (known as build specs) so you can build the same sources for different target architectures or different toolchains simply by changing the projects active build spec.
Workbench projects are preconfigured to provide the type of build support required by the task you are working on.
NOTE: You cant change a project type after you create it, so be sure to choose the correct project type initially.
24
3 Workbench Basics for Linux Developers 3.2 Wind River Linux Projects
Applications Workbench supplies the Makefile, determines build order, and provides macros, build paths, and build specifications. The build specs are based on the targets that are tested and supported by Wind River Linux. Appropriate libraries, cross-development tools, and so on are also provided, so much of the gathering and debugging of a working environment is eliminated. Platform Projects These projects are designed for building the entire target platform, including the kernel and file system. Workbench provides special tools for platform configuration, modification, and maintenance. You can build root file systems using default settings, or you can configure the file system through a GUI configuration tool that the project provides. Default kernels are provided for supported targets, and you can configure them using the provided GUI configuration tool. User-defined projects For these, you set up and maintain your own build system, file system contents, Makefile, and so on. Workbench lets you configure the build command to launch your build utility, so you can start builds from Workbench. You can also configure different rules for building, rebuilding, and cleaning the project. You can create build targets in the Project Explorer that reflect rules in your Makefiles, allowing you to select and build any of your make rules directly from the Project Explorer. Build output is captured to the Build Console. Kernel Modules These projects provide a way to create kernel modules for Wind River Linux. You can associate the kernel module with a platform, and the kernel module automatically inherits the build environment of that platform. Native Application Projects These are projects that are developed and deployed on the host; therefore no cross development is required. The build specs assume local development tools. Additional build specs support team development for when a team works with a combination of Windows, Linux, and Solaris host environments.
Customer-specific projects Application and kernel projects that are built and reside on the host computer, but run on the target. Workbench provides a generic managed build, allowing you to derive your specific build specs from a set of predefined ones. The customer-specific kernel projects wrap the typical Linux kernel command line build. Because your subsequent Linux application
25
projects will run on the Linux kernel on the target, this is often a necessary first project to build, unless you already have a target kernel. To enable Customer-Specific Linux projects, select Window > Preferences > Wind River > Capabilities. Expand Development. Check Customer-Specific Linux Development. Click Apply Note that user-defined and native application projects are available in both VxWorks and Wind River Linux versions of Workbench. For more information on types of projects, see the Wind River Workbench Users Guide: Projects Overview, especially the sections on project structures involving suband super-projects and project-specific execution environments, particularly the discussion of object.properties files.
26
3 Workbench Basics for Linux Developers 3.4 Producing a File System and Kernel
For information about the debuggers, see section, 3.6.1 Debuggers, p.30.
27
has the same effect as the Workbench Create Project wizards Configure Options screen that asks you to specify a particular board, kernel type, and file system. (See Creating the By-Example Platform Project, p.53, for a screenshot.)
28
3 Workbench Basics for Linux Developers 3.5 Accessing the File System and Kernel on a Target
Emulated targets using the Quick Emulator (QEMU) Check the release notes and the Online Support site to see which boards are emulated by QEMU. Currently, these include the Common PC and ARM Versatile AB-926EJS boards, among others.
Real targets Check the release notes and the Online Support site to see which physical target boards are supported.
In either case, Wind River Linux provides specific BSPs for the supported targets.
29
User ModeUser mode debugging allows source code debugging of user mode applications, including multi-process and multi-thread debugging. In user mode, a usermode-agent on the target communicates with Workbench on the host, allowing you to use Workbench to edit your source code, step through the application, set breakpoints, and so on. Kernel ModeKernel mode debugging allows for source code debugging of Linux kernels version 2.6 and later. The kernel must be patched for KGDB, the Kernel GNU Debugger, which communicates with GDB, the standard GNU debugger, on the host. Kernel mode source code debugging allows you to debug the kernel using suspends, breakpoints, and so on, as you would with user mode debugging.
NOTE: KGDB is enabled by default for Wind River Linux kernels and only needs to be disabled for you to go to production.
3.6.1 Debuggers
From the right-click context menu for a project, you can choose:
Debug As Local C/C++ Application, which automatically chooses a default GDB debugger Open Debug Dialog, so you can (a) specify a particular GDB debugger (such as Cygwin or MinGW) for C/C++ applications (and the postmortem debugger), or (b) choose other projects that use the Wind River Debugger (WDB).
If you choose Open Debug Dialog, the resulting Configure launch settings dialog (Create, manage, and run configurations), lists the configuration types. These types happen to be the same in VxWorks as in Wind River Linux. They determine whether to use GDB or WDB, as shown in the following table:
30
3 Workbench Basics for Linux Developers 3.6 Debugging and Analyzing on a Target
Table 3-1
Debugger
Project Type
WDB GDB GDB GDB GDB KGDB WDB WDB WDB WDB
Attach to Target C/C++ Attach to Local Application C/C++ Local Application C/C++ Postmortem debugger Native Application Kernel Task Launch Control Process on Target RTP on Target Wind River Application
(This table includes Native and Wind River Applications, though these are not in the same context menu.) For those projects that use the Wind River Debugger, there is no Debugger tab in the Configure launch settings dialog. This tab lets you choose a particular GDB debugger, such as GDB, Cygwin GDB, or MinGW.
NOTE: If the Debugger tab does not exist, you are using the Wind River Debugger
(WDB).
31
3.7 Productizing
This section very briefly describes productization in terms of how to work with:
Your applications, platforms, and kernels to create a product Other members of a development team with different roles in producing intra-team and customer-directed products on an iterative basis Patches and updates, in terms of providing them, when, and for whom
32
33
34
4
Life Cycle Development
4.1 Introduction 36 4.2 What Do You Do? 36 4.3 Where Does Your Work Fit into the Big Picture? 37 4.4 Starting with a Simple Project 38 4.5 Using Pre-Built User Space Content 39 4.6 Working with the File System Layout Tool 40 4.7 Configuring Kernels 41 4.8 Debugging and Deploying 41 4.9 Optimizing 42 4.10 Managing Content 43
35
4.1 Introduction
This chapter describes the typical chronological lifecycle of projects that you can create using Workbench. It introduces the various development stages, providing an introduction for each one, along with pointers to advanced material. This is to help you find and understand topics and tools presented throughout this book.
Application developers used to working with middleware and using a high-level application development framework or SDK. You can analyze and debug application behavior. Kernel developers who write and fix kernel features, integrate external source code, mix complicated patches together, and do source code manipulation. You might get the latest Linux kernel to boot on a device, and/or create a kernel driver module for an existing Linux kernel. We assume you can take a kernel and drivers and boot-strap a minimal Linux system with basic libraries, shell and GCC. You can analyze device behavior using tools such as on-chip debugging. Platform integrators who put all the pieces together, communicate to various groups of other developers, and perform integration tests, footprint optimizations, and boot time optimizations. Your deliverable is the production of the integrated platform. You can analyze and debug OS behavior.
In terms of Workbench and Wind River Linux, two types of licenses are available, platform and application:
As a platform developer, you configure the kernel, kernel modules, and the file system, using the Workbench kernel and user space configuration tools. As an application developer, you use the Workbench tools to develop cross-built applications. You get the default, pre-built sysroots that have all the
36
4 Life Cycle Development 4.3 Where Does Your Work Fit into the Big Picture?
necessary libraries, header files, and access to the cross-compilation tools. These pre-built sysroots let you start developing applications until your platform developers prepare a proper sysroot for the actual target system. A sysroot holds the shared header files and libraries from the file system (for example the C runtime libraries), for the use of the other packages.
4.3 Where Does Your Work Fit into the Big Picture?
Figure 4-1 briefly illustrates the development life cycle that Workbench makes available, although only part of this may apply to you, depending on how much of the cycle involves you.
Figure 4-1 Overview of the Product Development Life Cycle Product Requirements
Applications Files Packages Unit Tests Docs Layers Sysroots Profiles Kernel File System
Setup
Templates Layers Packages RPMs, CVS, . . .,
Develop
Config Edit Compile On-Host Workbench
Diagnose
Deploy Debug Test On-Host Workbench & Target
Product Deliverables
Kernel Image File System Image Layers Sysroots
Optimize
System Layout Views Profiles Static Analysis Cores Footprint Workbench, Eclipse, Target
In Figure 4-1, the requirements and deliverables are listed on the left. The deliverables can be to the end customer or to other team members. The life cycle circle suggests that you as a developer can enter the life cycle at any given point, and typically move on from that point to the next in a clockwise fashion. The various stages in the life cycle have, very briefly, the following characteristics for different developers.
37
SetupYou take the profiles, templates, layers, packages, and so on, whether expressed as RPMs, SRPMs, CVS or ClearCase repositories, or whatever, and you set up a Workbench environment so these are all available to Workbench users in the Develop, Diagnose, and Optimize stages (depending on how far such users progress in the cycle). These profiles, templates, layers, and packages come from the Optimize or Deliver stages. The Setup stage produces its own set of deliverables, not shown here, that are used in the next stage, Develop. DevelopBased on what is available as a delivery from the Setup stage and what you can import from external or other local sources, you work with Workbench running on your local or NFS-mounted host (or other remote host), and you go through the common edit, compile, debug cycle within the Develop stage. Upon completion, your deliverables are available to the next stage in the life cycle. DiagnoseStarting with what the Develop stage makes available as a deliverable, you use Workbench and on-target or on-simulated-target projects (kernels and file systems) in a deploy, debug, and test cycle. At this point, your deliverables are available to the Optimization stage, at which you or other developers study your deliverables and figure out how to make them better. OptimizeUsing the deliverables from the Diagnose stage, you work with the target, Workbench, and general Eclipse tools to improve certain aspects such as memory usage, footprint, response time, and so on. These tools may include OProfile, mpatrol, static analysis, core dump analysis, footprint tools, and various system and layout views.
38
2. 3. 4.
Build a target file system. See 5.1.1 Building New Platform Projectsan Overview, p.48. Connect to an actual or QEMU-emulated target. See 5.1.3 Connecting to a Target, p.49. Debug as appropriate:
Do user mode debugging. See 15. Debugging User Space. Do KGDB debugging. See 16. Debugging Kernel Space, and especially 16.4 Connecting with KGDB from Workbench, p.192
NOTE: If the connection succeeds and the Editor complains that it cannot find
source for the kgdb.c compilation unit, click Browse and provide the path to your Linux kernels source directory, which will be in your projects build folder. This is known as source path mapping. For more details, see 16.5.1 If the Compilation Unit Source Is Not Found, p.196. For further study, see:
5.8 Customizing Builds with Layers, Templates, and Profiles, p.75, regarding layers and templates The Wind River Linux Users Guide
39
To see which architectures were built for specific packages: 1. 2. Double-click the projects User Space Configuration node to open the Package Manager. Look in Column 3 for the architectures for installed packages. If the package is built for a CPU variant different from the default, you see the variant listed as arch.cpu-variant. If there is no .cpu-variant extension indicated, the package is using the default CPU variant of the file system. To rebuild packages: 1. 2. 3. Open the Package Manager. Highlight the package to rebuild, then click the Targets tab. Click the rebuild button.
NOTE: When you click on User Space Configuration, the User Space Configuration Tool opens. In that view, you can click on the Packages or File System tab to display the Package Manager or the File System Layout tool, respectively.
40
13.2 Assembling Your File System, p.156, which talks about putting together your runtime file system. 17.2 Managing File System Layout, p.212, for help on optimizing the contents of user space.
4
Configure and modify a platform kernel. See 6.2.1 Kernel Configuration Node, p.85. Add and share modules between projects. See 6.3 Prepopulating LKM Projects, p.87. Create custom modules. See 6.4.1 Creating a Custom Kernel Module, p.88.
You must use kernel rebuild target to instantiate changes. Note that this replaces the default sym links by your local kernel and vmlinux symbol file. This means that when you build your own kernel, the vmlinux is tied to your project and now has an automatic source path mapping, so you dont need to set the source path mapping.
41
For usermode-agent: 8.2.3 By Example: Building hello_world, p.100, and 15.2.1 Creating a Remote Connection, p.177. For Wind River Debugger, see 15. Debugging User Space. For KGDB kernel space debugging, see 16. Debugging Kernel Space, and also 16.6 Debugging User-Supplied Kernel Modules, p.198, 12.2 Working with Kernel Modules on the Target, p.149, and 12.3 Working with RPMs on the Target, p.151. For QEMU, see 5.1.3 Connecting to a Target, p.49, and 16.8 Using QEMU for KGDB Kernel Debugging, p.206. (You can have multiple instances of QEMU running at the same time, with different targets, if each instance has a higher instance number.) For physical targets, see the Wind River Linux Users Guide. For launch configurations, see the Wind River Workbench Users Guide. For pushing recompiled RPMs straight to live targets without rebooting them, see Table 5-2 on page 65, and the surrounding text.
4.9 Optimizing
Optimizing covers a lot of territory, from working with CPU variants, to optimizing packages, file system layout, kernels, kernel modules, and so on. See the following for pointers:
17.2 Managing File System Layout, p.212 17.3 Profiling CPU Usage with OProfile, p.213 17.4 Analyzing Code Execution Coverage, p.213 17.5 Analyzing Memory Problems with mpatrol, p.214 17.6 Using the System Viewer, p.214
42
Workbench provides meta-information within the project directory that you can use to manage your project at a high level. Some of the more useful files and directories in the project have been given purposeful names, for example, in workspace/Project_prj:
export What goes on the target. filesystem Pre-target-deployment. layers For managing device software components independently; to control larger configuration issues, perhaps reconfiguring and patching the kernel, modifying system files, and including one or more templates. packages For adding local packages to your build dist or tools directories (Project_prj/dist or Project_prj/tools) templates Typically for relatively small changes at the end of the configuration process.
Importing Packages
The Package Import Tool lets you import packages that are not already available on your system. You can import files and packages locally or by specifying a URL. See 5.6.6 Importing Packages, p.68.
Using Layers
You can export and import layers to make it easy to move software component configurations from one project to the next. See, in particular:
5.8.2 Working with Layers, p.78 (this includes adding layers) 20.2 Example: Preparing Layers that Modify Kernels, p.234 20.3 Providing Layers to Teams and External Customers, p.238
43
44
PAR T I I
Developing Platforms
5 6 7 Developing Platform Projects ........................... 47 Configuring Platform Kernels ........................... 83 Feature Templates and Profiles ........................ 91
45
46
5
Developing Platform Projects
5.1 Introduction 47 5.2 Creating Projects Using Workbench or the Command Line 50 5.3 Building a Target File System 55 5.4 Introducing the User Space Configuration Node 57 5.5 Exploring the Target File System 58 5.6 Using the Package Manager for RPMs 63 5.7 Creating a Project from a Package 73 5.8 Customizing Builds with Layers, Templates, and Profiles 75
5.1 Introduction
This chapter tells you how to create a new Wind River Linux platform project. Except for self-hosted (native-mode) applications, you cannot debug an application or a kernel until you have configured a platform and booted the platform containing the kernel and file system that you have configured. When you use a self-hosted application, you do not have to configure a target platform, because the development host is the target platform. Such applications
47
are only supported on a common PC running Linux. For more information, see the Wind River Workbench Users Guide: Developing Applications.
Figure 5-1 The Platform Development Stage of the Product Life Cycle
Platform Requirements
Applications Binaries Docs Kernel Modules Layers Non-Binary Files Packages
Setup
Templates Layers Packages RPMs, CVS, . . .,
Relevant Tools
Build Specs File System Layout Tool Layers Open Source Package Import Patch Manager Sysroots User Space Configuration
Develop
Config Edit Compile On-Host Workbench
Diagnose
Platform Deliverables
File System Kernel Sysroots
Deploy Debug Test On-Host Workbench & Target
Other Tools
Package Manager Quilt
Optimize
System Layout Views Profiles Static Analysis Cores Footprint Workbench, Eclipse, Target
48
NOTE: Working with packages is a major part of developing platform projects. You might consider this current chapter an introduction. For further information and more specific details, see the following chapters: 10. Importing Packages and 11. Patching Packages.
4.
Add templates and profiles to a project, and create and add layers. See 5.8 Customizing Builds with Layers, Templates, and Profiles, p.75.
Import any needed open source packages and/or local sources and applications Patch packages as necessary Customize your builds with layers and templates Develop your file system Deploy your file system to your target Test and debug your target system
For more information about deploying, see 13. Assembling File Systems and Kernels and 14. Deploying to Targets.
Workbench simplifies many aspects of creating and using QEMU targets if you follow this approach. The QEMU connections vary as follows:
Linux User Mode Target Server Runs the usermode-agent and QEMU.
49
Backend ConnectionFor use with KGDB, providing a command-line interface to QEMU to start, stop, query registers, and so on. ConnectionAlso uses KGDB, but more similar to an OCD connection, good for debugging Ethernet, early boot-time access before connections are available, and so on. This form of QEMU actually emulates real boards. It starts QEMU for you and opens a connection so you can sign on, or whatever.
2.
Specify (or verify) the connection object path mappings that name the target path (/) and host path, such as workspace/ProjectName_prj/export/dist. This mapping specifies which host directory is to be NFS mounted on the target root directory (or, for QEMU, which directory is to be mapped to the emulated target root directory).
NOTE: Make sure that you have specified the root directory (for example,
workspace/PlatformName_prj/export/dist) in the application root directory build property. If you do not see your subdirectory in /dist, you must rebuild the application project. 3. Run or debug the application on the target. Right-click, choose Run Process on Target or Debug Process on Target, and click Run or Debug in the lower-right of the Create, Manage, and Run Configurations screen For more information, see Part VI. Debugging and Analyzing.
50
5 Developing Platform Projects 5.2 Creating Projects Using Workbench or the Command Line
A board from the board menu. A file system size from the RootFS menu. Possible options are glibc_cgl for carrier grade Linux; glibc_std for standard Linux; glibc_small for a Busybox-based file system; and uclibc_small for one based on uClibc. A kernel. Possible options are cgl, ecgl, standard, small, preempt_rt (native real-time kernel preemption packages), and rtcore (Wind Rivers real-time kernel, installed optionally), depending on the choice of RootFS.
4.
You can see the configure command at the bottom of the wizard:
NOTE: You cannot edit the configure command directly, but you can use the following step to edit it under guidance from Workbench.
5.
(Optional) You can also use Workbenchs list of option-value templates to add or modify arguments to the configure command. a. Find the option-value part of the configuration dialog by clicking Advanced > >, then if needed, expand the dialog so you can see the Option part, for example:
51
b. c.
Click Add to open the Option/Value dialog box. Select options from the list and edit them as needed, substituting actual values for DIR, BUILD, and so on, and choosing between options specified in square brackets and separated by lines. For example, if you select the following option,
--with-toolchain-version=[STRING|current]
If you select an argument containing a DIR value, click the newly-enabled Browse button can find the appropriate directory. d. Click Add to add each additional option. e. 6. When you have finished adding options, click OK.
(Optional) If you click Advanced > >, you can take the following actions (as explained in 5.8 Customizing Builds with Layers, Templates, and Profiles, p.75):
Click Add to add one or more layers. Click Template... to add one or more templates. Click Profile... to add one or more profiles.
7.
Click Finish to ignore the source code indexer and its associated performance penalty.
Workbench executes the configure command and creates two subdirectories in your workspaceone with the project name (project) and one with the project name plus a _prj extension (project_prj).
NOTE: If you are importing an existing platform project, Workbench uses the existing projects location, and does not create a project_prj folder.
Output from the configure command appears in the Build Console and is stored, with additional information, in the project/creation.log file.
52
5 Developing Platform Projects 5.2 Creating Projects Using Workbench or the Command Line
At this point, your project_prj/export directory contains three empty subdirectories: dist, packages, and RPMS.
Use the following example data to create and configure a new platform project.
Table 5-1 Example Platform Project Parameters
Data
Field in GUI
Entry
This configuration provides a robust system to help you understand the procedures in creating a project, as well as in debugging it and optimizing it, as described in later chapters. Notice the following about these choices:
ARM Versatile AB-926EJS and Common PC boards are available as QEMU emulated targets. See the release notes and the Online Support site for lists of supported physical and emulated boards. The file system size is standard, meaning it is not specific to a platform or profile, and it avoids limitations found in the small size. The kernel type is common and not a soft or hard real-time kernel. It is appropriate to other examples in this guide.
Enter the parameters from Table 5-2 to build an ARM Versatile target.
53
1. 2.
Select New > Wind River Linux Platform Project, name your project my_arm, then click Next. Specify the parameters in the drop-down lists as described in Table 5-1.
3.
Build spec is associated with your chosen combination of board, kernel, and root file system. The Profiling build type causes packages to be built with the -fno-omit-frame-pointer flag, but keeps the optimization level from the Production build type. (See Wind River Linux Users Guide: Building libc from Source.) If you enable Link to Development Folders, links will be created to the dist and build folders of your platform project.
4.
Click Finish.
Note that you can debug a production build and make a very small change when done, but if you start out with a debug build, you cannot convert it to a production build.
54
After you have verified your project, you can build the target file system and continue development.
From the Project Explorer, select fs, right-click, and select Build Target. The Build Console reports on the build progress and status. Depending on the configuration, your build could take several minutes. The creation.log provides a build summary.
55
The export directory contains a link to the default kernel, and a compressed runtime file system (as a tar.bz2 file named according to the board, rootfs, and kernel you chose). The export directory contains a link to the default kernel (a WR3.0au_kernel file). The export/dist directory contains the file system for your target. It contains the build output from the application(s) you create.
56
5 Developing Platform Projects 5.4 Introducing the User Space Configuration Node
2.
NOTE: If you are following the example and using the table data, you should see the same names as above.
Explore the target file system, view the contributing packages, and delete or add files to customize and fine-tune the file system content. Work with packages (RPMs) involving the target file system. You can add, remove, import, and build packages.
NOTE: Some Wind River literature uses the acronym USE, for User Space Editor.
To use the User Space Configuration node: 1. 2. In the Project Explorer, double-click User Space Configuration. Click the following tabs in the lower left of the resulting dialog box.
The Filesystem tab opens the Filesystem Layout dialog. See 5.5 Exploring the Target File System, p.58. This tool works with the generated RPM files from the packages, and manipulates the filesystem/changelist.xml file. It does not operate on a live target.
57
The Packages tab opens the Packages dialog. See 5.6 Using the Package Manager for RPMs, p.63. This tool manipulates the pkglist file, plus it lets you send individual RPM packages to a live target.
The export/dist directory is the file system image for all configured projects. Regular targets take that image, then create the dist.tar.bz2 image as the last step in creating the file system Once created, the bz2 image can be expanded into an NFS mount directory; or used directly by QEMU, without needing to be expanded. You cannot NFS mount the export/dist directory.
NOTE: Wind River uses pseudo (replacing fakeroot) to install files into the target
root file system without having to set the UID to root. Like fakeroot, pseudo intercepts the system calls concerning root priority on file operations. It creates the regular, special files and directories but maintains a small database on what the settings would be would be if you had actually been root (these include setuid, setgid file permissions, device file class/major/minor, uid and gid ownership). This allows the build system to create a root file system tar file that has actual device files and root ownership. When you use the File System Layout tool to work with available RPMs, it reports package sizes as reported by them. Each available package is built and converted to an internal RPM file from the respective package's INSTALL_STAGE output. These prebuilt versions allow you to use the RPMs without rebuilding them. The File System Layout view works with those RPM files directly. Therefore, it represents a view of the target file system as it would be expanded into export/dist. Since it manages the file change list, it can modify what ends up in the file system without having to actually change the RPM files, so they stay pristine (untouched). Workbench expands these RPM files in export/dist, then runs fs_final script against the file change list. Finally, Workbench packages export/dist into a tarball file system image.
58
Figure 5-3
The Filesystem Layout dialog box displays two different views of the file system of the target that you are building, depending on whether you select Flat or Packages by clicking on the View icon to the right of the Pattern Filter field:
Flat provides a list of directories and files. Packages provides a list of packages.
The Pattern Filter field lets you enter and apply filters to the view; for example, allowing you to specify all files with a .pl extension. The Filter icon activates the filter, letting you mark the results for deletion if necessary. The filter works on all packages; for example, you can remove unneeded Perl scripts from all packages. The View icon selects the file system or package view. The file and package list specify file, mode, size, type, owner/group, package, and location. You can change file and package attributes, such as read/write permissions and
59
ownership. Right-click to mark directories to be created in (or removed from) the file system. You can also create nodes, pipes, and devices in the generated file system.
The Estimated Filesystem line annotates the size of files or packages added or removed, along with the total size of the file system currently available. The Log tab reports on the number of packages, files, and so on.
Examine meta properties of the files in the file system (see 5.5.1 Examining File Meta Properties, p.60) Add and remove files and directories to and from the file system (see 5.5.2 Adding Files and Directories to Your File System, p.61) Work with packages (see 5.5.4 Viewing Parent Packages and Removing Packages, p.62) Add devices and change ownership (see 5.5.5 Adding a Device, p.62)
NOTE: The File System Layout tool works with the generated RPM files from the packages, and manipulates the filesystem/changelist.xml file. It does not operate on the live target.
Open the bin directory, and examine the first file (for example, arch). Note the following: The mode string (-rwxr-xr-x) The file size (4230) The file type (for example ELF 64-bit LSB executable for a common_pc_64 project)
60
61
62
5 Developing Platform Projects 5.6 Using the Package Manager for RPMs
Some of the Package Managers commands map directly onto the Linux rpm -option. Some affect packages on live targets. See Table 5-2Package Controls, p.65. The Packages dialog box (Figure 5-4) displays a list of installed packages in Installed Packages. If you look in the pkglist file in the project_prj directory, it displays the same list of files. In Workbench, each package is listed with its version number and the amount of space it occupies. To create a user-defined project from one of these packages, see 5.7 Creating a Project from a Package, p.73. Note that packages are displayed even if their respective RPMs are not yet available: their file size is 0; and a ? question mark overlaps the RPM icon.
63
Figure 5-4
To get more information on any package, select it and look at the tabs at the bottom of the view:
The General tab provides a brief description of the package. The Advanced tab provides an editable URL to the RPM for the package, and states the architecture. The Contents tab lists the various files and directories that comprise the package. The Dependencies tab displays package interdependencies in two panels: The Requires panel lists the packages that are required by the package you have selected. The Required By panel lists the packages that require the package you have selected.
The Options tab lets you turn debugging or profiling on or off for particular packages.
64
5 Developing Platform Projects 5.6 Using the Package Manager for RPMs
The Targets tab presents ten buttons that let you choose build targets for the package: build, rebuild, prepatch, postpatch, patch, compile, install, custom, clean, and distclean. The Log tab primarily lists the additional RPMs that are generated by the installed packages.
5
Control
Add Check Erase Force Install Import Install Open Reload Remove Replace Revert Save
Moves packages from the Installable Packages list into pkglist Confirms the integrity of the package list Removes RPM file from live target, by doing an rpm -erase Installs RPM files on live target, by doing an rpm -install -force; ignores dependencies; see 5.6.4 Using Force Install, p.67 Adds packages not in the Installable Packages list; see 5.6.6 Importing Packages, p.68 Installs RPM on live target, by doing an rpm -install; see 5.6.3 Installing Packages, p.66 Opens pkglist for editing Reloads package lists from pkglist, typically after editing it Deletes from pkglist and puts into Installable Packages; see 5.6.8 Removing Packages, p.72 Does an rpm -erase then an rpm -install on the target Restores pkglist to before view was opened Saves changes
65
NOTE: Check confirms the integrity of the package list by testing all package dependencies (as registered in the respective and collective RPM file set). The integrity cannot be confirmed entirely because of potential conflicts with the original dependency content from upstream and in the respective customer package data.
66
5 Developing Platform Projects 5.6 Using the Package Manager for RPMs
You cannot install iptables now, whether you use Install or Force Install, because iptables-ipv6 is not installed. 2. Use Force Install to install iptables.
3. 4.
Export the sysroot (see 19.3.1 Exporting Sysroots, p.229). Now it includes these extra multi-libs. Add this sysroot to your project, using Window > Preferences > Wind River > Layers and Sysroots.
You can now build mthread; for example, for both the 32-bit n32_octeon and the 64-bit octeon build specs.
67
NOTE: If you see a pointer size warning for the octeon spec, it does not affect the
build success.
these instructions, with pointers to specific procedures for each type of package. To import packages: 1. 1. 2. Double-click the User Space Configuration node. Click the Import button. Click Import Package. The Package Import Tool appears. 3. Click the package type or source:
FileClassic Red Hat SRPM packages in bz2, gz, tgz, zip, or src.rpm format, on your system or LAN. WgetPackages available on the web via URL. WR Linux PackageWind River Linux packages (as opposed to open source); in bz2, gz, tgz, zip, or src.rpm format. This allows you to reuse the existing porting information in the respective dist/package directory, and to continue from there.
4.
If you chose File or WR Linux Package, browse for the file or package to import. When you have selected the package, the Package Import Tool screen displays the package list, package name, and version .
5. 6. 7. 8.
Click Go. A shell window opens to display the import activity. Press Enter as needed to return to the import tool from the shell. Examine the progress window to see that it has completed satisfactorily. Click Close. The package imports.
68
5 Developing Platform Projects 5.6 Using the Package Manager for RPMs
You still may need to complete the package; for example, to change it for cross compilation.
Extracts any RPMs for the package that you selected. Registers kernel patches. Registers patch files. Prepares the Quilt patches directory.
Some RPMs, as mentioned earlier in the discussion of Figure 5-4, are just placeholder entries in the package manager RPM list, while the package is under development and the resulting RPM file is not yet available. These placeholder RPMs show a size of 0 bytes.
69
Figure 5-5
If you highlight one of these RPMs and click the Dependencies tab, you can see whether any dependencies have yet been defined for the RPM. (See Figure 5-5.) Because the package manager currently only looks at run-time dependencies, you might remove a package and break a build dependency, but not know it until you try to build the filesystem. If an installed RPMs icon shows a blue "?" decoration, the RPM and its metadata are unavailable until the package is built.
70
5 Developing Platform Projects 5.6 Using the Package Manager for RPMs
Figure 5-6
Unavailable RPMs
This means that there is no RPM file available in either the installation prebuild or in the projects local build. This happens because not all RPMs are pre-built for all architectures. Some are only built when the user builds the file system. This feature allows you to customize the pkglist file for such packages. Previously, Workbench required you to build all needed RPMs locally, even if you just wanted to remove them from your file system.
The debugging features available using the User Space Configuration node let you select individual packages and build them with debugging turned on or off, regardless of the rest of the pre-built packages in your project. To enable and disable package debugging: 1. 2. 3. Select the package. Click the Options tab. Check or clear Debug.
71
4.
Click Apply. This sets the build type. Any single package can have only one build type, whether it is profiling, or debug, or default (neither profiling nor debug). The default is to use the build type specified in the configure command.
5.
Verify that the the package name in the pkglist file is marked
BUILD_TYPE=debug.
NOTE: For BUILD_TYPE=profiling, see 17.3 Profiling CPU Usage with OProfile,
p.213.
72
A dialog box opens and lists all the packages to be removed (the selected package and its dependencies) and the total space used by the packages. 4. Click OK.
The removed packages now appear in the Installable Packages list. Select File > Save and view the pkglist file. The packages are removed from the list in that file.
73
3.
Accept or change the default project name, choose to create the project at an external location, and specify the directory at that location, then click Finish.
4.
Notice that Workbench creates a user-defined project, which appears in the Project Explorer as a project separate from the platform project:
74
5 Developing Platform Projects 5.8 Customizing Builds with Layers, Templates, and Profiles
The location of the extracted package sources appears inside the build directory. In the case of the acl RPM, this is: project_prj/build/acl-version/...
Adding templates Creating new BSPs Ensuring that custom builds can be easily repeated Completely separating custom code from the installed Wind River development environment
75
This customizing facility is implemented as templates and layers. These can sometimes be used interchangeably, but they are designed for different purposes.
Templates are suitable for small or discrete changes, and are typically incorporated into a project at the end of the configuration process. Layers are appropriate for adding new packages and making significant changes to BSP templates. Profiles are templates that typically include a kernel, a root file system and, optionally, other features. Kernel profiles are layered to build a set of increasingly specific or enhanced functionality.
To add templates to a platform project: 1. 2. 3. Take the initial steps in creating the project, to the point where you have named it and have reached the Configure Options screen. Click Advanced > >. Click Add (to the right of the Templates box) and click OK. Select checkboxes to specify which templates you want to add. See Table 5-3 for a description of some of the supplied templates. Table 5-3 describes some of templates in subdirectories extra and feature in installDir/wrlinux-3.0/layers/wrll-wrlinux/templates. Each template is in its own directory, with at least a pkglist.add file and a README, for example:
[user@ala-docs-rh4 wifi]$ more README Introduction ============ This layer contains the wifi feature and associated tests for Wind River Linux:Platform for Consumer Devices. Building with the wifi feature ============================== Acquire a Ralink R73-USB part such as the Asus WL-167g and add the following options to your configure command: --with-template=feature/wifi
76
5 Developing Platform Projects 5.8 Customizing Builds with Layers, Templates, and Profiles
Table 5-3
Template
Function
extra/wrsnmp feature/acpi feature/busybox feature/debug feature/directfbfusion feature/glibc_discrete feature_glibc_small_extras( feature/ipmi feature/prelink feature/uclibc feature/unionfs
Enables Wind River SNMP and the SNMP Agent. Incorporates and starts the logging daemon on kernel-acpi enabled boards with cgl and std file systems. Adds the busybox package and sets up the configuration file in busybox/busybox/config. Adds the usermode-agent to small file system projects. Lets multiple DirectFB applications run at the same time within a session. Replaces busybox with a set of full-featured, discrete utilities (such as in glibc_standard). Replaces busybox with a set of small, extra utilities such as in glibc_small). Adds the IPMI package and enables support for IPMI controllers. Modifies ELF shared libraries and executables, to require fewer relocations to be resolved at runtime. Replaces glibc with the uclibc C library for MIPS and ARM targets with one or more uclibc rootfs names. Lets you boot from CD-ROM, for BSPs with CD-ROMs.
You can place custom templates anywhere, but they typically reside outside of both the development and build environments. Custom templates are processed last, after all other templates. Because of this, they are especially useful for:
Kernel configuration file fragments that must come at the end of a kernel configuration file. Additions to file system configuration files. For example, networking configuration files in /etc/sysconfig that might have to override default values.
77
The pkglist.add and pkglist.remove files that may have to override previous package list files You also may add a one-line kernel configuration to be processed last.
For more information about creating and adding custom templates to a project, see Wind River Linux Users Guide.
Create a new layer, where the proper layout and directory names are preset Create new template directories within this layer Duplicate template directories from the Wind River Linux installation Allow recursive duplication, to have a fully stand-alone template Minimize the layer, to remove unneeded directories Display the template include tree for a given template
Layers allow you to package, locate, and review a set of changes, revert undesirable changes, and share your changes in a coordinated method. You could, for example, add packages, remove other packages, and add and remove different kernel features with a single layer. You could then distribute your layer to a group of developers or simply make it available over the LAN. Other developers could then include or exclude your changes with a single configure command switch. You can create layers automatically from a build environment you have modified, or you can create them manually as described in the Wind River Linux Users Guide. Custom layers are processed differently from custom templates. During processing, the system looks first to the custom layer in an attempt to find the template, package, or file it is looking for. Thus, custom layers can be used to add templates, packages, or files, or to override the templates, packages, or files within the development environment. For instance:
78
5 Developing Platform Projects 5.8 Customizing Builds with Layers, Templates, and Profiles
A template within a custom layer is used instead of the identically named standard template with the development environment.
Although custom layers can be placed anywhere, they typically reside outside of both the development and build environments.
Adding Layers
Use the Platform Project wizard to add multiple layers to a project. These layers can add board and template information that automatically updates the wizard. In the following example (at Step 4), the wizard uses the path for the Real-Time Core layer.
Table 5-4 Basic Provided Layers
Layer
Notes
Base layer and source tree Default layer Default toolchain Optional layer
Use the example data in the following table to create and configure a platform and add and remove layers.
Table 5-5 Example Parameters
Data
Field in GUI
Entry
To add layers to a platform project: 1. Take the initial steps in creating the project, to the point where you have named it and have reached the Configure Options screen: follow up to Step 5 in
79
5.2 Creating Projects Using Workbench or the Command Line, p.50, but use the parameters from Table 5-5. 2. 3. 4. Click Advanced > >. Click Add to the right of the Layers box. Browse to the directory containing the rtcore layer, as shown in Table 5-4, to include it in the project. Workbench scans the new layer while you wait. The Workbench installation directory contains some layers, such as the kernel implementation in the layer wrlinux-3.0/layers/wrll-linux-2.6.27. However, the layers you choose to add to the project come from other directories. 5. Verify that your changes are working properly: a. b. c. 6. Observe that the kernel select field automatically changes to rtcore. Click Remove to delete this layer. Notice that Workbench rescans the environment that no longer contains the layer. The kernel select field automatically reverts to standard.
Click OK.
Reloading Changes
The Reload button in the layer list refreshes the list after you add, remove, or reorder list items. Without the Reload facility, you would have to wait for Workbench to reorder changes in the list every time you made a single change, rather than wait until you are done changing the list, then re-ordering it all act once. The Reload button only enables when you have made changes. When it is enabled, Workbench disables the Finish button.
80
5 Developing Platform Projects 5.8 Customizing Builds with Layers, Templates, and Profiles
Figure 5-7
The Configure Options dialog box displays a message that reminds you to reload.
81
Click Template... or Profile.. to select one or more templates or profiles to add to the platform project.
Figure 5-8
Note that you can select <no_kernel >, <no_rootfs >, and/or <no_board >. This lets you create a project with only a rootfs or only a kernel, or a kernel and/or file system, but no board, as has been possible from the command line. For <no_board >, see Wind River Linux Users Guide: Identifying Explicit and Implicit Templates. (Figure 5-8 shows that <no_kernel > has been selected.)
82
6
Configuring Platform Kernels
6.1 Introduction 83 6.2 Configuring Wind River Linux Platform Kernels 84 6.3 Prepopulating LKM Projects 87 6.4 Adding Kernel Modules to the Platform 87
6.1 Introduction
This chapter explains the following topics:
Configuring platform kernels Adding kernel modules to a platform Working with packages, build targets, and target file systems Handling RPMs Managing patches Automating target deployment.
83
Figure 6-1
Kernel Requirements
Kernel Modules
Setup
Templates Layers Packages RPMs, CVS, . . .,
Relevant Tools
Dependencies Filters Kconfig POSIX Signals QEMU Wind River Debugger
Develop
Config Edit Compile On-Host Workbench
Diagnose
Kernel Deliverables
Kernel Kernel Modules Patches
Deploy Debug Test On-Host Workbench & Target
Other Tools
Build Target Bus Options (CPU)
Optimize
System Layout Views Profiles Static Analysis Cores Footprint Workbench, Eclipse, Target
Figure 6-1 shows that configuring Wind River Linux platform kernels involves working with kernel modules, build targets, and options such as bus parameters. In addition, you can add build targets suitable for use by analysis tools. Note that this figure does not address the product life cycle aspects of kernel deployment, diagnosis, optimization, and delivery. For those, see:
Part V. Deploying to Your Board 16. Debugging Kernel Space 12.2 Working with Kernel Modules on the Target, p.149 19.5 Providing Kernels and Modules for Platforms, p.232
84
6 Configuring Platform Kernels 6.2 Configuring Wind River Linux Platform Kernels
the major uses of the kernel configuration tools. For detailed reference information on the Kernel Configuration node, see the Wind River Workbench User Interface Reference: Kernel Configuration Editor. For Wind River Linux Platform projects, Workbench provides a Kernel Configuration node that presents the standard Linux configuration choices in a GUI that shows inter-dependencies and provides additional information on each configuration option. If you prefer, you can use the menuconfig or xconfig interface, either from the command line or by clicking the menuconfig or xconfig nodes in the platform project.
The Overview tab displays the project configuration. This corresponds to the choices you made when creating a new Wind River Linux Platform project. The command-line arguments supplied to the configure command to create the initial configuration are shown at the bottom of the view.
Configuration Tab
The Configuration tab consists of two panels. The top panel presents the items for configuration that may be familiar to you from using menuconfig or xconfig to configure kernels. The lower panel consists of three tabs, Help, Dependencies, and Kconfig, that provide additional information on the items you select in the top panel.
NOTE: By moving your cursor around inside the Kernel Configuration view, you can find the drag points to enlarge view sections.
When you select an item in the top panel, help appears in the Help tab. Select the Dependencies tab to see any items your selected item depends on, or items that depend on it. Double-click any item dependency to move to it in the top panel. Select the Kconfig tab to see the definition of the item and the file system location where it is defined. If you click the file path link shown in blue, Workbench adds the file to the Edit view and you are placed at the location of the item definition.
85
Create a new kernel configuration by modifying the settings of menu items in the top panel. The current configuration status of items is indicated by the icons associated with them. (For a detailed description of the icons in the menu, see the second table, which is for Linux, in Wind River Workbench User Interface Reference: Kernel Configuration Quick Reference.) The Configuration view does not show all items, because some of them are disabled due to dependency conditions. To view all items, including disabled items, right-click in the Configuration view and select Filters > Show All. The disabled items are shown as grayed-out. You can still select them and view the Dependencies tab to see the reasons they are disabled.
Modifying the Configuration
For example, if you want your kernel to include support for PCMCIA or CardBus cards, find Bus options in the scroll-down list, click the arrow to expand it, and then click the arrow next to PCCard. This displays the entry for PCCard support. This is a tri-state configuration item which can be set to n for not included, m for included as module, or y for built-in. Double-click the item to change the setting. See the Help tab for details on what the settings mean for each particular item. To find options, use Edit > Find. For example, to find options concerned with USB support, select Edit > Find and enter the string USB. To generate the new kernel, right-click reconfig in the project folder and select Build Target. To save the configuration file, select File > Save. If you make any changes to the kernel using the Kernel Configurator (or menuconfig/xconfig), you need to rebuild the kernel to have the changes applied. To rebuild the kernel in Workbench, right-click the build target kernel_rebuild, and selecting Build Target. (On the command line you would use the make -C build linux.rebuild command.)
NOTE: When a project is configured, a symlink to a default kernel is placed in the export directory. You can use this kernel immediately after you build a file system. If, however, you configured the project with layers or templates that modify the kernel (for example by adding the analysis layer) you should rebuild the kernel since the default kernel image will be missing this content,
86
This template code file gives you a head start in creating your own source. It contains a properly formatted and buildable kernel module. It includes a working init handler, a simple kernel thread routine started by init, and a working exit handler. You can use this code to as a basis to writing your own custom kernel module. Note that the sample kernel module testmod provides additional features, for example using a kernel timer, and providing parameter access and control from user space.
NOTE: You will not see this option when you import a command-line LKM project or one of the example projects.
87
Guide: Structuring Projects. 2. 3. 4. Right-click and select New > Wind River Linux Kernel Module Project. Assign a name to your kernel module project and click Next. If you have highlighted a superproject, select it as a superproject for this kernel module and click Next. The following screenshot shows a project being assigned the superproject role.
5.
Note that the Linux kernel information at the bottom of the dialog is already populated because the values have been imported from the platform superproject. Click Finish.
6.
88
The kernel module project now appears as subproject of the platform superproject in the Project Explorer. 7. Import source files: a. b. c. Right-click the new kernel module project and select Import > General > File System. Browse to installDir/wrlinux-3.0/samples/moduledebug_2_6. Click OK.
6
d. Select the files bpHere.c and moduledebug.c. You could of course import your own source files. The files in this example demonstrate kernel module builds and testing: moduledebug.c provides the module init and exit points, and bpHere.c sets a breakpoint. e. Click Finish.
You can now build the module, deploy it, and test it.
89
90
7
Feature Templates and Profiles
7.1 Introduction 91 7.2 Feature Templates 92 7.3 Profile Basics 93 7.4 Templates and Profiles in the Platform Project Wizard 94
7.1 Introduction
You can use the Project Wizard to add templates or profiles. See 5.8 Customizing Builds with Layers, Templates, and Profiles, p.75). Notice that templates are named depending on their type:
Kernel-specific templates prefix their names with the word KERNEL, as in KERNEL:squashfs. File-system templates use ROOTFS as a prefix, for example, ROOTFS:Debug, where Debug is the name of a profile.
NOTE: Workbench automatically adds this template if you select a small filesystem when youre in the Project Wizard.
91
And see also 5.8 Customizing Builds with Layers, Templates, and Profiles, p.75, for a general discussion. For supplied templates and features, see Table 5-3, Some of the Supplied Templates, particularly the various feature templates.
92
Packagethe lowest common denominator Componenta group of packages delivering a named functionality Profilea group of components delivering a vertical solution, for example, a smart phone, a feature phone, or an MP3 player
93
94
PA R T II I
Developing Applications
8 9 10 If Youre an Application Developer ................... 97 Sysroots, Build Specs, and Properties ............ 111 Importing Packages ........................................... 117
95
96
8
If Youre an Application Developer
8.1 Introduction 97 8.2 Creating Applications 98 8.3 Running Applications 106 8.4 Changing Build Specs and Properties 109
8.1 Introduction
This chapter tells you how to:
Create or configure, build, and run applications. Change application build properties such as build specs, libraries, header files, build output location, the actual build command, and so on.
The application development part of the life cycle primarily concentrates on the Develop and Diagnose stages, using tools shown in the middle column. The main deliverables (see Figure 8-1) include application binaries, other files, unit tests, and documentation.
97
Figure 8-1
Application Requirements
Application Source Docs Sysroots
Setup
Templates Layers Packages RPMs, CVS, . . .,
Relevant Tools
Launch Configurations Packages, Files
Develop
Config Edit Compile On-Host Workbench
Diagnose
Application Deliverables
Binaries Other Files Packages Patches Unit Tests
Deploy Debug Test On-Host Workbench & Target
Other Tools
Edit, Script, Make Coverage Package Manager
Optimize
System Layout Views Profiles Static Analysis Cores Footprint Workbench, Eclipse, Target
Much of application development in terms of editing and compiling source is described in the Wind River Workbench Users Guide. Also, note that this current chapter does not explain how to deploy, debug, and test an application. For that information, see Part VI. Debugging and Analyzing, as well as related chapters in the Wind River Workbench Users Guide.
Your development environment, as explained in this section. One or more of the simple examples presented in this section.
98
99
Required Data
Notes
Installation of samples
This was done when you installed Workbench. Confirm that you have directory installDir/wrlinux-3.0/samples
It needs only a few GUI actions. It is documented more thoroughly in the Wind River Workbench Users Guide: Creating Native Application Projects.
To build hello_world: 1. 2. 3. Right-click anywhere in the Project Explorer (at the upper left of the Workbench perspective) and select New > Example. In the Select a Wizard page, choose Native Sample Project and click Next. In the Sample Project Template page, select The Hello World Demonstration Program and click Finish. Workbench creates the hello_world project. The sample project contains all the necessary files to build the program. 4. Right-click the hello_world_Native project folder and select Build Project. Workbench builds the executable, and the Build Console at the bottom of the Workbench perspective shows the build output. 5. Expand the hello_world_Native project folder in the Project Explorer, and expand the Binaries node to see the executable hello_world_Native. This is the build result.
100
Your compiled hello_world application is now ready to run on your target. Because native host applications do not need a target to be configured, you can run this right now, as described in 8.3.1 By Example: Running hello_world, a Native Application, p.106.
Required Data
Notes
Installation of samples
This was done when you installed Workbench. Confirm that you have directory installDir/wrlinux-3.0/samples
It is not documented in the Wind River Workbench Users Guide. It is a more complex project than ball and is used as an example later in this guide. Unlike the hello_world native application, it requires an emulated or actual hardware target.
101
To build Penguin: 1. 2. 3. 4. 5. Right-click anywhere in the Project Explorer (at the upper left of the Workbench perspective) and select New > Example. In the Select a Wizard page, choose Wind River Linux Application Sample Project and click Next. In the Sample Project Template page, select The Penguin Demonstration Program, and click Finish. Workbench creates the Penguin application project. The sample project contains all the necessary files to build the program. Right-click the penguin project folder and select Build Project. Workbench builds the executable, and the Build Console at the bottom of the Workbench perspective shows the build output. 6. Expand the penguin project folder in the Project Explorer, and expand the Binaries node to see the executable penguin.out. This is the build result.
The compiled Penguin application is now ready to run on your target. For information on running the application, see 8.3.2 Running Non-Native Mode Applications, p.108.
102
Required Data
Notes
This was created when you installed Workbench. Confirm that you have the directory installDir/wrlinux-3.0/samples/penguin/source.
The following table shows the GUI entries for this example.
Table 8-4 Basic Application Data for Importing Penguin Source
Data
Field in GUI
Entry
Project name
Project name
MyPenguin
To import source files for an application: 1. 2. 3. 4. 5. 6. Right-click in the Project Explorer, choose New > Wind River Linux Application Project, and enter the project name. Click Finish. Right-click the MyPenguin project and choose Import. Choose General > File System and click Next. Next to the From directory field, click Browse. In the Import from directory dialog box that appears, find the source directory for the files to be imported:
103
7.
In the Import dialog, Workbench warns you that no files have been selected yet, although you have chosen the directory:
8.
Select the checkbox either for the entire directory or for each individual file that you want to import:
104
9. 10. 11.
Optionally, you can specify the folder to contain the imports, and the options to overwrite, create complete folder structure, or create selected folders only. Click Finish. Workbench imports the files into your application project:
105
Right-click the project name, select Build Project, and click Generate Includes. Click Next, Next, and Finish. Check the Build Console and make changes to your project until it builds correctly. In the example below, the build fails because rand has not been defined:
Required Data
Notes
Configure and build hello_world See 8.2.3 By Example: Building hello_world, p.100
106
To run a native application such as hello_world, use the following steps: 1. 2. Right-click the project and choose Run Linux Application Process. Click Run to accept the configuration launch defaults:
107
3.
4.
108
Right-click your application project and choose Properties. Click Build Properties. Use the appropriate tab, depending on which properties you want to change:
7
Build Support and Specs Build Tools Build Macros Build Paths Libraries
Use IDE-generated makefiles; specify build command and build specs Specify build tool (assembler, compiler, linker, librarian); output generation; build-spec-specific settings and so on Build macro definitions; spec-specific settings Redirection root directory, build spec settings, include paths Libraries per specified active build spec
109
110
9
Sysroots, Build Specs, and Properties
9.1 Introduction 111 9.2 Importing Sysroots 112 9.3 Importing Build Specs 113 9.4 Changing Build Properties 114
9.1 Introduction
A board support package (BSP) is a collection of files that allow the creation and use of Linux kernels and file systems on a particular target hardware system, such as a reference board, or possibly a custom piece of hardware. Configuration files are central to a BSP because they integrate it with the Wind River Linux build system and environment, so you can use the standard build system and packages. A BSP may also contain drivers or other code. A build spec is a particular set of build settings appropriate for a specific target board used by Workbench application projects. The BSP determines the build specs that are initially available for a project. Sysroots, which can source one or more build specs for Workbench application projects, provide the libraries, header files, and other files and directories that are essential to the infrastructure of your projects. Sysroots provide the capability of cross building.
111
NOTE: Build specs are dynamically derived from the installed board templates or the extended templates from layers. It is not necessary to install additional sysroots for application development.
112
The sysroots that you see are available to you either because you or a platform developer exported them earlier (see 19.3 Exporting and Copying Sysroots, p.229), or because you have added them as described above. 5. Select the desired spec and click Finish.
113
114
5.
Workbench displays the build specs name on the Build Targets node, shown below as arm_versatile_926ejs-glibc-std-armv5tel_vfp-wrlinux_2_0.
115
Required Data
Notes
Source is in installDir/wrlinux-3.0/samples
Choose Properties > Build Properties > Build Macros. Click the down arrow for Active build spec. Choose common_pc-glibc_std-i686-wrlinux_2_0 and click OK. Verify that you have changed the target for penguin:
116
10
Importing Packages
10.1 Introduction 117 10.2 Overview of the User Space Configuration Tool 118 10.3 Importing Classic Packages from the Installation 119 10.4 Importing Source RPM Packages from the Web 121 10.5 Importing Wind River Linux Packages 123
10.1 Introduction
Wind River Linux provides an import package script that lets you:
Import a source package archive to the project packages directory. Create a project dist directory and wrapper Makefile for the package. Create a placeholder RPM file in the Workbench Package Manager. Create a preliminary pkg-wr-integration.patch file, and set it as the top-most patch file for Quilt in the patches.list file. Insert a %configure_target directive after %build and %install section heads.
NOTE: The import package script is also accessible from the command line.
117
Once you have imported a package, you can capture the new package and its controlling dist Makefile to a layer, using the export-layer command. See 20.2.2 Tailoring and Exporting a Layer, p.237, and 20.3.1 Making a Layer Available, p.238.
10.3 Importing Classic Packages from the Installation, p.119 10.4 Importing Source RPM Packages from the Web, p.121 10.5 Importing Wind River Linux Packages, p.123
3. 4. 5. 6.
Browse for and select the package you want to import to display the package, the package list, package name, and version in the Package Import Tool. Click Go to open a shell window and display the script activity. Press Enter until you exit the shell. When the import tool completes satisfactorily, click Close.
Simply importing a package does not necessarily mean the package is usable. For example, you might need to configure the package for cross-compilation.
118
To import a classic package: 1. 2. 3. 4. 5. 6. 7. 8. 9. Open the User Space Configuration tool. From the Installable Package list, click Import. The Package Import tool opens. Click Import Package. Select File and then click Browse to locate the archive for this example:
installDir/wrlinux-3.0/layers/wrll-wrlinux/packages/package.tar.gz
Click Go to open a shell window and display the script activity. Press Enter until you exit the shell. When the import tool completes satisfactorily, click Close to allow other Workbench actions, such as builds or Quilt actions. From Installed Packages, select the new entry and then click the Targets tab. Click patch. This step updates the controlling dist Makefile to adapt it to the wrlinux build environment. The patch target rule unpacks the new package and adds the default patches.
10.
Link or refresh the build directory link by performing one of the following actions:
If the build directory is already present, right-click it and then select Refresh to see the updated package directory contents. If it is not present, right-click the project and then select Add Links to Development Folders.
119
however, you can also re-use fixes that have already been created. 2. Return to the User Space Configuration, select the package entry, and click Build in the Targets tab. The build completes and generates its RPM files. If the build fails, repeat the steps of editing the dist Makefile file and building it until your build succeeds. For more examples and instructions for making packages cross compile, see the Wind River Linux Users Guide. 3. Modify the package as desired. Use Quilt > Add New File to Top Path to add any files you are going to modify, so that the changes can be captured back into patch files. (Optional) To start a new patch file (rather than use the default top-most path file) select Quilt > New Patch. Browse to the patch file to examine its contents (and the files it affects): open the virtual node patches tree and/or find build/package/patches.
4. 5.
To reuse fixes already prepared for this package in the wrlinux installation: 1. 2. 3. 4. Open the User Space Configuration tool. Select the new package and click distclean in the Target tab. Right-click the project and select Open Workbench development shell. In the development shell, enter the following commands:
$ cd ../project_prj $ rm -rf dist/package*
120
10 Importing Packages 10.4 Importing Source RPM Packages from the Web
5. 6. 7.
121
NOTE: The %configure_target RPM macro is added after every %build and %install section header. There is one %build and one %install used in this example.
4. 5.
Right-click the spec file, select Add File to Top Patch, and click OK to accept the change. Use the Workbench text editor to make the following change to the dos2unix.spec file: a. b. c. Immediately following every %build and %install section header, add the %configure_target RPM macro. (Optional) Add a change indicator (such as -WR), to the Release line. (Optional) Add an entry to changelog.
6. 7.
Right-click the spec file, select Quilt > Refresh Top Patch. Click OK. The modified dos2unix-wr-integration.patch file is located in the build/dos2unix-3.1-28.fc7/patches directory.
NOTE: For more information about patching, see 11. Patching Packages.
4.
NOTE: You can also use this procedure to import other packages.
122
5. 6. 7.
Click Go to open a shell window and display the script activity. Press Enter until you exit the shell. Click Close to return to the User Space Configuration tool.
Continue by building the package to the patch state. If you want to customize the package, select it, then click Patch in the Targets tab. The patch target rule unpacks the new package and adds the default patches. For instructions, see 10.4.1 Updating the Package Spec File, p.121.
123
124
PA R T I V
Developing Packages
11 12 Patching Packages ............................................. 127 Managing Packages on Live Targets ................ 149
125
126
11
Patching Packages
11.1 Introduction 127 11.2 Patching and Exporting Patches to Layers 131 11.3 Using Quilt Basics 135 11.4 Patching SRPM Packages 139 11.5 Manually Patching Classic Source Files 144
11.1 Introduction
The Wind River Linux build system uses the Quilt patching model. Quilt lets you easily add a series of patches, where each patch may contain multiple files. Quilt tracks changes made by each patch. You can apply these, un-apply them, refresh them, and so on. Quilt patches are managed as a stack and applied incrementally on top of the base virtual folder tree in addition to all preceding patches. They can be pushed to and popped from the top of the stack. By default, most commands apply to the top-most patch on the stack.
127
Quilt is based on the patch package, with an additional set of patching features, which include:
Pushing new patches to go forward Popping patches to go backward Capturing development changes into new patches Deriving patch annotation data
For more about using Quilt, see Andreas Grnbachers How To Survive With Many Patches or Introduction to Quilt, http://www.suse.de/~agruen/quilt.pdf. For information about resolving issues such as path names, fuzz factor, whitespace, and patch reverse situations, see Applying and Resolving Patches in the Wind River Linux Users Guide: Patch Principles and Workflow.
Product designers decide which template or layer should contain the patch. Individual developers: a. Create a project and import the template or layer to contain the patches.
NOTE: Typically, the more general the layer containing the patch, the greater the scope of testing required. Automated test tools and procedures can help keep the code base correct.
b. c.
Locally develop new code and new patches to extend existing code. Validate work against the central code base before checking in changes and patches.
d. Check in changes.
128
10
Allow the package to cross-compile in the build system. Apply Linux source community patches. Modify the contents and behavior to meet customer requirements.
You can see a packages list of existing Quilt patches if you look in the Quilt Patches folder in the Project Explorer. This patch list is fully manageable by Quilt commands, including pop and push.
129
NOTE: For more details, and for help creating an exact spec file replacement that
doesnt need a patch file, see the Wind River Linux Users Guide: Adding Packages. Second, once the SRPM package is fully unpacked, the inner file content of the package is visible and available. You can use the standard Quilt commands to create new patches for these files. However, to preserve the changes, you must register the new patch files in the spec file, and add the new patch file names to the rpm_patches.list file in the installations layers/wrll-wrlinux/dist/package/patches directory. You can see the spec files list of existing file content patches under the Project Explorer folder SRPM Patches. This patch list is managed only by the spec file, and is provided for reference and patching transparency.
Table 11-1
Command
Function
Add File to Top Patch Add New File to Top Patch Annotate File Compare With Delete Patch Export Patch
Adds one or more files to the top-most or named patch. Adds a new file. Displays an annotated listing of the specified file, showing which patches modify which lines. Compares (using diff) the specified files in the top-most or specified patch. Removes the specific or top-most patch. Exports an existing or new patch file from your platform project to an external file so that it can be shared. You can also import the exported patch file into a different project.
130
Table 11-1
Command
Function
Displays the list of files that the specific or top-most patch modifies. Integrates a patch into the top-most patch. Specify the file directly or browse to it. The tree displays the patch contents to verify the patch. Imports external patches, following the current top-most patch. Creates a new patch with a specified name and inserts it after the top-most patch. The patch name in the tree specifies whether or not the patch is loaded. Lists the patches that modified a specified file. Removes one or more patches from the stack of applied patches. Click Details to list the patches that have been removed and/or restored as a result of the pop. Applies one or more patches from the series file. Click Details to list the files patched by the push. Refreshes a specific patch or the default top-most one. Synchronizes information that Workbench has cached (such as command-line use of Quilt). Renames a specific or top-most patch. Removes file(s) from the named or top-most patch.
10
Patches Pop
Push Refresh Top Patch Reload Rename Patch Remove File from Patch
131
1. 2. 3. 4. 5.
Step 2:
Create a Platform Project. Open its User Space Configuration node. Select the wrproxy package. Click the Targets tab, and click Patch. Right-click the project, and select Add Links to Development Folders.
1. 2.
Open the project tree build > wrproxy > Quilt Patches. Observe that the patch kerntree.patch is the top-most patch (in bold).
132
3. 4.
Open the list under kerntree.patch, and double-click the file wrProxyTipcSockLib.c. Make a minor text addition such as in the copyright area, and select File > Save.
Step 3:
1. 2. 3. 4. 5. 6.
Step 4:
Right-click kerntree.patch, or another patch of your choosing, and select Quilt > Refresh Top Patch. Right-click it again and select Export Patch to Layer. Reset the layer path to installDir/wrlinux-3.0/layers/wrll-wrlinux, if it is not this path already. Select the layer to receive the patch. Add a quick description, and click OK. Click OK in the resulting dialog.
10
1. 2. 3. 4.
Step 5:
Open User Space Configuration in a project. Select the wrproxy package. Click the Targets tab, and click distclean and then patch. Right-click the build tree, and select Refresh.
1. 2.
Open the User Space Configuration node onto the Package Manager. Select the acpid package.
133
3. 4. 5.
Step 2:
Click the Targets tab, and click patch. Open the project tree build > acpid-1.0.6.7-fc9 > Quilt Patches. Observe that patch pkgname-wr-integration.patch is the top-most patch.
1.
Right-click the pkgname-wr-integration.patch, select Quilt > New Patch, and give it the name myChanges.patch.
NOTE: You may need to click on the package-version node and choose Refresh to see the new top patch.
2. 3. 4.
Step 3:
Open the tree to build > acpid-1.0.6.7-fc9 > BUILD > acpid-1.0.6, and double-click acpi_listen.c. Right-click acpi_listen.c, and select Quilt > Add to Top Patch. Make a minor text addition in the copyright area, and select File > Save.
1. 2. 3. 4.
Step 4:
Right-click myChanges.patch, and select Quilt > Refresh Top Patch. Right-click it again and select Export Patch to Layer. Add a description, and click OK. Click OK in the resulting dialog.
1. 2. 3. 4. 5.
Open the projects User Space Configuration node onto the Package Manager. Select the acpid package. Click the Targets tab, and click distclean and then patch. Right-click the build tree, and select Refresh. Open the acpid package under build, and observe that the change is now automatic, and that the custom Quilt patch is now an SRPM patch.
NOTE: SRPM patches are managed by the package's spec file. The techniques just demonstrated show how to use Quilt to create a new patch for the inner files of an SRPM package, and then promote it to a formal SRPM patch by adding it to rpm_patches.list and to the spec file. The Export to Layers script does exactly that. This Quilt patch then becomes an SRPM patch, and is no longer managed by Quilt.
134
10
build, so you can start working directly with the package builds dist, so you can work with local package wrapper Makefile and patches
They have the same content as ProjName_prj/build and ProjName_prj/dist. 3. Open the Package Manager by double-clicking the projects User Space Configuration node. (Click Yes to initialize the prebuilt PM package folder.)
135
Figure 11-1
3. 4.
Expand the package-version folder to display the Quilt Patches node. Right-click the Quilt Patches node to open the Quilt menu.
At this point, the build folder in the Project Explorer stops looking like the build directory in ProjName_prj. You can expand Quilt patches to display the patches applied. You can further expand the files that are part of a patch: for example, right-click a source file such as boa.c and use the Quilt menu Annotate File to annotate it. For more information, see 11.3.5 Viewing Patch Annotations, p.138.
136
Workbench adds the patch file to the package patch list file and places it in the Quilt Patches folder.
10
2. 3.
Open the build folder, then package-version, then Quilt Patches (a virtual folder displaying the Quilt-applied patches). Right-click this folder, select Quilt > New Patch, and enter a descriptive name such as New_Boa_Patch. An Info alert pops up, reporting that New_Boa_Patch is now on top.
4.
Click OK.
137
138
10
To unpack and apply current patches to the spec file: 1. 2. 3. 4. Open a platform project. Double-click User Space Configuration to open the Package Manager. Select the package, click the Targets tab, and click patch. Right-click your project and select Add Links to Development Folders. The build tree displays in the Project Explorer. 5. 6.
Step 2:
Open the build tree and browse to package-version > Quilt Patches > package-wr-integration.patch. Open the SPECS/package.spec file, which is the Quilt patch-managed file.
Modify it
7. 8. 9.
Change one of the initial comment lines, for example.) Select File > Save to save your changes. In the Package Manager, click build or rebuild (in the Targets tab) to verify your changes.
139
Step 3:
Save it
1. 2. 3.
Right-click the package-wr-integration.patch node and select Quilt > Refresh Top Patch. Right-click wr-integration.patch again and select Quilt > Export Patch. Save the patch in installDir /wrlinux-3.0/layers/wrll-wrlinux/dist/package/patches:
Back up the previous version and then save the new patch file.
4. 5.
You do not need to update the patches.list file because this patch file is already registered. Append the patch file name to the patches.list file, for example:
# This comment explains the purpose of this patch Newbzip2-wr-integration.patch
NOTE: If you shared the patches and the patches.list file does not exist, create
1. 2. 3.
Open the Package Manager and select the package. From the Target tab, click distclean. Click patch. Your changes are applied to the spec file.
140
During the unpacking and patching process, Quilt patches the spec file and then the spec file applies all of its patches to the package source.
NOTE: Ignore errors like cat: write error: Broken pipe. These messages are a
passive artifact of Quilt. To patch an SRPM source file: 1. 2. 3. 4. 5. Create a new top patch file. Save your patch file to the installation or layer location. Add the new patch file to the SRPM rpm_patch.list patch list file. Register the new patch file in the package spec file. Update and save the spec file registration change in its respective wr-integration.patch file.
10
If you patch an automake-managed file like a .am file, you may find that the package already includes the corresponding .in file. If so, patch both files to be safe. Likewise, if you modify a .in file, you should patch the parent .am file, in case working with the package triggers an automatic reconfiguration (autoreconf).
You can modify any package patch file to customize your installation. 1. 2. 3. 4. 5. Browse the build > package-version source tree and select a source file. Right-click the file and select Quilt > Add New File to Top Patch. Modify the file and select File > Save to save your changes. Right-click the file again and select Quilt > Refresh Top Patch to capture the changes to your new patch file. Double-click User Space Configuration, and in the Targets tab click build or rebuild to verify your changes.
1. 2.
Right-click the SRPM patch file and select Quilt > Export Patch. Save your patch to installDir /wrlinux-3.0/layers/wrll-wrlinux/dist/package/patches.
141
The working patch file is inside the package build directory, under the wrlinux_quilt_patches directory. 3. Create or append the rpm_patches.list file with the patch file name and description. For example:
# This comment explains the purpose of this patch coreutils_custom_EXTRA_DIST.patch
4.
Modify the patch file context in the saved patch file, so that it matches the context that the SRPM spec file uses: a. b. Open each patch file. Remove the a/build/ and b/build/ prefixes and then append a unique tag (such as .orig) to the original file name, for example: i. Remove the a/build/ and b/build/ prefixes:
--- a/BUILD/coreutils-6.9/Makefile.am +++ b/BUILD/coreutils-6.9/Makefile.am
1. 2.
Open the wr-integration.patch tree and double-click the SPECS/pkg.spec file. Register this new patch as the last patch. Locate the last entry (such as Patch5003:) in the spec file. For example:
... Patch5002: coreutils-6.9.2-cross_compiling_no.patch Patch5003: coreutils-6.9.2-custom_EXTRA_DIST.patch
3. 4.
Add your patch entry after the last Patchxxxx: entry in the spec file. (Optional) Add parameters to customize the patch command. For example:
Use the -p1 parameter to ignore coreutils-6.9/ filename prefixes. Use -b to generate a back-up file before patching the original.
The %patch macro automatically adds a prefix to the package name, version number, and post-fixes the .patch extension. For example:
... %patch5002 -p1 -b .cross_compiling_no %patch5002 -p1 -b .custom_EXTRA_DIST
5.
142
The package-wr-integration.patch file tracks all changes to the spec file. To preserve the changes to the spec file as a patch: 1. 2. 3. 4. Pop the source file patch or patches to get the wr-integration patch back to the top-most location on the stack. Right-click package-wr-integration.patch and select Quilt > Refresh Top Patch. Right-click package-wr-integration.patch and select Quilt > Export Patch. Save the patch in installDir /wrlinux-3.0/layers/wrll-wrlinux/dist/package/patches. You do not need to update the patches.list file because this patch is already registered in it. 5. 6. Open the project build/pkg-version/Quilt Patches virtual folder in the Project Explorer. Right-click the project and select Quilt > Pop until wr-integration.patch appears in bold, indicating that it is on top again. The popped patch files appear in italics.
10
Registered and listed filename spellings are correct. The syntax in the spec file is appropriate. The patches are in the proper order.
143
The before/after filename entries are listed in the source patch file.
5. 6.
(Optional) Repeat the package distclean and patch rules until all errors are resolved. Select the package build rule to compile the full package.
144
2. 3. 4. 5. 6.
Double-click User Space Configuration to open the Package Manager. Select the package, click the Targets tab, and click patch. Right-click the project and select Add Links to Development Folders. The build tree displays in the Project Explorer. Open the build tree and browse to build > package-version > Quilt Patches (a virtual folder displaying the Quilt-applied patches). Right-click this folder, select Quilt > New Patch, and enter a descriptive file name (for example, coreutils-6.9.2-custom_EXTRA_DIST.patch). If the package build folder does not display or is out-dated, right-click the build tree and select Refresh.
NOTE: You can create several new patch files containing any set of source file
changes. To switch between each patch file, right-click the project and select Quilt > Pop or Quilt > Push.
10
145
4. 5.
Modify the file and select File > Save to save your changes. Right-click the file and select Quilt > Refresh Top Patch to capture the changes to your new patch file, then click OK when the Info popup reports the refresh by name (for example, Refreshed patch New_Boa_Patch.) Double-click the User Space Configuration node, and, in the Targets tab, click build or rebuild to verify your changes.
6.
1.
Right-click the new patch file and then select Quilt > Export Patch. For example, right-click the New_Boa_Patch:
2.
146
3.
To save the patch in your own workspace, as in the following screenshot, accept the default wrlinux_quilt_patches folder, which in this example will be Workspace/my_arm_prj/build/boa-0.94.13/wrlinux_quilt_patches.
10
4.
NOTE: If patches.list does not exist, create it and add the patch filename(s).
5.
Repeat these steps if you have any additional patch files to export. Keep the entries in the patches.list file in the order you want them applied.
147
148
12
Managing Packages on Live Targets
12.1 Introduction 149 12.2 Working with Kernel Modules on the Target 149 12.3 Working with RPMs on the Target 151
12.1 Introduction
This section tells you how to put (and remove) RPMs and kernel modules on a target. You can also launch RPMs on a live target and replace them live.
149
8.
To remove a kernel module using Workbench, first check that there are no errors in the Workbench Console view, and then right-click the .ko file and select Remove Module.
150
12 Managing Packages on Live Targets 12.3 Working with RPMs on the Target
If you have requested an RPM install on the running target, the installation time depends on the size and complexity. (Operations other than installing are generally much faster.)
151
Optional: right-click the entry iptables-ipv6 and select Install. This returns an error message that indicates the prerequisite for installing this RPM:
error: Failed dependencies: iptables = 1.3.7 is needed by iptables-ipv6-1.3.7-2_WR3.0bl.armv5tel_vfp /lib/iptables is needed by iptables-ipv6-1.3.7-2_WR3.0bl.armv5tel_vfp
3.
Install the replacement(s) for the RPM. For example, to re-install what you just removed: a. b. Right-click on the entry iptables and select Install. Right-click on the entry iptables-ipv6 and select Install.
You now have both these packages replaced and running on the target.
152
PA R T V
153
154
13
Assembling File Systems and Kernels
13.1 Introduction 155 13.2 Assembling Your File System 156 13.3 Assembling Your Kernel 156 13.4 More on Build Targets 157 13.5 Adding Applications to Your File System 157 13.6 Collecting Your Files for Export 158
13.1 Introduction
This chapter briefly summarizes how to assemble your file systems and kernels so they can be placed (deployed) onto your target, whether it is physical or emulated, as explained in the next chapter. For more than these brief explanations, see the Wind River Linux Users Guide, particularly the sections on creating run-time systems (in the Design Overview: Build Environment chapter), and the relevant chapters on network or stand-alone deployment.
155
156
12
If you deploy to a QEMU-emulated target, you can put the application binaries and any associated data files into the appropriate locations within the file system that has been created at workspace/ProjectName_prj/export/dist. If you use the dist.tar.bz2 file in workspace/ProjectName_prj/export, which is present as a link in that directory, you must add your application files in a template under the fs node and then do a Build Target on the fs node.
NOTE: Your application and related files must be built into the dist.tar.bz2 file by means of the Build Target action. It does not work to uncompress dist.tar.bz2, add the application files, and then recompress.
157
The kernel and related files as described in 13.3 Assembling Your Kernel, p.156 The run-time file system as described in 13.2 Assembling Your File System, p.156 Any applications and related files, in the dist.tar.bz2 file, as described in 13.5 Adding Applications to Your File System, p.157
You can now plan to: 1. 2. 3. Unpack the file system from dist.tar.bz2 into a location from which it can be exported to a target. Copy the kernel to a similar location from where it can be exported to a target. Continue with chapter 14. Deploying to Targets.
158
14
Deploying to Targets
14.1 Introduction 159 14.2 Introducing Target Deployment 160 14.3 Connecting to Targets in General 162 14.4 Connecting to Emulated Targets 164 14.5 Connecting with KGDB 167 14.6 Using Advanced KGDB Options 170 14.7 Using Target Server Options 171 14.8 Using the Connection Summary Page 172
14.1 Introduction
You must configure and establish a target connection between your host and target machines before you can deploy your projects to the target for testing and debugging. The target connection runs on your host and manages the communications between your host tools and the target system. This chapter provides the information you need to define and configure a remote connection to your target. See also 4.8 Debugging and Deploying, p.41 for an overview of topics such as how usermode-agent is used.
159
Platform Project
Download Directories
Development Host
Target Board
160
Figure 14-2
QEMU Emulation
13
Bootloader
Platform Project
Download Directories
Development Host
161
Define new connections Connect and disconnect targets Modify connection properties
NOTE: After you connect to a target, more commands are enabled on the right-click context menu. See the Wind River Workbench Users Guide.
The Remote Systems view is available through both the Application Development and Device Debug perspectives. If it is not visible, choose Window > Show View > Remote Systems or Window > Show View > Other.
Connection Type
Creates a . . .
Connection to a Linux 3.0 application core dump (for step-by-step instructions, see 18. Analyzing Core Files)
Host Development Target Server Host development connection to a Linux 3.0 application
162
Table 14-1
Connection Type
Creates a . . .
KGDB
Kernel mode connection to a Linux 3.0 version kernel (see 16.6 Debugging User-Supplied Kernel Modules, p.198 and 16.8 Using QEMU for KGDB Kernel Debugging, p.206). RTCore Connection. Usermode connection to the target. Command-line interface to QEMU for KGDB back-end connection debugging. Uses KGDB and OCD-like connection to real board (in emulation)
QEMU Linux User Mode Target Uses usermode-agent for target connection Server (see 15. Debugging User Space).
13
3.
Enter any connection-specific properties. For example, if you select Wind River Linux Host Development Target Server Connection, a Browse button appears for the usermode-agent field. For more information about these options, see 14.7 Using Target Server Options, p.171.
NOTE: Typically, after configuring a new connection, Wind River Workbench automatically attempts a connection. If you do not want an automatic connection, deselect Immediately connect to target if possible.
163
Use the Remote Systems view to create and configure a QEMU connection for an emulated target: 1. 2. Select New > Connection. The Select Remote System Type dialog displays. Select Wind River Linux > Wind River QEMU Linux User Mode Target Server Connection then click Next. The QEMU Simulator Configuration screen appears.
164
3.
Select the project root directory or browse to workspace/projectName_prj then click Next. The following dialog appears.
13
4.
Select the workspace/projectName_prj/export/dist root file system and click Next. This is the file system you want exported to QEMU. The following dialog appears.
165
The object path mappings determine which part of the host file system gets NFS mounted (or mounted by QEMU) on the target. If your default target path is not your workspace (/) directory, or the host path is not your platform_prj/export/dist directory, click Add to specify them. 5. Click Finish. The Virtual-WRLinux0 terminal window opens. It outputs the connection processes. The WRQEMULinuxUser_Project_prj connection appears in the Remote Systems view. This is the target connection that Workbench uses to debug the application on the platform.
NOTE: You might have to log in to the terminal as root, with the password root. If
you are using a small rootFS, you are automatically logged in as root.
166
Connection Type
Linux KGDB via RS232 Linux KGDB via Ethernet Linux KGDB via Terminal Server Custom Linux KGDB Connection
Serial cable connection. Ethernet connection. Connection through a terminal server to the target. No defaults. Used for custom situations. See Wind River Support.
13
The Linux KGDB Connection Properties dialog opens. 3. Select a back end setting from the following list to define how the target server communicates with a target.
Provides . . .
RS232
A direct serial port connection (connection with a null-modem cable). You must specify your serial line settings. A connection to a terminal server with a direct serial connection. An Ethernet connection on the same subnet. Not currently supported.
Select the target processor from the Select menu, or leave the target default to have Workbench identify the target CPU. Specify serial line or remote host settings, depending on the connection template or back-end setting that you have chosen:
167
For serial line settings, enter the standard speed, data, parity, and stop bits, plus flow control. For networked hardware, enter a target name or an IP address , plus a port number (or accept the default 6443.)
6. 7.
Click Next. The Target Operating System Settings dialog opens. Enter the full path name including the kernel symbol file (for example, /home/wbuser/WindRiver/workspace/new_prj/export/vmlinux-symbols). By default, the debug server attempts to load module symbols each time a module is loaded. In the rare cases where you want to download a module or start a process without loading the symbol file, deselect Load module symbols to debug server automatically if possible.
NOTE: The target server must be configured with the same communication back end as the one built for the kernel image and used by the target agent.
8.
To enable the debugger to find symbol files for processes created on the target by creating a correspondence between a path on the target and the appropriate path on the host. To calculate target paths for processes that you want to launch by browsing to them with a host file system browser.
To specify an object file for the debugger to use (or if you are loading object code on the target or associating symbols with previously loaded modules): 1. Right-click a container in the Remote Systems view, then select Load/Add Symbols to Debug Server. A dialog appears with your connection and core already entered. Click Add to add a new object file to the Symbol Files and Order list. Select the file, then click Open. In the Symbol Load Options section, select Specify base start address or Specify start address for each section. Click OK.
2. 3. 4. 5.
168
For more information about the fields in this dialog, click in the Remote Systems view, then press the help key for your host.
The pathname prefix mappings match target path prefixes to host paths. You must use full paths and not relative paths. For example, mapping / to /opt/eldk/ppc_82xx/ tells the debugger that files accessible in / on the target can be found in /opt/eldk/ppc_82xx/ on the host. In most cases, Workbench provides correct defaults. If you need to make changes:
Click Add to add new mappings or select existing mappings. Click Edit to modify existing mappings.
Basename Mappings
13
Use square brackets to enclose each mapping of target file basenames (left element) to host file basenames (right element), separated by a semi-colon (;). Mapping pairs (in square brackets) are separated by commas. You can use an asterisk (*) as a wildcard.For example, if debug versions of files are identified by the extension *.unstripped, the mapping [*;*.unstripped] ensures that the debugger loads yourApp.unstripped when yourApp is launched on the target.
169
Property
Description
Available CPU(s) on target board Initial target state query and settings Target state refresh settings
Workbench correctly identifies the target CPU. In rare cases, a close variant might be misidentified. If so, manually set the CPU. Specify whether or not Workbench should query the target on connect, on stopped events, and/or on running events. You can select all options. Specify that the target state is refreshed only when you manually choose to do so, or if (and how often) the display should be refreshed automatically. Specify whether or not Workbench should listen for life-cycle events.
Advanced Option
Logs communications between agent and server. (See 16.6 Debugging User-Supplied Kernel Modules, p.198.)
For more information on connecting in kernel mode and configuring the target to support KGDB, see 16.8 Using QEMU for KGDB Kernel Debugging, p.206.
170
Enter the following options manually, or click Edit for GUI assisted editing.
Description
Advanced Option
Opens the Edit Target Server Options window. The options are subdivided into three tabbed groupsMemory, Logging, and Symbols. Sets how many seconds the target server waits for an answer from the target before sending a timeout, how often to retry, and at what intervals it should ping the target, (in seconds). The target server maintains a cache on the host system to avoid excessive data-transfer transactions with the target. By default, this cache can expand to 1 MB. A larger maximum cache size may be desirable if the memory pool used by host tools on the target is large, because transactions on memory outside the cache are far slower.
Timeout Options
13
Logging
Options on the logging tab are used mainly by Wind River support for troubleshooting. A maximum size can be specified for each of these files. If so, files are rewritten from the beginning when the maximum size is reached. If the file initially exists, it is deleted. If the target server restarts (for example, reboots), the log file is reset. For the WTX (Wind River Tool Exchange) log file, you can specify a filter (a regular expression that limits the type of information logged). In the absence of a filter, the log captures all WTX communication between host and target. Use this option in consultation with Customer Support.
171
NOTE: The command line field is filled in based on the values you enter in this dialog box.
Target connection configurations are normally only visible for your user-id. If you define it as Shared, other users can also see the configuration in your registry, provided that they connect to your registry (by adding it as a remote registry on their computer, see Wind River Workbench Users Guide: Remote Registries. Typically, when you disconnect a target connection, the target server (and simulator) are killed because they are no longer needed. In a connection that is flagged as Shared however, they are left running so that other users can connect to them. You can flag a connection as shared if you want to keep the target server (and simulator) running after you disconnect or exit Workbench.
Immediately connect to target if possibleIf you do not want to connect to the target immediately, you can connect to the target later using one of the ways described in Wind River Workbench Users Guide: Debugging Projects.
If you have applications ready to run using the connection(s) you have just created, also see Wind River Workbench Users Guide: Launching Programs.
172
PA R T VI
173
174
15
Debugging User Space
15.1 Introduction 175 15.2 Using the Wind River Debugger 176 15.3 Debugging Using GDB 178 15.4 Stepping Through Your Output 178 15.5 Using Dynamic printf Breakpoint Statements 180 15.6 Sending Signals to Processes 181
15.1 Introduction
Wind River Workbench provides two types of user-space application debugging toolsthe Wind River Debugger (WDB) for remote debugging and the GNU Debugger (GDB) for self-hosted debugging. The Wind River Debugger provides Eclipse-based tools specifically intended for debugging user-space applications. GDB is a standard Linux debugging tool included in the Eclipse distribution. Both tools let you step through a compiled program, set breakpoints, and view the original source text simultaneously. You can also analyze a crash using a core dump. The following examples provide the instructions needed to debug the hello_world application using the Wind River Debugger and GDB.
175
For more information, see Knowing Which Debugger Gets the Breakpoints, in Wind River Workbench Users Guide: Working with Breakpoints, or the following website: http://download.eclipse.org/tools/cdt/docs/tutorials/debug_tutorial/cdt_w_ debug.htm. Figure 15-1 illustrates the user space debugging process in a typical product life cycle.
Figure 15-1 Debugging User Space: The Diagnosis Stage of the Product Life Cycle
Setup
Templates Layers Packages RPMs, CVS, . . .,
Relevant Tools
Dynamic printf Launch Configurations Live Package Manager Remote System Explorer POSIX Signals Wind River Debugger
Develop
Config Edit Compile On-Host Workbench
Diagnose
User Space Deliverables
Patches Unit Tests
Deploy Debug Test On-Host Workbench & Target
Other Tools
GDB
Optimize
System Layout Views Profiles Static Analysis Cores Footprint Workbench, Eclipse, Target
176
To debug self-hosted applications from another host, start the usermode-agent on the self-hosted machine as if it were a target, then connect to it from another host.
NOTE: If WRLinuxHost_username is not connected, click Connect in the Debug dialog box.
3. 4.
Right-click WRLinuxHost_username and then, from the Workbench toolbar, select Debug > Debug Process on Target. Locate the Exec Path on Target text box. If there is no default path listed, browse to the location of the hello_world executable. The default location is workspace/hello_world_Native/Linux-gnu-native-3.x/ hello_world_Native /Debug/hello_world_Native. Select hello_world and click OK. Click Debug. The debugger runs and displays your output.
14
5. 6.
177
178
GDB Output
Process ID (PID) in the entry hello_world_Nat: PID (Task Mode). Entry hello_world_Nat: PID (Stopped - Breakpoint Hit). Breakpoint appears as main( ) helloworld.c:8. Execution is stopped at Line 8 in helloworld.c.
Process ID (PID) in the entry hello_world_Nat: PID (Task Mode). Entry hello_world_Nat: PID (Stopped - Step End). Breakpoint appears as main( ) helloworld.c:8. Execution is stopped at Line 8 in helloworld.c.
After you start the debugger, you can choose from the following functions:
Resume Restart a debugging session. Terminate End a debugging session. Disconnect Disconnect a remote host (Wind River remote debugging only). Step Into Single-step through code (step one line at a time.) Step Over Single-step through code without going into subroutines. Step Return After a step, continue execution until the current subroutine completes, then return control to the debugger in the calling statement. Toggle Assembly Stepping Mode Toggle between showing instruction-level steps or source-level steps. Clicking this button also causes Workbench to toggle between showing the Editor or showing the Disassembly view. Drop to Frame Resume until execution returns to the selected stack frame.
14
NOTE: You can use function keys for common activities. For a list, click Run in the Workbench toolbar.
To step through your output: 1. Click Step Over (or press F6). The program counter advances one line in the Editor and Hello World displays in the Console view. If variables are added to helloworld.c (and they have assigned values), click the Variables tab to display them. 2. Click Resume (or press F8) to continue stepping through the program. When the program has completed, the Debug view displays its exit status:
179
GDB Output
<terminated, exit value: 0>hello_world_Nat: PID <terminated, exit value: \ 0>hello_world_Native [C/C++ Local Application]
You can implement these event points as both software and breakpoints, and you can enable, disable, edit, or remove them just like regular breakpoints. To add a dynamic printf event point: 1. 2. Right-click in the editor or in the gutter. Select Add Dynamic printf from the context menu. This brings up the dynamic printf dialog. 3. Use this dialog to specify the printf arguments and other attributes. Workbench fills in the printf arguments for you, depending on their type. 4. Click OK to create the event point. The event point appears in the gutter, like any other breakpoint. For more information on this debugging tool, see Wind River Workbench Users Guide: Dynamic printf Event Points.
180
You can resume a suspended process with or without a signal. The selected process resumes and discards pending signals. In the Debug view:
In both cases, a dialog box opens where you can select a signal and then click OK. The process resumes and immediately receives the selected signal.
181
Attribute
Description
Values
Pass
Controls whether or not a trueProcess silently discards the signal sent to a process should signal. pass. falseProcess cannot silently discard the signal. Controls whether or not the trueSignal suspends the process process should suspend when when the process receives it. it receives the signal. falseProcess continues running after it receives the signal.
Suspend
Terminate Click Terminate. Remove launches Click Remove All Terminated Launches.
182
16
Debugging Kernel Space
16.1 Introduction 184 16.2 Background Steps and Concepts 185 16.3 Preparing the Target for KGDB 190 16.4 Connecting with KGDB from Workbench 192 16.5 Attaching and Debugging the Kernel from Workbench 196 16.6 Debugging User-Supplied Kernel Modules 198 16.7 Creating a Custom Kernel Module 205
16.8 Using QEMU for KGDB Kernel Debugging 206 16.9 Enabling and Disabling KGDB in the Kernel 209
183
16.1 Introduction
Wind River Workbench provides source-level debugging for Linux 2.6 kernels that support the Kernel GNU Debugger (KGDB).
NOTE: If you are not using a Wind River Linux platform, contact Wind River support about configuring your kernel for symbolic debugging with Workbench.
With KGDB installed, you can debug the kernel in the same way that you debug applications, including stepping through code, setting breakpoints, and examining variables. Kernel mode debugging between Workbench and the target takes place over a serial protocol connection, which may be over a serial line or Ethernet.
NOTE: With Wind River Linux, kernel debugging is enabled by default, and you only have to turn it off when going to production.
Wind River is a contributor to the KGDB open source project. Basic information on KGDB can be found at http://sourceforge.net/projects/kgdb/. Wind River has added several features to the mainline KGDB, including:
Functionality that is tested on all supported boards Support for CPU auto-detection Additional flags and test features added to the KGDB agent
For information on using the command line to debug with KGDB, to enable or disable KGDB, or to build your own cross-architecture gdb, see the Wind River Linux Users Guide.
184
Figure 16-1
Debugging Kernel Space: The Diagnose Stage of the Product Life Cycle
Setup
Templates Layers Packages RPMs, CVS, . . .,
Relevant Tools
agent-proxy CPU Auto-Detection NFS-Mounted File System POSIX Signals QEMU Wind River Debugger
Develop
Config Edit Compile On-Host Workbench
Diagnose
Kernel Debug Deliverables
Kernel Modules Patches
Deploy Debug Test On-Host Workbench & Target
Other Tools
KGDB Multiple Connection Types Safe Areas User-Supplied Kernel Modules Wind River Flags and Features
Optimize
System Layout Views Profiles Static Analysis Cores Footprint Workbench, Eclipse, Target
Figure 16-1 illustrates in brief the topics covered by this chapter: various tools that help you debug kernel space.
NOTE: See 15.5 Using Dynamic printf Breakpoint Statements, p.180, for a brief
description of dynamic printf event points, which let you set printf( ) breakpoint statements at run time, without recompilation.
185
Subnet 192.168.99.* Target Kernel IP 192.168.99.123 UDP Port 6443 (kgdboe) Target
186
Figure 16-3
Intranet ETH0: 208.77.190.11 Workbench From: TCP Port 3333 agent-proxy To: 192.168.99.123 UDP Port 6443 ETH1: 192.168.99.11 Development Host Bridging Host
Subnet 192.168.99.*
IP 208.77.188.166
Target
2.
Start a copy of agent-proxy. This will connect the TCP port 3333 to the UDP port 6443 from 192.168.99.123
$ ./agent-proxy 3333 192.168.99.123 udp:6443
3.
Log into the target (192.168.99.123), and enter the following command. This starts the kgdboe agent, connected to the bridging host.
root@target:/> modprobe kgdboe kgdboe=@192.168.99.123/,@192.168.29.11/
4. 5.
Log into the development host on the intranet. Start Workbench and create a kgdboe connection with these parameters:
TRANSPORT=TCP CPU=default IP=208.77.190.11 Port=3333
Workbench connects to the TCP port 3333 on 208.77.190.11, and treats it like a normal KGDB connection.
NOTE: You can have any number of agent-proxy connections running on the bridging host, one for each target within the subnet. Just assign a different TCP port, for example 3334, 3335, 3336, and so forth.
If you run agent-proxy without any parameters, it returns a list of its commands and abilities, as shown below:
$ wrlinux/host-tools/bin/agent-proxy agent-proxy version 1.6
187
Usage: agentproxy <[udp:][virt IP:]local port> <remote host> <[udp:]remote port> For udp wdb agent proxy example for default ports agentproxy udp:0x1001 10.0.0.2 udp:0x4321 agentproxy udp:0x1002 remotehost2 udp:0x4321 For KGDB udp target to udp host with default g agentproxy udp:3331 10.0.0.2 udp:6443 For KGDB udp target to tcp host with default g agentproxy 3332 10.0.0.3 udp:6443 Also you can bind to a local vitual interface IE: agentproxy udp:47.1.1.2:0x4321 10.0.0.2 udp:0x4321 agentproxy udp:47.1.1.3:0x4321 10.0.0.3 udp:0x4321 agentproxy udp:47.1.1.3:6443 10.0.0.3 udp:6443 agentproxy 47.1.1.3:44444 10.0.0.3 44444
The KGDB over serial connection does not have this limitation. You will need a physical serial cable that can make the connection; or, alternatively, you can set up a Telnet port repeater that connects the serial connection to a Telnet port on the intranet.
4.
Mount this directory. In this example, the many lab boards get their root file systems from NFS directories on a shared host.
$ mount t nfs ala-tuxlab://export/pxeboot/my_board/rootfs /target
5.
Exit root.
188
Spin locks. The Ethernet driver has several spin locks, and if you attempt to step over one that is needed, the connection locks up. Printk. This routine also has spin locks that freeze the KGDB connection. Simultaneous usermode-agent connections. The two debugging connections indirectly and unavoidably share some spin locks.
189
Wind River recommends that you explicitly call out the Ethernet port, because this guarantees that kgdboe uses the correct port (kgdboe does not know which port the device was booted with). Since many boards have multiple Ethernet ports, the default of eth0 may not be correct.
Target_# modprobe kgdboe kgdboe=@/eth2,@192.168.29.107
NOTE: To underline this point, if a board has multiple Ethernet ports, and/or the port you want is not the default port, you must explicitly select the alternate Ethernet port. You can use ipconfig to identify the proper port to use.
If you have problems connecting to KGDB, double check which port is configured and connected to the network. If, for example, the modprobe command takes a long time to return, it may be accessing or defaulting to a port that is not connected, and the only other sign of error is that kgdboe connections do not succeed. Here are some common short cuts for starting kgdboe:
This version assumes the default Ethernet port, for example eth0:
target_# modprobe kgdboe kgdboe=@/,@192.168.29.107/
You can now skip to 16.4 Connecting with KGDB from Workbench, p.192.
190
The first method is to add the kgdboe configuration into the boot command. You must know the IP address of both the target and the host at boot time. You can immediately connect with KGDB any time after the boot completes. For example, if you had:
You can now skip to 16.4 Connecting with KGDB from Workbench, p.192.
The kernel now also supports the new dynamic kgdboe configuration when used as a kernel built-in. Use the following command:
$ echo @/,@10.1.1.111/ > /proc/sys/kgdboe
191
NOTE: Since the device has booted, you do not need to specify its IP address.
You can now skip to 16.4 Connecting with KGDB from Workbench, p.192.
Do not use a port that has a console attached to it. You may make a connection, but it cannot work because the console attempts to interpret the KGDB data as typed commands. Also, for 9600 baud connections, you may want to reduce the KGDB watch options to achieve reasonable performance.
192
3. 4.
Select Linux KGDB via Ethernet and click Next. Select UDP as the transport.
NOTE: If you are using the agent-proxy, make this a TCP connection, as described in 16.2.2 Using agent-proxy to Cross Subnet Boundaries for kgdboe, p.186.
5.
6.
Enter the targets IP address. The IP address must match the setting from 16.3.1 Option 1: Using a UDP Connection on a Non-PCD Target, p.190.
7.
Use port 6443. This port is reserved for KGDB connections. If you are using the agent-proxy, select the respective agent-proxy port number, as described earlier.
8. 9. 10.
Click Next. Select Target OS Linux 2.6 if it is not already set. For the Kernel Image, point to your kernels vmlinux file and click Next.
$ mybuild/export/*-vmlinux-*
If you have built the kernel, the physical location of the new symbol file is at
$ mybuild/build/Linux-2.6.14/vmlinux
NOTE: Do not select the kernel image itself (for example the bzImage file).
11.
In the Object Path Mappings page, click Add, set the following values, and click OK:
12.
Click Next through the following dialog boxes, then click Done. It may take 20 to 40 seconds to load all the kernel symbols. When it completes, a red S appears on the vmlinux element in the targets connection tree.
193
NOTE: Make sure that the target has started the module kgdboe before opening the connection in Workbench; otherwise you will get a timeout and an connection error summary.
When the connection is successful, the Remote Systems view displays the connected message, and the kernel is shown as Stopped. Proceed to 16.5 Attaching and Debugging the Kernel from Workbench, p.196. If the connection fails, go to 16.4.4 Troubleshooting a KGDB Connection , p.195.
6.
Enter the targets IP address. The IP address must match the device providing the Telnet connection.
7. 8.
Proceed to 16.5 Attaching and Debugging the Kernel from Workbench, p.196.
194
5.
Proceed to 16.5 Attaching and Debugging the Kernel from Workbench, p.196. If the connection fails, go to 16.4.4 Troubleshooting a KGDB Connection , p.195.
Is the KGDB agent on the target running? Use the lsmod command on the target to see if the module is loaded. Is the KGDB agent using a functional network connection? For example, run the command ifconfig on the target and confirm that the kgdboe agent is using the correct Ethernet connection. Are all the IP addresses for the target and host correct? Run ifconfig on both the target and host. Are the target and host connected? Use the ping command to query the target from the host and the host from the target. The ping command uses TCP and KGDB uses the more restrictive unicast UDP packet; make sure that you are on the same subnet or have setup an intranet-to-subnet agent. Is there a firewall? Make sure that there are no firewalls on the host or target blocking the connection. Is there more than one copy of the Wind River WTX Target Registry running? Use the kill command to end any running copies and then restart Workbench.
195
Can your host locate the target? Make sure you have declared 127.0.0.1 localhost within your /etc/hosts file so the Remote Systems view can find the Target Registry on the host. Is your debug log turned on? You can turn on the debug log for your KGDB connection by adding the following options in the connection wizard. a. b. c. Right-click the connection and select Properties. Enter a location for the log in the Backend Log field. Try to connect again.
d. Select Help > Collect Logfiles. This gathers the connection log files. e. Forward the log files to the Wind River Support team.
196
16 Debugging Kernel Space 16.5 Attaching and Debugging the Kernel from Workbench
If you have performed a make fs, make C dist linux, or a make all, the Linux source folder will have been expanded in your projects build folder; for example, /home/user/workdir/myBoard/build/linux-2.6.14-type. 2. Click Next until you can click Finish. Workbench resolves the location of kgdb.c and any other kernel source. You can view the mappings between the object files and the respective source files by right-clicking the entry in the Debug view and selecting Edit Source Lookup.
4.
Enter a command, for example ls (press ENTER only once,) on the target. It does not return because execution has stopped at the fork. The Editor opens the fork.c source file. Click Resume in the Debug view to allow the command to complete; the next fork, for example another command, again causes a break.
5. 6.
To complete this example, remove the breakpoint and click Resume in the Debug view to continue execution of the kernel. To end the session, right-click the target connection in the Remote Systems view and select Disconnect.
197
To build the sample user-supplied kernel module: 1. 2. Open a Workbench project. Right-click the kernel_build build target and select Build Target. Typically, the kernel takes about 30 minutes to build. 3. 4. 5. Select File > New > Example. Select Wind River Linux Kernel Module Sample Project and click Next. Select The Kernel Module Debug 2.6 Demonstration and click Finish. A new project called moduledebug_2_6 appears in the Project Explorer. 6. Select a platform project and do the following: a. b. c. Select Project > Properties > Project References. Select the checkbox for moduledebug_2_6. Click OK. The moduledebug_2_6 project disappears from the Project Explorer and appears in the platform project tree. 7. 8. Open the platform project and find the sub-project moduledebug_2_6. Right-click the sub-project moduledebug_2_6 and select Build Project. The module moduleDebugExample.ko appears in the directory of the moduledebug_2_6 project. If you do not see it under the project icon, right-click the project and select Refresh. Remember, for the kernel module to build, the Linux kernel must be already built (by building the kernel_build build target in the platform project).
198
9.
Right-click on the moduledebug_2_6 sub-project and select Properties > Build Properties. You can see how the kernel root directory, target architecture, and cross compile prefix are set from the parent platform project.
You can add additional build options by appending them to the Build command entry make.
2.
Ensure that you can see periodic output from the user module. Enter the following command:
kgdb_target_$ klogd c 8
This command re-directs the kernel print statements to the console. You will see a message display every second or so. You may want to open an ssh or second Telnet session to remove this module when you are done. If klogd is already running and there is no output, you can locate the PID, kill the current instance, and then restart the demon. For example:
kgdb_target_$ cat /var/run/klogd.pid 1084 kgdb_target_$ kill 1084 kgdb_target_$ klogd c 8
Two messages are internally printed: a global and a local message. Depending on the display level, you might see both messages interspersed. If the Workbench Remote Systems connection is connected to the target, disconnect. After Workbench is running, reconnect to the target with the KGDB connection.
199
If you have placed moduleDebugExample.ko in a location other than the root, adjust the target connection object mapping list to include that location and then connect to the target. Make sure that the host path contains a forward slash (/) at the end. 3. Find the moduleDebugExample.ko entry in the Remote Systems view. If it does not have a red S mark on its icon, right-click it and select Load Symbols. The red S appears, indicating that symbols have been loaded. If the symbols do not load, or if moduleDebugExample.ko does not appear in the Remote Systems view, go to the platform projects Object Path Mappings screen, click Add, set the following values, and click OK:
4. 5. 6.
Right-click the Arch (OS) entry in the Remote Systems view and select Attach to Core. Click Resume in the Debug view so that the kernel is Running. Double-click bpHere.c in the moduledebug project. It appears in the Editor. Right-click in the gutter to the left of bpHere.c at line 21 (printfk(KERN_ALERT ) of the routine putBreakPointHere. Select a System Context breakpoint.
NOTE: If you find that the break point cannot be planted, make sure you added
the Object Mapping. 7. 8. Once it breaks (as seen in the Debug view), try single steps in and then out of this procedure. Then click Resume. When it breaks again, disable the breakpoint and click Resume.
You can remove the module from the kernel with the rmmod command:
kgdb_target_$ rmmod moduleDebugExample.ko
200
This technique can be used in many ways beyond this example. See the following section for ways to break within specific kernel module init routines, loaded or not. 1. Select File > Open File and browse to the kernel subdirectory of your builds Linux-2.6.14 source tree root. For example, module.c might be found at:
/home/user/workdir/myboard/build/linux-2.6.14-type/kernel/module.c
2. 3.
Double-click the module.c file to open it in the Editor. Go to the sys_init_module routine and find the lines that call the modules init procedure (search for the string Start the Module).
=> /* Start the Module */ if (mod->init != NULL) ret = mod->init();
4. .
5.
The Debug view shows the System Context as stopped, and load_module is highlighted; the Editor opens module.c to the location of the breakpoint. Note that the target terminal is hung at the insmod command. 6. Ensure that the moduleDebugExample.ko is registered by the Remote Systems view. Examine the terminal for your target connection, and look for moduleDebugExample.ko in the list on installed kernel modules, under Processes. If is not present, take the following steps to synchronize the Remote Systems view: a. b. c. Collapse the Processes node for the target. Click Refresh in the Remote Systems view. Expand the Processes node for the target again.
d. It the module does not yet appear, repeat the above steps. 7. Ensure that the symbols for moduleDebugExample.ko are loaded. Examine the Remote Systems view for your target, and look for
201
moduleDebugExample.ko in the list of installed kernel modules, under Processes. The icon for this module should be marked with a red S. If it is not, right-click the module and select Load Symbols. You can now single step into the initialization routine of the kernel module. 8. 9. 10. To resume processing, remove the breakpoint and click Resume in the Debug view. The insmod command completes. You can remove the module from the kernel with the rmmod command:
kgdb_target_$ rmmod moduleDebugExample.ko
When you remove the module, notice that moduleDebugExample.ko is no longer registered in the Remote Systems view.
6.
7.
202
NOTE: If you see a dialog stating that the location for the breakpoint is not available, remember that the module is not currently loaded. Click OK to continue. If you close the source file you will see that Workbench opens it when the breakpoint is hit.
8.
Observe the breakpoint being hit, and the source being opened to that location. You can now debug the init routine, or resume the execution. 9. When you are finished, remove the module:
$ rmmod moduleDebugExample.ko
You may see another dialog stating that the location for the breakpoint is not available, because the module is unloaded. Click OK to continue.
The shell now opens automatically in the project_prj directory. 3. Create a link to all kernel modules within the Linux kernel, and place them in this directory:
$ foreach file (` find . -name "*.ko" -print`) foreach? ln -s $file foreach? end $
4.
Add this object path mapping to your KGDB connection: a. Right-click the specific KGDB target connection entry.
203
b. c.
d. Leave the Target Path empty. e. f. 5. Browse for the Host Path; select projectname_prj/build/linux-version-type. Click OK for the path, then OK for the target connections properties dialog.
Make the connection to the target. If that connection is already active, disconnect and reconnect to assert the new mappings.
You can now place breakpoints in any kernel module source, have them planted by Workbench, hit those breakpoints, and have Workbench always be able to bring up the correct source file.
A simple kernel module. The file main.c initializes and removes the module. Parameter passing. A kernel timer. The file timer.c manages the timers. The sysctl command to change the timeout. The file settings.c manages the sysctl bindings.
To create a new kernel module project: 1. 2. 3. 4. Select File > Example. Select Wind River Linux Sample Project and click Next. Select Wind River Linux Kernel Module Sample Project and click Next. Select the Example Kernel Module Demonstration and click Finish. A new project called testmod appears in the Project Explorer. 5. Select and open an existing platform project in Workbench: a. Select Project > Property > Project References, then select testmod. Note that the testmod project disappears from the Project Explorer and appears in the platform project tree.
204
b. c.
Open the platform project and find the sub-project testmod. Right-click testmod and select Build Project. The module testmod.ko appears in the directory of the testmod sub-project. If you do not see it under the project icon, right-click on the project and select Refresh.
NOTE: For the kernel module to build, the Linux package must be already built (by building the Linux build target, for example).
6.
In the terminal or console on the target, use the get command to move the new file to the target and then use the insmod command to install the module.
kgdb_target_$ kgdb_target_$ kgdb_target_$ kgdb_target_$ ftp your host cd myhome/workspace/moduleDebug get testmod.ko quit
7.
You can use various additional sysctl supported commands to work with this module. For example:
sysctl -a shows all variables. sysctl dev.testmod.timeout queries variables. sysctl dev.testmod.timeout=5000 sets variables.
You can also query and set variables using /proc/sys/dev/testmod/timeout. 8. When you are finished, remove the module with the following command:
kgdb_target_$ rmmod testmod.ko
205
1. 2.
Select File > New > Example > WR Linux Kernel Module Project. Give the project a name, for example custom_lkm. Click Next. To attach this project to a platform project within Workbench, leave these values empty. To connect this custom kernel module to a platform project outside of Workbench: a. b. Fill in the Linux Kernel Directory, its ARCH, and its CROSS_COMPILE value. (You can edit these values later using the projects Build Properties.) Click Finish.
3.
Right-click the project and select Import > General > File System.
NOTE: The code for this kernel module is borrowed from an existing Wind River Linux sample project. You can import your own module code if you have some available.
4. 5. 6.
Browse to installDir/wrlinux-3.0/samples/moduledebug_2_6. Select the files bpHere.c and moduledebug.c and click Finish. You can now build this project:
If you have attached this project to an external platform project. If you have attached this project to an existing Workbench platform project as described in 16.6 Debugging User-Supplied Kernel Modules, p.198.
In-circuit emulator (ICE)-like debugging using the KGDB agent built into QEMU. This allows you to debug areas, such as exception vectors and Ethernet drivers, that regular KGDB-on-target debugging normally does not allow. (See 16.2.5 KGDB and Safe Areas when Debugging the Kernel, p.189.)
206
16 Debugging Kernel Space 16.8 Using QEMU for KGDB Kernel Debugging
A KGDB over Ethernet (kgdboe) agent running inside your kernel, on your target, loaded using the modprob command. This type of connection can show you, for example, the context that has caused a panic( ) state in the target.
This section describes ICE-like connection debugging. To create an ICE-like connection and open the target kernel in the debugger: 1. 2. 3. 4.
In the Remote Systems view, click Create a New Target Connection. Select Wind River Linux KGDB Connection and click Next. Select Linux KGDB via Ethernet and click Next. In the Linux KGDB Connection Properties dialog box, choose or enter the following, then click Next. Back End: TCP CPU: ARM9-LE (or any supported QEMU connection) Name/IP Address: localhost Port: 1234 Target Plugin Pass-through Options: notasklist=1
207
5.
In the Kernel image field in the Target Operating System Settings dialog, enter the name and path of the Linux kernel symbol file, using the syntax project_prj/export/boardName-vmlinux-symbols-version_fsType. For example:
project_prj/export/arm_versatile_926ejs-vmlinux-symbols-WR3.0ao_standard 6. 7. 8. 9. Click Next until you reach the Connection Summary dialog. Enter a name for the new connection. Select the Immediately connect to target if possible checkbox. Click Finish. The new connection appears in the Remote Systems view, and the debugger opens onto the kernel running on the emulated target.
208
16 Debugging Kernel Space 16.9 Enabling and Disabling KGDB in the Kernel
At this point, the debugger has attached the KGDB agent in QEMU on the target side, halted the target, and stopped in the kernel. 10. In the Debug view, click Resume to resume the target operation.
You can now do any kernel mode debugging that you would normally do using in-circuit emulation with a real target.
209
4. 5.
Select File > Save, to capture the configure changes. Right-click the projects build target kernel_rebuild.
The new kernel and vmlinux file are available in the workspaces projectname_prj/export directory.
210
17
Optimizing
17.1 Introduction 211 17.2 Managing File System Layout 212 17.3 Profiling CPU Usage with OProfile 213 17.4 Analyzing Code Execution Coverage 213 17.5 Analyzing Memory Problems with mpatrol 214 17.6 Using the System Viewer 214 17.7 Improving Boot Time 215 17.8 Optimizing Footprint 215
17.1 Introduction
Wind River tools can help when you want to analyze your projects footprint, memory use, code profile, and so on. In addition, Workbench and the Linux Platforms products incorporate some open-source tools related to profiling and memory usage.
211
Figure 17-1
Optimization Requirements
Applications File System (FS) FS Change List Kernel Unit Tests
Setup
Templates Layers Packages RPMs, CVS, . . .,
Relevant Tools
File System Layout Indexer mpatrol Memory Analysis OProfile CPU Analysis System Viewer
Develop
Config Edit Compile On-Host Workbench
Optimization Deliverables
Applications File System (FS) FS Change List Kernel Non-Binary Files Patches
Diagnose
Deploy Debug Test On-Host Workbench & Target
Other Tools
Boot Time Tools
Optimize
System Layout Views Profiles Static Analysis Cores Footprint Workbench, Eclipse, Target
Figure 17-1 lists some of the major analysis and optimization tools:
File System Layout Tools Wind River System Viewer Wind River Analysis Tools (formerly Wind River ScopeTools)
Adding and removing files and directories to and from the file system. Finding running totals of estimated file system sizes, thus allowing you to see changes as you use the tool.
212
Exporting file dependencies so users can do their own analyses, such as finding all parents of a package, output from RPM, data about contents and interrelationships. Importing and exporting file system settings, including the package list, changed file list, and layout changes. Taking snapshots of the file system by saving changes to the file system package list and explicit file content.
For more information, see 5.5 Exploring the Target File System, p.58.
213
See the Wind River System Viewer User's Guide for more details.
214
16
pkglist contains the list of installed packages changelist.xml typically configures the file system layout
You can see the approximate size of the file system on the Filesystem Layout Configuration screen. See Figure 5-3, File System Layout Showing Size, on page 59. As you use the Filesystem Layout tool, you can monitor the effect. For a command-line perspective, see Wind River Linux Users Guide: Getting a Footprint Snapshot.
215
A list of dependent packages and their total size appears 4. Click Cancel.
To export (create) a snapshot: 1. 2. 3. Click the Filesystem tab at the bottom of the Package Manager. Click the Targets tab if it is not already selected. Click Export Snapshot Footprint. A footprintPackage.tcl dialog appears.
216
4. 5.
In the Package Manager, remove a package such as acl from the Installed Packages list. Or make changes in the Filesystem Layout Configuration.
2. 3. 4. 5.
Select File > Save. Return to the Filesystem Layout view. Click the Targets tab if it is not already selected. Click Export Snapshot Footprint. A footprintPackage.tcl dialog appears.
6. 7.
1. 2. 3.
Click the Filesystem tab at the bottom of the Package Manager. Click the Targets tab if it is not already selected. Click Import Snapshot Footprint. A footprintPackage.tcl dialog appears.
4. 5.
Click Browse and choose the directory containing the snapshot. Click Import.
NOTE: You could also refresh the package data by clicking the Packages tab, then right-clicking and selecting Reload. This forces the update of the Makefiles derived from the package list file, and reloads the data into Workbench.
217
6.
Observe that the package list and the Filesystem Layout view have reverted to the previous baseline settings.
6. 7. 8.
Select Rpm Sizes. Browse to a directory and specify a file. Click Export. If you list this file, you will see, for example:
Package : libgcc Size : 108704
218
Package : setup Size : 434210 Package : filesystem Size : 0 Package : ncurses-base Size : 454 Package : cracklib-dicts Size : 5094668 ...
9.
Repeat this by selecting Rpm Files and clicking Export. The resulting file might look like this:
Package : libgcc List of files in rpm : /lib/libgcc_s.so.1 Package : setup List of files in rpm : /etc/aliases /etc/bashrc /etc/csh.cshrc /etc/csh.login /etc/environment ...
16
219
220
18
Analyzing Core Files
18.1 Introduction 221 18.2 Acquiring Core Files 222 18.3 Attaching Workbench to a Core File 223
18.1 Introduction
Workbench lets you configure your target system to save status and memory information from programs that crash for various reasons. For example, you can specify that the data should be saved if a process exceeds a certain size, or tries to access memory outside of its allowed memory space. This data is saved on the target in an ELF core dump file, typically named core.pid, where pid is the process ID of the program that crashed. This file contains status and memory information that can help you configure and troubleshoot your system. It contains an image of the process memory space, details of the process state, and additional information about processes occurring at the time of the crash. You can transfer this file to your host and use Workbench to analyze the cause of the crash.
221
Most Linux systems do not allow core file generation by default. In the above example, this is shown as a core file size setting of 0. You can turn on core file generation by specifying a maximum size or unlimited as the core file size, for example:
target_$ ulimit -c unlimited
Certain conditions, for example a program trying to access restricted memory, will then generate core dumps, as in:
target_$ ./segtest.out Segmentation fault (core dumped)
You can also turn on core file generation by setting a core file size (unlimited or as specified), and then cause a core file to be generated by setting a limit on some condition. For example:
target_$ ulimit 0 target_$ ulimit target_$ ulimit 12000 target_$ ulimit unlimited target_$ ulimit target_$ ulimit 2000 -c -c 12000 -c -m -m 2000 -m
The shell is now set to generate a core file of a maximum size of 12000 KB if the memory size for a process exceeds 2000 KB.
222
NOTE: Your ulimit settings entered at the command line apply to the current shell only. If you want to continue to generate core dumps across logins, add the ulimit commands to a shell startup file, for example to .bash_login.
Transfer the core dump to your host if it is not already on a file system that your target mounts from the host. You can now analyze the core file using the Workbench debugging tools.
17
223
NOTE: The core file does not contain information on the type of CPU or the version
of the operating system that it was created with. If you get a Failed to connect target error message indicating a target-CPU mismatch, it is likely that specifying the CPU number and OS version will resolve it. 5. 6. In the File field, enter or browse to the path of the application image that created the core dump file. The command line your selections have created is displayed at the bottom of the dialog. To add additional options for memory cache size, logging, and symbol loading, click the Edit button (next to the Options field) and make your selections. Click Next. Specify the location of the target root by clicking Add and entering the Target path (for example, /) and the Host path (for example, /target/rootfs), click OK, and then click Next. Click Next in the Target Refresh dialog box and then click Finish in the Connection Summary. Your core file connection appears in the Remote Systems view. You can now connect to the core dump by right-clicking the [stopped] process in the Remote Systems view and selecting Attach to Process. The Debug view shows the debugger attached to the process at the point of the failure and the Editor opens at the error location in the source file.
7.
8.
You can now perform various activities on the core file; for example, view a stack trace, a memory dump, a thread list, local and global variables, and register values. But remember that this is only a read-only view of the process at the time of the core dump.
To end the core file debugging session, disconnect in the Debug view and disconnect in the Remote Systems view.
224
PAR T VI I
225
226
19
Providing Platforms and Kernels
19.1 Introduction 227 19.2 Providing Platforms for Application Developers 228 19.3 Exporting and Copying Sysroots 229 19.4 Integrating Applications 232 19.5 Providing Kernels and Modules for Platforms 232
19.1 Introduction
This chapter discusses issues of delivering or productizing, including:
Providing platforms for application developers to use Integrating applications Providing kernels and kernel modules for platform and application developers
The Deliver stage, as suggested in Figure 19-1, uses various tools and procedures to deliver the product components shown. Of these, Workbench directly supplies export-sysroot, which is a node in the project tree that you can build as a target, and export-layer, which is a build target under build options.
227
For information on how to deliver layers, whether for internal teams or external customers, see 20. Delivering Layers.
Figure 19-1 Delivery Stage of the Product Development Life Cycle
Setup Requirements
Kernel Image File System Image Layers Packages Sysroots
Setup
Templates Layers Packages RPMs, CVS, . . .,
Relevant Tools
export-layer export-sysroot tar
Develop
Config Edit Compile On-Host Workbench
Product Deliverables
Docs File System Image Kernel Image Kernel Modules Layers Non-Binary Files Packages Patches Profiles Sysroots Templates Unit Tests
Diagnose
Deploy Debug Test On-Host Workbench & Target
Optimize
System Layout Views Profiles Static Analysis Cores Footprint Workbench, Eclipse, Target
Deliver
228
tools such as described in 8. If Youre an Application Developer, and in the Wind River Workbench Users Guide.
18
This creates the sysroot in the export/sysroot directory and names it according to the target and rootfs values by default. If you create it external to the workspace, you or your application users need to add it to their sysroot directory, by choosing Window > Preferences > Wind River > Layers and Sysroots.
229
Data
Field in GUI
Entry
To add available multilibs: 1. 2. 3. 4. 5. Create a platform project with the values shown in Table 19-1. Open the User Space Configuration. Add the following two entries from the Available list: glibc(mips 64) and libgcc(mips 64). Click Accept. Select File > Save.
230
For each added variant, Workbench prompts you with the variant plus any required additional variant RPMs on which the original RPM depends.
To add multilibs that are not yet available: 1. 2. 3. 4. 5. 6. 7. 8. Create a platform project with the values shown in Table 19-1. Click Import. Click Add Multi-libs. Select the CPU Variant. Select the package glibc, click Lookup, and click Add to pkglist. Select the package libgcc, click Lookup, and click Add to pkglist. Click OK. Select File > Save.
This second procedure works even if the respective RPMs have not yet been built, but you need to make the file system and generate the RPMs to see the added package with multilibs in the User Space Configuration.
To verify that you have added the multilib, and to export and use it: 1. Right-click anywhere in the Package Manager and select Edit pkglist. The pkglist file opens in the editor, and you can see that the two multilibs were added.
NOTE: You can make manual changes to the pkglist file. If you do make changes, be sure to right-click in the Package Manager and select Reload to update the view.
18
2. 3. 4.
Export the sysroot by building the export-sysroot build target. It will then include these extra multilibs in the sysroot. Add the sysroot to Window > Preferences > Wind River > Layers and Sysroots. Create a new mthread sample project.
231
5. 6.
Observe that there are now two new build specs, one for the 32-bit and one for the 64-bit CPU variant. Build mthread for both the 32-bit mips64_n32 and the 64-bit mips64 and notice that the appropriate separate build specs now work
232
20
Delivering Layers
20.1 Introduction 233 20.2 Example: Preparing Layers that Modify Kernels 234 20.3 Providing Layers to Teams and External Customers 238
20.1 Introduction
You can distribute layers that you have created, either by sending them to a group of developers or making them available over your intranet. Other developers can then include or exclude your layers changes with a single configure command switch (if configuring a project using the command line), or by adding the layer as described in Adding Layers, p.79. Remember, layers are suitable for both internal projects as well as for projects delivered to external customers. They are portable and can overlay any installation, regardless of whether it is read-only, write-only, internal, or external.
233
Use the example data in the following table to create and configure a platform for which we will modify a kernel configuration, save the result, and export (deliver) the result as a layer.
Table 20-1 Basic Project Parameters
Data
Field in GUI
Entry
board file system size kernel type project name package to remove package to import
234
a. b. c. 4.
Double-click the User Space Configuration to open it. Select the entry rngtools, click Remove, and OK. Select File > Save.
Import an external package: a. Open the User Space Editor (that is, the User Space Configuration node), click Import, then click Import Packages.
Figure 20-1
b.
19
235
Figure 20-2
c.
d. Into Package Location, paste the URL to the package. For example, for dos2unix: http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Fedora/source/ SRPMS/dos2unix-3.1-28.fc7.src.rpm e. Click Go. A shell opens and a script runs to perform the import and package setup. f. g. Press ENTER when done, to close the shell. Click Close, to return to Workbench.
236
The new layer directory will be created in builddir/export/export-layer/. (Note that builddir is the same as workspace/project_prj.) The export-layer directory contains the layer directory and a tar image of that same directory, for example:
builddir/export/export-layer/common_pc.prj.Wed_Oct_1_150608_PDT_2008 builddir/export/export-layer/common_pc.prj.Wed_Oct_1_150608_PDT_2008.tar
2.
Export the layer: a. b. c. Right-click the project. Select Open Workbench Development Shell. View the new layer's content, which reflects the changes you made:
$ cd export/export-layer/common_pc_prj.Wed_Oct_1_150608_PDT_2008 $ ls conf_cmd.ref dist packages README templates $ ls dist/ dos2unix $ ls packages/ dos2unix-3.1-28.fc7.src.rpm dos2unix-3.1.tar.bz2 $ ls templates/ default $ ls templates/default config.sh knl-base.cfg modlist.remove pkglist.remove fs modlist.add pkglist.add README $ cat templates/default/knl-base.cfg CONFIG_CONTAINERS=y CONFIG_CONTAINER_DEBUG=y $ cat templates/default/pkglist.add dos2unix $ cat templates/default/pkglist.remove # rng-tools
19
All layer changes placed in the templates/default subdirectory are automatically applied when the layer is added: they do not need a template selection to enable them. You can, however, re-arrange the new layer directory
237
so some of the changes can be placed into optional template selections, for the benefit of the user of your layer. 3. Make some of the changes optional (for example, you can move pkglist.remove into a separate template subdirectory, no_rng-tools): a. b. Create a non-default subdirectory:
$ mkdir templates/no_rng-tools
When the developer using your layer wants to remove the rng-tools package, its a simple matter of selecting the template with the layer:
--with-layer=/path/layer --with-template=no_rng-tools
NOTE: The above part of a command would be used in the command-line configuration of a project, as explained in the Wind River Linux Users Guide.
2. 3.
Send your recipients the tar file or a pointer to it. Explain how they can import and use the layer, as described in the next section.
238
239
14. 15.
Go to User Space Configuration > Filesystem. Observe that the two changes from the two layers are applied to the file system.
240
PAR T V II I
Reference
A B C D E FAQs .................................................................... 243 Starting usermode-agent at Boot Time ............ 255 Workbench and Command-Line Techniques ... 259 Installing on Network Servers ........................... 265 Glossary .............................................................. 269
241
242
A
FAQs
Is make reconfig really dangerous? 246 Can I still use standard managed builds for application projects? 246 Why is flexible managed build so great? 246 How can I say what should go into my flexible managed build? 247 How can I migrate Workbench 3.0 projects? 247 Can I structure projects? 247 Why can't I delete sub-projects from within the Project Explorer? 248 Can symbolic links be used for sources? 248 Why are the file permissions changed after importing sources? 248 How can I browse the generated file system user and permissions? 248 Can layers also be used for application code? 249 Can you use layers and templates to patch user space packages? 249 Where do build specs come from? 249 Where can I specify required libraries and library search paths? 249 What is the right way to get a reduced filesystem to a board template? 249 Do packages added via layers appear in the list of installable packages? 250 How is the list of installable packages populated? 250 Do you have to rebuild the wrproxy source for a proxy host? 250
243
How can I launch the Registry in read-only Workbench directories? 250 How can I redirect remote X environments to local servers? 250 Why doesnt Workbench list any available serial ports? 251 Where can I specify include search paths for application projects? 252 How can I modify compiler flags for application projects? 252 Is there a debug mode flag for application projects? 252 Can you redirect standard In when running/debugging via Workbench? 252 Can you multiplex multiple-process output into a single I/O console? 253 How do I collect logs? 253
244
A.1 Introduction
This appendix presents frequently asked questions about Workbench and Wind River Linux, and their answers, primarily to draw your attention to capabilities that you might not easily find in other areas of the documentation. Notice that you should: 1. 2. Direct generic Workbench questions to the Wind River Workbench Users Guide. See the same guides Troubleshooting section, which includes Linux issues.
This appendix presents the questions in the following groups, to help you see related questions. Although many fit into several groups, they are not repeated.
A.2 Projects in General, p.246. Reconfiguring projects; flexible vs. standard builds; structuring projects; symbolic links; imported file permissions; browsing file system user and permissions. A.3 Build Properties, Specs, Layers, and Templates, p.249. Layers for application code and patching user space packages; build specs; required libraries and search paths; reducing file system size for board templates. A.4 Package Manager, p.250. What appears in the list of installable packages. A.5 Host-Related Issues, p.250. Rebuilding wrproxy source for proxy hosts; launching the registry in read-only installations; redirection of remote X environments; enabling serial ports. A.6 Application Projects, p.252. Including search paths; compiler flags. A.7 Debugging, p.252. Debug mode flag for application projects; redirecting standard in; multiplexing multi-process output. A.8 Troubleshooting, p.253. Collecting logs.
245
The make reconfig is a powerful new tool to re-configure a project without having to create it again from scratch. You must however use it with care. For example, any custom changes to the file system or the fs tree will be lost without warning. (See, for example, 5.5 Exploring the Target File System, p.58.)
Can I still use standard managed builds for application projects?
Yes, but standard managed build is no longer the default managed build simply because flexible managed build is superior, and at the same time as easy to set up and configure. This is independent of the CDT adoption. You can use Project > Build Options > Convert to Flexible Managed Build to convert standard managed builds.
Why is flexible managed build so great?
Use flexible managed build wherever possible anyway. It is as easy to setup, provides much more features, and is much more powerful overall. Thus, talking about managed build basically means talking about flexible managed build. With flexible managed builds, you can:
Completely separate the project and build definition as well as the build output from the source code. Select build target contents from all over the workspace, also including build target references. Use multiple external source trees and linked resources. Add parts of the same source tree to multiple build targets, even within the same project. Exclude single files, or whole sub folders from the build, or even specify regular expression patterns for excludes. Disable single files, or whole sub folders from the build for specific build specs. Set up a flexible managed build for an existing project in a new project, which thus can coexist with another build system in place (for example to evaluate how easy it is to set up a flexible managed build.
246
Specify all compiler options directly on the build target level (these are part of the build property leveling chain). Recursively create virtual folders, where you can group lists of files or sub-folders, which should be built with specific options (these are part of the build property leveling chain, too), dramatically simplifying build property management (as options only are set in one single place). Specify different compiler options for the same source file within different build targets. Directly find flexible build target contents and exclusions. Find new icon overlays that describe the status of each build target and each content node (such as unresolved contents or references, or deltas for overridden levels).
As soon as you need to build something specific (as opposed to building everything inside your project to end up with a single binary), the flexible managed build system helps you define your build targets and any related build properties. You can specify arbitrary build targets of different types within a single project, with arbitrary contents or content exclusions from all over the workspace. Use New > Build Target" wizard, and subsequently either Edit Content... or Edit Excludes... from the context menu, or the corresponding tabs within Properties > Build Properties on any level of project, build target, build target content or virtual build target content.
How can I migrate Workbench 3.0 projects?
Follow the directions in Wind River Linux Migration Guide: Wind River Workbench.
Can I structure projects?
Yes, of course, although this is not available in standard Eclipse. This enables automatic recursive builds to reflect the build hierarchy using super- and sub-project relations. You can also specify the build order of sibling projects, in the Eclipse Preferences, but this is not visualized, and the information can not be shared in a team).
247
This could cause confusion. For example, imagine that the user just wants to remove the reference of the sub-project from the super-project, but mistakenly uses Delete. To delete a sub-project, first remove all references until it is a root project: use Project > Remove Project Reference , or do it in the Project Explorer.
Can symbolic links be used for sources?
Eclipse itself has no support of symbolic links and treat symbolic links like normal files. Thus the import wizard (File > Import... > File System) destroys symbolic links and replaces them with copies of the linked files. If you want to keep the permissions and symbolic links, copy the files outside of Eclipse.
Why are the file permissions changed after importing sources?
Eclipse changes file permissions. To keep the permissions, copy the files outside of Eclipse.
How can I browse the generated file system user and permissions?
The file system user and permissions are managed in parallel by the pseudo tool, so that files can be owned by the user on the real file system, but become root files in the target. You can enter this pseudo environment on your host, and examine the target-specific file owership and permissions. To examine a specific file via pseudo:
$ host-cross/bin/pseudo ls -l export/dist/path-to-file
248
Yes, the Analysis layer is an example of application code for the wr-opagent automatically wrapped into a package. See Wind River Workbench Performance Profiler User's Guide.
Can you use layers and templates to patch user space packages?
Yes, layers and templates can patch specific user space packages. . You can do this by creating a sub-directory within the templates. Use the package's name, and then place a patches directory there.
Where do build specs come from?
A TCL build spec provider script is responsible for all build defaults. This script provides build specs derived from sysroots (in the wrlinux/sysroots directory) and registered via Workbench Preferences. You can find the relevant files for provision in the $WIND_BASE scripts. As these are highly dynamic, build defaults are evaluated for each new project directly.
Where can I specify required libraries and library search paths?
You can specify and order libraries and LSPs within Properties > Build Properties > Libraries. You can manually add the same information in the dedicated LIBS and LIBPATH macros within Properties > Build Properties > Build Macros.
What is the right way to get a reduced filesystem to a board template?
For methods to reduce your file system, see 20.2 Example: Preparing Layers that Modify Kernels, p.234; 20.2.2 Tailoring and Exporting a Layer, p.237; Adding Custom Templates, p.77; and 5.5.4 Viewing Parent Packages and Removing Packages, p.62.
249
The package will show up as a placeholder entry in the Installed Packages list. If a prebuilt RPM binary that matches this configuration is not present in the layer, the entry will be a placeholder until the package is built locally.
How is the list of installable packages populated?
The list is populated from the package list file, and it depends on the respective RPM files.
Prebuilt RPM files can come from any layer in the installation directories. Locally built RPM files, where the projects pkgrpmlist.properties file maps package names to RPM names. (The project is always to topmost layer).
Formerly, prebuilt RPMs were not listed until you did a make fs or the equivalent. Now, there are placeholder entries until the respective RPM files are generated. , but of course they dont have the full dependency and other metadata until then.
The wrproxy binaries provided in the Linux installation are for the host on which you have installed Workbench. If you use a proxy host between your install host and your target, you need to rebuild the wrproxy source for your proxy host.
How can I launch the Registry in read-only Workbench directories?
Run installDir > /wrenv.sh -p package wtxregd help to get a list of options. Use -d filePath to put the database directory in a different location from the default $WIND_HOME/.wind directory.
How can I redirect remote X environments to local servers?
Eclipse and Workbench have the same performance fingerprint when it comes to X performance. If you are having performance problems in a remote X
250
environment where Workbench runs on a remote system and X is redirected to the local server, try the following solutions:
VNC (server, viewer)Use VNC to encapsulate X calls to greatly improve Workbench performance. Both the server and the client need to be read-writable for the installation of VNC. (This may not be applicable for very large company environments.) Clients and servers connected via a 10MBit TCP/IP networkUse half duplex instead of the standard and otherwise favorable full duplex setting on the local Ethernet card. Servers running Linux-GTKA gnome issue affects the anti-aliasing feature, so disable that setting. Use your desktop facilities such as the Gnome Font Properties dialog, of possible. Or, ensure that your ~/fonts.conf or system-wide fonts.conf file contains the following:
<match target="font"> <edit name="antialias" mode="assign"><bool>false</bool></edit> <edit name="hinting" mode="assign"><bool>true</bool></edit> <edit name="autohint" mode="assign"><bool>false</bool></edit> </match>
Clients using Exceed to connect to the remote XTry disabling Exceeds extension for rendering the fonts: Exceed Tools > XConfig > X Server Protocol > Extensions > RENDER. Or, tune Exceed for Workbench, by using xperf like this: Exceed Tools > XConfig > Other Server Settings > Performance > Tune...
If the Terminal view or the KGDB serial connection dialog has an empty list when you try to select a serial port, examine the port, specifically /dev/ttyS0, which maps to the default port, for example:
$ ls -la /dev/ttyS0 crw-rw---- 1 root uucp 4, 64 Dec 1 11:25 /dev/ttyS0
This tells you that the default serial port is read/write accessible by root and by the uucp group. Since you are not likely running as root, make sure that you are are in the uucp group:
$ grep uucp /etc/group uucp:x:14:uucp,Username
Your username should be included in the uucp list. If not, you need to get it added.
251
On the first build after project creation, you will be asked to choose Generate Includes.... This wizard helps you specify ISPs. (It is also available from Properties > Build Properties > Build Paths, then Generate. At the same page, you can specify and order ISPs directly.)
How can I modify compiler flags for application projects?
Use Properties > Build Properties > Build Tool; select C-Compiler ;and, if you need them, also Assembler and C++-Compiler. Then edit the Tool Flags in the entry field (or where it may be available within the specific options dialogs). You can click the Tools Flag, Debug Mode, and NonDebug Mode buttons for access to the common compiler flags. If you only want to temporarily add a flag instead, you can use the dedicated build macros (typically ADDED_CFLAGS and ADDED_C++FLAGS) from the managed build extension mechanism. Specify these in the User Build Arguments entry field in the Build Console. (For user-defined build projects you have to edit your Makefiles manually, or hope to have available, dedicated build macros just like for managed builds, which in a permanent or temporary manner. )
A.7 Debugging
Is there a debug mode flag for application projects?
For Wind River Linux, Workbench the project wizard provides a Debug checkbox along with the build spec selection. For platform packages, there is we a Debug check box in the User Space Configuration > Packages > Options tab.
Can you redirect standard In when running/debugging via Workbench?
No, there is no way to redirecting the input anywhere other than the debug console.
252
No.
A.8 Troubleshooting
How do I collect logs?
If you can start Workbench, collect all log files using Help > Collect Log Files... It is important to check the box of the project(s) for which you have identified issues, for example your platform project's configure command. This allows that project-specific information to be included with the log.
253
254
B
Starting usermode-agent at Boot Time
B.1 Introduction 255 B.2 Basic Requirements 255 B.3 Writing and Placing the Script 256
B.1 Introduction
This appendix contains an example script for starting usermode-agent when the Linux target system boots.
255
Installs the user mode agent as an OS service. Enables automatic startup using the init mechanism when booting.
256
B Starting usermode-agent at Boot Time B.3 Writing and Placing the Script
start ;; condrestart) [ -e /var/lock/subsys/usermode-agent ] && (stop; start) ;; *) echo $"Usage: $0 {start|stop|restart|reload|condrestart}" exit 1 esac exit 0
257
258
C
Workbench and Command-Line Techniques
C.1 Introduction 259 C.2 Workbench and the Command Shell Environment 260 C.3 Setting the Environment Without Starting a Sub-shell 263
C.1 Introduction
The following discussion explores some of the ways that Workbench and the command-line are interchangeable and complementary, so that you can use the right tool for the task, or even use one to help debug the other.
259
where package-name is the package name as it appears in the install.properties file. For Wind River Linux 3.0, the command is
$ ./wrenv.sh -p wrlinux-3.0
This spawns a sub-shell with the environment for the selected package-name, in this case wrlinux-3.0. In this shell the Wind River Linux toolchain and other required environment variables are preset.
NOTE: Wind River Linux has no dependencies on Workbench or other Wind River products, so except for the procedures described in this appendix, you should never need to use the wrenv command.
You now have a shell in that project's directory with the Wind River Linux environment. You can stay with this simple shell, or open a preferred shell like sh on Windows, or bash and csh on Solaris and Linux.
260
C Workbench and Command-Line Techniques C.2 Workbench and the Command Shell Environment
If this is a platform project, you can cd over to its configured project directory as follows:
$ cd ../project_name_prj
There may be a very complicated build issue, perhaps with a new BSP or a makefile, where you want to explore and modify the command and its environment. You may wish to instrument the makefiles to print or capture trace and debug information on the fly. You may want to experiment with build flags without endangering the existing build specs.
Here is an example of how to do this: 1. In Workbench, execute the build you wish to examine. For example, here is the build command for the mthread sample project as it appears in the build log:
echo "building fsl_8548cds-glibc_cgl_DEBUG/mthread.o ";powerpc-wrs-linux-gnu-e500v2-glibc_cgl-gcc -g -fno-omit-frame-pointer -mpowerpc -mcpu=8548 -pipe -MD -MP -c -DARCH=ppc -o "fsl_8548cds-glibc_cgl_DEBUG/mthread.o" "mthread.c"
2.
3.
Open a shell, as described in C.2.2 Setting the Environment with Workbench, p.260. This gives you the compatible shell environment. You can run the env command to see all the provided environment settings that your make commands will inherit. If you are on a Windows host, you will need to start a sh shell so that you have a proper make environment.
c:\WindRiver\workspace\mthread> sh
261
sh-2.04$
4.
You should get the exact same build results as you would get executing this in Workbench. 5. You can now experiment with the command and its environment to troubleshoot problems.
You want to have housekeeping scripts available in Workbench. You want to have scripts that execute in the correct and specific environment. You want to add temporary debug scripts that are project specific.
The following example assumes you want a command that displays all environment settings that contain the project's name. 1. 2. 3. 4. 5. 6. 7. 8. 9. Right-click a platfrom project and select Properties > Build Properties > Build targets. In the Custom build targets section, click New. Enter the name Display Environment. Click Variables, select Project Name, and click OK. Finish the command so that it looks like this:
sh -c "env | grep %selected_project_name%"
Set the Type to Command. Set Refresh after execution to Nothing. Click OK for the Build Target dialog box. Click OK for the Properties dialog box.
262
C Workbench and Command-Line Techniques C.3 Setting the Environment Without Starting a Sub-shell
1. 2.
Right-click the project and select Build Options > Display Environment. Observe the output in the Build Log. Note that only the PWD setting from the environment has the project's name in it.
... Command sh -c env | grep samplePlatformProject ... PWD=/home/user/WindRiver/Workspace/samplePlatformProject
This is probably the most complicated shell command you should enter in this dialog. It is generally better to have the command execute a script and pass parameters to it, using hand selected parameters, ones added from the project's variables as above, or ones from the project's macro list.
You are executing a script, and do not want it to have to start a sub-shell. You have .cshrc or .profile files that override PATH or other variables whenever a sub-shell is started.
NOTE: Most command-line Linux developers prefer to have absolute control over
their environment settings. This usage allows such developers to choose exactly when and what to add to the given shell for the task at hand.
The possible values for shell-type include plain, sh, csh, bat, and tcl. A more concrete example setting environment in csh without starting a sub-shell:
$ eval `wrenv.sh -p wrlinux-3.0 -p print_env -f csh`
263
For example, suppose you had a script that needed to find all packages that added a path for WIND_WRLINUX_LAYERS. These paths would be in install.properties in the following form:
ipnet60.eval.01=addpath WIND_WRLINUX_LAYERS $(WIND_HOME)$/ipnet-6.0
NOTE: In Windows, separate paths with a colon (:). For UNIX and Linux, separate
paths with a semi-colon (;). If there are no matches, the command returns an empty string.
264
D
Installing on Network Servers
D.1 Introduction 265 D.2 Basic Considerations 266 D.3 Shared Wind River Linux Installation 267 D.4 Local Workbench Installation 267
D.1 Introduction
Workbench and Wind River Linux can be installed on a network server instead of locally. This allows you to reduce the number of installations, simplify maintenance, and save disk space. You can also install Wind River Linux on a network server and then use a local installation of Workbench to access it.
265
You must use the same absolute path when installing and using the shared installation.
For example, you could mount an NFS-export from the network server locally on a Linux host on /net. You then cd to the installation directory under /net and install Workbench and Linux there. To run Workbench, you would reference the same directory, for example:
$ cd /net/installDir $ ./startWorkbench
Do not log on to the remote server and run Workbench using the path that is local to that server.
You must create a .wind directory at the shared location that is accessible to all users.
Note that Workbench will continue to use the .workbench-version in your home directory and that you can also have a local workspace.
You must install Workbench on the shared installation server, and you must install it first.
This applies even if you are going to be using a local installation of Workbench. The Workbench installation on the server provides some necessary support for the Wind River Linux installation that you perform after Workbench is installed.
Do not, for example, use a key for a platform development installation if you are installing an application development environment, because this will install the wrong infrastructure files.
266
You must have unique installations for each host operating system.
You cannot use the same shared installation for multiple host operating systems. Each host type must have its separate shared installation to get the proper host tools and infrastructure details.
3.
267
Before:
wrlinux14.eval.02=export WIND_LX_HOME=$(builtin:InstallHome)
After:
wrlinux14.eval.02=export WIND_LX_HOME=$/net$/sharedLinuxPlatDevDir$/WindRiver
You can now use this local Workbench and it will automatically use the data from the shared installation.
NOTE: If you install an additional Wind River product in this local directory, you must repeat the modifications to the local install.properties file described in this example.
268
E
Glossary
This glossary defines terms used in Workbench Wind River Linux projects. For additional terms involving the Workbench IDE and GUI presentation, see also the Wind River Workbench Users Guide.
back end
Functionality configured into a target server to allow it to communicate with various target agents, based on the mode of communication that you establish between the host and the target (network, serial, and so on).
board support package (BSP)
A Board Support Package (BSP) consists primarily of the hardware-specific code for a particular target board. A BSP includes facilities for hardware initialization, interrupt handling and generation, hardware clock and timer management, mapping of local and bus memory space, and so on.
BSP directory
The directory containing a particular BSP. This directory is found in the templates/board subdirectory of the layer containing the BSP.
build
The type of project built: managed build by default (formerly flexible build); and also a deprecated but still available standard managed build (sometimes known as a standard build). There are also user-defined and disabled builds.
269
build directory
The directory named build in a project, where build tasks such as patching and compilation are actually performed.
build output analysis
Also referred to as discovery, a mechanism to analyze build output to determine include paths, symbols, and the build scope (affected files) during a build run.
build scope
The set of files built during a build run, determining which source files are processed by the indexer. Generally, all projects use a build-driven setup, unless build information is missing, in which case, all files will be parsed (indexed).
build spec
A particular set of build settings appropriate for a specific target board. This provides functionality that is configured into a target server to allow it to communicate with various target agents, based on the mode of communication that you establish between the host and the target (network, serial, and so on).
CDT (C/C++ Development Tooling)
The process of writing code on one system, known as the host, that will run on another system, known as the target.
debugger framework (DFW)
The debugger backend, which communicates between the target server and target agent to provide debugging control in Workbench (as well as control in Workbenchs Remote Systems and OCD views).
debuggable objects
Debuggable objects are the executable application files, kernels, kernel modules, and libraries that can be accessed by both the host and target. These objects are ideally compiled without optimization, compiled with the appropriate debug flags (for example with -g, or -g-dwarf-2), and are not stripped of symbols.
270
E Glossary
DFW
Project builds for which Workbench provides no build support at all. Useful for projects or folders that contain, for example, only header or documentation files that do not need to be built.
discovery
An index holding a pre-parsed platform API for a project type. Most managed project types come with an external API package which, when indexed, provides the most common API functions, methods, and types for code completion and parameter hints in the source editor.
flexible managed build
The host-dependent key in Workbench that provides get context-sensitive help. On a Windows host, press F1. On a Linux or Solaris host, press CTRL+F1.
host shell
A Wind River command shell that provides a command-line environment for GDB and KGDB debugging. The host shell also provides Tcl scripting support.
host toolchain
Used on the development host to build the host tools and other software. This toolchain is provided by the development host operating system, for example by Red Hot or Ubuntu. This is a different toolchain than the cross-development toolchain.
271
host tools
Used on the development host to perform functions that are part of the build process, but other than the toolchain compiling functions. They are built by Wind River or by the user.
hunk
In Linux, a hunk is a contiguous group of source lines generated when the diff program is applied to compare files. The patch program and the Quilt patch program based upon it use diff to create patches, which are then internally represented as one or more hunks to apply to a file to patch it.
index
Source analysis information gathered by the indexer by parsing source code. The index is the basis for any source navigation and editing capabilities, such as navigation between declaration and definition of methods, showing included files in the Include Browser, showing the call tree of functions and methods, showing the type hierarchy of classes, code completion in the editor, hover information, etc.
JDT
Java Development Toolkit provided by the Eclipse organization (http://www.eclipse.org) and included with Workbench.
JNI
Java Native Interface is a means of calling non-Java code (native code) from within a Java application.
kernel mode
For Linux 2.6 and higher kernels, two connection modes are supported: kernel and user mode connections. Kernel mode connections allow kgdb debugging of the kernel in a manner analogous to debugging applications in user mode.
kernel module
A piece of code, such as a device driver, that can be loaded and unloaded without the need to rebuild and reboot the kernel.
272
E Glossary
launch configuration
A run-mode set of instructions that instructs Workbench to connect to your target and launch a process or application. A debug-mode launch configuration, for example, completes these actions and then attaches the debugger.
layer
A collection of packages and templates for use with the Wind River Linux build system.
layer directory
A build for which Workbench controls all phases, available for all project types except user-defined projects.
native mode development environment
A development environment requiring a usermode-agent program to be running on the target, in a Linux operating system. In this environment, the debugger and application are compiled with the same toolchain, thus no emulator is required when running in self-hosted mode. A native mode development environment can only be used for application development.
object path mappings
The object path mappings specify where the debuggable objects are to be found for both the debugger running on the host and the Linux target. In Workbench, this is set within the Remote Systems views Target Connection Properties.
package
A collection of software and files for installation on a targets root file system. The term package is used generically for both source builds and binary distributions. Examples include the ncurses library, or the busybox shell and utilities.
273
patch file
A file containing modifications to make to source code, conventionally in a format understood by the historic patch utility. Patches for use with Wind River Linux Platforms should be in unified diff format.
patch list
An independent module, available from Wind River, the Eclipse Foundation, or from many web sites, that delivers new functionality to Workbench without the need to recompile or reinstall it.
project
A collection of source code files, build settings, and binaries that are used to create a downloadable application, file system, kernel, bootable system image, and so on. Projects can be linked together in a hierarchical structure displayed as a project/subproject tree in the Project Explorer. This structure reflects the inner dependencies of the projects, and therefore the order in which they should be compiled and linked.
project description files
Automatically-generated files that contain information about a project, such as project properties, build information, Makefile fragments, and other metadata.
project directory
The directory containing a project. Created by the configure script, or the Wind River Workbench configuration tool.
registry
The registry associates a target servers name with the network address needed to connect to that target server, thereby allowing you to select a target server by a convenient name.
self-hosted development environment
The opposite of cross-development. The debugger and the application are running on the same machine.
274
E Glossary
The source lookup path specifies the location that the Workbench debugger uses to identify and open each source file as it is being debugged. This is set in the Debug view in Workbench.
spec file
All SRPM packages have a spec file that manages how a package is built on the host and how it installs in the target file system. Patching this file lets you customize and enhance the package in the build system and the specific target environment.
standard build; standard managed build
Synonymous, deprecated project build types suitable for projects with build structures similar to the file system structure.
system mode
When in system mode, the debugger is focused on kernel processes and threads. When a process is suspended, all processes stop. Compare with user mode.
sysroot
A sysroot holds the shared header files and libraries (for example the C runtime libraries) from the file system, for the use of other packages in a project. If the package list does not change, the sysroot does not change.
target
A piece of hardware or simulated hardware on which software needs to be run. Typically, software is built and configured for a particular target before being installed. A target generally refers to a specific configuration of a board.
target agent
The target agent runs on the target, and is the interface between Wind River Linux and all other Wind River Workbench tools running on the host or target.
target server
The target server runs on the host, and connects the Wind River Workbench tools to the target agent. There is one server for each target; all host tools access the target through this server.
275
template
A collection of configurations, settings, and patches used to modify the kernel or file system built for a target. Templates are combined to create a project.
TIPC
Transparent inter-process communication protocol typically used by nodes within a cluster. Wind River provides a proxy and usermode agent program that allow Workbench to access targets within the TIPC cluster.
toolchain
The compiler and other tools used on the development host to compile the software that will run on the target. Also called cross-development toolchain to distinguish it from the host toolchain.
user-defined build
Project builds for which you set up and maintain your own build system and Makefiles, and for which Workbench provides minimal support beyond a GUI launch, make rules expressed in the Project Explorer, and build output to the Build Console.
user mode
When in user mode, the debugger is focused on user applications and processes. When a process is suspended, other processes continue to run. Compare with system mode. For Linux 2.6 and higher kernels, user mode is a separate connection type. Compare with kernel mode.
workspace
The central location (installDir/workspace by default) for all the Workbench resources you see : your projects, folders, and files; settings that describe your working environment: open projects and views, how you have your views arranged within the perspective, whether you have breakpoints set, and so on. You can create more than one workspace. To share the build objects of your projects with a target, the workspace (directory) may be in a file system that is exported to the target, or you may redirect build objects from your workspace to a location exported to the target.
276
Index
Symbols
%build 117, 122 %configure_target 117, 122 %install 117, 122 +/- icon 61 .ko file 150 /dev directory 62
A
Add Links to Development Folders 121 adding layers 52 profiles 52 templates 52 Advanced tab 64 agent-proxy 186, 193 connections 187 port numbers 193 application binaries 157 developers 16, 36 projects 25 applications adding to file system 157 creating 98 development environment 99
importing code 103 incorporating into platforms 99 penguin 101 providing in layers 232 running native 106 running non-native 108 sysroots for 99 arch.cpu-variant 40 architecturedb file 223 archives 121 ARM Versatile AB-926EJS 164 creating target 53 emulation 29 assembly view debugging 179 attaching to core file 223
B
back end 269 Backend Connection 50 ball tutorial 98 baseline snapshots 216 bin directory 60 board menu 51 support package 111, 269
277
booting targets 228 boot-time access 50 feature template 215 logging 215 breakpoints 179 kernel 197 per debugger 176 bridging hosts 186 BSPs 75, 111, 269 directory 269 build 269 build target 65 directory 54, 56, 270 output 56, 270 paths 109 properties 109 scope 270 specs 54, 111, 113, 270 targets 65, 157 tools 109 Build Console 52 build properties build macros 109 changing 109, 114 libraries 109 Build Target 39, 55 BUILD_TYPE=debug 72 BUILD_TYPE=profiling 72 build-all node 39 Bus options 86
C
CardBus cards 86 Cavium example platform project 67 CDT (C/C++ Development Tooling) 270 cgl kernel type 51 changelist.xml 57, 60, 215 classic packages defined 130 importing 119 clean
build target 65 ClearCase repositories 38 Code Coverage Analyzer 213 command line configuring projects 50 Common PC 164 emulation 29 compile build target 65 components definition 93 hierarchy 93 configure command 51 modifying 51 output in Build Console 52 Configure Options dialog 54 connecting to targets 49 Connection 50 connections connect and disconnect 163 creating 177 emulated 164 Ethernet 192 ICE-like debugging 207 KGDB 167 new 162 properties 164 QEMU types 49 serial 195 serial cable 195 serial/telnet 192 shared 172 summary page 172 TCP 186 telnet 194 troubleshooting KGDB 195 types 162 types of KGDB 167 UDP 186 using KGDB 196 Contents tab 64 core files acquiring 222 analysis 224
278
Index
attaching to Workbench 223 attaching Workbench 223 core.pid 221 CPU type 224 Create template source 87 creating custom kernel module 88 creation.log 52, 55 cross compiling 120 cross-development 270 custom build target 65 kernel module projects 205 Custom Linux KGDB Connection 167 customer-specific projects 25 enabling 26 CVS repositories 38 Cygwin 26, 30
D
database queries 16 Debug Process on Target 50, 177 debuggable objects 270 debugger framework (DFW) 270 Debugger tab 31 debuggers table of 31 which breakpoints 176 debugging assembly 179 breakpoints 179 breakpoints in kernel modules 202 kernel mode, intro 30 kernel modules 198 kernel space 183 KGDB command-line 184 object path in kernel modules 202 object paths in kernel modules 203 packages, on or off 64 process overview 178 turning off for production 184 user mode, intro 30 user space 176 user supplied kernel modules 199, 200
default kernel 55, 56, 57, 156 Dependencies tab 64, 70, 72 deploying emulated targets 160 NFS 160 to targets 159 development environment 26 device adding 62 file class 58 ownership 62 Device Debug perspective 178 Device Management (DM) products 33 DFW 270, 271 directories adding and removing from file system 60, 61 disabled build 271 discovery 271 dist directory 53, 54, 156 Makefile 120 dist.tar.bz2 image 58, 157 distclean 120 build target 65 distribution media 32 DM products 33 do_fork 189 dynamic printf 180
E
ecgl kernel type 51 Eclipse plug-ins 19 Eclipse C/C++ IDE 270 Edit Source Lookup 196 ELF core dump file 221 Embedded Debug perspective 196 emulated target environment 160 --enable-debug 189 environment settings 260 environment variables sending to standard out 263
Index
279
Estimated Filesystem line 60 Ethernet connections 192 ports, multiple 190 event points 180 Exec Path on Target 177 export /dist directory 56, 58 directory 56 sysroot command 229 export directory 56 export/dist 58, 157 export/dist directories QEMU 164 exporting sysroots 229 export-layer build target 227 export-sysroot node 227 external API 271
File System Layout Configuration tool 40, 57, 58, 212 files adding and removing from file system 60, 61 collecting for export 158 Filesystem tab 60 Filter icon 59 fixes reusing package 120 Flat view 59 flexible managed build 271 footprint exporting dependency data 218 snapshots, creating 216 snapshots, restoring 217 snapshots, updating 217 Force Install 67 RPM 65 fs node 48, 55, 156 fs_final script 58
F
fakeroot 58 feature templates major description 92 file change list 58 ownership 40 properties 60 file system 57 adding applications 157 building example 56 components 156 configuration 57 creating 55 estimated size 60 finding 28 making exportable 158 managing 58 NFS mounting 188 NFS mounts 188 root 165 size 215 small 63
G
GDB GNU Debugger 175 native-mode applications using 178 General tab 64 generated RPM files 57 gid ownership 58 glibc_cgl carrier-grade Linux 51 glibc_small 63 Busybox-based 51 glibc_std standard Linux 51 GNU Debugger (GDB) 175 tools 26 Grnbacher, Andreas 128 178
280
Index
H
hello_world building 100 tutorial 100, 102 help key 271 host bridging 186 file system source path 61 shell 271 toolchain 271 tools 272 hosts supported 26 host-tools/bin directory 186 http //oprofile.sourceforge.net/about/ 213 //sourceforge.net/projects/kgdb/ 184 hunk 272
shared 11 shared Wind River Linux 267 installed packages 63 ipconfig 190
J
Java code 16 JDT 272 JNI 272
K
Kconfig tab 85 kernel 156 configuration 84 debugging 184 debugging with QEMU 207 default 55, 56 default, finding 28 developers 16, 36 image, default 57 information 88 pre-built 38 rebuild target 41 reconfiguration 84 safe areas 189 symbol file 168 symlink to default 86 types 51 Kernel Configuration node 85 Kernel GNU Debugger 30 Kernel Hacking tree 209 kernel mode 272 debugging 30 kernel module 272 debugging 198 moving projects 89 projects 25 kernel modules 87 adding 87 breakpoints in unloaded 202
I
ICE-like debugging 206, 207 Immediately connect to target 163 Import tool 235 importing classic packages 119 packages 68 source code 103 index 272 insmod command 199 Install RPM 65 install build target 65 install.properties file 260, 267 INSTALL_STAGE output 58 Installable Packages list 66, 73 window 68 installation licensing 11 local Workbench 267 network servers 265
Index
281
custom 88 custom projects 205 debugging 198 installing 150 moving projects 89 object path mappings 202, 203 providing 232 removing 150 testmod enhanced sample 204 user supplied, debugging 199 user supplied, stepping into 200 kernel space debugging 183 kernel_build 198 kernel_build node 156 kernel_rebuild 156 kernel_rebuild build target 86 kernels breakpoints 197 exporting layers 237 making exportable 158 modified by layers 234 providing 232 rebuilding 86, 156 KGDB advanced connections 170 and Workbench 184 command-line debugging 184 connection from Workbench 192 connections 167 connections -- UDP or COMM 190 disabling for production 30 enabled by default 189 enabling 189 enabling and disabling 209 Linux kernel config option 189 open source project 184 over Ethernet 207 over subnets 185 patching kernel for 30 QEMU kernel debugging 50, 206 standard port 186 starting agent on target 190 troubleshooting connection 195 using connection 196 KGDB over Ethernet (kgdboe) 186
kgdb.c compilation unit 39 source file 196 kgdb-8250 module usage syntax 192 kgdboe 186 agent 187 connection 187 for non-PCD 190 for PCD, dynamic config 191 for PCD, static config 191 starting, examples 190 static linked in kernel 191 UDP packets 186 klogd command 199
L
launch configurations 42, 273 layers 75, 273 adding 52, 79 directories 273 distributing 233 example to modify kernels 234 exporting kernel 237 importing 239 introduction 8 making available for team 238 of applications 232 libraries build properties 109 into relocatable directories 112 licensing and installation 11 life cycle introduction 37 Link to Development Folders 54 Linux hosts 26 Linux kernel information 88 Linux Kernel Module projects prepopulating 87 Linux kernels version 2.6 30 Linux KGDB via Ethernet 167, 193 Linux KGDB via RS-232 167, 195 Linux KGDB via Terminal Server 167, 194 Linux User Mode Target Server 49
282
Index
live targets 57, 58, 60, 63, 65 RPMs and kernel modules 149 Load/Add Symbols to Debug Server 168 localhost.localdomain 11 Log tab 60 generated RPMs 65 logging into terminals 166 lsmod command 195
M
make clean 156 make fs 156 Makefile modifying for cross-compile 120 managed build 269, 273 mapping source path 39 memory cache size, target server 171 Memory Analyze As 32 Memory Analyzer 214 menuconfig interface 85 meta properties files 60 middleware developers 16 MinGW 26, 30 modprobe commands 190 module.c 200 moduledebug.c 87 moduleDebugExample.ko 200 mpatrol 32, 38 multi-core systems 214 multi-lib RPMs installing 67
development environment 273 native-mode applications 47 network servers 265 networked hardware 168 New Connection wizard 162 NFS builds 11 directories on shared hosts 188 mounted hosts 38 mounting file system 188 mounting targets 188 target environment 160 non-native applications running 108
O
Object Path Mappings Ethernet 193 object path mappings 50, 203, 273 QEMU 166 symbol files and target paths 168 object.properties files 26 OCD connections 50 On-Chip Debugger 189 octeon spec warning message 68 On-Chip Debugger (OCD) 189 Open Workbench development shell 120 openssl 72 OProfile 38, 213 Option/Value dialog 52 Options tab 64 option-value templates 51 Index
N
native applications projects 25 running 106 native mode
P
package developers 16 Package Import Tool 68 Package Manager 63 intro 39
283
package sizes 58 package_RPM_ALL 10 package_RPM_DEFAULT 10 package_RPM_DEVEL 10 package_RPM_NAME 10 packages 273 archives 121 building new 122 classic 130 customizing 123 debugging 71 dependencies 66 dependent 216 directory 53 hierarchy 93 importing 68, 119 importing Wind River Linux 123 Package Manager 63 parent 62 removing 62, 72 required files 215 reusing fixes 120 RPMs 63 sizes of 215 turning debugging off 64 updating spec file 121 Packages dialog 58, 65 Packages view 59 parent packages 62 patch annotations 138 build target 65 files 274 lists 274 target rules 123 patch files modifying SRPM 141 patches annotations 138 applying and resolving 128 creating new top files 137 exporting 146 folder 137 models for using 128 modifying 145
new top files 144 new top patch files 130 popped files 143 registering 142 registering as last 142 running distclean on 147 saving SRPM 141 saving updates as 143 testing 143, 147 patches.list file 117, 143, 147 patching 127 SRPM packages 140 path mapping target to host 169 pathname prefix mappings 169 Pattern Filter field 59, 62 value 62 PCCard support 86 PCD Wind River Platform for Consumer Devices 191 PCMCIA cards 86 Penguin building 101 Performance Profiler 213 PHP pages 16 PIDs 179 pkglist file 58, 63, 65, 66, 67, 71, 73, 215 pkg-wr-integration.patch file 117 pkg-wr-integration.patch tree 142 placeholder RPMs 69 platform 47, 87 developers 16 integrators 36 kernel modules 87 projects 25 platform project verifying build 55 platform projects general steps 51 overview of building 47 plug-ins 274 Eclipse 19 ports
284
Index
6443 for KGDB 186 POSIX signals 181 postpatch build target 65 pre-built kernels 156, 196 RPMs 39 pre-built kernel 38 preempt_rt kernel type 51 prepatch 69 build target 65 printf 180 Printk 189 pristine RPM files 58 process IDs (PIDs) 179 processes reviewing 177 terminating 182 product development life cycle 37 profiles adding 52 basics 93 creating 93 differences from platforms 94 hierarchy 93 Profiling build type 54 profiling CPU usage 213 project 274 description files 274 directory 274 ProjectName_prj directory 48 projects application 25 customer-specific 25 kernel modules 25 native applications 25 platform 25 user-defined 25 Wind River Linux 25 properties 164 pseudo 58 pxeboot 188
Q
QEMU backend CLI connections 163 connecting to emulated targets 164 connections 49 emulated boards 29 export/dist directories 164 KGDB debugging 206, 207 Linux User Mode Target 163 object path mappings 166 Qemu-PPC32 164 Quilt Add File to Top Patch 122 Add New File to Top Patch 141 configuring 127 Export Patch 143 Import Patch 137 importing packages 121 introduction 127 menu 130 New Patch 120 new top patch files 144 patches node 136 Pop 143 Refresh Top Patch 122 setting up 135 starting 135 viewing patch annotations 138
R
rebuild build target 65 registered patches 142 Registry 108, 274 remote connections 177 Remote Systems view 162 New Connection wizard 162 pathname prefix mappings 169 shared connection configuration 172 Replace RPM 65 Required By panel 64
Index
285
Requires panel 64 root 58 directory 50 file system 165 RootFS menu 51 RPM dependencies 67 generated files 57 macros 122 manager 63, 151 pushes 63 queries 63 rpm -erase 65 rpm -install 65 rpm -install -force 65 rpm -option 63 rpm_patches.list 130 rpm_patches.list file 142 RPMs 63 available 58 configuration 57 installing multi-lib 67 launching to target 151 placeholder 69 pre-built 39 removing from target 152 replacing running 152 unavailable 63, 70 URLs for 64 RPMS directory 53 rtcore kernel type 51 Run Process on Target 50 runtime file system 57
S
safe areas 189 self-hosted applications 47 debugging 176 self-hosted development environment 274 serial cable connections 195 serial line settings 168 serial port connections 194
serial/telnet connections 192 setgid file permissions 58 shared connections 172 installations 11, 267 shell commands in Workbench 262 signals configuring 181 POSIX 181 simultaneous usermode-agent connections 189 small kernel type 51 snapshots baseline 216 Solaris hosts 26 source code indexer 52 source lookup path 275 source path mapping 39 Source RPM (SRPM) packages 121 spec files 143, 275 saving 140 SRPM package 140 updating 121 SPECS/pkg.spec file 142 Spin locks 189 SQL 19 SRPM packages 121 importing 121 packages importing SRPMs 121 patching 140 URLs 121 SRPM patch files modifying 141 saving 141 SRPMs cross compiling 140 integrating into Wind River Linux 140 standard builds 275 kernel types 51 managed builds 275 subprojects 88 superprojects 88 symbol files 168
286
Index
pre-built 38 Symbol Files and Order list 168 Symbol Load Options 168 sysroots 111, 112, 275 adding 112 copying 230 exporting 229 importing 112 provided 112 system mode 275 System Viewer 214 System.map file 156
tgtsvr command (TIPC) 171 timeout options 171 TIPC 276 toolchain 276 available 26 host 271 tools, development communications, managing tutorial Hello World 100, 102
159
U T
tar.bz2 files 56, 156 tarball file system image 58 target agent 275 environments 160 paths 168 servers 171, 275 memory cache size 171 timeout options 171 Target Operating System Settings dialog 208 targets 275 connecting 49 PCD 191 properties 169 server options 171 state refresh page 169 timeout 171 Targets tab 65, 69 TCP connections 186 telnet connections 194 templates 75, 276 adding 52 code 87 feature 92 named per type 91 terminals logging into 166 testmod, enhanced sample LKM 204 uClibc 51 uclibc_small 63 uClibc-based file system 51 UDP connections 186 packets 186 uid ownership 58 UID root 58 uimage 228 ulimit settings 223 URL to RPM 64 USE 57 user mode 276 debugging intro 30 User Mode Target Server 163 User Space Configuration node 40, 57 User Space Configuration Tool overview 118 user space debugging 176 User Space Editor 57 user-defined builds 276 projects 25 user-defined projects 63 usermode-agent and QEMU 49
Index
287
V
View icon 59, 62 Virtual-WRLinux0 terminal window vmlinux pre-built symbol file 38 vmlinux symbol file 41, 189, 193 166
wrenv command 260 wr-integration.patch file 143 wrlinux_quilt_patches directory 142 WRLinuxHost_username 177 wrll-analysis-1.0 layer 215 wrll-toolchain-version 99 WRQEMULinuxUser_Project_prj connection 166
W
WDB debugger 30, 175 Wget 68, 121 Wind River Debugger 30, 176 Wind River Debugger (WDB) 175 Wind River Linux Application Core Dump Target Server Connection 223 Wind River Linux KGDB Connection 192, 195 Wind River Linux Migration Guide 10 Wind River Linux Platform Project 54 Wind River Linux Release Notes 10 Wind River Linux Users Guide 42, 155, 184, 215 Wind River Platform for Consumer Devices (PCD) 191 Wind River Workbench Code Coverage Analyzer User's Guide 213 Wind River Workbench Memory Analyzer User's Guide 214 Wind River Workbench Performance Profiler User's Guide 213 Wind River Workbench Users Guide 24, 42, 98, 172 WIND_LX_HOME 267 Windows hosts 26 Workbench build commands 261 local installation 267 setting environment 260 shell commands 262 starting 24 workspace 276 directory 61 WR Linux Kernel Module Project 206 WR Linux Package 68 WR3.0au_kernel files 56
X
X 19 xconfig interface 85
288