The x86 CPU powers the final two targets: the Tri-M MZ104 and COTS PC. These targets boot from and use Flash IDE drives. This section presents the flash IDE technology selected and shows how to compile the kernel, create the target root filesystem, and prepare the flash drive for booting.
Flash IDE Technology
Flash technology has matured and provides a "no moving parts" solution for embedded designs. Flash ATA IDE drive capacity ranges from 8MB to 384MB, with single-piece pricing starting at $25 (as of fall 2001). The smallest size, 8MB, provides ample capacity for the Project Trailblazer root filesystem. The following components were selected for evaluation:
Connecting a Compact Flash memory card to an IDE controller requires an adapter. Using Compact Flash IDE drives eliminates moving parts from your design.
Pricing shown here reflects the manufacturer's suggested retail price in fall 2001. The SanDisk Compact Flash Card and SST ATA-Disk chip claim 100% ATA IDE compatibility. This means the Project Trailblazer engineers should be able to treat it like a regular drive (that is, they should be able to use fdisk, format, copy, and so on). The engineers also discovered that removable IDE drive bays, such as the StarTech SNT127A (www.startech.com), ease swapping IDE drives during development.
Preparing the Tri-M MZ104 and the COTS PC
Installing Linux with a distribution CD, such as Debian or Red Hat, on a commercial off-the-shelf PC is easy. Just put in the CD, boot, and install. As you saw earlier in this chapter, a minimum Debian installation requires 67MB and Red Hat requires 382MB, both of which are beyond the capacity of the Project Trailblazer Flash IDE drives.
During these installations, what actually happens? The distribution installation program partitions the destination drive, and if necessary, formats the drive, creates directories, extracts files from an archive file into these directories, configures various systems and subsystems, prepares the drive to be bootable, and then reboots. Sounds simple enough, doesn't it?
Preparing the root filesystem presents the largest challenge for distribution vendors. They have to select from among the thousands of existing programs. The Project Trailblazer engineers decided earlier in this chapter what their target Linux machines require. They also know what configuration files are necessary to boot the target root filesystem. Therefore, they now have to partition and format the Flash IDE drive, compile the x86 kernel, build the target root filesystem on the IDE drive, and boot the target board.
Partitioning and Formatting the Flash IDE Drive
The Tri-M MZ104 or the COTS PC will boot from and mount its root filesystem from a Flash IDE drive. Here are the steps in partitioning and formatting the Flash IDE drive using tbdev1:
The flash IDE drive is now ready for the kernel, the root filesystem, and booting preparation.
Compiling the i386 Kernel
Before you can boot the Tri-M MZ104 or COTS PC, you need to compile the kernel for it. This section describes how to compile the 2.4.10 kernel for the x86 target boards. Here are the steps to compile the x86 kernel:
This should create a compressed kernel image called bzImage in the arch/i386/boot directory. The buildrootfilesystem script requires this file.
Building the Target root Filesystem on the Compact Flash IDE Drive
The target root filesystem can now be placed on the flash IDE drive. The drive has been partitioned, formatted, and checked, and the kernel has been compiled. MontaVista's Journeyman FTP site provides the RPMs for root filesystem required programs. The buildrootfilesystem script also works for x86 platforms. The script performs the following steps:
Booting the Tri-M MZ104 Target
The Flash IDE drive contains the kernel and the root filesystem for the x86 target boards. Connect the Flash IDE drive to the x86 target primary IDE controller and power up. The target BIOS should find the flash IDE drive. LILO starts by showing the boot prompt then the kernel loads. The kernel mounts the root filesystem. The kernel then executes init, which executes bash. Here's the console output for the MZ104 power-up to bash prompt boot sequence:
LILO boot: Loading linux............... Linux version 2.4.10 (root@tbdev1) (gcc version 2.95.2 20000220 (Debian GNU/Linux)) #1 Fri Dec 7 02:28:38 MST 2001 BIOS-provided physical RAM map: BIOS-e820: 0000000000000000 - 000000000009f400 (usable) BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved) BIOS-e820: 00000000000d0000 - 00000000000d4000 (reserved) BIOS-e820: 00000000000e5c00 - 0000000000100000 (reserved) BIOS-e820: 0000000000100000 - 0000000002000000 (usable) BIOS-e820: 00000000fff80000 - 0000000100000000 (reserved) On node 0 totalpages: 8192 zone(0): 4096 pages. zone(1): 4096 pages. zone(2): 0 pages. Kernel command line: auto BOOT_IMAGE=linux ro root=301 BOOT_FILE=/tmp/tmpmnt/boot/bzImage Initializing CPU#0 Console: colour VGA+ 80x25 Calibrating delay loop... 39.83 BogoMIPS Memory: 30020k/32768k available (1098k kernel code, 2360k reserved, 313k data, 180k init, 0k highmem) Checking if this processor honours the WP bit even in supervisor mode... Ok. Dentry-cache hash table entries: 4096 (order: 3, 32768 bytes) Inode-cache hash table entries: 2048 (order: 2, 16384 bytes) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes) Page-cache hash table entries: 8192 (order: 3, 32768 bytes) CPU: Before vendor init, caps: 00000000 00000000 00000000, vendor = 1 CPU: After vendor init, caps: 00000000 00000000 00000000 00000000 CPU: After generic, caps: 00000000 00000000 00000000 00000000 CPU: Common caps: 00000000 00000000 00000000 00000000 CPU: Cyrix Cx486DX4 Checking 'hlt' instruction... OK. POSIX conformance testing by UNIFIX PCI: PCI BIOS revision 2.10 entry at 0xfd99e, last bus=0 PCI: Using configuration type 1 PCI: Probing PCI hardware PCI: Cannot allocate resource region 0 of device 00:00.0 got res[1040:107f] for resource 1 of PCI device 1078:0400 (Cyrix Corporation) Linux NET4.0 for Linux 2.4 Based upon Swansea University Computer Society NET3.039 Starting kswapd Detected PS/2 Mouse Port. pty: 256 Unix98 ptys configured Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI enabled ttyS00 at 0x03f8 (irq = 4) is a 16550A ttyS01 at 0x02f8 (irq = 3) is a 16550A block: 64 slots per queue, batch=8 Uniform Multi-Platform E-IDE driver Revision: 6.31 ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx PCI_IDE: unknown IDE controller on PCI bus 00 device 92, VID=1078, DID=0402 PCI_IDE: chipset revision 1 PCI_IDE: not 100% native mode: will probe irqs later ide0: BM-DMA at 0x1000-0x1007, BIOS settings: hda:pio, hdb:pio ide1: BM-DMA at 0x1008-0x100f, BIOS settings: hdc:pio, hdd:pio hda: SunDisk SDCFB-40, ATA DISK drive ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 hda: 78336 sectors (40 MB) w/1KiB Cache, CHS=612/4/32 Partition check: hda: hda1 Floppy drive(s): fd0 is 1.44M FDC 0 is a National Semiconductor PC87306 ne.c:v1.10 9/23/94 Donald Becker (firstname.lastname@example.org) Last modified Nov 1, 2000 by Paul Gortmaker NE*000 ethercard probe at 0x300: 00 40 33 55 3d c7 eth0: NE2000 found at 0x300, using IRQ 5. loop: loaded (max 8 devices) Linux Kernel Card Services 3.1.22 options: [pci] [cardbus] NET4: Linux TCP/IP 1.0 for NET4.0 IP Protocols: ICMP, UDP, TCP, IGMP IP: routing cache hash table of 512 buckets, 4Kbytes TCP: Hash tables configured (established 2048 bind 2048) NET4: Unix domain sockets 1.0/SMP for Linux NET4.0. ds: no socket drivers loaded! VFS: Disk change detected on device ide0(3,1) hda: hda1 VFS: Mounted root (ext2 filesystem) readonly. Freeing unused kernel memory: 180k freed INIT: version 2.78 booting INIT: Entering runlevel: 2 Starting Network bash-2.04#
You're now at the bash prompt on the COTS PC.
Tri-M MZ104 Target Platform Boot Requirements Review
In this section, the seven PBRs are reviewed for the MZ104. Remember that each target board needs to fulfill the seven PBRs in order to be used in Project Trailblazer.
PBR-1 for the MZ104
The target board should use Linux kernel 2.4 or greater. Here's the MZ104 console output during the boot process:
Linux version 2.4.10 (root@tbdev1) (gcc version 2.95.2 20000220 (Debian GNU/Linux)) #1 Fri Dec 7 02:28:38 MST 2001
PBR-1 is fulfilled because Linux version 2.4.10 boots.
PBR-2 for the MZ104
The target board will execute the bash shell. Exiting from the bash shell re-executes the bash shell. On the MZ104 console, exit from the bash shell by using the exit command:
bash-2.04# exit exit bash-2.04#
PBR-2 is fulfilled because exiting from bash respawns bash. init is properly configured.
PBR-3 for the MZ104
The system should execute the bash shell without security authentication. Here's the MZ104 console output during the boot process:
INIT: version 2.78 booting INIT: Entering runlevel: 2 Starting Network bash-2.04#
PBR-3 is fulfilled because init starts bash without authentication.
PBR-4 for the MZ104
The system should boot, initialize the Ethernet hardware, set a static IP address, and be configured to use DNS. At the bash prompt, use ifconfig to display the Ethernet hardware configuration and use ping to verify proper DNS configuration:
bash-2.04# ifconfig eth0 Link encap:Ethernet HWaddr 00:40:33:55:3D;C7 inet addr:192.168.1.23 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:17 errors:1 dropped:0 overruns:0 frame:0 TX packets:14 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 Interrupt:5 Base address:0x300 bash-2.04# ping yahoo.com PING yahoo.com (18.104.22.168): 56 data bytes 64 bytes from 22.214.171.124: icmp_seq=0 ttl=246 time=49.2 ms 64 bytes from 126.96.36.199: icmp_seq=1 ttl=246 time=48.8 ms 64 bytes from 188.8.131.52: icmp_seq=2 ttl=246 time=53.0 ms
PBR-4 is fulfilled because the Ethernet hardware is initialized. The target board's resolver translated yahoo.com to 184.108.40.206. This verifies proper DNS configuration.
PBR-5 for the MZ104
The system should contain the ping program to debug network programs:
bash-2.04# ping yahoo.com PING yahoo.com (220.127.116.11): 56 data bytes 64 bytes from 18.104.22.168: icmp_seq=0 ttl=246 time=49.2 ms 64 bytes from 22.214.171.124: icmp_seq=1 ttl=246 time=48.8 ms 64 bytes from 126.96.36.199: icmp_seq=2 ttl=246 time=53.0 ms
PBR-5 is fulfilled because a yahoo.com ping is successful.
PBR-6 for the MZ104
The system should be capable of executing the Project Trailblazer compiled version of helloworld. At the bash prompt, execute the helloworld program:
bash-2.04# /tmp/helloworld-i386 Hello world 1 times! Hello world 2 times! Hello world 3 times! . . .
PBR-6 is fulfilled because the i386 version of helloworld executes.
PBR-7 for the MZ104
The system should use the current version of GNU glibc. At the bash prompt, list the library directory and confirm the current versions:
bash-2.04# ls /lib ld-2.2.3.so libncurses.so.5.2 libresolv.so.2 ld-linux.so.2 libnss_dns-2.2.3.so librt-2.2.3.so libc-2.2.3.so libnss_dns.so.2 librt.so.1 libc.so.6 libnss_files-2.2.3.so libstdc++-3-libc6.1-2-2.10.0.so libdl-2.2.3.so libnss_files.so.2 libstdc++-libc6.1-2.so.3 libdl.so.2 libproc.so.2.0.7 libutil-2.2.3.so libm-2.2.3.so libpthread-0.9.so libutil.so.1 libm.so.6 libpthread.so.0 libncurses.so.5 libresolv-2.2.3.so
PBR-7 is fulfilled because the target boots with the current version of GNU glibc.
The Tri-M MZ104 fulfills all the PBRs.