|
|
PatchSet - A Patch Management Tool
Installing PatchSet
Configuring PatchSet
Set Specification Files
Download Scripts
Automatic Set Creation
Build Scripts
Showing differences between trees
Applying and Reversing Patches
Download PatchSet
PatchSet is a very simple tool for the easy managment of source trees, in
particular the Linux kernel. While the application of patches is not difficult,
it can get time consuming for a large number of patches and in combination
with generating seperate builds, it can get frustrating especially if many
trees are being worked on. This tool provides a set of scripts that;
Automate the downloading of sources and patches
Specify how trees should be extracted and built
Specify clean and working trees
Show differences between trees, files or individual structs and functionos
Automate the creation and reversal of patches
Specify sets which are source trees with multiple patches associated with them
Installing PatchSet
The easiest method to install PatchSet is simply to untar it to your
favourite source directory and then adjust your path to match PatchSets bin/
directory. This example presumes you are using bash as your shell.
cd /usr/src
tar -zxvf ~/patchset-0.5.tar.gz
export PATH=/usr/src/patchset-0.5/bin:$PATH
Now you are ready to use PatchSet!
Configuring PatchSet
The configuration of PatchSet is very simple. In the extracted directory,
there is a file called etc/patchset.conf which is the default
configuration. If a file called patchset.conf exists in the current directory
or in ~/.patchset/patchset.conf, they take precedance.
There is comments in the file describing all the parameters and in most cases,
the defaults are fine. At the top level of the tool, there is a file called
patchset.conf. Some of the more important ones are;
AUTOBUILD is set to y if you wish kernels always to be compiled and
may also be specified with the -b switch at the command line. If set to a
as is the default, the user will be prompted if the kernel they want should
be built
LXR_ROOT is the root where LXR, if available, is installed
WWW_USER is the user the web server is running as, needed by LXR
GCCGRAPH is where the location of the patched version of gcc required
for the CodeViz tool. Only needed if you use CodeViz.
DIR_* is a set of directories where stuff like sources is kept
(DIR_SOURCES). See the conf file for a full list and description.
KERNEL_MIRROR is the location of your local kernel.org mirror
DEFAULT_CONFIG is the default config file from configs/ to install
as .config when creating new sets
http_proxy is needed for wget if you are using a web proxy
Set Specifications
Set specifications are the files contained within the sets directory which
describe how a tree is to be built. For the purposes of this, we will presume
it is the Linux kernel but it is not hard to apply the principals to any
source tree.
The format of the file is pretty simple. The first line is the name of the
source tar.gz file to begin with. The second line is what the compiled kernel
will be called. The third line is what config file to use by default for
compiling. Every line after that consists of two parts. The first column
says what depth to start with and is the value of the -p parameter for
patcvh. For most patches, this should be 1. The second column is the name of
the patch. The script can determine how to decompress it if necessary.
Below is an example set specification for building 2.4.20-rmap15a. The
starting source is the stock 2.4.18 tar file and all the patches needed to
build the full tree.
linux-2.4.18.tar.gz
2.4.20-rmap15a
config_algernon
1 patch-2.4.19.gz
1 patch-2.4.20.gz
1 2.4.20-rmap15a
The above set file will apply all the patches to the 2.4.18 kernel as
necessary and use the file config_algernon as the .config when
building.
Specifing .config's
Configs are specified either with the set specification file or with the
-s switch. If the specified file exists at the patckage root, it is simply
copied in as .config. If it does not exist but exists with the prefix config_,
then it is used instead. For example, -s algernon will check for the existance
of a file called algernon and config_algernon.
Download Scripts
To automatically download a kernel source, use the download script
(--help supported). With the -p switch, it will instead download a patch. For
example, the first command in this example would download linux-2.4.20 and
the second will download a patch for linux-2.4.21
download 2.4.20
download -p 2.4.21
Automatic Set Creation
If working with normal kernels, use the createset script to create
new sets for you. It will guess what sources and patches to use based on
what you have available. With the sources and patches downloaded above,
a new set could be created with:
createset 2.4.21
Build Scripts
There is three build scripts provided with the package. All of them support a
--help switch to print out a full help message.
| Script Name |
Function |
| make-kernel |
This script takes the name of a set specification stored in
the sets/ directory. This file specifies the source to begin with, the
resulting name of the kernel, the .config file to use and the patches to
apply. At a base level, it will simply unpack the source tree and apply
the patches. If requested, it will build the kernel with either the
config name specified in the set specification or the config supplied
on the command line argument. If the target system is a debian system,
it can also be used to generate the debian packages. |
| make-codeviz |
This script is essentially the same as the above with one
important difference. If the package CodeViz available from http://www.csn.ul.ie/~mel/projects/codeviz,
it will build the kernel and generate the files necessary to be able
to generate call graphs. As this compiles with a seperate compiler,
this script should be used before make-kernel.sh |
| make-lxr |
This script unpacks and applies the patches the same as the previous
two scripts. The important difference is that it is unpacked to the
location where LXR is located. It then
runs the genxref scripts and updates the versions list so that a web
browsable version of the kernel tree is available |
Setting clean and work trees
At this point, you are working on two trees, either for creating your
own patches or seeing the differences between two versions. PatchSet only
takes a clean and working tree into account. To set your clean tree, use
setclean and to set your working tree, use setworking. To see
what your current paths are, run showtree. The following shows an
example of setting my clean and working tree:
mel@joshua:/usr/src/patchset$ setclean linux-2.5.72-clean
mel@joshua:/usr/src/patchset$ setworking linux-2.5.72-mel
mel@joshua:/usr/src/patchset$ showtree
Clean tree: /usr/src/patchset/bin//../kernels/linux-2.5.72-clean
Work tree: /usr/src/patchset/bin//../kernels/linux-2.5.72-mel
Current set: 2.5.73
mel@joshua:/usr/src/patchset$
Showing differences between trees
There is three scripts which are provided to show the differences between
trees and generate patches.
| Script Name |
Function |
| difftree |
Show the differences between two directories or files relative to
the toplevel of the source. With the -o switch, a patch will be created
and dumped into the patches directory. The patches that are generated
are suitable for emailing to the kernel mailing list.
# Generate a full diff of the mm/ directory between clean and working tree
difftree mm/
# Generate a diff of a single file and output it to the patches directory
difftree mm/vmscan.c -o small-patch.diff
|
| diffstruct |
Extract a struct from the given file and display the differences
between the versions. This is useful when comparing an old kernel with a
new one and you want to examine just small parts of the kernel to begin
with. The first time it is used, the -f switch has to be specified to
tell where the struct is declared. After that, it is remembers.
# Show difference between kmem_cache_s struct
diffstruct -f mm/slab.c kmem_cache_s
# Second time it is run, there is no need for -f
diffstruct kmem_cache_s
|
| difffunc |
Same idea as diffstruct except that it will extract and compare a
function |
Applying and Reversing Patches
To add a patch to the current set, use addpatch. If the -a switch is
used, the patch will also be tested and then applied to the current working
tree. If the patch would fail to apply, it will exit unless the -f switch
is used.
To delete a patch from the current set, use delpatch. It also has a
-a and -f switch.
When you have applied or deleted a number of patches, it is sometimes
desirable to rename your current working set. If so, use the renameset
script. Note that this will not change your current working tree.
Comments, Feedback and Bug Reports
Email comments, feedback and bug reports to mel@csn.ul.ie .
Download
Download patchset-0.5.tar.gz
Download patchset-0.4.tar.gz
Download patchset-0.3.tar.gz
Download patchset-0.2.tar.gz
Download patchset-0.1.tar.gz
|