View | Details | Raw Unified | Return to bug 91518
Collapse All | Expand All

(-)chapter.sgml (-144 / +95 lines)
Lines 1-7 Link Here
1
<!--
1
<!--
2
     The FreeBSD Documentation Project
2
     The FreeBSD Documentation Project
3
3
4
     $FreeBSD: doc/en_US.ISO8859-1/books/handbook/cutting-edge/chapter.sgml,v 1.221 2006/01/02 23:29:53 simon Exp $
4
     $FreeBSD$
5
-->
5
-->
6
6
7
<chapter id="cutting-edge">
7
<chapter id="cutting-edge">
Lines 551-566 Link Here
551
      tree to rebuild the system.</para>
551
      tree to rebuild the system.</para>
552
552
553
    <warning>
553
    <warning>
554
      <title>Take a Backup</title>
554
      <title>Make a Backup</title>
555
555
556
      <para>It cannot be stressed enough how important it is to take a
556
      <para>It cannot be stressed enough how important it is to make a
557
	backup of your system <emphasis>before</emphasis> you do this.
557
	backup of your system <emphasis>before</emphasis> you do this.
558
	While rebuilding the world is (as long as you follow these
558
	While rebuilding the world is (as long as you follow these
559
	instructions) an easy task to do, there will inevitably be times
559
	instructions) an easy task to do, there will inevitably be times
560
	when you make mistakes, or when mistakes made by others in the
560
	when you make mistakes, or when mistakes made by others in the
561
	source tree render your system unbootable.</para>
561
	source tree render your system unbootable.</para>
562
562
563
      <para>Make sure you have taken a backup.  And have a fixit floppy or
563
      <para>Make sure you have made a backup.  And have a fixit floppy or
564
	bootable CD at
564
	bootable CD at
565
	hand.  You will probably never have to use it, but it is better to be
565
	hand.  You will probably never have to use it, but it is better to be
566
	safe than sorry!</para>
566
	safe than sorry!</para>
Lines 603-620 Link Here
603
	the procedure described here should be used instead.</para>
603
	the procedure described here should be used instead.</para>
604
    </warning>
604
    </warning>
605
605
606
    <sect2>
606
    <sect2 id="updatesystem">
607
      <title>The Canonical Way to Update Your System</title>
607
      <title>The Canonical Way to Update a System</title>
608
608
609
      <para>To update your system, you should check
609
      <para>To update a system use the following procedure.  Each step
610
	<filename>/usr/src/UPDATING</filename> for any pre-buildworld steps
610
	is detailed further down this section:</para>
611
	necessary for your version of the sources and then use the following
612
	procedure:</para>
613
611
614
      <screen>&prompt.root; <userinput>make buildworld</userinput>
612
      <procedure>
615
&prompt.root; <userinput>make buildkernel</userinput>
613
	<step>
616
&prompt.root; <userinput>make installkernel</userinput>
614
	  <para><link linkend="read-updating">Read</link>
617
&prompt.root; <userinput>reboot</userinput></screen>
615
	  <filename>/usr/src/UPDATING</filename> and look for any
616
	  pre-buildworld steps necessary for your version of the
617
	  sources.</para>
618
	</step>
619
620
	<step>
621
	  <para><link linkend="compile-base">Compile the source for the
622
	      base system</link> using <command>make
623
	      buildworld</command>:</para>
624
625
	  <screen>&prompt.root; <userinput>make buildworld</userinput></screen>
618
626
619
      <note>
627
      <note>
620
	<para>There are a few rare cases when an extra run of
628
	<para>There are a few rare cases when an extra run of
Lines 624-639 Link Here
624
	  though, you can safely omit this step if you are not
632
	  though, you can safely omit this step if you are not
625
	  updating across one or more major &os; versions.</para>
633
	  updating across one or more major &os; versions.</para>
626
      </note>
634
      </note>
635
	</step>
636
637
	<step>
638
	  <para>Compile a <link linkend="compile-install-kernel">new
639
	      kernel</link>:</para>
640
641
	  <screen>&prompt.root; <userinput>make buildkernel</userinput></screen>
642
	</step>
643
644
	<step>
645
	  <para>Install the <link linkend="compile-install-kernel">new
646
	      kernel</link>:</para>
647
648
	  <screen>&prompt.root; <userinput>make installkernel</userinput></screen>
649
	</step>
627
650
651
	<step>
628
      <para>After <maketarget>installkernel</maketarget> finishes
652
      <para>After <maketarget>installkernel</maketarget> finishes
629
	successfully, you should boot in single user mode
653
	successfully, boot in <link
654
	  linkend="makeworld-singleuser">single user mode</link>
630
	(i.e.&nbsp;using <command>boot -s</command> from the loader
655
	(i.e.&nbsp;using <command>boot -s</command> from the loader
631
	prompt).  Then run:</para>
656
	prompt).</para>
632
657
633
      <screen>&prompt.root; <userinput>mergemaster -p</userinput>
658
	  <screen>&prompt.root; <userinput>reboot</userinput></screen>
634
&prompt.root; <userinput>make installworld</userinput>
659
635
&prompt.root; <userinput>mergemaster</userinput>
660
	</step>
636
&prompt.root; <userinput>reboot</userinput></screen>
661
662
	<step>
663
	  <para>Run &man.mergemaster.8; in pre-buildworld mode, so that
664
	    only files known to be essential to the success of
665
	    installworld, including <filename>/etc/make.conf</filename>
666
	    are compared:</para>
667
668
	  <screen>&prompt.root; <userinput>mergemaster -p</userinput></screen>
669
	</step>
670
671
	<step>
672
	  <para><link linkend="make-installworld">Install</link> the
673
	    new system binaries:</para>
674
675
	  <screen>&prompt.root; <userinput>make installworld</userinput></screen>
676
	</step>
677
678
	<step>
679
	  <para>Remaking the world will not update certain directories
680
	    (in particular, <filename>/etc</filename>,
681
	    <filename>/var</filename> and <filename>/usr</filename>)
682
	    with new or changed configuration files.  Use <link
683
	      linkend="mergemaster">mergemaster</link> to update these
684
	      files:</para>
685
686
	  <screen>&prompt.root; <userinput>mergemaster</userinput></screen>
687
	</step>
688
689
	<step>
690
	  <para>Reboot after verifying that everything appears to be in
691
	    the right place:</para>
692
693
	  <screen>&prompt.root; <userinput>reboot</userinput></screen>
694
	</step>
695
      </procedure>
637
696
638
      <warning>
697
      <warning>
639
	<title>Read Further Explanations</title>
698
	<title>Read Further Explanations</title>
Lines 645-651 Link Here
645
      </warning>
704
      </warning>
646
    </sect2>
705
    </sect2>
647
706
648
    <sect2>
707
    <sect2 id="read-updating">
649
      <title>Read <filename>/usr/src/UPDATING</filename></title>
708
      <title>Read <filename>/usr/src/UPDATING</filename></title>
650
709
651
      <para>Before you do anything else, read
710
      <para>Before you do anything else, read
Lines 672-678 Link Here
672
731
673
      <para>Examine the files
732
      <para>Examine the files
674
	<filename>/usr/share/examples/etc/make.conf</filename>
733
	<filename>/usr/share/examples/etc/make.conf</filename>
675
	(called <filename>/etc/defaults/make.conf</filename> in &os;&nbsp;4.X) and
734
	and
676
	<filename>/etc/make.conf</filename>.  The first contains some
735
	<filename>/etc/make.conf</filename>.  The first contains some
677
	default defines &ndash; most of which are commented out.  To
736
	default defines &ndash; most of which are commented out.  To
678
	make use of them when you rebuild your system from source, add
737
	make use of them when you rebuild your system from source, add
Lines 686-692 Link Here
686
	<makevar>NO_PROFILE</makevar> (or <makevar>NOPROFILE</makevar> on
745
	<makevar>NO_PROFILE</makevar> (or <makevar>NOPROFILE</makevar> on
687
	&os;&nbsp;5.X and older) lines found in
746
	&os;&nbsp;5.X and older) lines found in
688
	<filename>/usr/share/examples/etc/make.conf</filename>
747
	<filename>/usr/share/examples/etc/make.conf</filename>
689
	(or in <filename>/etc/defaults/make.conf</filename> on &os;&nbsp;4.X) to
748
	to
690
	<filename>/etc/make.conf</filename> and uncomment them.</para>
749
	<filename>/etc/make.conf</filename> and uncomment them.</para>
691
750
692
      <para>Examine the other definitions (<makevar>COPTFLAGS</makevar>, 
751
      <para>Examine the other definitions (<makevar>COPTFLAGS</makevar>, 
Lines 727-743 Link Here
727
	the same GID but a different name to those in
786
	the same GID but a different name to those in
728
	<filename>/usr/src/etc/group</filename>.</para>
787
	<filename>/usr/src/etc/group</filename>.</para>
729
788
730
      <para>Since 4.6-RELEASE you can run &man.mergemaster.8; in
789
      <para>The command &man.mergemaster.8; can run in
731
	pre-buildworld mode by providing the <option>-p</option> option.
790
	pre-buildworld mode by providing the <option>-p</option> option.
732
	This will compare only those files that are essential for the success
791
	This will compare only those files that are essential for the success
733
	of <maketarget>buildworld</maketarget> or
792
	of <maketarget>buildworld</maketarget> or
734
	<maketarget>installworld</maketarget>.  If your old version of
793
	<maketarget>installworld</maketarget>.</para>
735
	<command>mergemaster</command> does not support <option>-p</option>,
736
	use the new version in the source tree when running for the first
737
	time:</para>
738
739
      <screen>&prompt.root; <userinput>cd /usr/src/usr.sbin/mergemaster</userinput>
740
&prompt.root; <userinput>./mergemaster.sh -p</userinput></screen>
741
794
742
      <tip>
795
      <tip>
743
	<para>If you are feeling particularly paranoid, you can check your
796
	<para>If you are feeling particularly paranoid, you can check your
Lines 829-836 Link Here
829
&prompt.root; <userinput>rm -rf *</userinput></screen>
882
&prompt.root; <userinput>rm -rf *</userinput></screen>
830
    </sect2>
883
    </sect2>
831
884
832
    <sect2>
885
    <sect2 id="compile-base">
833
      <title>Recompile the Source</title>
886
      <title>Compile the Source for the Base System</title>
834
887
835
      <sect3>
888
      <sect3>
836
	<title>Saving the Output</title>
889
	<title>Saving the Output</title>
Lines 921-929 Link Here
921
974
922
	<screen>&prompt.root; <userinput>make <replaceable>target</replaceable></userinput></screen>
975
	<screen>&prompt.root; <userinput>make <replaceable>target</replaceable></userinput></screen>
923
976
924
	<para>Beginning with version 2.2.5 of &os; (actually, it was
977
	<para>The
925
	  first created on the &os.current; branch, and then retrofitted to
926
	  &os.stable; midway between 2.2.2 and 2.2.5) the
927
	  <maketarget>world</maketarget> target has been split in
978
	  <maketarget>world</maketarget> target has been split in
928
	  two: <maketarget>buildworld</maketarget> and
979
	  two: <maketarget>buildworld</maketarget> and
929
	  <maketarget>installworld</maketarget>.  Beginning with version
980
	  <maketarget>installworld</maketarget>.  Beginning with version
Lines 936-942 Link Here
936
	  and <maketarget>installworld</maketarget> installs this tree on
987
	  and <maketarget>installworld</maketarget> installs this tree on
937
	  the current machine.</para>
988
	  the current machine.</para>
938
989
939
	<para>This is very useful for 2 reasons.  First, it allows you
990
	<para>This is very useful for two reasons.  First, it allows you
940
	  to do the build safe in the knowledge that no components of
991
	  to do the build safe in the knowledge that no components of
941
	  your running system will be affected.  The build is
992
	  your running system will be affected.  The build is
942
	  <quote>self hosted</quote>.  Because of this, you can safely
993
	  <quote>self hosted</quote>.  Because of this, you can safely
Lines 979-989 Link Here
979
	<para>If you have a multi-CPU machine and you are using an SMP
1030
	<para>If you have a multi-CPU machine and you are using an SMP
980
	  configured kernel try values between 6 and 10 and see how they speed
1031
	  configured kernel try values between 6 and 10 and see how they speed
981
	  things up.</para>
1032
	  things up.</para>
982
983
	<para>Be aware that this is still somewhat experimental, and commits
984
	  to the source tree may occasionally break this feature.  If the
985
	  world fails to compile using this parameter try again without it
986
	  before you report any problems.</para>
987
      </sect3>
1033
      </sect3>
988
      
1034
      
989
      <sect3>
1035
      <sect3>
Lines 993-1006 Link Here
993
	  <secondary>timings</secondary>
1039
	  <secondary>timings</secondary>
994
	</indexterm>
1040
	</indexterm>
995
1041
996
        <para>Many factors influence the build time, but currently a 500&nbsp;MHz
1042
        <para>Many factors influence the build time, but fairly recent
997
          &pentium;&nbsp;III with 128&nbsp;MB of RAM takes about 2&nbsp;hours to build
1043
          machines usually take less than an hour to build
998
          the &os.stable; tree, with no tricks or shortcuts used during the
1044
          the &os.stable; tree, with no tricks or shortcuts used during the
999
          process.  A &os.current; tree will take somewhat longer.</para>
1045
          process.  A &os.current; tree will take somewhat longer.</para>
1000
      </sect3>
1046
      </sect3>
1001
    </sect2>
1047
    </sect2>
1002
    
1048
    
1003
    <sect2>
1049
    <sect2 id="compile-install-kernel">
1004
      <title>Compile and Install a New Kernel</title>
1050
      <title>Compile and Install a New Kernel</title>
1005
      <indexterm>
1051
      <indexterm>
1006
        <primary>kernel</primary>
1052
        <primary>kernel</primary>
Lines 1023-1029 Link Here
1023
	can then build a new kernel based on your normal kernel	configuration
1069
	can then build a new kernel based on your normal kernel	configuration
1024
	file.</para>
1070
	file.</para>
1025
1071
1026
      <para>On modern versions of FreeBSD it is important to <link
1072
      <para>On FreeBSD it is important to <link
1027
        linkend="make-buildworld">build world</link> before building a
1073
        linkend="make-buildworld">build world</link> before building a
1028
        new kernel.</para>
1074
        new kernel.</para>
1029
1075
Lines 1056-1062 Link Here
1056
	<xref linkend="makeworld-singleuser">.</para>
1102
	<xref linkend="makeworld-singleuser">.</para>
1057
    </sect2>
1103
    </sect2>
1058
1104
1059
    <sect2>
1105
    <sect2 id="make-installworld">
1060
      <title>Install the New System Binaries</title>
1106
      <title>Install the New System Binaries</title>
1061
1107
1062
      <para>If you were building a version of &os; recent enough to have
1108
      <para>If you were building a version of &os; recent enough to have
Lines 1186-1192 Link Here
1186
	not in <filename>/usr/src/etc</filename>.</para>
1232
	not in <filename>/usr/src/etc</filename>.</para>
1187
1233
1188
      <para>If you are using &man.mergemaster.8; (as recommended),
1234
      <para>If you are using &man.mergemaster.8; (as recommended),
1189
        you can skip forward to the <link linkend="update-dev">next
1235
        you can skip forward to the <link linkend="cutting-edge-rebooting">next
1190
	section</link>.</para>
1236
	section</link>.</para>
1191
1237
1192
      <para>The simplest way to do this by hand is to install the
1238
      <para>The simplest way to do this by hand is to install the
Lines 1333-1435 Link Here
1333
      </tip>
1379
      </tip>
1334
      </sect3>
1380
      </sect3>
1335
    </sect2>
1381
    </sect2>
1336
  
1337
    <sect2 id="update-dev">
1338
      <title>Update <filename>/dev</filename></title>
1339
      
1340
      <note>
1341
        <indexterm><primary>DEVFS</primary></indexterm>
1342
	<para>If you are running FreeBSD&nbsp;5.0 or later you can safely
1343
	  skip this section.  These versions use &man.devfs.5; to
1344
	  allocate device nodes transparently for the user.</para>
1345
      </note>
1346
1347
      <para>In most cases, the &man.mergemaster.8; tool will realize when
1348
        it is necessary to update the device nodes, and offer to complete it
1349
        automatically.  These instructions tell how to update the device
1350
        nodes manually.</para>
1351
      
1352
      <para>For safety's sake, this is a multi-step process.</para>
1353
1354
      <procedure>
1355
	<step>
1356
	  <para>Copy <filename>/var/tmp/root/dev/MAKEDEV</filename> to
1357
	    <filename>/dev</filename>:</para>
1358
1359
	  <screen>&prompt.root; <userinput>cp /var/tmp/root/dev/MAKEDEV /dev</userinput></screen>
1360
	  <indexterm>
1361
	    <primary><filename>MAKEDEV</filename></primary>
1362
	  </indexterm>
1363
1364
          <para>If you used &man.mergemaster.8; to
1365
            update <filename>/etc</filename>, then your
1366
            <filename>MAKEDEV</filename> script should have been updated
1367
            already, though it cannot hurt to check (with &man.diff.1;)
1368
            and copy it manually if necessary.</para>
1369
	</step>
1370
1371
	<step>
1372
	  <para>Now, take a snapshot of your current
1373
	    <filename>/dev</filename>.  This snapshot needs to contain the
1374
	    permissions, ownerships, major and minor numbers of each filename,
1375
	    but it should not contain the time stamps.  The easiest way to do
1376
	    this is to use &man.awk.1; to strip out some of the
1377
	    information:</para>
1378
1379
	  <screen>&prompt.root; <userinput>cd /dev</userinput>
1380
&prompt.root; <userinput>ls -l | awk '{print $1, $2, $3, $4, $5, $6, $NF}' > /var/tmp/dev.out</userinput></screen>
1381
	</step>
1382
1383
	<step>
1384
	  <para>Remake all the device nodes:</para>
1385
	    
1386
	    <screen>&prompt.root; <userinput>sh MAKEDEV all</userinput></screen>
1387
	</step>
1388
1389
	<step>
1390
	  <para>Write another snapshot of the directory, this time to
1391
	    <filename>/var/tmp/dev2.out</filename>.  Now look through these
1392
	    two files for any device node that you missed creating.  There should
1393
	    not be any, but it is better to be safe than sorry.</para>
1394
1395
	  <screen>&prompt.root; <userinput>diff /var/tmp/dev.out /var/tmp/dev2.out</userinput></screen>
1396
1397
	  <para>You are most likely to notice disk slice discrepancies which
1398
	    will involve commands such as:</para>
1399
	  
1400
	    <screen>&prompt.root; <userinput>sh MAKEDEV sd0s1</userinput></screen>
1401
1402
	  <para>to recreate the slice entries.  Your precise circumstances may
1403
	    vary.</para>
1404
	</step>
1405
      </procedure>
1406
    </sect2>
1407
    
1382
    
1408
    <sect2>
1383
    <sect2 id="cutting-edge-rebooting">
1409
      <title>Update <filename>/stand</filename></title>
1410
      
1411
      <note>
1412
	<para>This step is included only for completeness.  It can safely be
1413
	  omitted.  If you are using FreeBSD&nbsp;5.2 or later, the
1414
          <filename>/rescue</filename> directory is automatically updated
1415
          for the user with current, statically compiled binaries during
1416
	  <command>make installworld</command>, thus obsoleting the need
1417
	  to update <filename>/stand</filename> (which does not exist at
1418
	  all on &os;&nbsp;6.0 and later).</para>
1419
      </note>
1420
      
1421
      <para>For the sake of completeness, you may want to update the files in
1422
	<filename>/stand</filename> as well.  These files consist of hard
1423
	links to the <filename>/stand/sysinstall</filename> binary.  This
1424
	binary should be statically linked, so that it can work when no other
1425
	file systems (and in particular <filename>/usr</filename>) have been
1426
	mounted.</para>
1427
1428
      <screen>&prompt.root; <userinput>cd /usr/src/release/sysinstall</userinput>
1429
&prompt.root; <userinput>make all install</userinput></screen>
1430
    </sect2>
1431
    
1432
    <sect2>
1433
      <title>Rebooting</title>
1384
      <title>Rebooting</title>
1434
      
1385
      
1435
      <para>You are now done.  After you have verified that everything appears
1386
      <para>You are now done.  After you have verified that everything appears

Return to bug 91518