Runtime Initialization Sequence
Directory Structure
From the perspective of system initialization there are a number of key directories:
|
Directory
|
Description
|
|
/etc/init.d
|
Location of all the initialization scripts
|
|
/etc/network
|
Initialization scripts and data files for network interface initialization
|
|
/etc/default
|
Data files defining the configuration values for various subsystems
|
System Initialization Sequence
The following sequence looks at the common parts of the initialization sequence. There are some package-specific initialization steps that happen interleaved with this sequence (see Specific Package initialization below).
1. /sbin/init
2. Execution of /etc/rc.d
3. Mounting Filesystems
4. Setting the hostname
5. Networking
6. Console Login
1. /sbin/init
The init program (part of busybox) will process the /etc/inittab file. By default, this file contains just two lines:
console::wait:/etc/cp_factory
console::wait:/etc/init.d/rc
The first is a script that is intended to provide a placeholder for a script that would initialize the system from factory defaults if necessary. This does nothing in today's release.
The second script, /etc/init.d/rc, is the core of the system initialization sequence.
2. Execution of /etc/rc.d
This is the beginning of a stripped down version of the regular Unix™ System V initialization sequence. It will execute, in order, the scripts that it finds under /etc/rc.d (in fact symbolic links to scripts in /etc/init.d, but with a prefix that defines the order of execution using lexical sequence).
When adding a new feature to the system, its initialization script should be added to the /etc/init.d directory and a symbolic link created from the /etc/rc.d directory to this script. The symbolic link name should be prefixed with 'Snn' where 'nn' is a two digit number (zero padded if less than 10) that defines when the script will run relative to the other scripts.
3. Mounting Filesystems
S20mountall mounts all the file systems defined in the /etc/fstab file. This is a board-dependent file that is added as part of the ds-config-* package for the board.
4. Setting the hostname
S40hostname sets the hostname based on the content of the file /etc/hostname.
5. Networking
S40networking starts the process of initializing the network components.
Network initialization is handled by the ifup command, and this script merely invokes that command with the '-a' option to bring up all automatically configured interfaces.
The interfaces themselves are described in the /etc/network/interfaces file. This file consists of a definitions for a number of interfaces as well statement(s) defining which interface(s) are to be automatically started. A typical /etc/network/interfaces file might look like this:
auto lo br0
iface lo inet loopback
iface eth1 inet dhcp
iface br0 inet dhcp
bridge_ports eth0 wlan0
In this case, there are three interfaces defined: lo, eth1 and br0. Two of them, lo and br0, are automatically configured. The third, eth1, is defined as a manually configurable interface; that is, somebody would have to manually issue an 'ifup eth1' command to configure this interface.
Physical Interfaces
The information in this section applies to both ethernet interfaces and wireless interfaces. In all cases, any necessary driver modules should be loaded before the networking initialization script runs (for example, by an earlier initialization script).
There are a number of parameters that can be set for the iface block. The first parameter is the name of the interface. Next is the address family that will be used over it. This will normally be inet (for TCP/IP traffic), but could be "ipx" or "inet6" if the system has been configured to support those address families.
For an "inet" family interface, there are a number of options for determining the address configuration for the interface:
|
Note
|
In the current release of the Devicescape Universal Wireless Platform, only loopback, dhcp and static are supported.
|
|
Keyword
|
Description
|
|
loopback
|
Set as a loopback interface; requires no further parameters.
|
|
static
|
Set address information statically. Requires additional parameters:
|
| |
address <Address>
|
Set IP address (dotted quad format)
|
| |
netmask <NetworkMask>
|
Set network mask (dotted quad)
|
| |
broadcast <BroadcastAddress>
|
Set broadcast address
|
| |
Additionally, there are some optional parameters:
|
| |
network <NetworkAddress>
|
Set network address.
|
| |
metric <Metric>
|
Set routing metric for default gateway (integer).
|
| |
gateway <GatewayAddress>
|
Set default gateway address.
|
| |
pointopoint <Address>
|
Set address of other endpoint. Note: Be sure to use the unusual spelling of "point-to" given in this parameter.
|
| |
media <Type>
|
Specify the media type (driver dependent).
|
| |
hwaddress <Class> <Address>
|
Specify the hardware address.
Class will normally be 'ether' but could be "ax25", "ARCnet" or "netrom". The address format will depend on the class. For an ethernet type, it will be six hexadecimal octets, colon separated.
|
| |
mtu <Size>
|
Specify Maximum Transmission Unit ( MTU) size.
|
|
manual
|
All settings will be applied manually. There are no additional parameters for this method.
|
|
dhcp
|
Use DHCP to get the address information. Options are:
|
| |
hostname <Name>
|
Send "Name" as our hostname.
|
| |
leasehours <Hours>
|
Specify preferred lease time in hours (for pump).
|
| |
leasetime <Seconds>
|
Specify preferred lease time in seconds (for dhcpd).
|
| |
vendor <VendorID>
|
Set vendor class ID (for dhcpd).
|
| |
client <ClientID>'
|
Set the client ID (for dhcpd and udhcpd).
|
| |
hwaddress <Class> <Address>
|
Specify the hardware address.
Class will normally be 'ether' but could be "ax25", "ARCnet" or "netrom". The address format will depend on the class. For an ethernet type, it will be six hexadecimal octets, colon separated.
|
|
bootp
|
Obtain address information using bootp. Parameters for this method are:
|
| |
bootfile <File>
|
Tell the server to use "File" as the bootfile.
|
| |
server <Address>
|
Use the IP address address to communicate with the server.
|
| |
hwaddr <Address>
|
Use "Address" as the hardware address instead of whatever it really is.
|
|
ppp
|
Use pon/poff to configure a PPP interface. Possible parameters are:
|
| |
provider <Name>
|
Use name as the provider (from /etc/ppp/peers).
|
|
wvdial
|
Use wvdial to configure a PPP interface. Possible parameters are:
|
| |
provider <Name>
|
Use name as the provider (from /etc/ppp/peers).
|
In addition to the method-specific parameters that are show above, an 'iface' section can also specify commands (or scripts) that will be executed before or after the change in state for the interface:
|
Keyword
|
Description
|
|
up <Command>
|
Execute the command following this keyword after bringing the interface up.
|
|
down <Command>
|
Execute the command following this keyword after taking the interface down.
|
|
pre-down <Command>
|
Execute the command following this keyword before taking the interface down.
|
Any other options that are given are exported in to the environment in upper case with "IF_" prepended, with hyphens converted to underscores and non-alphanumeric characters discarded.
Bridging Interfaces
The same
ifup/
ifdown commands and the
/etc/network/interfaces file used for physical interfaces also can be used to describe bridge interfaces. The address method setting is handled the same way as for a physical interface (see
Physical Interfaces), but there are some additional parameters for setting the bridging options:
|
Keyword
|
Description
|
|
bridge_ports <Interfaces>
|
This option must exist for the scripts to set up the bridge. With it, you specify the ports you want to add to your bridge:
- Use "
bridge_ports none" if you want a bridge without any interfaces or you want to add them later using brctl
- Use "
bridge_ports all" if you want all the ethX interfaces to be added to the bridge
- To define one or more interfaces specifically, list the interfaces you want to add separated by spaces, for example:
bridge_ports eth0 eth4
You should not put any lines to configure the interfaces that will be used by the bridge, as this will be setup automatically by the scripts when bringing the bridge up..
|
|
bridge_bridgeprio <Priority>
|
Set bridge priority, <priority> is between 0 and 65535, default is 32768, affects bridge id, lowest priority bridge will be the root.
|
|
bridge_fd <Time>
|
Set bridge forward delay to <time> seconds, default is 15, can have a fractional part.
|
|
bridge_gcint <Time>
|
Set garbage collection interval to <time> seconds, default is 4, can have a fractional part.
|
|
bridge_hello <Time>
|
Set hello time to <time> seconds, default is 2, can have a fractional part.
|
|
bridge_maxage <Time>
|
Set max message age to <Time> seconds, default is 20, can have a fractional part.
|
|
bridge_maxwait <Time>
|
Forces to <Time> seconds the maximum time that the Debian bridge setup scripts will wait for the bridge ports to get to the forwarding status, doesn't allow factional part. If it is equal to 0 then no waiting is done.
|
|
bridge_pathcost <Port> <Cost>
|
Set path cost for a port. <Port> is the name of the interface to which this setting applies.
|
|
bridge_portprio <Port> <Priority>
|
Set port priority, default is 128, affects port id, <Port> is the name of the interface to which this setting applies.
|
|
bridge_stp <State>
|
Turn spanning tree protocol ( STP) on/off.
The <State> values are "on" or "yes" to turn STP on, and any other value to turn it off.
The default has changed to "off" for security reasons in latest kernels, so you should specify if you want STP on or off with this option, and not rely on your kernel's default behavior.
|
6. Console Login
The S50getty script will start getty to enable console login. The /etc/default/getty configuration file defines all the devices that getty should run on, and the serial speed it should use. An example of this file is:
ttyS0:getty -L 115200 ttyS0
Specific Package Initialization
This section describes the package-specific initialization scripts that are added to the boot sequence when the package is installed (either during RFS creation on the host, or dynamically).
- Wireless driver modules
|
Keyword
|
Description
|
|
S30broadcom-drv
|
Broadcom 4306/4309/4712 wireless driver
|
|
S30ieee80211
|
Devicescape IEEE 802.11 datapath driver
|
|
S31atheros-drv
|
Devicescape Atheros chip-driver
|
|
S31conexant-drv
|
Conexant SoftMAC driver
|
- Ethernet driver modules (board specific)
|
Keyword
|
Description
|
|
S30bcm947xx-eth
|
Broadcom 4712 SoC ethernet driver
|
- Wireless applications (hostapd)
|
Keyword
|
Description
|
|
S35hostapd
|
Access point management daemon
|
- Client module (wpa_supplicant)
|
Keyword
|
Description
|
|
S35wpa_supplican
|
Wireless client supplicant daemon
|
- Other applications:
|
Keyword
|
Description
|
|
S50dropbear
|
Dropbear SSH server daemon
|
|
S50httpd
|
Web server
|
|
S50telnet
|
Telnet daemon
|