BlueCat Linux from LynuxWorks (www.LynuxWorks.com)

LynuxWorks’s BlueCat Linux Version 3.0 is a professional embedded Linux toolkit that’s fully documented, supports a broad range of target hardware, and is freely downloadable (although you have to agree not to develop commercial applications with the freely downloadable version). The software is distributed on several CDs—one for all of the source code, and one for the binaries of each architecture.

LynuxWorks’s CDK includes the following items:

  • Compilers for C, C++, and Java

  • Hooks for the GDB debugger

  • Performance measurement tools

  • A small set of network tools and applications

The following target processor families are supported:

  • Intel IA-32 (x86)

  • PowerPC

  • PowerQUICC

  • ARM/ARM7/ARM9/StrongARM

  • Super-H

  • MIPS R3000/R4000

The following host operating systems are supported:

  • Red Hat 6.1 and 6.2

  • TurboLinux Workstation, version 6.0

  • Windows 98/NT/2000

Using BlueCat Linux

I was able to install BlueCat Linux version 3.0 and get my serial communications floppy running in about a day.The documentation is quite good. The following procedure outlines the general steps I followed:

1.
Obtain root privileges to your machine.

2.
As root, enter the following command to create a bluecat directory within

/tmp: 
         mkdir -p /tmp/bluecat 

The BlueCat tarball contains multiple files and directories in the root (naughty). By putting all these files into an empty directory in /tmp, you can easily delete them after install.

3.
Now let’s download the x86-linux.tar.gz file from the BlueCat Web site with the following command:

cd /tmp/bluecat; lynx http://www.LynuxWorks.com/… 

At 70MB, it will take a bit of time.

4.
Extract the archive with the following command:

tar xvzf x86-linux.tar.gz 

When this process is finished, you’ll have an install script and a BlueCat_i386 directory.

5.
Create the bluecat user:

adduser bluecat 

You can put the software somewhere else if you prefer.

6.
Change to the bluecat user:

cd ∼bluecat 

7.
Create a bluecat directory within the bluecat user’s home directory and cd to it:

mkdir bluecat ; cd bluecat 

I tried to install the BlueCat software directly into the bluecat user’s home directory, but the install script will only install into a directory with no other files. Users’ home directories always have lots of hidden junk in them, which will prevent installation, so using a subdirectory is a requirement.

8.
Install the BlueCat software with this command:

/tmp/bluecat/install 

When the install completes, you’ll have nine new directories and a setup script in the ∼bluecat/bluecat directory. The directories (bin, boot, cdt, demo.x86, etc, lib, sbin, usr, and var) contain, among other things, the cross-compiler tools and the target’s executables. Of course, for this demonstration, both the build environment and the target are x86, so it’s not really cross-compiling, but you get the point.

9.
Source the SETUP.sh script into your current shell using the dot command:

. SETUP.sh 

This script sets up several environment variables to work with BlueCat. It also updates your PATH to include the paths to the BlueCat build tools and updates your MANPATH so that you can view the BlueCat man pages. Finally, this script adds Bluecat: to the beginning of your command prompt so you know you’re in “BlueCat” mode.

10.
Change to the demo directory:

cd demo 

BlueCat creates a symbolic link named demo that points to the demo.x86 directory.Within the demo directory are seven different demo projects: default, disk, hello, osloader, ping, shell, and tcl.

11.
Make a copy of the shell demo and call it minicom:

cp -r shell minicom 

12.
Change to the minicom directory:

cd minicom 

13.
The shell demo came with a shell.config file. Since our example is called minicom, we must rename shell.config to minicom.config:

mv shell.config minicom.config 

14.
For the same reason, rename shell.spec to minicom.spec:

mv shell.spec minicom.spec 

15.
Make a new directory called minicom:

mkdir minicom 

We’ll keep the source files for Minicom here.

16.
Change to the new minicom directory:

cd minicom 

17.
Download Minicom from http://www.pp.clinet.fi/∼walker/minicom.html.

If it’s not there, try http://www.freshmeat.net to find it. If you have trouble downloading it, use http://ftpsearch.lycos.com to search for the filename, and then pick a site near you to download from. At the time of this writing, the latest version was 1.83.1.

18.
Untar Minicom (if you want to see the files that are created, type xvzf instead of xzf):

tar xzf minicom-1.83.1.src.tar.gz 

19.
Create a symbolic link named minicom that points to minicom-1.83.1:

ln -s minicom-1.83.1 minicom 

This symbolic link will be used in the opt/minicom/Makefile; if you decide to upgrade to a later version of Minicom in the future, you can just change the symbolic link to point to the new one.

20.
We have to make a small change to the Minicom source code to make sure that it works properly in our mini-environment. Change to the minicom source directory:

cd minicom/src 

21.
Let’s remove a Minicom security feature that’s unnecessary in an embedded application. In minicom.c, search for the following line:

if (real_uid == 0 && dosetup == 0) {

Delete about 61 lines—up to, but not including this line:

buf[0] == 0; 

If these lines are not removed, Minicom will bail out at this point. Since we don’t have to be concerned with permissions and correct users in our embedded environment, it’s safe to just skip this code.

22.
Save your changes.

23.
BlueCat comes with all of its own libraries for the target environment, but the free version doesn’t come with the ncurses library installed, so we’re going to cheat a bit:

vi Makefile 

Search for the following line within a group of assignments that say we’re compiling for Linux with libncurses:

LIBS = -lncurses #-lintl 

Change the line to read as follows:

LIBS = -L /usr/lib -lncurses #-lintl 

We could have downloaded the ncurses library from the Internet and built it using the BlueCat build tools in a separate directory, then linked with it. If you’re building a real embedded device, that’s exactly what you should do. But that procedure takes a dozen more steps and adds little to the book, so instead I’m showing you how to take advantage of the fact that our host environment is the same as our target environment; we can just use the ncurses library that’s installed with the host environment. This is handy if you want to kludge something up for testing (as long as you remember to fix it later).

24.
Back to Makefile:

vi Makefile 

Find the following line:

minicom: $(MOBJS) 

Insert the text -static before the text -o minicom on the next line. We need to make the minicom executable static because BlueCat won’t use the shared ncurses library from the host machine.

25.
Now make the minicom executable file:

make 

In a real project, you would modify the project Makefile to make minicom instead of building the executable “by hand” in this directory.

26.
Okay, back to the root of our project:

cd ../../.. 

27.
Ready for another Makefile change?

vi Makefile 

Find the third line:

KDI_NAME = shell 

Change it to read as follows:

KDI_NAME = minicom 

28.
Another ncurses kludge. This one is fairly harmless since this file is architecture-independent. Minicom needs the terminfo file for the Linux console “terminal” type:

cp /usr/share/terminfo/l/linux local 

29.
Now we need to make some changes to the minicom.spec file:

vi minicom.spec 

Here’s the first line:

# shell.spec 

Change it to read as follows:

# minicom.spec 

It’s just a comment, but you might as well fix it. Now find the following line:

ln -s /dev/console /dev/tty1 

Add the following lines after it:

mknod /dev/ttyS0 c 4 64 
mknod /dev/ttyS1 c 4 65 
mknod /dev/ttyS2 c 4 66 
mknod /dev/ttyS3 c 4 67 

These lines create the device nodes for the four serial ports on the target system’s /dev directory.

Now find the following line:

mkdir -p /var/run 

Add the following line after it (note that the last character is the lowercase letter L):

mkdir -p /usr/share/terminfo/l 

This creates the directory for the terminfo file.

Almost there. Find this line:

cp ./local/rc.sysinit /etc/rc.d 

Add the following lines after it:

cp ./local/linux /usr/share/terminfo/l 
cp ./minicom/minicom/src/minicom /bin 

These lines put the minicom executable and the terminfo file onto the target’s root filesystem.

30.
Now we need to edit the file. Run the vi command:

vi local/inittab 

The last line should look like this:

1:12345:respawn:/sbin/mingetty tty1 

Change the line to read as follows:

1:12345:respawn:/bin/minicom 

Be sure to take the s out of sbin. This forces the init program to run the minicom command when it’s done initializing the machine.

31.
Run the make command to make the BlueCat project:

make 

The first time through it has to rebuild the kernel, so it’ll take a while.

32.
Now create the boot floppy:

mkboot -b -k minicom.disk -f minicom.rfs -r /dev/fd0 /dev/fd0 

The mkboot command is part of the BlueCat distribution. It creates a bootable image on the specified device (/dev/fd0) from the parts created by the make command.The minicom.disk file is a copy of bzImage from the kernel in ∼bluecat/bluecat/usr/src/linux. The minicom.rfs file was built by BlueCat’s mkrootfs command during the make. One problem with the mkboot command is that it must output to a real device if you use the -b option. This is a problem if you use hardware emulation software such as VMware and never actually create a real floppy disk. For example, while testing BlueCat, I had to build a real floppy disk with the mkboot command and then use the dd command to pull the image back off the floppy and send it to a file.

33.
Boot the floppy disk on your target device. With a little luck, trusty old Minicom should appear for your serial terminal needs.

What’s Included with BlueCat Linux?

More than 20 packages are included in the base BlueCat Linux distribution:

Package Version License Description
SysVinit_trg 2.77-1 GPL The SysVinit package contains a group of processes that control the very basic functions of your system. SysVinit includes the init program, the first program started by the Linux kernel when the system boots. init then controls the startup, running, and shutdown of all other programs.
bash_trg 1.14.7-1 GPL bash is a GNU project sh -compati-ble shell or command language interpreter. bash (short for Bourne again shell) incorporates useful features from the Korn shell (ksh) and the C shell (csh). Most sh scripts can be run by bash without modification.

bash offers several improvements over sh, including command-line editing, unlimited-size command history, job control, shell functions and aliases, indexed arrays of unlimited size, and integer arithmetic in any base from 2 to 64. bash is ultimately intended to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools standard.

bash is the default shell for Red Hat Linux.You should install bash because of its popularity and power. You’ll probably end up using it.
demo_trg-x86 1.0-1 LynuxWorks This RPM contains all BlueCat Linux demo configurations.
e2fsprogs_trg 1.15-1 GPL The e2fsprogs package contains a number of utilities for creating, checking, modifying, and correcting any inconsistencies in second extended (ext2) filesystems. e2fsprogs contains e2fsck (used to repair filesystem inconsistencies after an unclean shutdown), mke2fs (used to initialize a partition to contain an empty ext2 filesystem), debugfs (used to examine the internal structure of a filesystem, to manually repair a corrupted filesystem, or to create test cases for e2fsck), tune2fs (used to modify filesystem parameters), and most of the other core ext2fs filesystem utilities. You should install the e2fsprogs package if you need to manage the performance of an ext2 filesystem.
ffs_trg 1.0-1 LynuxWorks BlueCat Linux Flash File System provides a filesystem directly on Flash, rather than emulating a block device. FFS is intended to provide a crash/powerdown-safe filesystem for diskless embedded devices.
fileutils_trg 4.0-1 GPL The fileutils package includes a number of GNU versions of common and popular file-management utilities. fileutils includes the following tools: chgrp (changes a file’s group ownership), chown (changes a file’s ownership), chmod (changes a file’s permissions), cp (copies files), dd (copies and converts files), df (shows a filesystem’s disk usage), dir (gives a brief directory listing), dircolors (the setup program for the color version of the ls command), du (shows disk usage), install (copies files and sets permissions), ln (creates file links), ls (lists directory contents), mkdir (creates directories), mkfifo (creates FIFOs or named pipes), mknod (creates special files), mv (renames files), rm (removes/deletes files), rmdir (removes empty directories), sync (synchronizes memory and disk), touch (changes file timestamps), and vdir (provides long directory listings). You should install the fileutils package because it includes many file-management utilities that you’ll use frequently.
glibc_trg 2.1.2-1 L GPL The glibc package contains standard libraries that are used by multiple programs on the system. To save disk space and memory, as well as make upgrading easier, common system code is kept in one place and shared between programs. This particular package contains the most important sets of shared libraries: the standard C library and the standard math library. Without these two libraries, a Linux system won’t function. The glibc package also contains national language (locale) support and timezone databases.
glibc_trg-devel 2.1.2-1 LGPL The glibc-devel package contains the header and object files necessary for developing programs that use the standard C libraries (which are used by nearly all programs). If you’re developing programs that will use the standard C libraries, your system needs to have these standard header and object files available in order to create the executables. Install glibc-devel if you’re going to develop programs that will use the standard C libraries.
kernel_trg-bcboot 2.2.12-1 GPL This package contains the BlueCat boot sector used by installation tools to make hard disks and floppies bootable with the BlueCat kernel.
kernel_trg-headers 2.2.12-1 GPL kernel-headers includes the C header files for the Linux kernel. The header files define structures and constants that are needed for building most standard programs and are also needed for rebuilding the kernel.
kernel_trg-source 2.2.12-1 GPL The kernel-source package contains the source code files for the Linux kernel. These source files are needed to build most C programs, since they depend on the constants defined in the source code. The source files can also be used to build a custom kernel that is better tuned to your particular hardware, if you are so inclined (and you know what you’re doing).
kernel_trg-x86 2.2.12-1 GPL The kernel package contains the Linux kernel (vmlinuz), the core of your Red Hat Linux operating system. The kernel handles the basic functions of the operating system: memory allocation, process allocation, device input and output, etc.
libtermcap_trg 2.0.8-1 L GPL The libtermcap package contains a basic system library needed to access the termcap database. The termcap library supports easy access to the termcap database, so that programs can output character-based displays in a terminal-independent manner.
libtermcap_trg-devel 2.0.8-1 LGPL This package includes the libraries and header files necessary for developing programs that will access the termcap database.If you need to develop programs that will access the termcap database, you’ll need to install this package. You’ll also need to install the libtermcap package.
mingetty_trg 0.9.4-1 GPL The mingetty program is a lightweight, minimalist getty program for use only on virtual consoles. mingetty is not suitable for serial lines (you should use the mgetty program for that purpose).
mkboot_trg 1.0-1 LynuxWorks The mkboot utility installs a kernel on bootable media (hard disk or floppy).
mount_trg 2.9u-1 GPL The mount package contains the mount, umount, swapon, and swapoff programs.Accessible files on your system are arranged in one big tree or hierarchy. These files can be spread out over several devices. The mount command attaches a filesystem on some device to your system’s file tree. The umount command detaches a filesystem from the tree. swapon and swapoff specify and disable devices and files for paging and swapping, respectively.
net-tools_trg 1.53-1 GPL The net-tools package contains the basic tools needed for setting up networking: arp, rarp, ifconfig, netstat, ethers, and route.
netkit-base_trg 0.10-1 BSD The netkit-base package contains the basic networking tools ping and inetd. The ping command sends a series of ICMP protocol ECHO_REQUEST packets to a specified network host and can tell you whether that machine is alive and receiving network traffic. inetd listens on certain Internet sockets for connection requests, decides which program should receive each request, and starts that program. The netkit-base package should be installed on any machine that’s on a network.
pam_trg 0.68-1 GPL or BSD PAM (Pluggable Authentication Modules) is a system-security tool that allows system administrators to set authentication policy without having to recompile programs that do authentication.
procps_trg 2.0.4-1 GPL The procps package contains a set of system utilities that provide system information. procps includes ps, free, sessreg, skill, snice, tload, top, uptime, vmstat, w, and watch. The ps command displays a snapshot of running processes. The top command provides a repetitive update of the statuses of running processes. The free command displays the amounts of free and used memory on your system. sessreg is a simple program for managing utmp/wtmp entries for xdm sessions. The skill command sends a terminate command (or another specified signal) to a specified set of processes. The snice command is used to change the scheduling priority of specified processes. The tload command prints a graph of the current system load average to a specified TTY. The uptime command displays the current time, how long the system has been running, how many users are logged on, and system load averages for the past one, five, and fifteen minutes. The w command displays a list of the users who are currently logged on and what they’re running. The watch program watches a running program. The vmstat command displays virtual memory statistics about processes, memory, paging, block I/O, traps, and CPU activity.
tcl_trg 8.0.5-1 BSD tcl is a simple scripting language designed to be embedded into other applications. tcl is designed to be used with tk, a widget set, which is provided in the tk package. This package also includes tclsh, a simple example of a tcl application.If you’re installing the tcl package and you want to use tcl for development, you should also install the tk and tclx packages.
util-linux_trg 2.9w-1 distributable The util-linux package contains a large variety of low-level system utilities that are necessary for a Linux system to function.Among many features, util-linux contains the fdisk configuration tool and login program.

BlueCat Linux Pros and Cons

We now turn to our list of questions to ask any embedded Linux toolkit to see how well BlueCat Linux stacks up to the competition.

What is the size of image produced?

Like PeeWeeLinux, examined later in this chapter, BlueCat Linux suffers from the use of glibc as its C library. This makes it difficult to put a lot of functionality into an embedded device with less than 2MB of storage. However, BlueCat can fit more on the floppy disk than PeeWeeLinux, since it doesn’t use syslinux to boot.

What architectures are supported?

The following target processor families are supported:

  • Intel IA-32 (x86)

  • PowerPC

  • PowerQUICC

  • ARM/ARM7/ARM9/StrongARM

  • Super-H

  • MIPS R3000/R4000

How easy is the toolkit to use?

The toolkit is quite straightforward and easy to use. However if you’re a true believer in a graphical development environment, you’ll be disappointed—it’s straight text only. This works well for my style of development, but some people just don’t like hacking on Makefiles.

How many optional packages are available?

I counted 381 optional packages in Appendix B of the BlueCat Linux User’s Guide. Most of that stuff is completely useless for an embedded system, however (unless you consider putting the Slovenian HOWTO on your target somehow useful).

What exceptional packages are available?

The packages I reviewed were all standard Linux software. BlueCat’s value-add is their build environment and toolset—they don’t give you anything out of the ordinary in their target RPM packages.

How customizable is the image? How difficult is it to customize?

BlueCat Linux uses a special specification file to lay out the filesystem of the target. The specification file looks very much like a shell script, and as such, the target is completely customizable.

How much does the toolkit cost? Is a royalty involved?

In early 2001, BlueCat Linux costs anywhere from US$299 to US$20,000, depending on the support level you want to pay for.

How well is the toolkit documented? Is printed documentation available?

The documentation was up to the task of getting me started. A HOWTO would be helpful. For instance, it wasn’t obvious how to add code to the target from the documentation (however, one look at the specification file was all it took).

How well is the toolkit supported? Paid support? Active list?

LynuxWorks has been around for a number of years. They have another embeddable operating system called LynxOS, so they have an established support organization. Therefore, their Linux support looks like many other software companies’ support—you can buy installation support and/or incident support from them directly. As of this writing, their Web site doesn’t mention any lists.

What are the requirements to use the toolkit?

The following host operating systems are supported:

  • Red Hat 6.1 and 6.2

  • TurboLinux Workstation, version 6.0

  • Windows 98/NT/2000

Windows is supported using cygwin. Supporting Microsoft Windows as a hosting environment, although it may make many Linux partisans cringe, is quite a good idea. It can only serve to spread Linux to more developers.

Can a new version of the toolkit be installed without losing changes?

Even though our examples lived within the ∼bluecat/bluecat directory tree, there was no reason why they had to. You can easily upgrade BlueCat without fear of blowing away your projects.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.120.109