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
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
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. | |
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. | |
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. | |
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. |
More than 20 packages are included in the base BlueCat Linux distribution:
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.
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.
The following target processor families are supported:
Intel IA-32 (x86)
PowerPC
PowerQUICC
ARM/ARM7/ARM9/StrongARM
Super-H
MIPS R3000/R4000
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.
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).
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.
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.
In early 2001, BlueCat Linux costs anywhere from US$299 to US$20,000, depending on the support level you want to pay for.
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).
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.
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.
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.
18.118.120.109