Setting up for Mentor PCB Tools

updated 2/16/05

The focus of this document is enabling a PC user to run the X-Windows Mentor application dmgr on a workstation licensed for it,  and have the window appear on a PC somewhere else on the network.

Setup for Hummingbird Exceed

Instructions on setting up Exceed for Mentor,  see http://kahuna.sdsu.edu/mentor.html. (It's where I found mgc_fonts_b4.tar)

Setup for Cygwin/XFree86 on Windows machines running a Microsoft OS

Cygwin and XFree86 for Win32  is available from http://www.cygwin.com/, and recently from http://altruistic.lbl.gov/mirrors/, and a number of other mirror sites.  It's a no cost alternative to the Exceed X-Server package, however, some clue is required to set up and maintian the installation. 

The Cygwin web site.contains numorous links for Cygwin/XFree86 help     They are a bit much to absorbe, though, and don't say much about doing the atypical things needed to run the Mentor dmgr applications.

Be warned that the full installation of Cygwin and XFree86 can consume about half a gig of your disk, if you choose to keep the sources. If the Cygwin package were available from altruistic.lbl.gov as a windows share, then installation would be simplified, and clean-up simplified, since unnecessary file transfers, and later, the deletion of the installation kit would not be necessary.
Note:
In  2004, here appears to be a Cygwin installation bug connected with the miscounting of  free
space on the disk of the target system that can cause installations to hang.    If the installation    
hangs,  delete the Cygwin installation kit  directory, and the installed application directory tree,
fill up another 500 megabytes on the disk,  and try again. The problem hasn't been reported.   

A successful installation will provide you with a desk-top start-up icon for a bash shell, as well as start-menu item containing several other application links.  There is much more to Cygwin than just the shell, ssh and the X-Server... you practically get a whole unix on your windows machine...  Editors, compilers, utilities, manual files, servers...   If you are a newbie to *nix/linux, it  helps if you have an X-Windows expert close by for when you find things don't work as expected, or don't work at all.

Where are we going?
To run Mentor design manager,  you have to ssh into your Mentor server (from your PC, most likely) and execute dmgr, with the DISPLAY environment variable pointed back to your PC.  Your PC has to be running its X-Server, and the server has to be set up with support for some special Mentor fonts and icons.   This server can be Exceed,  or it can be the Cygwin XFree86 X-Server.


Installing the customizations to the Cygwin X-Free86 X-Server in support of Mentor dmgr

To set up the special font support, you can follow the steps below.  There are alternatives to many of these steps,   so feel free to play around, and read man pages, FAQs and help files.

    Notes on interpreting the steps below:
bold text  indicates a command you execute at a shell prompt, 
courier text indicates text to be added to files

Steps:
  1. Install Cygwin and XFree86 by going through the successive pages of the installer.  Have a good internet connection, and expect this to take some time.  Several 'Next' clicks into the installer,  you reach the package menu page.  Click once on the 'default' text string on the very first line in the inner window.  Wait until the text changes to 'install' (which may take a while).  It's helpful to have the cpu usage monitor on (xload for windows), since the install scripts keep the CPU very busy for quite a long time. 
         Let's call the top-level Cygwin directory       $(Cygwin_root), 
         your root home directory               ~
         and your Cygwin username            $(<Windows_Login_Name@$(Windows_Login_Name)
  2. After the install is complete, start Cygwin from the desktop icon, or the start menu.   Do it two or three times, so that all the Cygwin initializatons are completed befor proceeding.  You will notice that the first-time startup deposits several files into your home directory of
    $(Cygwin_root)\home\$(username)\  otherwise known to Cygwin as /home/$(username) or ~/
  3. With the editor (vi, for instance) add the following line into the ~/.bashrc file.
           alias startx='/usr/X11R6/bin/startx &'
    Then, when you want to start your x-server from the command line, you type startx
  4. Locate and download the tar ball of Mentor fonts into your home directory
  5. Use the Cygwin bash shell untar the file mgc_fonts_br.tar into  /usr/X11R6/lib/X11/fonts/mgc_fonts_b4 as follows:
            (cd /usr/X11R6/lib/X11/fonts ; tar xvf  mgc_fonts_b4.tar)
      (** after a cygwin upgrade or reinstallation this directory may have to be recreated)
    or  untar the file mgc_fonts_b4.tar into the /home/mgc_fonts_b4 directory and link it, as follows:
            (cd /home ;tar xvf mgc_fonts_b4.tar)
            ln -s /home/fonts/mgc_fonts_b4_fonts /usr/X11R6/lib/X11/fonts/mgc_fonts_b4
    (** after a cygwin upgrade or reinstallation, these links may have to be remade)
  6. Use the Cygwin bash shell to execute the following commands to prepare the directories for xset:
           mkfontdir  /usr/X11R6/lib/X11/fonts/mgc_fonts_b4
    (after a cygwin upgrade or reinstallation, these commandss may have to be reexecuted)
  7. With the editor create a file named  ~/.xfonts, and add the following lines:
       xset  fp  default
       xset  +fp /usr/X11R6/lib/X11/fonts/mgc_fonts_b4
       xset  fp  rehash
       # if you don't do this for xinitrc, then dmgr will exit with font errors
  8. Now... this is the tricky bit that took a while to tease out of the man files and advice... With the editor add, a few lines to the /usr/X11R6/lib/X11/xinit/xinitrc...   In the variables section at the top, add the following line:
       userfontinit="$HOME"/.xfonts
  9. At the end of the conditional statements section, add these lines:
       if [ -f $userfontinit ]; then
             sh $userfontinit
       fi
    (after an XFree86 upgrade or reinstallation, these lines may have to be added to the xinitrc file agian)
  10. For your convenience, you might consider adding the following line to your .bashrc file
            alias xterm='/usr//bin/xterm -geometry 80x50+400+50 -rightbar -sb -sl 200 &'
Now, when your XFree86 x-server launches, (after executing the command /usr/X11R6/bin/startx &, or by using the command alias) the server will learn all about the work you did in step 4, 5 and 6.
Note:
With the current version of XFree86 (Feb '05), startx launches /usr/X11R6/bin/XWin as the window manager, which is rootless.
If you prefer a rooted window manager, you will have to modify startx, or some file it depends on,  to launch twm, or mwm, or 
fvwm, or your favorite window manager.  Check documentation, and for window managers in /usr/X11R6/bin for other possible
window managers.
Next...  
(The hard way...)
You have many ways to log into your Mentor server, but the preferred way is with secure shell (ssh).  ssh can tunnel your X session for you. You can opt to setenv DISPLAY to point to your PC.  (see the man page for the use of setenv).    If you setenv DISPLAY by hand, you will also have to provide permission to use your PC's X-Server  by executing an xhost + command on your PC (see the man page), or place entries in the /etc/X0.hosts file in your Cygwin installation on your PC  (see the man pages for Xserver).

(The easy way...)
The preferable way to log in to your Mentor server and  properly set yourself up for x-sessions is this:.  From an xterm running on your XFree86 X-server,  execute the command ssh -X username@hostname  and log in. (If you have everything set up right, when you execute the command env | grep DISPLAY on the mentor server, instead of a blank line,  it will print a result which is your x-server display information.)
Then,  execute the usual comands to configure your client environmen for Mentor,  and execute dmgr. 
A design manager window should appear on your PC's screen.

Troubleshooting:
If the dmgr can't open the display,  make sure DISPLAY is set on the mentor server machine.   If display is set, then try executing xclock or xload, or xterm, to see if any application can pop a window on your PC.
If dmgr makes a vague error reference to fonts,  then make sure the font directories are in the right place, and prepared with mkfontdir.  Execute the xset commands by hand while looking for errors. 

More helpful stuff:
The mentor font files are available from your engineering systems administrator, or see the links at the top of http://kahuna.sdsu.edu/mentor.html.

A sample  /usr/X11R6/lib/X11/init/xinitrc
A sample  ~/.xfonts
A sample  /usr/X11R6/bin/startx  (with the -rootless option turned on)
A directory full of mentor fonts in a zip file
Another directory full of mentor fonts in a zip file

Thanks to Arthur Jones, and Thorsten Stezelberger for hints on how to do all this.

Comments to    Suggestions for improvements??