UbuntuのLinuxカーネルをビルドする

UbuntuでもRedhatなどと同じようにメインラインのカーネルをいくらか変更したローカルバージョンをメンテナンスしていて、ディストリローカルのバイナリパッケージとしてリリースされているので、単純にmainlineのtar.gzを落としてきてmake && make installしても同じものがビルド出来るわけではない。

今回は、mainlineのカーネルを使ってもkdumpが動かない(vmcoreinfoファイルが作れなかった)ので、Ubuntuバージョンを作ってみた。
#mainlineカーネルでもkdump出来る方法自体はあるはず。あくまでその方法が分かるまでの回避策。

$ git clone git://kernel.ubuntu.com/ubuntu/ubuntu-oneiric.git
$ cd ubuntu-oneiric
$ uname -r
3.0.0-14-server
$ git tag|grep 3.0.0-14
Ubuntu-3.0.0-14.23
$ git checkout Ubuntu-3.0.0-14.23 -b test

現在のカーネルバージョンに相当するタグを探してチェックアウト&ブランチ作成。

$ cd debian.master/config/amd64/
$ cp config.flavor.generic config.flavour.test
$ cd -
$ cd debian.master/abi/3.0.0-13.22/amd64
$ cp server test
$ cp server.compiler test.compiler
$ server.modules test.modules
$ cd -
$ cd debian.master/control.d/
$ cp vars.generic vars.test
$ vi vars.test
$ cd -
$ vi debian.master/rules.d/amd64.mk
flavoursにtestを追加
$ git add debian.master/abi/3.0.0-13.22/amd64/test* \
debian.master/config/amd64/config.flavour.test \
debian.master/control.d/vars.test
$ git commit -a -m "test config added"

新しいコンフィグを作成。

$ patch -p1 < ~/hoge.diff
$ git commit -a -m "hoge merged"

カーネル変更(※カーネルをいじる必要がある場合のみ)。

$ fakeroot debian/rules clean
$ debian/rules updateconfigs
$ debian/rules editconfigs
$ git commit -a -m "new configuration"

コンフィグ変更。

$ CONCURRENCY_LEVEL=12 AUTOBUILD=1 fakeroot debian/rules binary-test
$ sudo dpkg -i ../linux-*.deb
$ reboot

カーネルパッケージをビルド&インストール。