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

File: [cvs.NetBSD.org] / htdocs / docs / updating.xml (download)

Revision 1.11, Mon Jun 26 08:06:27 2017 UTC (4 years, 3 months ago) by leot
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +11 -10 lines

Move the tip about consulting `build.sh -h', UPDATING and BUILDING files before
the first use of `build.sh'. Format it as a `<note>' to better stand out it.

<?xml version="1.0"?>
<!DOCTYPE webpage
PUBLIC "-//NetBSD//DTD Website-based NetBSD Extension//EN"
"http://www.NetBSD.org/XML/htdocs/lang/share/xml/website-netbsd.dtd">

<webpage id="docs-updating">
  <config param="desc" value="Updating a stable NetBSD release" />
  <config param="cvstag"
  value="$NetBSD: updating.xml,v 1.11 2017/06/26 08:06:27 leot Exp $" />
  <config param="rcsdate" value="$Date: 2017/06/26 08:06:27 $" />
  <head>
    <!-- Copyright (c) 2003-2006
           The NetBSD Foundation, Inc.  ALL RIGHTS RESERVED. -->
    <title>Updating a stable NetBSD release</title>
  </head>
  <sect1 role="toc" id="updating-stable">
    <sect2 id="top">

      <sect3 id="current">
        <title>Tracking -current</title>
        <para>
          See 
          <ulink url="current/">this document</ulink>
          for our documentation on how to track NetBSD-current.
        </para>
      </sect3>

      <sect3 id="update-src">
        <title>Updating the sources</title>
        <para>
          If you are running a stable NetBSD release (such as 
          <ulink url="../releases/formal-6/">NetBSD 6.1</ulink>),
          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.
       </para>

       <para>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 <filename>/usr</filename> 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 <filename>/usr</filename>, 
       but this can be changed by root. </para>

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

  <note>
  Be sure to take care in selecting the correct and desired branch tag so
  you don't accidently <emphasis>downgrade</emphasis> your source tree.
  </note>

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

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

</sect3>

<sect3 id="tools">
  <title>Building the tools</title>

  <note>
    Please always refer to <code>build.sh -h</code> and the
    files <filename>UPDATING</filename> and
    <filename>BUILDING</filename> for details - it's worth
    it, there are <emphasis>many</emphasis> options that can
    be set on the command line or in
    <filename>/etc/mk.conf</filename>.
  </note>

  <para>The next step is to build the toolchain. You need to 
  create an <filename>obj/</filename> and a <filename>tools/</filename> 
  directory, followed by a run of <command>build.sh</command>:</para>

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

</sect3>


      <sect3 id="kernel">
        <title>Building a new kernel</title>
        <para>
          Building a new kernel pretty much follows the steps
          as described in 
          <ulink url="kernel/#how_to_build_a_kernel">this
          document</ulink>.
        </para>

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


      </sect3>

      <sect3 id="userland">
        <title>Building a new  userland</title>

<para>The build the userland, do:</para>
<programlisting>
$ ./build.sh -O ../obj -T ../tools -U distribution</programlisting>

      </sect3>

<sect3 id="installing">
  <title>Installing the kernel and userland</title>

<para>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:</para>
<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=/ </programlisting>

<para>If the new kernel <filename>netbsd</filename> does not boot 
successfully, you can fall back on booting the 
<filename>netbsd.old</filename> kernel.</para>

</sect3>


      <sect3 id="parts">
        <title>Updating only parts of the source tree</title>

        <para>
          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:
        </para>

<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</programlisting>

</sect3>

<sect3 id="summary">
  <title>Terse summary of an updating procedure</title>
<itemizedlist>

          <listitem>
            <para>Updating the sources:</para>
            <programlisting>
$ cd /usr/src
$ export CVS_RSH=ssh 
$ cvs update -dP</programlisting>
          </listitem>


  <listitem>
  <para>Building the new kernel and userland:</para>
  <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</programlisting>
  </listitem>

  <listitem>
  <para>Installing the new kernel and userland:</para>
  <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=/ </programlisting>
  </listitem>

</itemizedlist>
</sect3>

    </sect2>
  </sect1>
</webpage>