From owner-doc-jp@jp.freebsd.org  Sun Oct 31 15:41:18 1999
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id PAA67847;
	Sun, 31 Oct 1999 15:41:18 +0900 (JST)
	(envelope-from owner-doc-jp@jp.FreeBSD.org)
Received: from sv01.geocities.co.jp (sv01.geocities.co.jp [210.153.89.155])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id PAA67842
	for <doc-jp@jp.freebsd.org>; Sun, 31 Oct 1999 15:41:18 +0900 (JST)
	(envelope-from hrs@geocities.co.jp)
Received: from mail.geocities.co.jp (mail.geocities.co.jp [210.153.89.137]) by sv01.geocities.co.jp (8.9.3+3.2W/3.7W) with ESMTP id PAB17595 for <doc-jp@jp.freebsd.org>; Sun, 31 Oct 1999 15:41:18 +0900 (JST)
Received: from mail.hrs.jp (sutnmax1-ppp45.ed.noda.sut.ac.jp [133.31.173.55]) by mail.geocities.co.jp (1.3G-GeocitiesJ-3.3) with ESMTP id PAA07669 for <doc-jp@jp.freebsd.org>; Sun, 31 Oct 1999 15:41:16 +0900 (JST)
Message-Id: <199910310641.PAA07669@mail.geocities.co.jp>
Received: from localhost (alph.hrs.jp [192.168.0.10])
	by mail.hrs.jp (8.9.3/3.7W/DomainMaster) with ESMTP id PAA77427
	for <doc-jp@jp.freebsd.org>; Sun, 31 Oct 1999 15:36:07 +0900 (JST)
	(envelope-from hrs@hrs.jp)
To: FreeBSD-doc-jp <doc-jp@jp.freebsd.org>
X-Mailer: Mew version 1.94 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Date: Sun, 31 Oct 1999 15:35:20 +0900
From: Hiroki Sato <hrs@geocities.co.jp>
X-Dispatcher: imput version 990905(IM130)
Lines: 211
Reply-To: doc-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+990727
X-Sequence: doc-jp 6822
Subject: [doc-jp 6822] <handbook> cutting-edge/chapter.sgml 1.30 -> 1.32 (part 3/7)
Errors-To: owner-doc-jp@jp.freebsd.org
Sender: owner-doc-jp@jp.freebsd.org
X-Originator: hrs@geocities.co.jp

$B:4F#!wEl5~M}2JBg3X$G$9!#(B

$B;0$DL\!#(B

+    <sect2>
+      <title/Recompile the source and install the new system/
+      
+      <sect3>
+	<title>All versions</title>
+	
+	<para>You must be in the <filename>/usr/src</filename> directory, so
+	
+	  <screen>&prompt.root; <userinput>cd /usr/src</userinput></screen>
+	  
+	  (unless, of course, your source code is elsewhere, in which case
+	  change to that directory instead).</para>
+      
+	<para>To rebuild the world you use the &man.make.1; command.  This
+	  command reads instructions from the <filename>Makefile</filename>
+	  which describes how the programs that comprise FreeBSD should be
+	  rebuilt, the order they should be built in, and so on.</para>
+	
+	<para>The general format of the command line you will type is as
+	  follows;</para>
+
+	<screen>&prompt.root; <userinput>make <option>-<replaceable/x/</option> <option>-D<replaceable>VARIABLE</replaceable></option> <replaceable>target</replaceable></userinput></screen>
+
+	<para>In this example, <option>-<replaceable>x</replaceable></option>
+	  is an option that you would pass to &man.make.1;.  See the manual
+	  page for an example of the options you can pass.</para>
+
+	<para><option>-D<replaceable>VARIABLE</replaceable></option> passes a
+	  variable to the <filename>Makefile</filename>.  The behaviour of the
+	  <filename>Makefile</filename> is controlled by these variables.
+	  These are the same variables as are set in
+	  <filename>/etc/make.conf</filename>, and this provides another way
+	  of setting them.</para>
+
+	<screen>&prompt.root; <userinput>make -DNOPROFILE=true <replaceable>target</replaceable></userinput></screen>
+      
+	<para>is another way of specifying that profiled libaries should not be
+	  built, and corresponds with the
+	
+	  <programlisting>NOPROFILE=    true
+#    Avoid compiling profiled libraries</programlisting>
+
+	  lines in <filename>/etc/make.conf</filename>.</para>
+
+	<para><replaceable>target</replaceable> tells &man.make.1; what you
+	  want to do.  Each <filename>Makefile</filename> defines a number of
+	  different <quote>targets</quote>, and your choice of target
+	  determines what happens.</para>
+
+	<para>Some targets are listed in the <filename>Makefile</filename>,
+	  but are not meant for you to run.  Instead, they are used by the
+	  build process to break out the steps necessary to rebuild the system
+	  into a number of sub-steps.</para>
+
+	<para>Most of the time you won't need to pass any parameters to
+	    &man.make.1;, and so your command like will look like this.</para>
+
+	<screen>&prompt.root; <userinput>make <replaceable>target</replaceable></userinput></screen>
+      </sect3>
+
+      <sect3>
+	<title>Saving the output</title>
+	
+	<para>It's a good idea to save the output you get from running
+	    &man.make.1; to another file.  If something goes wrong you will
+	  have a copy of the error message, and a complete list of where the
+	  process had got to.  While this might not help you in diagnosing
+	  what has gone wrong, it can help others if you post your problem to
+	  one of the FreeBSD mailing lists.</para>
+
+	<para>The easiest way to do this is to use the &man.script.1; command,
+	  with a parameter that specifies the name of the file to save all
+	  output to.  You would do this immediately before remaking the world,
+	  and then type <userinput>exit</userinput> when the process has
+	  finished.</para>
+
+	<screen>&prompt.root; <userinput>script /var/tmp/mw.out</userinput>
+Script started, output file is /var/tmp/mw.out	 
+&prompt.root; <userinput>make world</userinput>
+<emphasis>&hellip; compile, compile, compile &hellip;</emphasis>	  
+&prompt.root; <userinput>exit</userinput>
+Script done, &hellip;</screen>
+
+	<para>If you do this, <emphasis>do not</emphasis> save the output in
+	  <filename>/tmp</filename>.  This directory may be cleared next time
+	  you reboot.  A better place to store it is in
+	  <filename>/var/tmp</filename> (as in the previous example) or in
+	  <username>root</username>'s home directory.</para>
+      </sect3>
+      
+      <sect3>
+	<title>Version 2.2.2 and below</title>
+	
+	<para><filename>/usr/src/Makefile</filename> contains the
+	  <maketarget>world</maketarget> target, which will rebuild the entire
+	  system and then install it.</para>
+	
+	<para>Use it like this.</para>
+      
+	<screen>&prompt.root; <userinput>make world</userinput></screen>
+      </sect3>
+      
+      <sect3>
+	<title>Version 2.2.5 and above</title>
+	
+	<para>Beginning with version 2.2.5 of FreeBSD (actually, it was first
+	  created on the -current branch, and then retrofitted to -stable
+	  midway between 2.2.2 and 2.2.5) the <maketarget>world</maketarget>
+	  target has been split in two.  <maketarget>buildworld</maketarget>
+	  and <maketarget>installworld</maketarget>.</para>
+
+	<para>As the names imply, <maketarget>buildworld</maketarget> builds a
+	  complete new tree under <filename>/usr/obj</filename>, and
+	  <maketarget>installworld</maketarget> installs this tree on the
+	  current machine.</para>
+
+	<para>This is very useful for 2 reasons.  First, it allows you to do
+	  the build safe in the knowledge that no components of your running
+	  system will be affected.  The build is <quote>self hosted</quote>.
+	  Because of this, you can safely run
+	  <maketarget>buildworld</maketarget> on a machine running in
+	  multi-user mode with  no fear of ill-effects.  I still recommend you
+	  run the <maketarget>installworld</maketarget> part in single user
+	  mode though.</para>
+
+	<para>Secondly, it allows you to use NFS mounts to upgrade multiple
+	  machines on your network.  If you have three machines, A, B and C
+	  that you want to upgrade, run <command>make buildworld</command> and
+	  <command>make installworld</command> on A.  B and C should then NFS
+	  mount <filename>/usr/src</filename> and
+	  <filename>/usr/obj</filename> from A, and you can then run
+	  <command>make installworld</command> to install the results of the
+	  build on B and C.</para>
+
+	<para>The <maketarget>world</maketarget> target still exists, and you
+	  can use it exactly as shown for version 2.2.2.  <command>make
+	    world</command> runs <command>make buildworld</command> followed
+	  by <command>make installworld</command>.</para>
+
+	<note>
+	  <para>If you do the <command>make buildworld</command> and
+	    <command>make installworld</command> commands separately, you must
+	    pass the same parameters to &man.make.1; each time.</para>
+
+	  <para>If you run
+
+	    <screen>&prompt.root; <userinput>make -DNOPROFILE=true buildworld</userinput></screen>
+
+	    you must install the results with
+
+	    <screen>&prompt.root; <userinput>make -DNOPROFILE=true installworld</userinput></screen>
+
+	    otherwise it would try and install profiled libraries that had not
+	    been built during the <command>make buildworld</command>
+	    phase.</para>
+	</note>
+      </sect3>
+      
+      <sect3>
+	<title>-current and above</title>
+	
+	<para>If you are tracking -current you can also pass the
+	  <option>-j</option> option to <command>make</command>.  This lets
+	  <command>make</command> spawn several simultaneous processes.</para>
+
+	<para>This is most useful on true multi-CPU machines.  However, since
+	  much of the compiling process is IO bound rather than CPU bound it is
+	  also useful on single CPU machines.</para>
+
+	<para>On a typical single-CPU machine you would run:</para>
+	  
+	  <screen>&prompt.root; <userinput>make -j4 <replaceable>target</replaceable></userinput></screen>
+
+	<para>&man.make.1; will then have up to 4 processes running at any one
+	  time. Empirical evidence posted to the mailing lists shows this
+	  generally gives the best performance benefit.</para>
+
+	<para>If you have a multi-CPU machine and you are using an SMP
+	  configured kernel try values between 6 and 10 and see how they speed
+	  things up.</para>
 	
-    <para>A successor to this tutorial will be integrated into the
-      handbook.</para>
+	<para>Be aware that (at the time of writing) this is still
+	  experimental, and commits to the source tree may occasionally break
+	  this feature. If  the world fails to compile using this parameter
+	  try again without it before you report any problems.</para>
+      </sect3>
+      
+      <sect3>
+	<title>Timings</title>
+
+	<para>Assuming everything goes well you have anywhere between an hour
+	  and a half and a day or so to wait.</para>
+	
+	<para>As a general rule of thumb, a 200MHz P6 with more than 32MB of
+	  RAM  and reasonable SCSI disks will complete <command>make
+	    world</command> in about an hour and a half.  A 32MB P133 will
+	  take 5 or 6 hours.  Revise these figures down if your machines are
+	  slower&hellip;</para>
+      </sect3>
+    </sect2>

--
| $B:4F#(B $B9-@8!wEl5~M}2JBg3X(B <hrs@geocities.co.jp>
|                         mailto:j7397067@ed.noda.sut.ac.jp
|
