Installing the System Integration Applications

The engineers needed to install the following applications on tbdev1: MySQL, Apache, and gnuplot. The nc program runs on the target boards. Therefore, the engineers needed to cross-compile an ARM and PowerPC version of nc. These steps are necessary to install the system integration applications and cross-compile nc:

1.
Log in as root and install MySQL by using this command:

root@tbdev1[504]: apt-get install mysql-server
							

Read the security and update notice and click OK. When asked to remove everything below /var/lib/mysql, click No.

2.
Test the MySQL server installation by using the mysql client program:

root@tbdev1[505]: mysql
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2 to server version: 3.22.32-log

Type 'help' for help.
mysql> show databases;
+----------+
| Database |
+----------+
| mysql    |
| test     |
+----------+
2 rows in set (0.00 sec)

mysql> quit
Bye

This output shows that the MySQL server is running with access to two databases: mysql and test. We will work more with the MySQL server in the “Creating and Testing the Project Trailblazer Database” section later in this chapter.

3.
Install the Apache HTTP server by using this command:

root@tbdev1[506]: apt-get install apache
							

4.
Test the Apache server by making an HTTP connection to it with this command:

root@tbdev1[507]: lynx –dump http://192.168.1.11/ | head –n9

        Welcome to Your New Home in Cyberspace!

This is a placeholder page installed by the Debian
release of the Apache Web server package, because no
home page was installed on this host. You may want to
replace this as soon as possible with your own web
pages, of course....

This output means that the Apache HTTP server is running.

5.
Install gnuplot by using this command:

root@tbdev1[508]: apt-get install gnuplot
							

When asked to install gnuplot setuid root, click No.

6.
Test gnuplot by making a sine wave plot, using this command:

root@tbdev1[509]: gnuplot

        G N U P L O T
        Linux version 3.7
        patchlevel 1
        last modified Fri Oct 22 18:00:00 BST 1999

        Copyright(C) 1986 - 1993, 1998, 1999
        Thomas Williams, Colin Kelley and many others

        Type `help` to access the on-line reference manual
        The gnuplot FAQ is available from
        <http://www.ucc.ie/gnuplot/gnuplot-faq.html>

        Send comments and requests for help to
        <[email protected]>
        Send bugs, suggestions and mods to
        <[email protected]>

Terminal type set to 'x11'
gnuplot> set terminal dumb
Terminal type set to 'dumb'
Options are 'feed 79 24'
gnuplot> plot sin(x)

    1 ++------------**------------+---**--------+------**----++
      +             * *           +  * **       sin(x) ****** +
  0.8 ++           *  *              *   *            *   *  ++
      |           *    *             *   *            *   *   |
  0.6 ++          *     *           *    *            *    * ++
      *           *     *          *      *          *     *  |
  0.4 +*          *     *          *      *          *     * ++
      |*         *       *         *      *         *       * |
  0.2 +*         *       *         *      *         *       *++
      | *        *       *        *        *        *       * |
    0 ++*        *       *        *        *        *       *++
      | *       *         *       *        *       *         *|
 -0.2 ++*       *         *       *        *       *         *+
      |  *      *         *      *          *      *         *|
 -0.4 ++ *      *         *      *          *      *         *+
      |  *     *           *     *          *     *           *
 -0.6 ++ *    *            *    *           *     *          ++
      |   *   *            *    *            *    *           |
 -0.8 ++   *  *             *  *              *  *           ++
      +    * *      +       ** *  +           * *             +
   -1 ++----**------+--------**---+------------**------------++
     -10           -5             0             5            10

gnuplot> quit
							

7.
Download and compile the nc program by using these commands:

root@tbdev1[510]: cd /root
root@tbdev1[511]: apt-get source netcat
root@tbdev1[512]: cd netcat-1.10/
root@tbdev1[514]: make linux
root@tbdev1[516]: ls
								-lG nc
-rwxr-xr-x    1 root        17232 Dec 30 19:27 nc

This version of nc is an i386 executable. Copy it to the i386 root filesystem directory:

root@tbdev1[519]: cp nc /tftpboot/i386-rootfs/usr/bin/
							

8.
Now create an ARM cross-compiled version of nc and place it in the corresponding root filesystem for the ARM target board:

root@tbdev1[519]: arm-linux-gcc netcat.c
								-o
								/tftpboot/arm-rootfs/usr/bin/nc
/tmp/ccb2puO2.o: In function `main':
/tmp/ccb2puO2.o(.text+0x2674): undefined reference to `res_init'
collect2: ld returned 1 exit status

This output shows an error in the compilation process. netcat.c requires a slight modification for cross-compiling. Edit netcat.c and search for this line:

#define HAVE_BIND /* ASSUMPTION -- seems to work everywhere! */

Add the comment characters /* to the line's start. This removes this line from compilation, like this:

/*#define HAVE_BIND /* ASSUMPTION -- seems to work everywhere! */

9.
Now cross-compile nc for the ARM processor again and check the executable by using the file command:

root@tbdev1[521]:  arm-linux-gcc netcat.c
								-o /tftpboot/arm-rootfs/usr/bin/nc
root@tbdev1[522]: file /tftpboot/arm-rootfs/usr/bin/nc
/tftpboot/arm-rootfs/usr/bin/nc: ELF 32-bit LSB executable,
Advanced RISC Machines ARM, version 1, dynamically linked
uses shared libs), not stripped

This output shows that an ARM executable called nc exists in the /tftpboot/arm-rootfs/usr/bin directory.

10.
Test the ARM version of nc. Boot the MediaEngine and use nc to make an HTTP connection to tbdev1:

bash-2.04# echo "GET" | nc 192.168.1.11 80 | head
								-n15
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
    charset=iso-8859-1">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en]
   (X11; I; Linux 2.3.99-pre3 i686) [Netscape]">
   <META NAME="Author" CONTENT="[email protected]
   (Johnie Ingram)">
   <META NAME="Description" CONTENT="The initial installation of
    Debian/GNU Apache.">
   <TITLE>Welcome to Your New Home Page!</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EF"
  VLINK="#55188A" ALINK="#FF0000">

<BR>

<H1>Welcome to Your New Home in Cyberspace!</H1>

echo "GET" | nc 192.168.1.11 80 tells nc to pipe GET to a TCP/IP connection on tbdev1 Port 80. This should return the default Apache server Web page, index.html. As the output shows, nc running on the MediaEngine made an HTTP connection to tbdev1 and retrieved the index.html file.

11.
Create a PowerPC cross-compiled version of nc and place it in the corresponding root filesystem for the PowerPC target board:

root@tbdev1[523]: powerpc-linux-gcc netcat.c
								-o
								/tftpboot/powerpc-rootfs/usr/bin/nc
root@tbdev1[524]: file /tftpboot/powerpc-rootfs/usr/bin/nc
/tftpboot/powerpc-rootfs/usr/bin/nc: ELF 32-bit MSB executable,
PowerPC or cisco 4500, version 1, dynamically linked
uses shared libs), not stripped

By following these steps, you have configured tbdev1 with the applications required to develop Project Trailblazer system integration.

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

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