home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Edition 1: Linux / CD1.iso / doc / HOWTO / mini / Mac-Terminal < prev    next >
Text File  |  1998-10-14  |  13KB  |  266 lines

  1.   The MacTerminal MINI-HOWTO
  2.   Robert Kiesling
  3.   v1.4, 9 November 1997
  4.  
  5.   This mini HOWTO describes the 1,002nd use for a dead Macintosh (grin):
  6.   how to configure the Mac for use as a Linux terminal.  Configurations
  7.   using getty and the terminal program kermit are described, as well as
  8.   using kermit peer-to-peer networking between between Linux and a Mac¡
  9.   intosh.  This document may be reproduced freely, in whole or in part,
  10.   provided that any usage conforms to the general copyright notice of
  11.   the HOWTO series of the Linux Documentation Project.  See the file
  12.   COPYRIGHT for details.  Send all complaints, suggestions, errata, and
  13.   any miscellany to kiesling@terracom.net, so I can keep this document
  14.   as complete and up to date as possible.
  15.  
  16.   1.  Introduction.
  17.  
  18.   This mini-HOWTO should give you some Insanely Great ideas for how to
  19.   make your Macintosh work with Linux.  Unfortunately, I have been very
  20.   busy, and so I haven't been able to include even half of what I wanted
  21.   to include, like using MacTCP and Open Transport to connect to your
  22.   Linux box via a PPP line.  That will need to wait for future versions.
  23.  
  24.   This mini-HOWTO doesn't cover networking with LocalTalk and AppleTalk,
  25.   either.  I might explore these avenues if there's enough interest in,
  26.   say, printing to a LaserWriter printer from Linux.  Otherwise, it
  27.   seems to me that such applications, being more trouble than they're
  28.   worth (not to mention pricey), are beyond the scope of this document.
  29.  
  30.   I don't plan to cover MkLinux in this document, either.  It's more
  31.   than adequately documented elsewhere.
  32.  
  33.   So if you have ideas for this document, drop me a line at the e-mail
  34.   above.  Both systems embody a lot of the beginner's mindset as well as
  35.   technical prowess, and in my opinion they don't talk to each other
  36.   nearly enough.
  37.  
  38.   2.  Setting up a serial link.
  39.  
  40.   To set up a serial link between a Mac and a Linux machine, you will
  41.   need, on the Linux side, either a DB9 Female-to-DB25 Male serial cable
  42.   or a DB25 Female-to-DB25 Male serial cable, depending on your serial
  43.   port.  On the Macintosh side, you will need a DIN9-to-DB25 Male high-
  44.   speed modem cable.
  45.  
  46.   Make sure that the cable is labeled a "high speed" cable, because some
  47.   older Macintosh cables are configured with their handshaking lines
  48.   tied high, which makes them useless for high-speed serial connections.
  49.  
  50.   You will also need a null modem adapter, available at Comp USA, Radio
  51.   Shack, and similar outlets, and a DB25 Female-to-DB25 Female serial
  52.   gender changer to connect the two serial cables.
  53.  
  54.   I have heard that Mac printer cables are really null modem cables in
  55.   disguise, but I can't confirm this.  Some of them are DIN9-to-DIN9
  56.   anyway, and wiring one into a serial link would be more trouble than
  57.   it's worth.
  58.  
  59.   If this sounds like Greek to you, read the Serial-HOWTO for details of
  60.   RS-232 cable configurations and data transmission protocols.
  61.  
  62.   Before connecting the Mac and the Linux machines, you should determine
  63.   that you have a working serial port on both machines, either by
  64.   connecting a modem and dialing out to another computer with minicom
  65.   (Linux), ZTerm (Mac), kermit (either), or the communications program
  66.   of your choice.
  67.  
  68.   The latest version of minicom is available from
  69.   sunsite.unc.edu/pub/Linux/apps/serialcomm/dialout and mirror sites.
  70.  
  71.   ZTerm is a complete, easy to use comm program.  Unfortunately, it's
  72.   shareware.  A current version is available from mac.archive.umich.edu
  73.   and outlets like it.
  74.  
  75.   The kermit program has been ported to every computer and operating
  76.   system in existence.  The archives are located at
  77.   ftp.columbia.edu/kermit.
  78.  
  79.   You should strongly consider using kermit on both machines at this
  80.   stage at least, because 1) it's free (although it's not covered by the
  81.   Free Software Foundation's General Public License); and 2) it's a lot
  82.   less confusing to have kermit on both machines than two completely
  83.   different communications programs.
  84.  
  85.   If you have another way to determine that the serial ports of the two
  86.   machines are operational, feel free to use that.  The point is to
  87.   ensure that both machines have working serial ports.
  88.  
  89.   Making the actual serial connection should be easy, given the
  90.   directions above.  In case it isn't, the connection looks like this:
  91.  
  92.    Linux PC    DB9- or DB25-  Null     Gender   DIN9-to-       MacBox
  93.    ---------   to-DB25 male   Modem    Changer  DB25 Mac      --------
  94.    |       |   serial cable. |     |  |     |   Serial Cable  |      |
  95.    |       |-----------------|     |--|     |-----------------|      |
  96.    |       |                 |     |  |     |                 |      |
  97.    ---------                  Adapter                         --------
  98.  
  99.   3.  Client-server connection with kermit.
  100.  
  101.   This is the most transient of all the configurations described here.
  102.   It requires the least amount of system configuration, although in
  103.   operation, it is the more difficult to use of the systems described
  104.   here.
  105.  
  106.   In brief, you start kermit on both the Linux machine and the Mac, and
  107.   place one of them in server mode.  It doesn't matter which machine is
  108.   the client ant which is the server, because this is a peer-to-peer
  109.   connection.  However, the Linux kermit can take advantage of Linux's
  110.   superior scripting abilities, so it seems logical (to me at least) to
  111.   designate the Linux-side kermit as the server, because this is the
  112.   more readily automated task.
  113.  
  114.   You should ensure that kermit is installed correctly on both the Mac
  115.   and the Linux PC.  Follow the instructions in the respective kermit
  116.   distributions.  On the Linux machine type kermit at the shell prompt
  117.   to start it.  You may need root permissions in order to set the port
  118.   and baud rate.
  119.  
  120.   kermit, the recent POSIX versions for Unices, supports baud rates up
  121.   to 115 Kbps.  The more recent Macintosh versions support serial port
  122.   speeds up to 57.6 Kbps.  This should be more than sufficient for any
  123.   dumb tty-type application, but if you need a higher-speed connection,
  124.   you're s.o.l, as far as kermit and serial lines are concerned.
  125.   However, kermit provides facilities for communication over a TCP/IP
  126.   link, but I haven't been able to test it.  See the alternative in the
  127.   following sections.  Just remember, especially on the Mac side, to use
  128.   a different port for kermit serial connections than your TCP/IP
  129.   connections, because Mac kermit will rudely hose a serial port that is
  130.   already in use.
  131.  
  132.   With that in mind, your .kermrc file would contain something like
  133.   this:
  134.  
  135.   echo Executing site initialization file /usr/local/bin/ckermit.local.ini....
  136.   set prompt Chanel3 >
  137.   set line /dev/ttyS0
  138.   set baud 38400
  139.   set send packet-length 2000
  140.   set receive packet-length 2000
  141.   set block 3
  142.   set file type binary
  143.  
  144.   Then, in your ~/.kermrc file, you would have a line like
  145.  
  146.   take /usr/local/bin/ckermit.local.ini
  147.  
  148.   On the Macintosh side, set the same communication parameters for bps,
  149.   stop bits, parity, and word length.  Some older versions of Mac Kermit
  150.   do not support 2k packets, so you might need to set a smaller packet
  151.   size.  Howerver, kermit sets the communication packet length based on
  152.   the receive packet-length setting, so you need to set a shorter packet
  153.   size on the Linux end, too.
  154.  
  155.   To actually communicate over the link, you need to enter server mode
  156.   on either the Mac or Linux side.  It doesn't matter which.  See the
  157.   kermit docs for details of server mode.
  158.  
  159.   3.1.  Macintosh resources.
  160.  
  161.   This is one of the very few kermit applications where setting a text
  162.   file type for transfers is useful.  This is because Macintosh files
  163.   have two parts: the data fork and the resource fork.  The data fork
  164.   corresponds to what we in the Linux world think of as a file: it's the
  165.   actual data.  The resource fork contains bitmaps for the icons,
  166.   keymaps, font specifications, and the like.  If you transfer a file
  167.   from Linux to the Mac, the file won't be recognized as a text file by
  168.   the Mac, if you use binary mode.
  169.  
  170.   When transferring binary files between the two systems, you should use
  171.   the Macintosh .hqx BinHex format, which is a 7-bit encoding of an
  172.   8-bit data file.  Mac utilities like BinHexer or StuffIt will covert
  173.   the file to its binary form.
  174.  
  175.   If you have a text file which inadvertently ends up as a data-only
  176.   file on the Mac, it's likely that it won't even appear in an Open
  177.   dialog list box.  What you need to do is open the file with ResEdit,
  178.   which is available from mac.archive.umich.edu.  ResEdit will tell you
  179.   that the file you're opening has no resource fork and then asks if you
  180.   would like to add one.  You should answer "Yes" to this question.  You
  181.   can then edit the file's Type and Creator by selecting the Open
  182.   Special option of the File menu.  All Macintosh text files are type
  183.   TEXT, so replace the question marks in the Text box with that.  The
  184.   Creator code depends on your text editor or word processor.  Each one
  185.   is unique, incidentally, and is how the Mac identifies different apps.
  186.   The Creator code for GNU Emacs on the Mac is EMAC, for example.  If in
  187.   doubt what the creator code of your text editor or word processor is,
  188.   use ttxt, which is the creator code for TeachText (which is the Mac
  189.   equivalent of EDLIN.EXE.)  Then your real word processor or text
  190.   editor can translate the file from TeachText to its native type.
  191.   There are many other neato things which TeachText can do, so it's
  192.   worthwhile to keep it permanently on your Mac.  The book Voodoo Mac,
  193.   by Kay Yarborough Nelson, is a good source of tried-and-true Macintosh
  194.   tricks that use ResEdit, TeachText, the Finder, and other overlooked
  195.   programs.
  196.  
  197.   4.  Logging in via kermit.
  198.  
  199.   Configuring Linux to use the Mac as a login: terminal is even easier.
  200.   kermit is ideal for this purpose, because it is one of the few free
  201.   communication programs which provides credible VT100/120/220
  202.   emulation.
  203.  
  204.   Essentially, what you want to do is start kermit on the Macintosh side
  205.   as in the previous section, but rather than issue server commands, you
  206.   enter connect mode.  This is the normal terminal emulation mode that
  207.   most people use, anyway.
  208.  
  209.   On the Linux side, the serial line must be configured with a getty on
  210.   it to start a login: shell.  To do this, you need to tell init that
  211.   the serial line has a terminal on it.  In your /etc/inittab file you
  212.   will need a line something like this:
  213.  
  214.   T1:23:respawn:/sbin/getty -L ttyS0 9600 vt100
  215.  
  216.   Be sure to substitute the appropriate serial device for /dev/ttyS0 and
  217.   the correct baud rate for 9600 in the command line above.
  218.  
  219.   This command tells getty to start login (the -L switch) on the
  220.   terminal display, and, when the login times out, to re-start (respawn)
  221.   the login program until someone logs in.  If no device is connected to
  222.   the serial line, or if the connection is defective, you may see a
  223.   message on the system console like: /dev/ttyS0 respawning too fast:
  224.   disabling for 5 minutes.  If this happens, you can return things to
  225.   normal by (as root) killing the getty process, or using the init q
  226.   command.  Both of them have the effect of re-spawning the getty
  227.   processe(s).  If everything is in order, you should see the Linux
  228.   banner and login prompt on the Mac's kermit window.  That's all there
  229.   is to it.
  230.  
  231.   Also, if you use something besides vanilla getty, like getty_ps, the
  232.   command above will look somewhat different.  The important thing to
  233.   remember is that everything to the right of /sbin/getty is an argument
  234.   for getty itself; not init.  You should look at the manual pages for
  235.   getty, init,and inittab if you have questions concerning the setup of
  236.   init and getty.
  237.  
  238.   The Serial HOWTO provides helpful details on how to configure
  239.   /etc/inittab for getty_ps, if that's what your system uses.
  240.  
  241.   To transfer files back and forth between the Macintosh and the Linux
  242.   machine, you can (via the Mac's Kermit) issue the kermit -x command to
  243.   start the Linux kermit in server mode.  You can then use the normal
  244.   file transfer commands to send files across the serial line.  It's
  245.   useful to set a prompt in your ~/.kermrc with a line like
  246.  
  247.   set prompt Linux-kermit >
  248.  
  249.   Otherwise, remembering which machine you're on can quickly become con¡
  250.   fusing.
  251.  
  252.   4.1.  Other Mac terminal programs.
  253.  
  254.   This method should work equally well for any other Mac terminal
  255.   program.  If you have ZTerm, you can use rz and sz on the Linux
  256.   machine to transfer files via the ZModem protocol.  If Microphone Lite
  257.   came bundled with your fax modem, that works equally well, albeit
  258.   without kermit's superior scripting and configuration facilities.
  259.  
  260.   5.  Conclusion.
  261.  
  262.   If you have questions about any of this material, or suggestions for
  263.   future directions of Mac-Linux serial-line connectivity, don't
  264.   hesitate to drop me a line at kiesling@terracom.net.
  265.  
  266.