![]() |
|
||||
LynxOS User's Guide |
Getting Started
This chapter provides a quick overview of basic LynxOS usage and concepts, including:
- Starting and shutting down the LynxOS Development Environment
- Starting and exiting from the X Windows
- Using PosixWorks Desk
- Using basic UNIX commands
- Creating file systems on floppy disks
- Making backups
- Starting the LynxOS environment for cross development systems
LynxOS Packages
The base LynxOS Windows cross development package includes the following
CD-ROMs:
- Messenger (only included if required by a BSP)
- Additional Components CD-ROM containing Linux ABI Compatibility Layer, GNU Zebra Routing Package, OpenSSL Encryption Package
The base LynxOS UNIX-hosted cross development package includes the following CD-ROMs:
This CD-ROM also contains the Board Support Package (BSP) for a particular target.
- Additional Components containing Linux ABI Compatibility Layer, GNU Zebra Routing Package, OpenSSL Encryption Package
- Messenger (only included if required by a BSP)
The native development environment includes the following CD-ROMs:
This CD-ROM also contains the Board Support Package (BSP) for a particular target.
- X & Motif
- Messenger (only included if required by a BSP)
- Additional Components CD-ROM containing Linux ABI Compatibility Layer, GNU Zebra Routing Package, OpenSSL Encryption Package
Starting and Stopping LynxOS
When powered on, systems running LynxOS boots to a command line prompt. If password access is enabled, users are prompted to enter a login name and password. Depending on the system's user access and privileges configuration, the initial working directory is either root or the user's home directory. The pwd command displays the current working directory.
On a cross development system where LynxOS is installed on top of an existing operating system (Windows, Linux, Solaris, etc.), the user must navigate to the LynxOS installation directory and set the LynxOS environment with a SETUP script. The script SETUP.bash is used for bash shells, and SETUP.csh is used for C shells. Refer to "Setting the Cross Development Environment" for details.
To prevent system corruption, LynxOS must be powered-off with a predefined shutdown sequence. To properly shutdown LynxOS, use the following command:
The -h option (halt) means that the system is not ready to power off until the following message indicates disk activity has stopped:
At this point, it is safe to power down the system.
Starting and Stopping X Windows
The native development configuration of LynxOS includes X11R6 and Motif (referred to as the "X Window System" or just "X Windows"). The X and Motif Package for LynxOS cross development systems is available separately. X Windows provides an industry standard graphical user interface (GUI) based on X11R6. The following command starts X Windows:
The keyboard sequence Ctrl-Alt-Backspace exits X Windows.
Using PosixWorks Desk
PosixWorks Desk provides quick access to LynxOS tools and utilities. Tool bars, buttons and icons facilitate management of the development environment. The folder-style file manager allows users to drag and drop files. Users can optionally install PosixWorks Desk when they install X Windows. Pressing the Help button on the main tool bar provides detailed information on PosixWorks Desk supported features.
Basic LynxOS Commands
Most basic LynxOS commands are identical to UNIX commands. This section briefly describes these basic LynxOS commands.
Further information about these commands is also available through LynxOS man pages. LynxOS man pages are accessed using the following command syntax:
man command, where command is any LynxOS command verbatim. For more information, see "LynxOS Man Pages".Users should familiarize themselves with the following basic LynxOS commands:
LynxOS Man Pages
LynxOS provides man (manual) pages for information and help with commands, utilities and tools. All LynxOS man pages are called with the syntax:
Where subject is any LynxOS command, utility or tool name. Users can enter the man command from anywhere on their systems.
LynxOS man pages are text files located in the /usr/man directory.
The LynxOS man command uses the less command to display the information one page at a time (see the description of less in the previous section). LynxOS man pages have the same user interface functionality as read-only files - users can view a text file and perform some operations on the file, such as scrolling and string searches, but cannot edit them.
While viewing the man page with the man command, users can get help with available viewing options by pressing the h key. Pressing the q key then Enter exits the help session and returns the user to the man page.
If a user is interested in a topic but is not sure what the exact commands are, a man search can be done for a keyword using the -k option:
The man command with a -k option is the least restrictive type of search - it is not case-sensitive, the keyword can be within the description of one or many commands, options, or the command name itself (as shown in the example command and its screen return below):
# man -k less
less (1) - interactive paginator files, viewing
lesskey (1) - specify key bindings for less
ltgt (3) - test for floating-point less-than or greater-than
slaveboot (1) - transfers a kernel image to a diskless SCMP client
Users can also use the more restrictive -f option with the man command --it is case sensitive--as shown in the example command and its screen return below:
If neither of these options helps a user find information, the following command displays an alphabetical list of all LynxOS man pages:
Creating File Systems and Making Backups
Users can create file systems and make backups to archive important data. The following steps detail creating a file system on a high-density floppy device, copying files to the floppy device, and then unmounting the device:
- Insert an empty, high-density floppy disk into the floppy disk drive.
- Format the floppy disk in the fdd1440.0 disk drive with the fmtflop command and -v argument (verbose mode: displays messages as the floppy is being formatted):
- Mount the fd1440.0 floppy disk's file system with the mount command onto the mount point directory, /mnt, by entering the following command:
- Copy any number of files to the mounted floppy disk file system using the following command syntax, where directory represents any directory, and file.abc and file.xyz represent any number of files from that directory:
Making Backups
The tar archive utility is used to make backups of important data files on a variety of media. The type (s) of backup media chosen depends on both the development platform, and the amount of data that is to be backed up.
The following commands are examples of backing up data for a number of common configurations.
In the example below, the user's home directory is named /usr/home/mystuff. To back up the home directory's contents to a file named backup.tar, the following syntax is used:
The -cvf arguments direct tar to perform the following actions:
- c - create a new tar archive
- v - provide verbose screen return (optional)
- f - direct the output to a file located in the current directory.
To back up directly to a device instead of a file, direct the output to a device node in the /dev directory. For example,
To list the archival contents of the backup.tar file, the following syntax is used:
In this example, -t is the argument that directs tar to list the archival contents of the backup.tar file.
To extract archival data in the file backup.tar and place it into /usr/home/mystuff, the following syntax is used:
In the previous example, -x is the argument that directs tar to extract the archival contents of device /dev/device.
LynxOS Cross Development Environment
The term Cross development is the process of developing an application or kernel on a host system configuration that is different from the configuration of the target system (where the application is to be deployed).
The cross development environment provided in LynxOS includes compilers, linkers, libraries, and other development tools specific to LynxOS. The LynxOS cross development environment allows the developer the flexibility of creating LynxOS applications and kernels from a variety of platforms.
When working on a LynxOS cross development system, users must set their host system environment to use the LynxOS cross development tools before running any Makefiles or compiling applications. The cross development environment, once set, provides users the complete functionality of a native development system. The advantages of this approach is that there is no need to establish a dedicated machine for cross compiling and cross debugging an application. The application can be recompiled easily for different platforms, i.e., x86 and UNIX.
Setting the Cross Development Environment
Refer to the LynxOS Installation Guide for information on installing the Cross Development Kit (CDK) CD-ROM.
Before developing LynxOS applications on a cross development host, users must set the LynxOS cross development environment with a provided setup script. Two setup scripts are provided: SETUP.bash, which sets the bash shell environment; and SETUP.csh, which sets the C shell environment. Users must run one of these setup scripts, depending on their preferred shell, before compiling or linking LynxOS applications.
These setup scripts allow users to develop applications and run Makefiles as if they were on a native development system. With the exception of running the setup script, there is no operational difference between the application development process on a cross development or native development system.
The SETUP.bash and SETUP.csh scripts add the environment variable ENV_PREFIX to a user's PATH. The ENV_PREFIX variable specifies the directory on the host where the LynxOS development tools are located. This allows users to create their applications with LynxOS-specific compilers, linkers, and libraries. ENV_PREFIX is set to the first entry of a user's PATH to ensure that users create applications with LynxOS-specific tools.
Setting up Cross Development on UNIX Hosts
To develop LynxOS applications on a UNIX cross development host, run the setup script as follows:
- Change to the LynxOS cross development directory. This is /usr/lynx/release/platform, where release is the LynxOS release number, and platform is the target architecture. For example:
- The setup script directs the user to the detected LynxOS development tools path. If this path is correct, type y. Otherwise, type n and enter the correct path to the LynxOS cross development tools directory.
Once the setup script has run, users can begin to develop LynxOS applications on the cross development host.
Setting up Cross Development on Windows Hosts
- Change to the LynxOS cross development directory. This is /usr/lynx/release/platform, where release is the LynxOS release number, and platform is the target architecture. For example:
- The setup script directs the user to the detected LynxOS development tools path. If this path is correct, type y. Otherwise, type n and enter the correct path to the LynxOS cross development tools directory.
Once the setup script has run, users can begin to develop LynxOS applications on the cross development host.
The Application Development Process
The figure below shows the basic steps in the application development process.
![]()
Application Development Process Overview
Creating Source Code with vi Text Editor
Users familiar with UNIX operating systems should already be familiar with the vi text editor. LynxOS provides vi as a part of its standard distribution.
For users unfamiliar with vi, this section provides a quick list of important functions.
vi is a full screen text editor used to create and modify ASCII files. There are two main modes in vi - command mode and input mode. Command mode is used for issuing short cursor placement or text selection commands. Input mode is used to add, change, or delete text in a file.
The following example shows how to create a text file, in this case a simple C program, using vi (other C program source files can be found in /src/examples):
- vi opens the new file HelloWorld.c in command mode. Input mode is set by pressing i.
- Type some characters.
- Return to command mode by pressing the Esc key.
- Close vi, and save all changes by entering the following:
:wq
To quit vi after opening the file as read-only (making no changes), enter the following command:
Basic vi Commands
The following table details basic vi navigation and editing commands used in Command Mode:
Example vi C Program
Begin vi as shown previously and enter the following text:
#include <stdio.h>
main ()
{
int index = 10;
printf("\n\n*****************\n");
printf("Hello World! \n");
printf("*****************\n\n");
}
Now go into command mode and save the file. This example file is used in the following section, "Compiling and Linking Source Code".
Compiling and Linking Source Code
After entering and saving the source code file, the user can create an executable application by compiling and linking it with the LynxOS GNU C compiler. To compile the HelloWorld.c file, enter the following command:
If the program compiled without errors a default executable file called a.out is generated.
Users can rename the executable to something other than a.out by using the
-o name option as shown in the example below:The resulting executable is the file HelloWorld. To execute the file, enter the following command:
The executable prints the following text:
Debugging Source Code
LynuxWorks has two debuggers available for use with LynxOS:
- The GNU Debugger (GDB) - Provided as a standard part of the LynxOS development environment. For additional information, see the Total/db User's Guide.
- TotalView - Offered as an optional separate product; for more information on TotalView, see the TotalView User's Guide and TotalView Supplement for LynxOS Users.
Since TotalView is optional, only gdb is detailed below.
First, for GDB to function properly, the source code being debugged must be compiled using the -g GDB option as part of the compile command. This option adds debugging information to the executable. For example, to compile a source code file named HelloWorld for debugging with GDB, enter:
To start GDB, enter the following command:
To quit GDB, enter the following command:
GDB does not initialize or set any default breakpoints. A breakpoint makes a program stop whenever a certain point in the program is reached during execution. Users must provide the initial breakpoint. However, it is usually convenient to set a breakpoint at main, which is done using the following command:
GDB includes a command recognition feature that requires users to enter only as many characters of any command as make the command unique. For example, if a user wants to enter the help command, it is only necessary to type he, then press the Enter key for GDB to bring up the help list of GDB commands and their options.
Some basic GDB commands are listed below:
Creating Custom Kernels
Users can customize individual LynxOS kernels specific to the requirements of their application. The LynxOS kernel can be optimized for maximum memory footprint economy, an advantage when memory constraints or costs are a key product requirement.
Unnecessary kernel components and/or features can be removed based upon specific application requirements.
For more information on LynxOS kernel customizations, see Chapter 7, "Customizing the Default LynxOS Kernel Configuration".
Making Final Images
The LynxOS mkimage utility can be used to create a final application or LynxOS kernel image, and LynxOS facilities for run-time. The mkimage man page and "Creating Kernel Downloadable Images (KDIs)" describe this process in detail.
Identifying LynxOS Facilities for Run-Time
Users can choose to distribute their final software product as a ROM- or RAM-based file systems containing a LynxOS kernel and an application. Users can also choose to distribute their software product as a LynxOS kernel, an application, or some subset of a development facility packages on more conventional storage media such as a disk or CD-ROM.
To distribute LynxOS in any of these configurations, users must purchase appropriate run-time royalty licenses from LynuxWorks.
![]() LynuxWorks, Inc. 855 Branham Lane East San Jose, CA 95138 http://www.lynuxworks.com 1.800.255.5969 |
![]() |
![]() |
![]() |
![]() |