home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / mach / doc / notes / mach3_setup.doc.Z / mach3_setup.doc
Encoding:
Text File  |  1993-03-31  |  20.2 KB  |  369 lines

  1.                               SETUP FOR MACH 3.0
  2.  
  3.                                Mary R. Thompson
  4.  
  5.                                  1 April 1993
  6.  
  7. 1. Introduction
  8.   Booting  a  micro-kernel/server  system  is  slightly  more  complicated than
  9. booting a macro-kernel system  since  more  files  have  to  be  in  place  and
  10. functioning  correctly  before  the system will accept input from the user. The
  11. CMU environment has also contributed some complexity  to  the  usual  BSD  Unix
  12. setup.
  13.  
  14.   In  Mach  3.0  the  pieces  that  are  needed  for a sucessful boot are:  the
  15. 16-sector boot code (usually supplied by the machine vendor), the micro-kernel,
  16. a  paging file, a server for the kernel to call, an emulation library (at least
  17. for our servers) and a startup user program.
  18.  
  19.   The other complications are the fact that we normally have a super  root  and
  20. local  root  in order to support the CMU RFS file system and the fact that when
  21. you come up single user, you do not have root access, but are running with  the
  22. userid "opr". Also on CMU machines we have an /etc/rc that insists that /vmunix
  23. be a symbolic link to the unix-server you are running before it will complete a
  24. boot to multi-user.
  25.  
  26.   This  document explains exactly what is required to boot a Mach 3.0 system up
  27. multi-user. It explains the non-Uxix features,  how  to  set  up  your  machine
  28. originally,  how  to  safely boot alternative pieces of the OS and how external
  29. sites can get the OS files.
  30.  
  31. 2. Super root and local root
  32.   Mach systems (2.5 or 3.0) are normally set up with a super root that contains
  33. one  real directory RFS. RFS contains the directory .LOCALROOT and links to all
  34. other machines that are accessible via RFS.    The  super  root  also  contains
  35. symbolic  links  to  all  the  standard directories in /, eg. /dev, /mnt, /bin,
  36. /etc, /lib, /usr, /usr1.  /RFS/.LOCALROOT is known as  the  local  root.  After
  37. boot  time the local root is named / and the super root is named /../../.  Some
  38. files such as the Mach kernel and the Unix-server have hard links in  both  the
  39. local  root  and  super root, so that they can be found by the same name during
  40. and after the boot sequence. In the Mach 3.0 case the switching of the root, /,
  41. from  the super root to the local root is done by the Unix-server or POE rather
  42. than the micro-kernel. If you are not using the RFS filesystem you can use only
  43. a  single root by not having the /RFS directory. You may see a complaint during
  44. the boot sequence about i(unable to change to local root), but the system  will
  45. work ok.
  46.  
  47. 3. Setup for a default boot
  48.  
  49.  
  50.  
  51. 3.1. Micro-kernel Names
  52.   In  Mach  2.5 the kernel is called both mach and vmunix and is hard-linked to
  53. by /../../vmunix, /../../mach, /mach and /vmunix. Some boot code looks for  the
  54. file  /vmunix by default and some looks for /mach but always on the super root.
  55. As the kernel boots, the root is changed to be the local root, /RFS/.LOCALROOT.
  56. After  booting  some  Unix  programs  read  the  "Unix namelist" by referencing
  57. /vmunix.
  58.  
  59.   In Mach 3.0 the names mach and mach.boot are used for the  Mach  micro-kernel
  60. and  vmunix  and  startup are used for the Unix-server. The micro-kernel is the
  61. program that you wish to boot. Boot code that we provide for the i386 will boot
  62. mach  on  device  0,  partition  a  by default. Older boot code for the Vax and
  63. Sun3's may boot vmunix by default. On the DecStations, the default boot name is
  64. setable. On DecStations setup by CMUCS facilities the default is mach_kernel on
  65. device  0,  partition  0.  Boot  programs  normally  allow  you  to  specify  a
  66. non-default  name  for  the program to be booted, so you can either install the
  67. micro kernel on your machine by whatever default name your boot code  uses,  or
  68. specify  the  boot  file  by  name  whenever  you  boot  the machine.  The Mach
  69. micro-kernel  is  named  mach.boot.MKnn.<config>  in  the  build  and   release
  70. directories.    Note  that  in  releases  prior  to  MK68  the kernel was named
  71. mach_kernel.MKnn.<config> but now the file by that name is not a bootable file.
  72. The  Unix-server  is  named  vmunix.UKnn.<config>  in  the  build  and  release
  73. directories.
  74.  
  75.  
  76.  
  77. 3.2. Other file names
  78.   The /mach_servers directory is the  default  directory  where  the  Mach  3.0
  79. kernel  and  various servers look for files. There are four required file names
  80. that are coded into the micro-kernel and unix-servers and cannot be changed  at
  81. boot  time.  They  are  paging_file,  startup, emulator and mach_init. The name
  82. mach_servers may be specified at boot time to allow the booting of  alternative
  83. pieces of the OS, but in this section the default boot is assumed.
  84.  
  85.   /mach_servers  may  be  a  subdirectory in either the local root or the super
  86. root with a symbolic link to it in the other root or there can be two different
  87. directories.  A  directory of this name must be findable from both the root and
  88. super-root and at least one of the directories must be on the  root  partition.
  89. If  you  do  not have enough room on your root partition for all the files that
  90. are required to boot, the mach_servers directory  on  the  superoot  can  be  a
  91. symbolic link to a directory on a different partition. This link is read by the
  92. micro-kernel and must be of the form  /dev/<partition>/mach_servers,  by  which
  93. the micro-kernel reads unmounted partitions.
  94.  
  95.   The micro-kernel by default looks in the /mach_servers directory on the super
  96. root for three files: startup which is the program it will start the user  task
  97. in;  emulator  which  the kernel reads to initialize the symbols for the kernel
  98. debugger; and paging_file which is the default paging space.  These  names  may
  99. refer to files in that directory, symbolic links to files on the root partition
  100. or symbolic links to files on other unmounted partitions.  See the next section
  101. for an example of this last case.
  102.  
  103.   The  Unix-server by default looks in the /mach_servers directory on the local
  104. root for two files: emulator and mach_init.  emulator is the emulation  library
  105. that  is  loaded  with  each task that the Unix-server starts. mach_init is the
  106. program called by the first task started by the Unix-server. These  files  must
  107. reside on the root partition, since the Unix-server only has the root partition
  108. mounted and does not read unmounted partitions like the micro-kernel did.
  109.  
  110.   If you  are  running  POE  rather  than  the  Unix-server  it  looks  in  the
  111. /mach_servers  directory  on  the  local  root for two files:  poe_emulator and
  112. poe_init.  poe_emulator is the emulation library that is loaded with each  task
  113. that  POE starts. poe_init is the program that is run by the the first task POE
  114. starts.  As in the case of the Unix server, these programs must reside  on  the
  115. root partition.
  116.  
  117.  
  118.  
  119. 3.3. Installing the pieces
  120.   First  you  need  to  install  a  Mach  3.0 micro-kernel on the root.  Copy a
  121. "mach.boot" to /mach and create a hard-link to it from /../../mach or  whatever
  122. your  default  boot  file  name is.  mach.boot is built from the sources in the
  123. mach3.kernel collection or can be  found  in  mach3.release  in  the  directory
  124. special. It's name in those directories is of the form mach.boot.MKnn.<congig>.
  125.  
  126.   Now you need to make a /mach_servers directory, the recommended way is:
  127.  
  128.     mkdir /../../mach_servers
  129.     cd /
  130.     ln -s ../../mach_servers mach_servers
  131.  
  132.  
  133.   The alternative method to conserve space on the root partition (assuming that
  134. /dev/sd0e is mounted on /usr) is to:
  135.  
  136.     mkdir /mach_servers
  137.     mkdir /usr/mach_servers
  138.     cd /../..
  139.     ln -s /dev/sd0e/mach_servers mach_servers
  140.  
  141.  
  142.   This second alternative is the default setup for DecStations at  CMU,  so  be
  143. sure  you know what you are doing if you try to install new pieces of the OS on
  144. one of those machines.
  145.  
  146.   Now populate /mach_servers with:
  147.  
  148. paging_file     this is usually a symbolic  link  to  a  file  on  an  umounted
  149.                 partition in order to avoid using large amounts of space on the
  150.                 root partition.  For example if /usr1 is mounted  on  /dev/hd0f
  151.                 and  has  enough  free  space  you  could make paging_file be a
  152.                 symbolic link to "/dev/hd0f/pagingfile".   Then  you  create  a
  153.                 /usr1/pagingfile  of  sufficient  size  to  handle  your paging
  154.                 needs. Between about 4-20M is recommended.  The system does not
  155.                 grow this file, so you must set it up in advance as a big file.
  156.                 An easy way to pre-assign the space is to do:
  157.  
  158.                     dd if=/dev/rhd0f of=/usr1/pagingfile bs=1024k count=n
  159.  
  160.                 which creates a nMeg file. It is possible to have Mach 2.5  and
  161.                 3.0  use  the  same paging file, but care must be taken so that
  162.                 Mach 2.5 does not truncate the file when it  boots.  To  ensure
  163.                 this  the line in /etc/fstab that specifies the paging file for
  164.                 Mach 2.5 should have the value of pagelowat equal  to  that  of
  165.                 pagehiwat.  The system will boot without a paging files and run
  166.                 until it needs to page something out.  Just answer the  request
  167.                 during  the  boot  process  for  a  paging file with a carriage
  168.                 return. This may be useful if you are booting off a  floppy  or
  169.                 are just trying to come up single-user to fix something.
  170.  
  171. startup         the  program  that  the  micro-kernel  calls. This file must be
  172.                 found in the /mach_servers directory  that  is  on  (or  linked
  173.                 from)  the super-root. It does not need to physically reside on
  174.                 the  root  partition.     This   is   the   way   putting   the
  175.                 "super-root/mach_servers"  directory  off  the  root  partition
  176.                 saves  space  on  the  root  partition.  Usually  this  is  the
  177.                 Unix-server  or POE. It could be an OS program of your own. The
  178.                 name of the unix server is vmunix.UXnn.<config>  and  is  built
  179.                 from  the  sources in the mach3.unix release or can be found in
  180.                 the mach3.release collection in the directory special. The name
  181.                 of  POE  is poe.POEn. It is built from the sources in mach3.poe
  182.                 or can  be  found  in  the  mach3.release  collections  in  the
  183.                 directory special.
  184.  
  185. emulator        the  emulation  library  which  the Unix-server loads with each
  186.                 task and the micro-kernel reads symbols from. This file must be
  187.                 accessible  both  from  the  super-root  where the micro-kernel
  188.                 reads and from the local root where the Unix-server  loads  it.
  189.                 If  you  are using separate mach_servers directories you either
  190.                 need two copies of this file, or one copy on the root partition
  191.                 and  a  symlink  that that the micro-kernel can follow from the
  192.                 non-root directory.  This program is built from the sources  in
  193.                 the  mach3.unix collection or can be found in the mach3.release
  194.                 collection as special/emulator.UXnn.
  195.  
  196. mach_init       the program that is run  by  the  first  task  the  Unix-server
  197.                 creates.  It  must  be  installed in /mach_servers on the local
  198.                 root.  It is built from sources in the mach3.user collection in
  199.                 the  directory  etc/mach_init  or can be found in mach3.release
  200.                 etc/mach_init.  THIS PROGRAM IS NOT COMPATIBLE  WITH  THE  MACH
  201.                 2.5  VERSION.    You  may  set  /mach_servers/mach_init to be a
  202.                 symbolic link to the Mach 2.5 version  of  /etc/init.  In  this
  203.                 case the system will boot, but Mach servers will not work.
  204.  
  205. poe_init        the  program  that  is  run  by the first task POE creates.  It
  206.                 should be installed as /mach_servers/poe_init if you are  going
  207.                 to  run  POE.  It provides a user shell for a single user under
  208.                 POE. It is built from the sources in the  mach3.poe  collection
  209.                 or can be found in mach3.release as etc/poe_init.
  210.  
  211. poe_emulator    the  emulation  library  which  POE loads with each task. It is
  212.                 built from the sources in the mach3.poe collection  or  can  be
  213.                 found in mach3.release as special/poe_emulator.POEn.  It should
  214.                 be installed as /mach_servers/poe_emulator if you are going  to
  215.                 run POE.
  216.  
  217. 4. Booting new kernel/server pieces
  218.   If  you  wish  to  try out a new version of any of the critical OS pieces you
  219. should be sure that you have a system that is known to work in a place where it
  220. can  be  found  by  the  boot  process.  The bootcode, the micro-kernel and the
  221. unix-server allow you to specify an alternative name for the  micro-kernel  and
  222. the  /mach_servers  directory.  You  cannot specify the names of specific files
  223. that live in the </mach_servers> directory, so even if you want to change  only
  224. one  file there, you must create a fully populated directory with that file and
  225. copies or links of the old files in it.
  226.  
  227.   Only the boot code needs to know the name and location of  the  micro-kernel,
  228. so  how  you  specify that is dependent on what boot code you are running.  The
  229. boot code we use accepts several options to be passed  to  the  booted  program
  230. (the  micro-kernel).  We  use -s for single-user boot and -q (DecStation) or -a
  231. (Sun3,Vax and I386) to prompt for an alternative mach_servers directory.  Since
  232. the  only  information  the micro-kernel and unix-server have is an alternative
  233. directory name, this directory must contain a complete set of  the  four  files
  234. needed for booting.
  235.  
  236.   Some examples of how to set things up follow:
  237.  
  238.   Booting a new micro-kernel, standard unix-server et.al
  239.         install new kernel as mach.new on superroot.
  240.         do an /etc/halt or /etc/shutdown
  241.  
  242.         at boot prompt type:
  243.             DecStation 5000:    >>boot 3/rz0/mach.new
  244.             i386:               boot mach.new or sd(0,a)mach.new
  245.             Sun3:               >>boot mach.new or boot sd(0,0,0)mach.new
  246.             Micro Vax:          >>b/3 mach.new
  247.  
  248.   Booting a new unix-server and emultor, standard micro-kernel
  249.         Create  mach_servers.new directories or links on root and super-root
  250.  
  251.         If you only have one directory (and one link) populate it with
  252.                 startup  -- new unix-server
  253.                 emulator -- new emulator code
  254.                 paging_file  -- link to existing pagingfile
  255.                 mach_init -- link to existing version of mach_init.
  256.         If you have two directories populate /../../mach_servers.new with
  257.                 startup  -- new unix-server
  258.                 emulator -- new emulator code (may be a symlink)
  259.                 paging_file  -- link to existing pagingfile
  260.         and /mach_servers.new with
  261.                 emulator  -- new emulator code
  262.                 mach_init -- link to existing version of mach_init
  263.  
  264.         do and /etc/halt or /etc/shutdown
  265.  
  266.         at the boot prompt type:
  267.             DecStation 5000:    >>boot -sq
  268.             i386:               boot -sa
  269.             Sun3:               >>boot -sa
  270.             Micro Vax:          >>b/3 -sa
  271.  
  272.   The  the -s switch will cause the kernel to drop into the debugger as soon as
  273. is possible to allow you to set any break points. Typing c causes the  boot  to
  274. be  continued.  It  also  causes  the  system to come up single-user.  You will
  275. prompted for the name of the root device and the /mach_servers directory.
  276.  
  277.   Booting both a new micro-kernel and unix-server
  278.         With the setup as in the previous examples respond to the boot prompt
  279.             DecStation 5000:    >>boot 3/rz0/mach.new -sq
  280.             i386:               boot mach.new -sa
  281.             Sun3:               >>boot sd(0,0,0)mach.new -sa
  282.             Micro Vax:          >>b/3 mach.new -sa
  283.  
  284. 5. Mach 3.0 Servers
  285.   If it exists /mach_servers/mach_init is  the  first  program  called  by  the
  286. Unix-server.    If  it  does not exist /etc/init is called and your system will
  287. boot but none of the  mach  servers  will  work.    mach_init  initializes  the
  288. following ports: name_server_port, environment_port and service_port. The first
  289. port is used by either the NetMsgServer or snames depending on which you choose
  290. to  run.  The  second  is  used  by  the  Environment  Manager and the third by
  291. mach_init itself as the Service server. All the processes on the system inherit
  292. these ports.
  293.  
  294.   The  collection  mach3.release  contains  executables  of  mach3 programs and
  295. servers. They can be installed anywhere on your system and your  PATH  variable
  296. set to find them.
  297.  
  298.   It  is  assumed  below that you have copied the contents of the mach3.release
  299. collection (except for the directory special) to /usr/mach3.    There  are  two
  300. servers that we normally run:
  301.  
  302. /usr/mach3/bin/snames
  303.                 provides a local name  service  that  supplies  the  same  name
  304.                 lookup functions (on the same port) that the NetMsgServer does.
  305.                 Snames' name space is local to the machine  it  is  running  on
  306.                 while the NetMsgServer's name space spans all machines that are
  307.                 running instantiations of the NetMsgServer.  Only one of  these
  308.                 servers can be run.
  309.  
  310. /usr/mach3/bin/machid
  311.                 provides the machid services which are needed by such  programs
  312.                 as  ms,  pinfo, vmstat and gdb4.5.  Machid needs to have a name
  313.                 server running.
  314.  
  315. 6. Accessing AFS
  316.   Since UX29 Mach 3.0 has used the same AFS file access code as Mach 2.5.  Thus
  317. both  systems  look  in  /usr/vice/etc/cacheinfo  to  find  the location of the
  318. venus.cache directory.  Note: that the name given  in  cacheinfo  should  be  a
  319. symbolic link to the real venus cache.
  320.  
  321.   The daemon afsd (or afsd.31) must be run to get AFS access.  In Mach 2.5 this
  322. is started by nanny with the script  /usr/misc/.afs/etc/launchafsd.  This  will
  323. continue to work in Mach 3.0.
  324.  
  325. 7. Finding the files
  326.  
  327.  
  328.  
  329. 7.1. Sup Collections
  330.   Mach  3.0  is  suped as 6 separate collections. The collections mach3.kernel,
  331. mach3.unix, mach3.poe, mach3.user  and  mach3.buildtools  contain  only  source
  332. files.  When  you build these sources directories named obj/<machine_type> will
  333. be created.  These directories are referred to as  build  directories.  In  the
  334. past  you  have  been  expected  to copy the programs that you built from these
  335. directories to the places from which they were  used.  Starting  with  releases
  336. MK69,  UX31,  POE9  and  USER12  the build process copies the end products of a
  337. build to the release directory, release/<machine_type>. The major  servers  and
  338. the  kernel  files  are  put into the directory release/<machine_type>/special,
  339. from which they must be copied to the directories in which they are used. Other
  340. programs          and          libraries          are          put         into
  341. release/<machine_type>/{bin,include,etc,lib}. These  directories  are  normally
  342. added  to  the  approriate  path names when a Mach 3.0 system is running so the
  343. files can be used directly from there.
  344.  
  345.   The sixth Mach3 collection, Mach3.release, provides  a  copy  of  the  latest
  346. binaries that were built at CMU. You may use these to facilitate boot-strapping
  347. or as a binary system if you do not want to make any changes  and  trust  other
  348. people's binaries.
  349.  
  350.  
  351.  
  352. 7.2. AFS release directories
  353.   If  you are at CMU or have AFS access to cs.cmu.edu, the kernel and ux binary
  354. files can be found in /afs/cs.cmu.edu/project/mach3/latest/release/@sys/special
  355. and mach_init can be found in .../release/@sys/etc/mach_init.
  356.                                Table of Contents
  357. 1. Introduction                                                               0
  358. 2. Super root and local root                                                  0
  359. 3. Setup for a default boot                                                   0
  360.      3.1. Micro-kernel Names                                                  0
  361.      3.2. Other file names                                                    0
  362.      3.3. Installing the pieces                                               0
  363. 4. Booting new kernel/server pieces                                           1
  364. 5. Mach 3.0 Servers                                                           1
  365. 6. Accessing AFS                                                              1
  366. 7. Finding the files                                                          1
  367.      7.1. Sup Collections                                                     1
  368.      7.2. AFS release directories                                             1
  369.