This HowTo is copyright (c) 1996 by M. Warner Losh. All rights reserved. You may view this on your web browser, but you may not distribute this on cdrom or publish it in print at this time. Contact the author for more information. This HowTo is under construction and will be placed under different terms when completed.

Here's a quick mini-howto keep the local kernel changes under CVS w/o going nuts. We won't go into how to use CVS much, since it is rather easy to use. We'll just cover how to do vendor branches. Please send feedback to

CVS allows one to create vendor branches. Think of Linus as the Linux vendor. He releases kernels from time to time and you have to integrate them with the local patches you've made. You'll need approximately 1.5x the current source size for disk storage. This could grow large in time, so be advised. This represents between 15-20M typically. If you don't have the disk to burn, then get more disk.

The first step is to get CVS and RCS, build it, install it. It is basically a "./configure ; make ; make install" sort of deal, so I'll not go into detail here.

Importing the sources

First, you need to create a repository, then you need to import the sources, then you need to check things out, make your hacks and commit them. This section will tell you how to do all but the last two items. The next section will tell you how to merge in changes.

Creating a Repository

To create a repository, you'll need to do the following (assuming csh): If you have installed CVS correctly, you should have a new version of the repository. We'll assume through the rest of this HowTo that you have CVSROOT set, since it saves a lot of time and effort.

Now there is one thing that you'll need to do with linux. Since there is a file named core in the distribution (net/core to be precise), you'll need to modify your cvsingnore list to not ignore this file. Here's what I use in my cvsignore file:

RCSLOG  cvslog.*
tags    TAGS
.make.state     .nse_depinfo
*~      #*      .#*     ,*
*.old   *.bak   *.BAK   *.orig  *.rej   .del-*
*.a     *.o     *.obj   *.so    *.Z     *.elc   *.ln
This list is taken from the CVS info file, and has had core removed. I don't think there is anyway to just remove core from the list.

Improting the sources

You need to extract the sources from the distribution. It is best if you put them in a directory named linux and not one that is tied to a version number. I'll assume linux and that you can extract them there and that all of the sources live directly under the linux directory.

Once you have done that, and have created the repository in the last section, you'll need to actually import the sources. I've edited the info files from CVS on how to do this. In general, the info files are a wonderful source of information on CVS and shouldn't be overlooked.

In the terminology used in CVS, the supplier of the program is called a "vendor". In the case of Linux, this would be Linus Torvalds. The unmodified distribution from the vendor is checked in on its own branch, the "vendor branch". CVS reserves branch 1.1.1 for this use.

When you modify the source and commit it, your revision will end up on the main trunk. When a new release is made by the vendor, you commit it on the vendor branch and copy the modifications onto the main trunk.

Use the `import' command to create and update the vendor branch. After a successful `import' the vendor branch is made the `head' revision, so anyone that checks out a copy of the file gets that revision. When a local modification is committed it is placed on the main trunk, and made the `head' revision.

Use the `import' command to check in the sources for the first time. The import command takes three args. The first arg is the directory in the repository that you add, in our case linux. The second arg is the "vendor tag," while the third arg the "release tag." When you use the `import' command to track third-party sources, the "vendor tag" and "release tags" are useful. The "vendor tag" is a symbolic name for the branch. The "release tags" are symbolic names for a particular release, such as `V1_3_64'.

You start by importing the source to your reposiotry

The vendor tag is named LINUX and the release tag is V1_3_64. It is best to have a system for both of these. The vendor tag will never change, while the release tag changes on every revision.

At this point, you need to checkout your sources. The cvs checkout command will do that for you. Go to your development area (away from the CVS area and the area you used to import the linux sources from) and checkout the sources. If you keep all the os hacking in ~/src/os, then the following works:

This will create a directory named linux with all the sources. I've included the -ko option to cvs checkout because the linux sources have RCS tags in them that will cause problems if you have RCS (which CVS is built on) expand them.

New releases

After you've been hacking for a while, you'll find that you need to import a new revision of Linux. Bascially you do it the same way as before. However, be sure to remove all the .orig files if you are patching an old relase. Also, if you patch an old release, it is best to do something like Although the last step isn't strictly necessary, I often do it to ensure that I'm doing things the right way.

Now that we have a clean version of the sources, we can import them again.

You must import from the root of the distribution. This is different than checkout, which is up one directory up.

Now that you have imported the sources to the LINUX vendor branch (and it is important to always use the same Vendor Tag), you need to merge them with your own changes. To do this, "just" check out the files with the CVS merge option.

This command tells CVS to checkout the sources from the main branch and try to merge in the changes from 1.3.64 to 1.3.65 at the same time.

CVS isn't perfect. It will sometimes require that you do manual merging by hand. When this is the case, you'll find that the files have had long strings of less than (<), greater than (>) and equals signs (=) inserted. You will need to merge these by hand. Any good suggestions for this text here would be welcomed.
$Id: howtocvs.html,v 1.1 1996/12/31 04:28:01 imp Exp $