[BACK]Return to updating.html CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / htdocs / docs

File: [cvs.NetBSD.org] / htdocs / docs / updating.html (download) (as text)

Revision 1.62, Mon Apr 19 07:19:25 2021 UTC (6 months ago) by nia
Branch: MAIN
CVS Tags: HEAD
Changes since 1.61: +1 -1 lines

regen

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="generator" content="Website XSL Stylesheet V2.6.0">
<link rel="home" href="../." title="Welcome to The NetBSD Project: Of course it runs NetBSD.">
<link rel="up" href="../docs/." title="NetBSD Documentation">
<link rel="previous" href="../docs/software/." title="Application Software for NetBSD">
<link rel="next" href="../docs/x/." title="NetBSD Documentation: The X Window System">
<link rel="first" href="../docs/Hardware/." title="Hardware Documentation">
<link rel="last" href="../docs/x/." title="NetBSD Documentation: The X Window System">
<link rel="stylesheet" href="../global.css" type="text/css">
<link rel="stylesheet" href="../donations/thermo/fundraiser.css" type="text/css">
    
    <title>Updating a stable NetBSD release</title>
  </head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<body class="website"><div class="webpage">
<a name="docs-updating"></a><div id="top"><a href="#mainContent" id="skiplink" tabindex="1">Skip to main content.</a></div>
<input id="hamburger" type="checkbox"><label class="menuicon" for="hamburger"><span></span><span></span><span></span></label><div id="navBar" role="navigation">
<div id="centralHeader"><div id="logo">
<a href="../"><img id="projectLogo" alt="" height="120" src="../images/NetBSD-smaller-tb.png"></a><a href="/"><div id="fundraiser">
<br><div id="fundraiser-amount"><div id="fundraiser-raised"></div></div>
</div></a>
</div></div>
<span class="doNotDisplay">
	  Navigation:
	</span><ul>
<li>
<a href="../">
	  Home</a><ul>
<li><a href="../changes/">
	    Recent changes</a></li>
<li><a href="//blog.NetBSD.org/">
	    NetBSD blog</a></li>
<li><a href="../gallery/presentations/">
	    Presentations</a></li>
</ul>
</li>
<li>
<a href="../about/">
	  About</a><ul>
<li><a href="../people/developers.html">
	    Developers</a></li>
<li><a href="../gallery/">
	    Gallery</a></li>
<li><a href="//wiki.NetBSD.org/ports/">
	    Ports</a></li>
<li><a href="//www.pkgsrc.org/">
	    Packages</a></li>
</ul>
</li>
<li>
<a href="../docs/">
	  Documentation</a><ul>
<li><a href="../docs/misc/index.html">
	    FAQ &amp; HOWTOs</a></li>
<li><a href="../docs/guide/en/">
	    The Guide</a></li>
<li><a href="//man.NetBSD.org/">
	    Manual pages</a></li>
<li><a href="//wiki.NetBSD.org/">
	    Wiki</a></li>
</ul>
</li>
<li>
<a href="../support/">
	  Support</a><ul>
<li><a href="/community/">
	    Community</a></li>
<li><a href="/mailinglists/">
	    Mailing lists</a></li>
<li><a href="../support/send-pr.html">
	    Bug reports</a></li>
<li><a href="../support/security/">
	    Security</a></li>
</ul>
</li>
<li>
<a href="../developers/">
	  Developers</a><ul>
<li><a href="http://cvsweb.NetBSD.org/">
	    CVSWeb</a></li>
<li><a href="//anonhg.NetBSD.org/">
	    Mercurial</a></li>
<li><a href="//nxr.NetBSD.org/">
	    Cross-reference</a></li>
<li><a href="//releng.NetBSD.org/">
	    Release engineering</a></li>
<li><a href="//wiki.NetBSD.org/projects/">
	    Projects list</a></li>
</ul>
</li>
</ul>
</div>
<div id="content"><div id="mainContent" class="fullWidth"><div class="rowOfBoxes">
<h1>Updating a stable NetBSD release</h1>
<h3 class="title"><a name="top"></a></h3>
<ul>
<li><a href="#current">Tracking -current</a></li>
<li><a href="#update-src">Updating the sources</a></li>
<li><a href="#tools">Building the tools</a></li>
<li><a href="#kernel">Building a new kernel</a></li>
<li><a href="#userland">Building a new  userland</a></li>
<li><a href="#installing">Installing the kernel and userland</a></li>
<li><a href="#parts">Updating only parts of the source tree</a></li>
<li><a href="#summary">Terse summary of an updating procedure</a></li>
</ul>
<hr>
<h3 class="title"></h3>
        <h4 class="title">
<a name="current"></a>Tracking -current</h4>
        <p>
          See 
          <a class="ulink" href="current/" target="_top">this document</a>
          for our documentation on how to track NetBSD-current.
        </p>
      
        <h4 class="title">
<a name="update-src"></a>Updating the sources</h4>
        <p>
          If you are running a stable NetBSD release (such as 
          <a class="ulink" href="../releases/formal-6/" target="_top">NetBSD 6.1</a>),
          in a production environment, you should occasionally
          update your sources and rebuild the system or the kernel,
          in order to incorporate any security fixes that have been
          applied to the branch since its release.
       </p>

       <p>Most of the following steps can be done as ordinary user. 
       Only the installation of a new kernel and the userland will require 
       root privileges.
       Although <code class="filename">/usr</code> is choosen as the working 
       directory in the following examples, the procedure can also 
       take place in a user's home directory. Ordinary users have normally not 
       the permissions to make changes in <code class="filename">/usr</code>, 
       but this can be changed by root. </p>

     <p> 
         You can retrieve or update the sources for your
         release using 
         <a class="ulink" href="current/#using-anoncvs-over-ssh" target="_top">anoncvs over
          ssh</a>
          by specifying the correct branch tag. For example, to
          checkout the sources for the NetBSD 6.1 release branch, you
          would use:
        </p>
        <pre class="programlisting">
$ cd /usr
$ export CVS_RSH=ssh 
$ cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot co -r netbsd-6-1 -P src</pre>

  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
  Be sure to take care in selecting the correct and desired branch tag so
  you don't accidently <span class="emphasis"><em>downgrade</em></span> your source tree.
  </div>

  <p>To update an existing source tree, do:</p>

<pre class="programlisting">
$ cd /usr/src
$ export CVS_RSH=ssh 
$ cvs update -dP</pre>


  <h4 class="title">
<a name="tools"></a>Building the tools</h4>

  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
    Please always refer to <code class="code">build.sh -h</code> and the
    files <code class="filename">UPDATING</code> and
    <code class="filename">BUILDING</code> for details - it's worth
    it, there are <span class="emphasis"><em>many</em></span> options that can
    be set on the command line or in
    <code class="filename">/etc/mk.conf</code>.
  </div>

  <p>The next step is to build the toolchain. You need to 
  create an <code class="filename">obj/</code> and a <code class="filename">tools/</code> 
  directory, followed by a run of <span class="command"><strong>build.sh</strong></span>:</p>

  <pre class="programlisting">
$ mkdir /usr/obj /usr/tools
$ cd /usr/src
$ ./build.sh -O /usr/obj -T /usr/tools -U -u tools</pre>


        <h4 class="title">
<a name="kernel"></a>Building a new kernel</h4>
        <p>
          Building a new kernel pretty much follows the steps
          as described in 
          <a class="ulink" href="kernel/#how_to_build_a_kernel" target="_top">this
          document</a>.
        </p>

<p>The steps to build the kernel are:</p>
<pre class="programlisting">
$ cd /usr/src
$ ./build.sh -O ../obj -T ../tools -U kernel=&lt;KERNEL&gt;
</pre>


      
        <h4 class="title">
<a name="userland"></a>Building a new  userland</h4>

<p>The build the userland, do:</p>
<pre class="programlisting">
$ ./build.sh -O ../obj -T ../tools -U distribution</pre>

      
  <h4 class="title">
<a name="installing"></a>Installing the kernel and userland</h4>

<p>Installing the new kernel, rebooting (to ensure that the new kernel 
works) and installing the new userland are the final steps of the updating 
procedure:</p>
<pre class="programlisting">
$ cd /usr/src
$ su
# mv /netbsd /netbsd.old
# mv /usr/obj/sys/arch/&lt;ARCH&gt;/compile/&lt;KERNEL&gt;/netbsd /
# shutdown -r now
...
$ cd /usr/src
$ su
# ./build.sh -O ../obj -T ../tools -U install=/ </pre>

<p>If the new kernel <code class="filename">netbsd</code> does not boot 
successfully, you can fall back on booting the 
<code class="filename">netbsd.old</code> kernel.</p>


        <h4 class="title">
<a name="parts"></a>Updating only parts of the source tree</h4>

        <p>
          If a security advisory has been issued, and you want
          to just rebuild the necessary libraries and applications,
          your best bet is to follow the instructions provided in the
          advisory. An example is given below:
        </p>

<pre class="programlisting">
$ cd src
$ export CVS_RSH=ssh cvs update -d -P -r netbsd-6-1
$ cd libexec/httpd
$ make USETOOLS=no cleandir dependall
$ su
# make USETOOLS=no install</pre>


  <h4 class="title">
<a name="summary"></a>Terse summary of an updating procedure</h4>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            <p>Updating the sources:</p>
            <pre class="programlisting">
$ cd /usr/src
$ export CVS_RSH=ssh 
$ cvs update -dP</pre>
          </li>
<li class="listitem">
  <p>Building the new kernel and userland:</p>
  <pre class="programlisting">
$ cd /usr/src
$ ./build.sh -O ../obj -T ../tools tools
$ ./build.sh -O ../obj -T ../tools kernel=&lt;KERNEL&gt;
$ ./build.sh -O ../obj -T ../tools -U distribution</pre>
  </li>
<li class="listitem">
  <p>Installing the new kernel and userland:</p>
  <pre class="programlisting">
$ su
# mv /netbsd /netbsd.old
# mv /usr/obj/sys/arch/&lt;ARCH&gt;/compile/&lt;KERNEL&gt;/netbsd /
# shutdown -r now
...
$ cd /usr/src
$ su
# ./build.sh -O ../obj -T ../tools -U install=/ </pre>
  </li>
</ul></div>
</div></div></div>
<div class="navfoot"></div>
<div id="footer"><div id="footerContent"><center>
<span class="footfeed"><a href="//www.NetBSD.org/cgi-bin/feedback.cgi">
	  Contact</a> |
      </span><span class="footcopy"><a href="../about/disclaimer.html">
      Disclaimer</a> |

      <span class="copyright">Copyright 1994-2021 The NetBSD Foundation, Inc. </span>ALL RIGHTS RESERVED.<br>NetBSD<sup>/sup> is a registered trademark of The NetBSD
	Foundation, Inc.</span>
</center></div></div>
</div></body>
</html>