Rhyous

December 25, 2009

How to download FreeBSD-Current or FreeBSD-Stable using svn?

Filed under: FreeBSD — J. Abram barneck @ 1:00 am
Tags: , , , ,

How to download FreeBSD-Current or FreeBSD-STABLE using svn?

The goal of this article is to help users who want to get started developing on FreeBSD and want to contribute code fixes/changes/enhancements to FreeBSD. I really try to be “newbie” proof, so even a newbie can do this, so if you think I am stating the obvious, then skip what you already know.

The first thing you need to do in order to work on FreeBSD code is to download the FreeBSD code itself.

Step 1 – You need a FreeBSD install

Following one of these documents:
How do I install FreeBSD?
or if you want a FreeBSD install with a desktop as well:
How to install and configure a FreeBSD 8 Desktop with Xorg and KDE?

Step 2 – Make sure that the FreeBSD version of Subversion is installed
If you built a FreeBSD 8 Desktop as described above, you probably already have Subversion installed but it is the wrong version. You should install the subversion-freebsd port as described on the wiki:
http://wiki.freebsd.org/SubversionPrimer#head-d0af2380587f2e6b75285c1aa2db931b23698ab7

  1. Check if subversion is installed with this command:

    $ pkg_info |grep subversion

  2. If subversion (not subversion-freebsd) is installed, uninstall it.
    #
    #
    cd /usr/ports/devel/subversion
    make deinstall
  3. If it is not installed, install it.

    By package:

    # pkg_add -r subversion-freebsd

    By port:

    #
    #
    cd /usr/ports/devel/subversion-freebsd
    make install

Step 3 - Choose/Create a location to store the source

While you could download to /usr/src where source is usually installed, you may want to maintain multiple versions of code, such as head, stable/8, and stable/7 or even more. So lets create a folder other than source for all of these.

  1. Access a shell (also called a command prompt or terminal).
  2. Create a directory that is in a partition that has plenty of space. I have all my space in /usr (where my home directory /usr/home/jared resides) and other partitions are small so I am going to create a folder in my home directory.
  3. Make a directory to store your source. I am just calling my directory Devel, but you can name yours whatever you would like.

    $ mkdir Devel

  4. Now change to your new directory.

    $ cd Devel

You are now read to use svn to check out the source.

Step 4 - List or browse the repository so you know what to checkout

  1. List what is in the svn base.

    $ svn list svn://svn.freebsd.org/base

  2. Now list what is in head.

    $ svn list svn://svn.freebsd.org/base/head

  3. Now list what is in stable.

    $ svn list svn://svn.freebsd.org/base/stable

You should now have a good idea of how to browse the svn repository from the command line and determine what to download.

Step 5 - Obtaining source for FreeBSD-Current (which could become FreeBSD 9

  1. To download head or FreeBSD-Current, run the following command.

    $ svn checkout svn://svn.freebsd.org/base/head

  2. Wait for your source to download.

Yes, it was that easy if you can believe it.
You will have the following directory containing source for head: /usr/home/jared/Devel/head

Step 6 - Obtaining source for FreeBSD-STABLE

  1. To download stable or FreeBSD-STABLE, run the following command.

    $ svn checkout svn://svn.freebsd.org/base/stable/8

  2. Wait for your source to download.

You will have the following directory containing source for head: /usr/home/jared/Devel/8

Step 7 - Updating /usr/src using subversion-freebsd

  1. To update /usr/src you need root access, so su to root.
  2. To download head or FreeBSD-Current, run the following command.

    # svn checkout svn://svn.freebsd.org/base/head /usr/src

  3. Wait for your source to download.

Copyright ® Rhyous.com - Linking to this article is allowed without permission and as many as ten lines of this article can be used along with this link. Any other use of this article is allowed only by permission of Rhyous.com.

Advertisements

2 Comments »

  1. […] Step 3 – Download the FreeBSD Source Follow this guide to make sure you have the source you need. How to download FreeBSD-Current or FreeBSD-Stable using svn? […]

    Pingback by How to compile a portion of FreeBSD code (Sysinstall for this example) with debugging? « Rhyous's 127.0.0.1 or ::1 — January 1, 2010 @ 6:09 pm | Reply

  2. When I ran this command in /usr/src
    $ svn checkout svn://svn.freebsd.org/base/stable/8
    it saved the source code in /usr/src/8. Now I want to base a buildworld on that source code, so it seems to me that mergemaster might require the -m /usr/src/8 switch. I’ll have to try it and see, unless I hear from someone who already knows.

    Comment by Robert Kopp — April 19, 2010 @ 11:34 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.