Jump to content

Linux sources

From HW wiki

Introduction

Getting Linux sources for boards used at our department requires these steps:

  1. Getting vanilla Linux sources
  2. Applying several patches to these sources

The reason for providing the patches separately is that for many users it is important to know which patches were applied to the kernel they are using. The maintenance of the additional patches is not an easy task as these patches evolve in time. They are either being ported to newer Linux versions or being updated for other readons.

To maintain the patches we have decided to use the tool TopGit. This page describes how this tool is used for our Linux sources.


TopGit overview

TopGit is a tool manage patches as so called topic branches in Git repositories. Every patch is represented by one branch. The history of patch evolution is tracked on that branch. As some patches might depend on other patches, TopGit also manages these dependencies.

For more information check the TopGit README.

Linux repositories

We maintain the following Linux repositories:

Layout

Our Linux repositories have the following branches:

vanilla
Tracks vanilla linux sources.
patch/*
Topic branches for individual patches. These branches are managed using TopGit.


Managing TopGit patches

Cloning a TopGit managed repository

git clone <some-url/linux.git>
cd linux
git branch vanilla origin/vanilla
tg remote --populate origin

Updating patches

git checkout vanilla
git pull git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git tag v2.6.29-rc1
tg summary  # patches marked by 'D' must be updated
git checkout patch/...
tg update
...

Exporting patches

To make accessing kernel sources easier for users who just want the sources for the board they use, we provide branches witch all the needed patches exported from TopGit.

git checkout patch/<last patch>
tg export shark/<version>

Porting patches to -stable linux version

Most patches are based against vanilla branch. Therefore tg update updates the patches against newer vanilla sources. Stable kernels (2.6.x.y) are maintained as separate branches and for that reason TopGit wont do the update for us.

I use the following commands to prepare a version based on 2.6.26.5 assuming that vanilla is at 2.6.26

tg export tmp
git rebase v2.6.26.5 tmp
git branch -m tmp shark-2.6.26.5

Viewing patch history

git log --first-parent

Thank to the --first-parent option, only changes made to the topic branch are displayed and not the changes of merged-in branches (upstream).