嵌入式linux中文站在线图书

  Previous section   Next section


Booting the Embedded Planet RPX-CLLF

Before you can boot the RPX-CLLF, you need to compile the kernel for it. The buildtoolchain script in Chapter 3 configured the kernel and its kernel headers but didn't compile the kernel. This section describes how to compile the 2.4.7 kernel for the RPX-CLLF, create an image file consisting of the kernel and a RAM disk, download the image file to the RPX-CLLF, and boot the RPX-CLLF. Here are the steps for booting the RPX-CLLF:

  1. Change directory to the PowerPC kernel source:

    root@tbdev1[501]: cd /usr/src/powerpc-linux
    
  2. A default configuration file for RPX-CLLF exists in arch/ppc/configs/ rpxcllf_defconfig. Configure the kernel using this default config file, with two make commands:

    root@tbdev1[502]: make rpxcllf_config
    root@tbdev1[503]: make oldconfig
    
  3. You need to change one setting in the kernel configuration. The default RAM disk size is too small. The PowerPC root filesystem requires more than 4096KB of disk space. Run make menuconfig, select "Block devices", and then change the default RAM disk size to 8192. Then, exit twice and select Yes to save the new kernel configuration.

  4. Use these commands to compile the kernel and make an image file with a RAM disk for the RPX-CLLF.

    root@tbdev1[504]: make dep
    root@tbdev1[505]: make zImage.initrd
    

    You're likely to get this error:

    powerpc-linux-objcopy: cannot stat: http://images/ramdisk.image.gz: No such file or directory
    

    This error means make couldn't find the RAM disk file. You need to rerun buildrootfilesystem script again, with the ramdisk option:

    root@tbdev1[506]: cd /root/cross/buildrootfilesystem
    root@tbdev1[507]: buildrootfilesystem ppc ramdisk
    

    This creates a PowerPC RAM disk file in two locations: /tftpboot/ and /usr/src/powerpc-linux/arch/ppc/boot/images:

    root@tbdev1[512]: cd /tftpboot/
    root@tbdev1[514]: ls -l powerpc-ramdisk.gz
    -rw-r--r-- 1 root    root      1791234 Aug 24 01:15 powerpc-ramdisk.gz
    root@tbdev1[515]: cd /usr/src/powerpc-linux/arch/ppc/boot/images
    root@tbdev1[516]: ls -l ramdisk.image.gz
    -rw-r--r-- 1 root    root      1791234 Aug 24 01:15 ramdisk.image.gz
    
  5. Change directory back to the kernel directory and rerun make zImage.initrd:

    root@tbdev1[517]: cd /usr/src/powerpc-linux/
    root@tbdev1[518]: make zImage.initrd
    

    This time you should be successful in creating the zImage.initrd file called zImage.initrd.embedded in the arch/ppc/boot/images directory.

  6. Copy zImage.initrd.embedded to /tftproot/powerpc-zImage:

    root@tbdev1[520]: cp arch/ppc/boot/images/zImage.initrd.embedded /tftpboot/powerpc-zImage
    

    The RPX-CLLF kernel and RAM disk image combination file called powerpc-zImage that is located in /tftpboot is ready to be downloaded and booted.

  7. Connect RPX-CLLF's serial port ttyS0 to tbdev1's ttyS0 (COM1) port. Run minicom and reboot the RPX-CLLF. Look for the PlanetCore Bootloader banner:

    PlanetCore Boot Loader v1.02
    Copyright 2000 Embedded Planet.  All rights reserved.
    DRAM available size = 16 MB
    wvCV
    DRAM OK
    Autoboot in 2 seconds.
    ESC to abort, SPACE or ENTER to go.
    PlanetCore Diagnostics and Utilities - Release 2.01
    pcd#q
    >
    

    If the PlanetCore Diagnostics program starts running (at the pcd prompt), exit the program by typing q return; this gives you the bootloader prompt (>).

  8. Use the tftp program to download powerpc-zImage. Downloading the image to address offset of 400000 puts the image in the middle of the RAM space. The kernel and RAM disk decompression should occur without errors. Here are the RPX-CLLF TFTP commands and the go instruction to boot the kernel:

    >tftp
    Load using tftp via Ethernet
    Enter server IP address <192.168.1.11> : 192.168.1.11
    Enter server filename   <powerpc-zImage> : powerpc-zImage
    Enter (B)inary or (S)record input mode <S> : B
    Enter address offset  : <FFF80000 hex> : 400000
    .1.2.4.8.16.32.64.128.256.512.1024.2048.4096
    Total bytes = 2313209 in 4136171 uSecs
    Loaded addresses 00400000 through 00634BF8.
    Start address = 00400000
    >
    >go
    [Go 00400000]
    loaded at:     00400000 0040B580
    relocated to:  00180000 0018B580
    board data at: 001801C0 001801DC
    relocated to:  00200100 0020011C
    zimage at:     00408000 0047DE2D
    initrd at:     0047DE2D 0063332F
    avail ram:     00634000 01000000
    
    Linux/PPC load: root=/dev/ram
    Uncompressing Linux...done.
    Now booting the kernel
    Linux version 2.4.7 (root@tbdev1) (gcc version 2.95.3 20010315 (release)) #3 Fri Aug 24 
    graphics/ccc.gif01:22:07 MST 2001
    
    On node 0 totalpages: 4096
    zone(0): 4096 pages.
    zone(1): 0 pages.
    zone(2): 0 pages.
    Kernel command line: root=/dev/ram
    Decrementer Frequency = 180000000/60
    Calibrating delay loop... 47.82 BogoMIPS
    Memory: 13016k available (920k kernel code, 332k data, 52k init, 0k highmem)
    Dentry-cache hash table entries: 2048 (order: 2, 16384 bytes)
    Inode-cache hash table entries: 1024 (order: 1, 8192 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: 4096 (order: 2, 16384 bytes)
    POSIX conformance testing by UNIFIX
    Linux NET4.0 for Linux 2.4
    Based upon Swansea University Computer Society NET3.039
    Starting kswapd v1.8
    Starting kswapd v1.8
    CPM UART driver version 0.03
    ttyS00 at 0x0280 is a SMC
    ttyS01 at 0x0380 is a SMC
    ttyS02 at 0x0100 is a SCC
    ttyS03 at 0x0200 is a SCC
    pty: 256 Unix98 ptys configured
    block: queued sectors max/low 8554kB/2851kB, 64 slots per queue
    RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
    eth0: CPM ENET Version 0.2 on SCC1, 00:10:ec:00:26:41
    fec.c[1367] mii_link_interrupt: unexpected Link interrupt
    eth1: FEC ENET Version 0.2, FEC irq 3, addr 00:10:ec:80:26:41
    loop: loaded (max 8 devices)
    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 1024 bind 1024)
    NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
    RAMDISK: Compressed image found at block 0
    Freeing initrd memory: 1749k freed
    VFS: Mounted root (ext2 filesystem).
    INIT: version 2.78 bootingry: 52k initú
    INIT: Entering runlevel: 2
    Starting Network
    bash-2.04#
    

    You are now at the bash prompt.

  9. Try out the network connection and check for proper DNS configuration:

    bash-2.04# ping yahoo.com
    PING yahoo.com (216.115.108.243): 56 data bytes
    64 bytes from 216.115.108.243: icmp_seq=0 ttl=246 time=72.5 ms
    64 bytes from 216.115.108.243: icmp_seq=1 ttl=246 time=91.8 ms
    64 bytes from 216.115.108.243: icmp_seq=2 ttl=246 time=139.2 ms
    
    --- yahoo.com ping statistics ---
    3 packets transmitted, 3 packets received, 0% packet loss
    round-trip min/avg/max = 72.5/101.1/139.2 ms
    

    TIP

    The ping program's output tells whether DNS is working. When you ping a host by name, its IP address is returned in the output, meaning that DNS is configured properly and is operational.

    Pinging yahoo.com returns the IP address 216.115.108.243, which confirms proper DNS configuration. Pings are returned, so you know the network is running.

  10. Run helloworld, which is located in the /tmp directory:

    bash-2.04# cd /tmp
    bash-2.04# ls -l
    total 31
    -rwxr-xr-x 1 0    0           28931 Aug 24  2001 helloworld-powerpc-linux
    -rw-r--r-- 1 0    0             120 Aug 24  2001 helloworld.c
    bash-2.04# ./helloworld-powerpc-linux
    Hello world 1 times!
    Hello world 2 times!
    Hello world 3 times!
    Hello world 4 times!
    Hello world 5 times!
    Hello world 6 times!
    Hello world 7 times!
    Hello world 8 times!
    Hello world 9 times!
    

The Embedded Planet RPX-CLLF is now up and running.

Embedded Planet RPX-CLLF Target PBR Review

In this section, the seven PBRs are reviewed for the RPX-CLLF. The output from the "Booting the Embedded Planet RPX-CLLF" section earlier in the chapter provides all the information necessary for this review. Remember that each target board needs to fulfill the seven PBRs in order to be used in Project Trailblazer.

PBR-1 for the RPX-CLLF

The target board should use Linux kernel 2.4 or greater. Here's the RPX-CLLF console output during the boot process:

Now booting the kernel
Linux version 2.4.7 (root@tbdev1) (gcc version 2.95.3 20010315 (release)) #3 Fri Aug 24 
graphics/ccc.gif01:22:07 MST 2001

PBR-1 is fulfilled because Linux version 2.4.7 boots.

PBR-2 for the RPX-CLLF

The target board will execute the bash shell. Exiting from the bash shell re-executes the bash shell. On the RPX-CLLF 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 RPX-CLLF

The system should execute the bash shell without security authentication. Here's the RPX-CLLF console output during the boot process:

INIT: version 2.78 bootingry: 52k initú
INIT: Entering runlevel: 2
Starting Network
bash-2.04#

PBR-3 is fulfilled because init starts bash without authentication.

PBR-4 for the RPX-CLLF

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 Ethernet hardware configuration and use ping to verify proper DNS configuration:

bash-2.04# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:10:EC:00:26:41
          inet addr:192.168.1.22  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:44 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          Base address:0x3c00
bash-2.04# ping yahoo.com
PING yahoo.com (216.115.108.243): 56 data bytes
64 bytes from 216.115.108.243: icmp_seq=0 ttl=246 time=72.5 ms

PBR-4 is fulfilled because the Ethernet hardware is initialized. The target board's resolver translated yahoo.com to 216.115.108.243. This verifies proper DNS configuration.

PBR-5 for the RPX-CLLF

The system should contain the ping program to debug network programs.

bash-2.04# ping yahoo.com
PING yahoo.com (216.115.108.243): 56 data bytes
64 bytes from 216.115.108.243: icmp_seq=0 ttl=246 time=72.5 ms

PBR-5 is fulfilled because the yahoo.com ping is successful.

PBR-6 for the RPX-CLLF

The system should be capable of executing the Project Trailblazer compiled version of helloworld. At the bash prompt, execute the cross-compiled helloworld program.

bash-2.04# ./helloworld-powerpc-linux
Hello world 1 times!
Hello world 2 times!
Hello world 3 times!
. . .

PBR-6 is fulfilled because the cross-compiled version of helloworld executes.

PBR-7 for the RPX-CLLF

The system should use the current version of GNU glibc. At the bash, list the library directory and confirm current versions:

bash-2.04# ls /lib
ld-2.2.3.so      libncurses.so.5.2      libresolv.so.2
ld.so.1          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 Embedded Planet RPX-CLLF fulfills all the PBRs.


      Previous section   Next section
    Top