Getting an SH kernel source tree
This page describes how to get your hands on an SH-specific 2.6 Linux kernel source tree. This generally involves three steps:
-
downloading a generic version of the 2.6.x kernel source, perhaps from
http://www.kernel.org,
-
downloading a corresponding "drop-in tree" of SH-specific source changes, and
-
linking or overlaying that drop-in tree into the generic source tree to update it with the latest SH-specific changes
In short, you don't just download an SH-ready source tree; you have to create one by downloading both a kernel source tree and a drop-in tree, and combining them. The rationale for this is that the drop-in tree is normally much smaller than a full kernel tree, so it's much more space-efficient to just keep track of the differences and let you download those diffs and apply them to the source.
You have to be careful in that there are different versions of the drop-in tree for different versions of the kernel source tree, so you have to make sure your two downloads are compatible. More on this shortly.
Getting the drop-in tree
We'll start by explaining how to get the drop-in tree first, since which version you get will dictate which version of the generic kernel source you'll have to download to go with it. You can get the drop-in tree using either arch or CVS; we'll start by explaining how to use arch since that seems to be the preferred SCM system for all of this.
Getting the drop-in tree using arch
If you're not familiar with arch, you should probably read the online tutorial at Quick Introduction. The rest of this section assumes you've installed arch, and can run the corresponding tla command.
Registering with the arch archive
The primary SH-related development tree which mirrors CVS HEAD is located at the arch archive:
lethal@linux-sh.org--linux \ http://www.stampede.org/~lethal/{archive}/linux
In order to get a branch from that archive, you first have to register with the archive, after which you can verify that the registration worked by asking for your list of currently-registered archives:
$ tla register-archive http://www.stampede.org/~lethal/{archive}/linux Registering archive: lethal@linux-sh.org--linux $ tla archives lethal@linux-sh.org--linux http://www.stampede.org/~lethal/{archive}/linux # looks good
If you get all of the above, you're registered and can go on to browse the archive.
Browsing the archive
The archive has a number of branches related to both sh and sh64, with the stable ones called sh--stable--2.6 and sh64--stable--2.6, respectively. You can browse the branches to different levels:
$ tla abrowse lethal@linux-sh.org--linux # all Linux stuff $ tla abrowse lethal@linux-sh.org--linux/sh # just sh-related stuff $ tla abrowse lethal@linux-sh.org--linux/sh--stable # stable sh stuff $ tla abrowse lethal@linux-sh.org--linux/sh--stable--2.6 # stable 2.6-specific stuff
Branches with specific version numbers like sh--stable--2.6.4 or sh--stable-2.6.8.1 refer to the drop-in trees for precisely those kernel versions, while the more generic branch sh--stable--2.6 refers to the most up-to-date drop-in tree, whose kernel version you can figure out once you download it.
Getting a drop-in tree
Once you decide which branch you want, use the tla command to download it:
$ tla get lethal@linux-sh.org--linux/sh--stable--2.6.8.1 # specific version $ tla get lethal@linux-sh.org--linux/sh--stable--2.6 # most recent version
For any of these get operations, you can add an optional argument for the directory name to use, otherwise it will correspond to the branch you downloaded.
Once you've downloaded the drop-in tree, you can cd into that new directory and what you'll find is a subset of the kernel source tree that you'll overlay on top of a generic source tree. And in that directory, you should find a file that identifies the kernel version that this drop-in tree matches, something like AGAINST-2.6.9 or something similar.
Getting the drop-in tree via CVS
Soon.
Linking the drop-in tree to the source tree
At this point, you should have both your drop-in tree and its corresponding generic kernel source tree. In the scripts/ directory in the drop-in tree, you'll find the script treelink.sh which takes two arguments: a drop-in tree directory, and a kernel source directory to apply it to. If you're in the scripts/ directory, you could run a command similar to the following:
$ ./treelink.sh ../../<drop-in tree dirname> <kernel source tree name>
This will subsequently symlink all of the drop-in tree components over top of the stock kernel ones, resulting in a full kernel tree ready for development and building.
Updating the kernel source tree
Naturally, there will be ongoing updates to the drop-in tree that you'll want to add to your working tree. With arch, you can check if there are any updates to your drop-in tree, and get those updates, by running these commands inside the top-level directory of the tree:
$ tla missing $ tla missing --summary # surprisingly, more verbose $ tla update # get all updates
If there were changes that still correspond to the same kernel version, you can use the treeunlink.sh script to undo the SH-related additions to the kernel tree, then relink with the newer drop-in tree.
If there is a whole new kernel version drop-in tree, then naturally you'll have to get the newer kernel source and start the process all over again.