Adding a Terminal

Team-Fly    

Solaris™ Operating Environment Boot Camp
By David Rhodes, Dominic Butler
Table of Contents
Chapter 14.  Connecting Serial Devices


Now we're ready to add the terminal. Table 14.3 shows the parameters we'll use to do this. Also, as we are going to connect it to port "A," we need to be aware of how this port functions when the machine is headless. For now we'll assume it has a graphics console and revisit the headless case later in the section "Consoles and Serial Ports" on page 343.

Table 14.3. Terminal Configuration Details

Setting

Value

Port Connection

A

Speed

9600

Data Format

7, e, 2 (7 data, even parity, 2 stop)

Terminal Emulation

VT100

The first thing we need is the terminal and the serial cable. Our cable will be a null-modem cableit has pins 2 and 3 crossed, and 7 straight through. Once it is connected and powered on, you will probably be able to make sure it's working by sending data to the port that the terminal is connected to:

 hydrogen# cat /etc/motd > /dev/term/a hydrogen# 

At this point, data should hopefully appear on the screen, which confirms that the cable is the correct type and that the terminal is configured correctly.

Add a Port Monitor

Now we're ready to add our first port monitor. We've already said that we'll use the standard "zsmon" tag, and that because we are dealing with a serial device, the port monitor used will be /usr/lib/saf/ttymon. Let's add the port monitor now:

 hydrogen# sacadm -a -p zsmon -t ttymon -c /usr/lib/saf/ttymon    -v `ttyadm V` hydrogen# 

We can see that besides the port monitor and tag information, we've also specified the port monitor version number using the ttymon helper program, ttyadm. We'll see how useful ttyadm is when we visit it again later. For now, let's run sacadm again to confirm that the system has a valid port monitor defined:

 hydrogen# sacadm l PMTAG    PMTYPE     FLGS RCNT STATUS   COMMAND zsmon    ttymon     -    0    ENABLED   /usr/lib/saf/ttymon hydrogen# 

So, what tasks has sacadm performed for us? The main one, as far as we are concerned, is that it has updated the hierarchy beneath /etc/saf. Let's look at this now to see what's been changed:

 hydrogen# ls -l total 6 prw-------   1 root     root      0 Mar  9 13:03 _cmdpipe prw-------   1 root     root      0 Mar  9 14:12 _sacpipe -r--r--r--   1 root     other    13 Mar  9 14:25 _sactab -rw-r--r--   1 root     sys      45 Aug 27  2000 _sysconfig drwxr-xr-x   2 root     other   512 Mar  9 14:06 zsmon hydrogen# 

We can see that the zsmon directory that we removed earlier has been recreated, and that the _sactab file has also been updated. If we look at its contents, we'll see that it now contains an entry for the new port monitor:

 hydrogen# cat _sactab # VERSION=1 zsmon:ttymon::0:/usr/lib/saf/ttymon     # hydrogen# 

We've already seen that the first line of this file relates to the SAF version information and is specified using the ttyadm V command. The remaining entries describe any port monitors that have been added, with each line formatted as a colon-separated string. Table 14.4 uses the example port monitor definition shown above to describe each of the field details.

Table 14.4. Sactab File Details

Setting

Value

Zsmon

Port monitor name

Ttymon

Port monitor type

(blank)

Flags field (none in this case)

If "d," do not enable port monitor. If "x," do not start it.

0

0 means don't restart the port monitor if it fails

/usr/lib/saf/ttymon

Port monitor path name

#

Comment field

If we look in the newly created zsmon directory, we can see the files listed below. We haven't defined any services yet, so the _pmtab file should be empty (apart from the version number).

 hydrogen# ls -l zsmon total 4 -rw-r--r--   1 root     other     4 Mar  9 14:06 _pid prw-------   1 root     other     0 Mar  9 14:06 _pmpipe -rw-r--r--   1 root     other    12 Mar  9 14:06 _pmtab hydrogen# hydrogen# cat zsmon/_pmtab # VERSION=1 hydrogen# 

Obviously we don't want to have to trawl through all these files to determine whether any services have been defined or not! Instead we can use pmadm in a way similar to how we used sacadm earlier, as shown in the following example:

 hydrogen# pmadm l No services defined hydrogen# 

Configure the Port Monitor

Now that we have successfully added a port monitor, we need to configure it for a service. This is where the commands start to become a little more complicated, so to understand them better, let's run the command first and then break it down into each of its components:

 hydrogen# pmadm -a -p zsmon -s ttya -i root -fu \ -v 'ttyadm V` -y "Terminal" -m "`ttyadm -l contty5H \ -d /dev/term/a T vt100 -s /usr/bin/login S y`" hydrogen# 

Table 14.5 shows most of the options used and what they refer to, although we'll deal with the individual options passed to ttyadm in a moment.

Table 14.5. Port Monitor Parameters

Option

Meaning

-p zsmon

Name of the port monitor that we are configuring

-s ttya

Defines a tag for the service

-i root

Run the service as root

-fu

Create a utmpx entry when the user logs in

-v `ttyadm V`

Get the version number of ttyadm and pass it to pmadm

-y "Terminal"

Add a comment to the port details file

-m "<ttyadm command>"

Generate the ttymon-specific details

Pmadm has performed a set of tasks similar to those of sacadm; it has updated part of the SAF hierarchy and configured the port monitor for the correct service. We'll see how it has done this if we take a look at the _pmtab file:

[View full width]

hydrogen# cat zsmon/_pmtab # VERSION=1 ttya:u:root:reserved:reserved:reserved:/dev/term/a:::/usr/bin/login::contty5H::login\: :: graphics/ccc.gifvt100:y:#Terminal hydrogen#

We'll look at most of these values in the next section, "Ttyadm," but for now let's run pmadm again to make sure that it knows the port has been successfully configured:

 hydrogen# pmadm l PMTAG  PMTYPE  SVCTAG  FLGS  ID    <PMSPECIFIC> zsmon  ttymon  ttya    u     root  /dev/term/a - - /usr/bin/login     contty5H - login: - vt100 y #Terminal hydrogen# 

Good. Everything looks OK. The port should now be accessible so that when we power the terminal on, we'll see the login prompt. Now that everything is working, let's have a look at some of the additional commands we've used above in a little more detail, before we move on and create the second service.


    Team-Fly    
    Top
     



    Solaris Operating Environment Boot Camp
    Solaris Operating Environment Boot Camp
    ISBN: 0130342874
    EAN: 2147483647
    Year: 2002
    Pages: 301

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net