home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / mach / doc / notes / mach3_cmu.doc.Z / mach3_cmu.doc
Encoding:
Text File  |  1992-08-19  |  33.0 KB  |  707 lines

  1.                       CMU-TOOLS FOR MACH 3.0 DEVELOPMENT
  2.  
  3.                                Mary R. Thompson
  4.  
  5.                                  29 June 1992
  6.  
  7. 1. Introduction
  8.   This  document  describes  the organization of the Mach 3.0 sources and build
  9. areas and the methods for changing them.  It documents the standard method  for
  10. getting  a  private  copy  of selected sources: the m3tree script; the building
  11. your own version of the Mach 3.0 programs, and the required  way  of  inserting
  12. your  changes  back  into  the  official  sources:   the m3merge script.  It is
  13. intended to be used by the Mach 3.0 developers at CMU.
  14.  
  15. 2. Background knowledge
  16.  
  17.  
  18.  
  19. 2.1. Andrew File System
  20.   The Andrew File System (AFS) is used to hold all of the sources and  compiled
  21. object  files.    An  understanding  of  the AFS filesystem in general, and its
  22. protection scheme in particular, is required.
  23.  
  24.   CMU systems recognize the special name @sys  in  symbolic  link  names.  When
  25. evaluating  such  a  link  name  @sys is bound to vax_mach, rt_mach, sun3_mach,
  26. sun4_mach, i386_mach, pmax_mach or  luna88k_mach  depending  on  what  type  of
  27. machine the task is executing on.
  28.  
  29.   Most  AFS  volumes are backed-up in two ways: the /afs/cs/.BACKUP directories
  30. and a nightly backup to tape. However, some volumes are  set  up  without  such
  31. backup  to  hold object or other easily regenerated files. These volumes can be
  32. identified by doing "fs lv ." on a directory and getting the  message  "***  No
  33. backups  made  for  this volume ***". The offical Mach object areas are on such
  34. volumes and there are several other such volumes for individual use.
  35.  
  36.  
  37.  
  38. 2.2. Make
  39.   The local version of make has been modified  to  deal  with  the  problem  of
  40. building  programs  for several machine types from one set of sources. Features
  41. have been added to allow the objects to be built in a directory other than  the
  42. source  directory.    The  make variable OBJECTDIR is used to specify where the
  43. object files should be placed. The built-in make variable target_machine is set
  44. to  vax,  pmax,  i386, luna88k, sun3 or sun4 depending on what machine type the
  45. make is being executed on. The TARGET_MACHINE variable has the same values only
  46. in  upper-case.   OBJECTDIR is typically defined in a file called Makeconf as a
  47. function of target_machine and relative to the source tree. When  make  is  run
  48. with   the  -m  switch  it  will  search  for  files  in  subdirectories  named
  49. TARGET_MACHINE before looking in the curent directory. make will search up  the
  50. tree  starting  from the current working directory looking for a Makeconf file.
  51. The -N switch to make will supress this search.  Another switch to remember  is
  52. -c.  This  will  prevent  make  from  automatically looking for RCS files for a
  53. prerequite file, if it can't find the prequiste file. This is mostly  important
  54. when make is set up to search lots of directories.  The -d switch will procduce
  55. lots of information about what it is  doing.  See  make(1)  for  more  complete
  56. information.
  57.  
  58.  
  59.  
  60. 2.3. SUP
  61.   Sup  is  a  program  used  at  CMU to copy a consistent set of files from one
  62. machine to another. In our current source distribution sup is  mostly  used  to
  63. provide  copies  of our files to external sites. You can sup files locally, but
  64. the machine that you are supping to, must be in our host tables  for  the  Mach
  65. 3.0    collections    on    x29.    For   more   information   see   sup.1   or
  66. /afs/cs/project/mach/public/sup/sup.doc.
  67.  
  68.  
  69.  
  70. 2.4. RCS/BCS
  71.   RCS is used extensively to maintain a history of modifications  to  the  Mach
  72. sources,  and to aid in managing concurrent lines of development.  Therefore, a
  73. working knowledge of RCS is necessary.  See the online manual pages for rcs for
  74. a  discussion  of  how revisions are managed.  Most of the local changes to the
  75. RCS programs were done to make the version control of a set of files stored  in
  76. a directory tree easier.  Configuation rules have been introduced to facilitate
  77. the specification of which versions to chose for a set of files.  Configuration
  78. rules  specify  some  general  rule like a date or branch name which is used to
  79. select the desired version of each file.
  80.  
  81.   A set of b-commands have been written to keep track  of  all  the  files  and
  82. changes  on  a branch and to handle the problems that arise from the separation
  83. of the RCS tree from the checked out versions of the files. The b-commands need
  84. various  bits of information before they can function. Most of these parameters
  85. can be supplied by environment variables, command line switches or  files.  Our
  86. standard  tools  set one environment variable, BCSBBASE, which defines the base
  87. of your shadow or working area and then use files within that  area  to  define
  88. the other values.
  89.  
  90.   The following .BCS-files are of interest:
  91.  
  92. .BCSBRANCH       specifies the RCS branch on which you would like to store your
  93.                 modifications
  94.  
  95. .BCSVBASE       containing the pathname of the RCS source tree.
  96.  
  97. .BCSconfig-<branch_name>
  98.                 which  contains  the  configuration  rules used to select files
  99.                 that are not on your branch.
  100.  
  101. .BCSset-<branch_name>
  102.                 Whenever  you  either  bco  or bci a file, its name is added to
  103.                 this file. Thus this file gives a complete list  of  all  files
  104.                 that you have modified.
  105.  
  106. .BCSlog-<branch_name>
  107.                 Whenever you bci a file, its name and log message is placed  in
  108.                 this file.
  109.  
  110. .BCSlock        This  file  locks  a  source or shadow area. It's purpose is to
  111.                 ensure that only one user at a time is using the b-commands  in
  112.                 the same working area.
  113.  
  114.   Further information can be found in the the man page for bci(1).
  115.  
  116.  
  117.  
  118. 2.5. workon
  119.   /usr/misc/.sdm/bin/workon  is a command that reads a project description file
  120. which defines the source, rcs and possibly shadow  area,  creates  any  missing
  121. .BCS-files,  and  leaves  you  in a subshell with BCSBBASE set as well as a few
  122. other BCS variables.
  123.  
  124.   A sample project description that could be used to define a working area  for
  125. the mk sources with no shadowing is:
  126.  
  127.     project mk
  128.     project_base /afs/cs/user/<userid>/mach3
  129.     rcs_base /afs/cs/project/mach3/rcs/mk
  130.     source_base src/mk
  131.     object_base obj/@sys/mk
  132.  
  133.   Place  the  project  description on your LPATH with the name project/mk. Then
  134. the command
  135.  
  136.     workon -project mk -branch mrt_MK73
  137.  
  138. will exec a subshell, set all the necessary environment variables,  and  cd  to
  139. the  source base directory.  Assuming that <userid> was set to mrt, workon will
  140. create in /afs/cs/user/mrt/mach3/src/mk any of the following files that do  not
  141. already exist:
  142.  
  143.   .BCSVBASE containing the line
  144.  
  145.       /afs/cs/project/mach3/rcs/mk
  146.  
  147.   .BCSconfig-mrt_MK73 containing the line
  148.  
  149.       <current date and time>
  150.  
  151. where  the  time  will be the time workon was first run. You may need to modify
  152. this date to correspond with the creation time of the kernel version  that  you
  153. want your branch relative to.
  154.  
  155.   .BCSconfig-TRUNK containing the line
  156.  
  157.     <>
  158.  
  159.   .BCSpath-mrt_MK73 containing the line
  160.  
  161.     .
  162.  
  163.   .BCSlock containing locking information.
  164.  
  165.   If  you wanted to shadow the user sources you would use a project description
  166. like:
  167.  
  168.     project user
  169.     shadow_base /afs/cs/usr/mrt/mach3
  170.     shadow_source_base src/user
  171.     shadow_object_base obj/@sys/user
  172.  
  173.     project_base /afs/cs/project/mach3
  174.     rcs_base rcs/user
  175.     release_base latest/release/@sys
  176.  
  177.     # change the next line to shadow from another area
  178.     source_base latest/src/user
  179.  
  180.     # this object_base is just to appease workon which insists
  181.     # that an object_directory exists, even if it is never used
  182.     object_base /afs/cs/project/mach-mrt/mach3/obj/@sys
  183.  
  184.  
  185.  
  186.  
  187. 2.6. Other
  188.   Note that the machine names used  by  AFS:  vax_mach,  pmax_mach,  sun3_mach,
  189. those  used  by make: vax, sun3, pmax, and those used by the kernel: vax, sun3,
  190. mips are all slightly different. This  difference  accounts  for  the  indirect
  191. linking  to  machine  directories,  and the various names for machine dependent
  192. stuff.
  193.  
  194.   The Mach 3.0 specific scripts that are mentioned  in  this  document  can  be
  195. found  in  /afs/cs/project/mach3/tools.   The best versions of the RCS programs
  196. and b-commands can be found  in  /afs/cs/@sys/{alpha,beta,omega}/usr/misc/.rcs.
  197. To get these on your machine use
  198.  
  199.     modmisc -release beta cs.misc.rcs
  200. If you set -release alpha you will get any new features more quickly. There are
  201. also symbolic links to these programs in /usr/misc/bin.  build and  workon  are
  202. released  as another misc collection:  cs.misc.sdm. These program can be linked
  203. to in /afs/cs/@sys/{alpha,beta,omega}/usr/misc/.sdm or supped to  your  machine
  204. by using the following command.
  205.  
  206.     modmisc cs.misc.sdm
  207.  
  208. 3. Organization of Mach 3.0 source, release and build trees
  209.   All  the  Mach  3.0  tools,  source,  object,  and  release area can be found
  210. starting at  /afs/cs.cmu.edu/project/mach3.  There  are  currently  3  versions
  211. there:  merge  where  merges  take place, latest the latest official version of
  212. sources and releases, and alpha which is supposed to be an  older  more  stable
  213. version  of  the  sources  and  releases.  The tools directory is where we keep
  214. useful scripts.
  215.  
  216.   The  source,  object  and  release   directory   organization   relative   to
  217. /afs/cs/project/mach3/{merge,latest,alpha} is:
  218.         src/{mk,ux,user,poe,us,bsdss,mdos}/...
  219.         obj/{pmax_mach,i386_mach,...}/{mk,ux,user,...}/...
  220.         release/{pmax_mach,i386_mach,...}/{bin,lib,include,etc,man,special}/...
  221.  
  222.   mk  is the kernel directory; ux is the Unix-server area (BSD 4.3 flavor); poe
  223. is the Poe server; user is the area for user level programs: us is the area for
  224. the  multi-server  work; and mdos is the Mach-dos server; and bsdss is the BNR2
  225. based license-free Unix server.
  226.  
  227.   Each time the latest area is updated some information about  the  release  is
  228. created:
  229.  
  230.    - The    file    {mk,ux,user,poe,us,bsdss,mdos}/conf/version.edit    is
  231.      incremented by one and checked into the RCS tree.
  232.  
  233.    - A post is made to the mach3 mailing list with a summary  of  all  the
  234.      changes to this version. This post is also saved in the MERGE_HISTORY
  235.      file in the sources.
  236.  
  237. 4. Kernel AFS groups and privileges
  238.   If you are new to AFS, be aware that unprotected files on AFS can be read  by
  239. everyone  at  CMU and at quite a few other sites. Check the contents of /afs to
  240. get an idea of how widespread access is. To help people limit access to  useful
  241. subsets  of  the world there are several standard access groups provided by our
  242. AFS cell administation.  Some of them are:
  243.  
  244. system:anyuser   anybody at all
  245.  
  246. system:authuser  anyone who is authenticated in the CS.CMU cell
  247.  
  248. system:friendlyhost
  249.                 anyone,  authenticated  or  not,  referencing  the  file from a
  250.                 CS-CMU machine.
  251.  
  252. system:campushost
  253.                 anyone,  authenticated  or not, referencing the file from a CMU
  254.                 machine.
  255.  
  256.   Mach project files that contain no licensed code are  generally  readable  by
  257. system:anyuser  or  system:authuser  and  system:friendlyhost, depending on how
  258. proud we are of the files. The mach rcs tree is restricted for reading  to  the
  259. kernel:view.local  group.  This is to protect any old licensed code that may be
  260. in previous versions of the files.
  261.  
  262.   Read access to the Mach 3.0 sources that contain licensed code must  be  much
  263. more   carefully   controlled.   We   use   the  facilities  controlled  groups
  264. kernel:view.{4bsd,sun3,pmax,nfs} and sys:read.afs to grant read  access.    The
  265. kernel:view  and  system:view  groups  are  in  the process of being renamed to
  266. sys:read  groups.    To  be  added  to  any  of  these  groups,  send  mail  to
  267. help@cs.cmu.edu specifiying which groups you want to be added to.
  268.  
  269.   Files  in directories that are protected with these read groups must never be
  270. copied to AFS directories with greater permissions or to local directories with
  271. world-read  access.  (Remember  that  at  CS-CMU,  RFS  allows users from other
  272. machines to read files on your local machine).  Most of the licensed code lives
  273. in   the  ux  area,  but  there  is  also  some  in  the  mk/kernel/{vax*,sun*}
  274. directories.
  275.  
  276.   If you are going to check out files from the kernel sources using  m3tree  or
  277. an  update  script,  be  sure  that  the  directories that will be created have
  278. restricted read access, either by having umask set to 27 if  you  are  creating
  279. local  directories, or by having the base directory set for reading only by you
  280. if you are creating AFS directories.
  281.  
  282.   Write access to the sources and RCS files are controlled by a different group
  283. for  each collection: mach:update.{kernel,unixserver,poe,user,mdos,us}.  If you
  284. want to check in files on a private branch in the RCS tree or do a  merge,  you
  285. will need to be in the appropriate group. To be added to these groups send mail
  286. to mach@cs.cmu.edu speciying what access you need.
  287.  
  288. 5. Getting an initial set of sources
  289.  
  290.  
  291.  
  292. 5.1. m3tree
  293.   If you are at CMU and have read access to the mach3 archive area, you can get
  294. a  copy  of  the  sources  by  using the /afs/cs/project/mach3/tools/bin/m3tree
  295. script. You should  run  this  script  either  in  a  directory  <base>/src  or
  296. <base>/src/<collection> where <collection> is the subtree you are checking out.
  297. The arguments for this command are:
  298.  
  299.         m3tree [-options] [mk|ux|user|poe|us|bsdss|mdos] [<Dirlist>]
  300.  
  301. where the options are:
  302.  
  303. -dir <dir>      specify a dir to process. Can be used if you only want  to  get
  304.                 the files from a few directories.
  305.  
  306. -co             check out subdirectories (default)
  307.  
  308. -noco           don't  check out subdirectories. Can be used to set up an empty
  309.                 tree with the RCS links and .BCS files in place
  310.  
  311. -q              be quiet
  312.  
  313. -v              be verbose (default)
  314.  
  315. -i              ask questions (default)
  316.  
  317. -f              don't ask questions; use default answer
  318.  
  319. -b <version>    specify a base version. Can be used if you want to check out an
  320.                 older version than the one currently in latest. <version> is of
  321.                 the form MK70 or UX28.
  322.  
  323. -n <name>       specify a branch name. Can be used  to  get  the  files  off  a
  324.                 branch rather than the trunk.
  325.  
  326. -help           this summary
  327.  
  328.   The   Dirlist  names  correspond  to  the  files  in  {mk,ux,...}/Directories
  329. directory. e.g. ALL, MI, ca, sun3, i386 ...  ALL will select all the files  for
  330. all  platforms.  MI gets the machine independent files to which you can add the
  331. specific platforms for which you want to build. Thus
  332.  
  333.         m3tree mk MI mips
  334.  
  335. checks out  all  the  sources  needed  to  build  the  latest  kernel  for  the
  336. DecStation.
  337.  
  338.         m3tree -b UX30 ux MI sun3 vax
  339.  
  340. checks out the files needed to build the UX30 Unix server for a sun3 and vax.
  341.  
  342.   Note:  if  you want to checkout sources earlier than MK68 or UX29 you need to
  343. use the mktree.obsolete and uxtree.obsolete scripts  as  the  directory  layout
  344. changed at that time.
  345.  
  346.   In  addition  to  building  the  directory structure, the m3tree program will
  347. create all the .BCS-files that the b-commands  need  and  will  create  an  RCS
  348. symbolic link in each directory that refers to the appropriate directory in the
  349. real  RCS   tree.      At   the   top   level   RCS   will   be   a   link   to
  350. /afs/cs/project/mach3/rcs/{mk,ux,user..}  and at the lower levels, for example,
  351. kern/RCS will be a symbolic link to ../RCS/kern.  It will also create a copy of
  352. the  Directories  directories  at  the  top  level.  These files will allow the
  353. normal RCS  utilities  to  be  used  in  any  subdirectory,  but  will  collect
  354. configuration  information  in the top-level directory. Note that if you do use
  355. the plain RCS commands, you will not get entries  in  the  .BCSset-<branch>  or
  356. .BCSlog-<branch>  files  that  the  b-commands  create that allow for automatic
  357. tracking of all the files that you change.
  358.  
  359.  
  360.  
  361. 5.2. sup
  362.   If you do not have access to AFS, but want to get a copy the  latest  release
  363. of the kernel sources, it is possible to sup the kernel sources from x29:/usr2.
  364. To do this you must set up the proper sup files on your target machine, and you
  365. need  to  have  the  machine onto which you wish to copy the files added to the
  366. host tables on x29. If you want to sup into an AFS directory, you can  use  the
  367. machine  ernst.mach.cs.cmu.edu as sups are already enabled to it with the crypt
  368. testing.      For       futher       information       see       the       file
  369. /afs/cs/project/mach/public/doc/mach3/mach3_sup.
  370.  
  371.  
  372.  
  373. 5.3. Shadowing sources
  374.   It  may be that you do not want a complete copy of a source tree. For example
  375. if you are only changing a few files in the user area, or want to  do  a  quick
  376. build of some version of the kernel or other server changing none or only a few
  377. files. (The emphasis here is on quick as there is no guarantee that the sources
  378. in  the  latest  area  will stay the same for any period of time.) Our make and
  379. Makefiles are set up so that it is possible for make to look in both  a  shadow
  380. and a base source tree for files. Any file found in the shadow will be used. If
  381. there is no file in the shadow the one in the base tree will be used.
  382.  
  383.   Setting up a shadow directory so that you can use the b-commands can be  done
  384. in  either  of  two  easy  ways: you can use workon with an appropriate project
  385. description file, or you can use m3tree with the -noco option. If you chose  to
  386. use m3tree, you must remember to set BCSBBASE and BCSBRANCH.
  387.  
  388.   Do either:
  389.  
  390.         workon -project <project_name> -branch <branch_name>
  391.  
  392.     or
  393.  
  394.        cd  <your shadow src directory>
  395.        m3tree -noco <project_name>
  396.        setenv BCSBBASE `pwd`
  397.  
  398.   to  create  all  the necessary .BCS-files in your shadow user area and to set
  399. the environment variable BCSBBASE.
  400.  
  401.   The m3tree -noco <project_name> only needs to be done once, but BCSBBASE must
  402. be  set whenever a b-command is executed.  If you want to work on more than one
  403. branch in the same working area, you do a workon for whichever branch you  want
  404. to currently workon. If you want to do this without using using workon, you can
  405. set the environment variable BCSBRANCH after using m3tree with the -n option to
  406. set up the .BCS-files.
  407.  
  408.   If  you  are  planning  to  do  build in your shadow you should check out the
  409. Makeconf file. That is the one file that make will not find in the shadow area.
  410. You  also need to tell make where the master source directory is. One way is to
  411. add the line
  412.  
  413.     SOURCEDIR=/afs/cs/project/mach3/latest/src/<collection>
  414.  
  415. to your local copy of the Makeconf file. This make variable can also be set  on
  416. the command line to make.
  417.  
  418. 6. Making modifications
  419.   When  you  wish  to make changes that can be stored in the RCS tree, you will
  420. need to use the b-commands to check files in and out of the RCS tree.  See  the
  421. previous section on RCS/BCS.
  422.  
  423.   You  may  check  out the files you want to change from anywhere in the source
  424. tree, using the bco command.  For example,
  425.  
  426.     cd my_kernel_sources
  427.     bco vax/pmap.c
  428.     cd bsd
  429.     bco kern_exec.c
  430.     bco ../vm/vm_map.c
  431.  
  432.   In order to checkpoint your work, to share your work with others, or just  to
  433. update  the .BCSset file so that you will have a list of all the files you have
  434. modified, you may wish to periodically check in your changes to the  RCS  tree.
  435. Also  it  is  easiest  to  merge  your  files onto the mainline if they are all
  436. checked into a branch before you start the merge process.
  437.  
  438.   To checkin a file, you run the bci program. For example:
  439.  
  440.     bci -[switches] kern/mach.defs
  441.  
  442.   If the bci program is run with no switches it will look for a whist style log
  443. entry  between the HISTORY and the $Log$ line in your file to be used as an RCS
  444. log message. If there is no such entry, an editor will be invoked, primed  with
  445. the differences between your source file and the version from which you began.
  446.  
  447.   If  the  file  being  checked  in does not have a comment line containing the
  448. phrase $Log$, the bci program will insist that you edit the source  to  include
  449. one.   A line should be added after the HISTORY comment; that line should begin
  450. with the appropriate comment leader, then $Log$.
  451.  
  452.   After an adequate log message is ready, the bci program  will  allow  you  to
  453. check the file in, make further edits, or abort the checkin procedure.
  454.  
  455.   There  are  several  other  ways that bci can find a log entry:  there is the
  456. -xlog switch and the -m"put log here" switch.  See the bci(1) for more details.
  457. Generally, you should always create a whist entry when you are editing the file
  458. in the first place, then it is not a major nuisance to create them at check  in
  459. time and more importantly there will be a record of what changes have been made
  460. to the file.
  461.  
  462.   If the file you are checking in did not exist in the source tree before,  the
  463. bci  program will ask you whether an original source file from another software
  464. vendor (e.g., Berkeley, Sun, DEC) is available, and if  so,  where  the  source
  465. file  may  be found.  If your file is original to Mach, you should specify that
  466. it is "local".  If an original is provided, it will be checked in  as  revision
  467. 1.1.  Local versions begin with revision 2.1.
  468.  
  469. 7. Updating your branch
  470.   Often  a developer may keep his changes on a branch for a considerable length
  471. of time before merging them back into the mainline.  As time goes by, it  is  a
  472. good  idea  to  bring  the branch up-to-date with changes that have been taking
  473. place on the mainline.
  474.  
  475.   The easiest current procedure for updating an existing branch,  for  example,
  476. mrt_MK70, to the current sources, MK73, is:
  477.  
  478.    1. Be  sure  that  all  changed files are checked in on the old branch,
  479.       mrt_MK70.
  480.  
  481.    2. Use "m3tree mk <dirlist>" to check out a completely new MK73 tree.
  482.  
  483.    3. Do a "workon -project kernel -branch mrt_MK73"  to  create  the  new
  484.       branch and set you up to be working on it.
  485.  
  486.    4. Use  a  "bmerge  -rmrt_MK70 <filelist>" to merge the old branch into
  487.       the new branch.
  488.  
  489.    5. Use a "bci -xlog mrt_MK70 <filelist>" to check the merged files into
  490.       the new branch, doing the right thing with the log messages.
  491.  
  492.    6. Suspend  the  workon  for branch mrt_MK73. Enter a workon for branch
  493.       mrt_MK70 and remove the old branch with "bcs -o1- <filelist>".  This
  494.       removes  all the old revisions for branch mrt_MK70, but still leaves
  495.       the symbolic name.
  496.  
  497.    7. Exit the workon for branch mrt_MK70. Delete any extraneous .BCS*MK70
  498.       files  in  your  source  area.  Do  all further work on the mrt_MK73
  499.       branch.
  500.  
  501. 8. Merging your changes back to the mainline
  502.  
  503.  
  504.  
  505. 8.1. M3merge: pass 1
  506.   The /afs/cs/project/mach3/tools/bin/m3merge script must be used to merge your
  507. changes  back  to the mainline. Use of this script ensures that only one person
  508. at a time is doing a  merge  and  leaves  the  merge  and  latest  areas  in  a
  509. consistent and predictable state.
  510.  
  511.   For the m3merge script to execute correctly you must:
  512.  
  513.    - Be   authenticated   to   AFS  and  a  member  of  the  access  group
  514.      mach:update.mach3 and the appropriate mach:update group for the  area
  515.      you are merging.
  516.  
  517.    - Have the rcs commands, /usr/misc/bin, on your PATH.
  518.  
  519.    - The  /afs/cs/project/mach3/merge/src/{mk,ux,..}/.BCSlock  must either
  520.      not exist, or have been locked by you on the previous m3merge pass.
  521.  
  522.   m3merge is called at least twice while doing a check-in.  The first  time  it
  523. is  called  you  normally  give  it  a list of files to be merged.  These files
  524. should already be checked-in to the rcs tree with a  single  branch  name.  For
  525. example:
  526.  
  527.     m3merge mk|ux|user|poe|mdos|bsdss `cat .BCSset-mystuff`
  528.  
  529.   m3merge  will check the status of the lock by comparing the value of $USER to
  530. the name in the file if it exists. If the file does not exist, m3merge  creates
  531. it, locks it for you and gives you a chance to put a comment in the file to say
  532. what you are changing.  It will then prompt you for the  branch  name  of  your
  533. changes.  It will do a bmerge with that branch, copying over and compacting the
  534. log messages, and giving you a chance to edit  conflicting  versions.    During
  535. this   process   the   .BCSlog-TRUNK   and  .BCSset-TRUNK  files  are  created.
  536. .BCSlog-TRUNK contains log messages for all the files that  are  being  merged.
  537. .BCSset-TRUNK  contains  a list of all the files that have been merged.  At the
  538. end of the check-in process, all the latest merged versions  are  left  checked
  539. out in /afs/cs/project/mach3/merge/src/{mk,ux,user,poe.bsdss}.  Note that TRUNK
  540. is a branch name that the b-commands recognize to mean to check  things  on  or
  541. off the RCS trunk.
  542.  
  543.   Once  your  changes  are merged and the resulting files checked out in merge,
  544. the first pass of m3merge exits and you are expected to build the tree  for  an
  545. i386, pmax, vax, and sun3 and using the sources in merge.
  546.  
  547.  
  548.  
  549. 8.2. Making changes in the merge source area
  550.   If  you want to make any changes directly to files in the src/merge area, you
  551. should use bco, to lock the rcs file on the trunk, and bci  to  check  in  your
  552. changed  file.  You  must  set  the  environemnt variable, BCSSBASE, before the
  553. b-commands will work. Do this either by
  554.  
  555.        setenv BCSBBASE /afs/cs/project/mach3/merge/src/<collection>
  556.  
  557. or
  558.  
  559.         workon -project <collection>.merge -branch TRUNK
  560.  
  561. The     merge     project      descriptions      can      be      found      in
  562. /afs/cs/project/mach3/tools/lib/project.
  563.  
  564.  
  565.  
  566. 8.3. Adding to Directories
  567.   At  this  point  if you have added any new directories to the tree you should
  568. add them to  the  appropriate  file  in  the  Directories  directory.  The  new
  569. directories  should  be  added  to  the  ALL file and either to the MI (machine
  570. independent) file or the machine(s) file in which it belongs.  bco the file and
  571. update it. You can either check it in manually or wait until the second part of
  572. the m3merge process to do it for you.
  573.  
  574.  
  575.  
  576. 8.4. Defuncting files and directories
  577.   If you have deleted any files or moved files to  a  different  directory  you
  578. need  to  defunct  the  file  in  the  rcs tree. This keeps the file from being
  579. checked out by either the m3tree script or by the second pass of  m3merge  when
  580. it  checks files out to the latest/src area. The second pass of m3merge will in
  581. fact delete files from latest that have been marked defunct in the rcs tree. To
  582. defunct  a file you need to lock the file and then checkin a null file with the
  583. state set to defunct.  A procedure for doing this is:
  584.  
  585.       bco <file>            -- locks the file
  586.       cp /dev/null <file>   -- creates a zero length file
  587.       bci -defunct -m"Deleted" or -m"moved to ..." <file>
  588.                             -- checks in the file and sets
  589.                             -- the state to defunct
  590.       rm -f <file>          -- gets rid of the null file
  591.  
  592.   If you have removed all the files in a directory, you need to  also  manually
  593. remove  the  directory  from  the  src/merge  area  and  to  remove it from the
  594. appropriate Directories files. After the copy from merge to latest is made, the
  595. directory  also has to be removed from src/latest. Note that it should be empty
  596. by this time, if all the files were successfully defuncted. The  directory  and
  597. files  must remain in the rcs tree so that older versions of the kernel sources
  598. can still be retrieved.
  599. 8.5. Building and testing
  600.   Now  you  are  ready  to  build.  It  is  assumed  that  you  will  build  in
  601. /afs/cs/project/mach3/merge/obj/{i386_mach,pmax_mach,vax_mach,sun3_mach}.   You
  602. should decide if you want to build incrementally on top of the last build or if
  603. you  want to delete everything in that area and build from scratch. The project
  604. machines: wb1 (sun3), natasha (vax), ernst (pmax) and intel2 (i386) may be used
  605. to build on.
  606.  
  607.   See  the document Building Mach 3.0 if you have any questions on how to build
  608. a collection. Basically at this point the way to build and release poe and  the
  609. user  tree is to simply execute the make command at the top of the tree you are
  610. building,  e.g.  /afs/cs/project/mach3/merge/src/user.  This  will   build   in
  611. ../../obj/@sys and release the files to ../../release/@sys.
  612.  
  613.   For the kernel and Unix server it is recommended to use the m3build script to
  614. get  all  the  configurations  built.    This   script   should   be   run   in
  615. /afs/cs/project/mach3/merge/src as follows:
  616.  
  617.       m3build mk|ux -extra
  618.  
  619. The  -extra  switch  to  m3build  is  used  to get all the officially supported
  620. versions of the kernel and Unix server built.
  621.  
  622.   If bugs are found during the testing process, you can use bco  (to  lock  the
  623. version  on  the trunk), correct the file and bci it, all in the context of the
  624. merge directory.  This process is repeated until  the  system  has  passed  its
  625. tests.
  626.  
  627.  
  628.  
  629. 8.6. M3merge: pass 2
  630.   Once the system has been tested, you execute m3merge again, this time with no
  631. arguments. It now checks in the new files to the TRUNK. Then it checks for  any
  632. files  that  you  may have changed in the ../merge/src area and asks you if you
  633. want to check them in. After  any  remaining  files  are  checked  in,  m3merge
  634. prompts  you  for a release message to send to the mach3 mailing list.  It then
  635. appends the release message to MERGE_HISTORY file and checks that file in.
  636.  
  637.   If this is a merge being done in the merge area, m3merge checks out  all  the
  638. files  in .BCSset-TRUNK into the latest area. After it does this it asks you if
  639. you want to run diff on the merge and latest areas.  They should  be  identical
  640. at  this  point  except for the .BCS files. Sometimes if there have been errors
  641. and not all the changed files in the merge area have  been  checked  in,  these
  642. areas  will  differ. Thus it is a good idea to let it do this diff. The results
  643. of the diff are put in /tmp/m3merge.diffs as well as being displayed on stdout.
  644. At  the  end  it checks in the .BCSset-TRUNK file and removes the .BCSlog-TRUNK
  645. and .BCSlock files.
  646.  
  647.   Since several of these steps are time consuming and  occasionally  cause  the
  648. script  to  abort,  the  script  will  ask you if you have already successfully
  649. completed each step.  None of the steps  are  optional.  However,  if  you  are
  650. rerunning  the  script  for  some reason, you do not have to do these the steps
  651. twice.
  652.  
  653.   The only things that are not currently done for you by m3merge is  to  update
  654. the  Directories list, in case you have created or deleted any new directories,
  655. and to move the released binaries to mach3/latest/release.  Running
  656.  
  657.       make TRELEASEDIR=/afs/cs/project/mach3/latest/release/@sys
  658.  
  659. make will copy the current build targets from ...merge/release to the  parallel
  660. directories  in  ...latest/release. Note that this release step must be done on
  661. each platform that you have built for. In the case of the kernel, and  ux,  poe
  662. and  and  bsdss  servers  the  new  binaries will have different names from the
  663. previous ones and will thus not replace anything.  Periodically some of the old
  664. versions  of  these  servers  need  to  be  removed to keep the release areas a
  665. resonable size. Releasing the user files and the kernel include  and  libraries
  666. will  overide  the  existing  versions.   So some thought should be given about
  667. moving the latest release programs to alpha before overriding them.
  668.  
  669.  
  670.  
  671. 8.7. Deleting your old branch
  672.   It is also a good idea once the merge has been done to  delete  your  branch.
  673. This  keeps  down the space used by the rcs tree and keeps the rcs headers from
  674. growing beyond their allowed limits.  To  delete  a  branch  go  back  to  your
  675. working area, do a workon for your old branch and run
  676.  
  677.        bcs -rm -o1- `cat .BCSset-<branch_name>`
  678.  
  679. The  -rm  switch  causes  the file to be deleted from the .BCSset file and from
  680. your working directory. At this point you would need to do a new m3tree command
  681. to start doing additional work relative to the current head of the tree.
  682.                                Table of Contents
  683. 1. Introduction                                                               0
  684. 2. Background knowledge                                                       0
  685.      2.1. Andrew File System                                                  0
  686.      2.2. Make                                                                0
  687.      2.3. SUP                                                                 0
  688.      2.4. RCS/BCS                                                             0
  689.      2.5. workon                                                              0
  690.      2.6. Other                                                               0
  691. 3. Organization of Mach 3.0 source, release and build trees                   1
  692. 4. Kernel AFS groups and privileges                                           1
  693. 5. Getting an initial set of sources                                          1
  694.      5.1. m3tree                                                              1
  695.      5.2. sup                                                                 1
  696.      5.3. Shadowing sources                                                   1
  697. 6. Making modifications                                                       2
  698. 7. Updating your branch                                                       2
  699. 8. Merging your changes back to the mainline                                  2
  700.      8.1. M3merge: pass 1                                                     2
  701.      8.2. Making changes in the merge source area                             2
  702.      8.3. Adding to Directories                                               2
  703.      8.4. Defuncting files and directories                                    2
  704.      8.5. Building and testing                                                3
  705.      8.6. M3merge: pass 2                                                     3
  706.      8.7. Deleting your old branch                                            3
  707.