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
参考
Yet Another Diary: Ubuntu 8.10 (interpid)以降でのsystemtap
How to compile a custom kernel for Ubuntu Intrepid using git • A Virtual Home
How to compile a kernel for Ubuntu Jaunty • A Virtual Home
Yet Another Diary: Ubuntu 9.10でgit経由のカーネル再構築
Kernel/Dev/KernelGitGuide - Ubuntu Wiki
Kernel/Compile - Community Help Wiki