Configuring the RedBoot Environment

Once installed, RedBoot will operate fairly generically. However, there are some features that can be configured for a particular installation. These depend primarily on whether flash and/or networking support are available. The remainder of this discussion assumes that support for both of these options is included in RedBoot.

Target Network Configuration

Each node in a networked system needs to have a unique address. Since the network support in RedBoot is based on TCP/IP, this address is an IP (Internet Protocol) address. There are two ways for a system to “know” its IP address. First, it can be stored locally on the platform. This is known as having a static IP address. Second, the system can use the network itself to discover its IP address. This is known as a dynamic IP address. RedBoot supports this dynamic IP address mode by use of either the BOOTP protocol, or a subset of the DHCP protocol. In this case, RedBoot will ask the network (actually some generic server on the network) for the IP address to use.

NOTE: Currently, RedBoot only supports BOOTP and a very simple form of DHCP which is limited to additional data items, not lease-based address allocation. If you wish to use this subset of DHCP, then ensure you the configuration option CYGSEM_REDBOOT_NETWORKING_DHCP is enabled in RedBoot's configuration.

If you are intending to use RedBoot for network debugging, and are also intending to use BOOTP or DHCP in the loaded application, then you should not also use BOOTP/DHCP with RedBoot. Otherwise the DHCP server is likely to give both RedBoot's and the application's network stacks the same IP address which will result in problems.

The choice of IP address type is made via the fconfig command. Once a selection is made, it will be stored in flash memory. RedBoot only queries the flash configuration information at reset, so any changes will require restarting the platform.

Here is an example of the RedBoot fconfig command, showing network addressing:

RedBoot> fconfig -l
Run script at boot: false
Use BOOTP for network configuration: false
Local IP address: 192.168.1.29
Default server IP address: 192.168.1.101
DNS server IP address: 192.168.1.1
GDB connection port: 9000
Network debug at boot time: false  

In this case, the board has been configured with a static IP address listed as the Local IP address. The default server IP address specifies which network node to communicate with for TFTP service. This address can be overridden directly in the TFTP commands.

The DNS server IP address option controls where RedBoot should make DNS lookups. A setting of 0.0.0.0 will disable DNS lookups. The DNS server IP address can also be set at runtime.

If the selection for Use BOOTP for network configuration had been true, these IP addresses would be determined at boot time, via the BOOTP protocol. The final number which needs to be configured, regardless of IP address selection mode, is the GDB connection port. RedBoot allows for incoming commands on either the available serial ports or via the network. This port number is the TCP port that RedBoot will use to accept incoming connections.

These connections can be used for GDB sessions, but they can also be used for generic RedBoot commands. In particular, it is possible to communicate with RedBoot via the telnet protocol. For example, on Linux®:

% telnet redboot_board 9000
Connected to redboot_board
Escape character is ‘^]’.
RedBoot>  

Host Network Configuration

RedBoot may require three different classes of service from a network host:

  • dynamic IP address allocation, using BOOTP

  • TFTP service for file downloading

  • DNS server for hostname lookups

Depending on the host system, these services may or may not be available or enabled by default. See your system documentation for more details.

In particular, on Red Hat Linux, neither of these services will be configured out of the box. The following will provide a limited explanation of how to set them up. These configuration setups must be done as root on the host or server machine.

Enable TFTP on Red Hat Linux 6.2

  1. Ensure that you have the tftp-server RPM package installed. By default, this installs the TFTP server in a disabled state. These steps will enable it:

  2. Make sure that the following line is uncommented in the control file /etc/inetd.conf

    tftp dgram   udp     wait    root    /usr/sbin/tcpd      /usr/sbin/in.tftpd

  3. If it was necessary to change the line in Step 2, then the inetd server must be restarted, which can be done via the command:

    # service inet reload

Enable TFTP on Red Hat Linux 7 (or newer)

  1. Ensure that the xinetd RPM is installed.

  2. Ensure that the tftp-server RPM is installed.

  3. Enable TFTP by means of the following:

    /sbin/chkconfig tftp on
    Reload the xinetd configuration using the command:
     /sbin/service xinetd reload 
    Create the directory /tftpboot using the command
    mkdir /tftpboot

  4. If you are using Red Hat 8 or newer, you may need to configure the built-in firewall to allow through TFTP. Either edit /etc/sysconfig/iptables or run redhat-config-securitylevel on the command line or from the menu as System Settings->Security Settings to lower the security level. You should only do this with the permission of your systems administrator and if you are already behind a separate firewall.

NOTE: Under Red Hat 7 you must address files by absolute pathnames, for example: /tftpboot/boot.img not /boot.img, as you may have done with other implementations. On systems newer than Red Hat 7 (7.1 and beyond), filenames are once again relative to the /tftpboot directory.

Enable BOOTP/DHCP server on Red Hat Linux

First, ensure that you have the proper package, dhcp (not dhcpd) installed. The DHCP server provides Dynamic Host Configuration, that is, IP address and other data to hosts on a network. It does this in different ways. Next, there can be a fixed relationship between a certain node and the data, based on that node’s unique Ethernet Station Address (ESA, sometimes called a MAC address). The other possibility is simply to assign addresses that are free. The sample DHCP configuration file shown does both. Refer to the DHCP documentation for more details.

Example 192-1. Sample DHCP configuration file

--------------- /etc/dhcpd.conf -----------------------------
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option domain-name-servers 198.41.0.4, 128.9.0.107;
option domain-name “bogus.com”;
allow bootp;
shared-network BOGUS {
subnet 192.168.1.0 netmask 255.255.255.0 {
         option routers 192.168.1.101;
         range 192.168.1.1 192.168.1.254;
}
 }
host mbx {
         hardware ethernet 08:00:3E:28:79:B8;
         fixed-address 192.168.1.20;
         filename “/tftpboot/192.168.1.21/zImage”;
         default-lease-time -1;
         server-name “srvr.bugus.com”;
         server-identifier 192.168.1.101;
         option host-name “mbx”;
} 

Once the DHCP package has been installed and the configuration file set up, type:

# service dhcpd start

Enable DNS server on Red Hat Linux

First, ensure that you have the proper RPM package, caching-nameserver installed. Then change the configuration (in /etc/named.conf) so that the forwarders point to the primary nameservers for your machine, normally using the nameservers listed in /etc/resolv.conf.

Example 192-2. Sample /etc/named.conf for Red Hat Linux 7.x

--------------- /etc/named.conf -----------------------------
// generated by named-bootconf.pl

options {
        directory "/var/named";
        /*
         * If there is a firewall between you and nameservers you want
         * to talk to, you might need to uncomment the query-source
         * directive below.  Previous versions of BIND always asked
         * questions using port 53, but BIND 8.1 uses an unprivileged
         * port by default.
         */
        // query-source address * port 53;


        forward first;
        forwarders {
                212.242.40.3;
                212.242.40.51;
        };
};

//
// a caching only nameserver config
//
// Uncomment the following for Red Hat Linux 7.2 or above:
// controls {
//         inet 127.0.0.1 allow { localhost; } keys { rndckey; };
// };
// include "/etc/rndc.key";
zone "." IN {
        type hint;
        file "named.ca";
};

zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};

Make sure the server is started with the command:

# service named start
and is started on next reboot with the command
# chkconfig named on
Finally, you may wish to change /etc/resolv.conf to use 127.0.0.1 as the nameserver for your local machine.

RedBoot network gateway

RedBoot only provides simple routing. If a remote host is not on the same directly connected IP subnet as that associated with the network interface (even if on the same ‘wire’), then you will need to configure a gateway which can be used to route packets to the remote host. First you should ensure RedBoot has been built with support for using a gateway using the configuration option CYGSEM_REDBOOT_NETWORKING_USE_GATEWAY. Then you can either:-

  • Hard-code a gateway into the configuration with the option CYGDAT_REDBOOT_DEFAULT_GATEWAY_IP_ADDR;

  • Use RedBoot's persistent flash configuration to set the “Gateway IP address” gateway persistently in flash using the fconfig command; or

  • Configure RedBoot to use obtain an address from a DHCP server (not just BOOTP), and then configure the DHCP server to provide the gateway IP address.

Verification

Once your network setup has been configured, perform simple verification tests as follows:

  • Reboot your system, to enable the setup, and then try to ‘ping’ the target board from a host.

  • Once communication has been established, try to ping a host using the RedBoot ping command - both by IP address and hostname.

  • Try using the RedBoot load command to download a file from a host.

2017-02-09
Documentation license for this page: Open Publication License