Gumstix カーネル開発方法

ネタ元

カーネルコンパイルについては、下記URLの解説が分かりやすい。

Gumstix kernel development <http://www.jumpnowtek.com/index.php?option=com_content&view=article&id=46&Itemid=54>

このページも基本的には、上記ページの情報を元にしている。

Linux kernel source場所

overo-oe/tmp/work/overo-angstrom-linux-gnueabi/linux-omap3-2.6.36-r100/git

ただし、このdirectoryのファイルを書き換えても、bitbake時にオリジナルファイルで上書きされてしまう。 patchを作って所定の場所に置いておく必要有り。 patchの当て方については、下記の解説が分かりやすい。

Gumstix kernel development <http://www.jumpnowtek.com/index.php?option=com_content&view=article&id=46&Itemid=54#_patching_board_file>

kernel config

下記URLの解説をベースにして説明する。

Gumstix kernel development <http://www.jumpnowtek.com/index.php?option=com_content&view=article&id=46&Itemid=54>

These instructions assume you are using the default gumstix-oe kernel, the 'virtual/kernel', which is declared here

$ cd $OVEROTOP
$ grep linux org.openembedded.dev/conf/machine/overo.conf 
PREFERRED_PROVIDER_virtual/kernel = "linux-omap3"
And the current version and revision as defined here
$ bitbake --show-versions | grep linux-omap3
linux-omap3                                     0:2.6.36-r100                          
linux-omap3-caspapx                             0:2.6.34-r100                          
First build the kernel normally with bitbake. If you have built an image, then it's already done. If not run this command
$ bitbake virtual/kernel

kernel menu config

カーネルをmenu configするには。

$ bitbake -c menuconfig virtual/kernel

kernel config copy

menu configで設定したconfig fileは、ここにある。

${OVEROTOP}/tmp/work/overo-angstrom-linux-gnueabi/linux-omap3-2.6.36-r100/git/.config

Copy that file to where the bitbake recipe for the kernel will use it.

$ cp ${OVEROTOP}/tmp/work/overo-angstrom-linux/gnueabi/linux-omap3-2.6.36-r100/git/.config \
   ${OVEROTOP}/org.openembedded.dev/recipes/linux/linux-omap3-2.6.36/defconfig
linux-omap3-2.6.36-r100の所は、カーネルのバージョによって変わる。

Rebuild the kernel

$ cd $OVEROTOP
$ bitbake -c clean virtual/kernel; bitbake virtual/kernel

2H程度で終了

下記のディレクトリにカーネルイメージできている

$OVEROTOP/tmp/deploy/glibc/images/overo/uImage-2.6.36-r100-overo.bin

rebuild the rootfs

$ bitbake omap3-console-image; date

SDカードのフォーマットをする

Sakomanのmksdcard.shでSDカードのフォーマットをする。

mksdcard.shは下記URLから入手する。

Downloads <http://www.sakoman.com/category/8-gnome-daily-builds-r13.html>

mksdcard.shのあるディレクトリで下記のコマンドを実行する。

$ sudo mksdcard.sh /dev/sdd overo console
/dev/sddはSDカードのデバイス名

このコマンドはovero用のconsoleイメージをダウンロードしてSDに展開する。 このSDをOveroに挿入すれば起動するが、今回はSDカードに必要なパーティションを作成してフォーマットするためだけに使用する。

kernelとconsole-imageをSDに展開する

Sakomanのmksdcard.shで作成したSDカードに作ったkernelとconsole-imageを展開する。

作ったkernelとconsole-imageは以下の場所にある。

  • ディレクトリ $OVEROTOP/tmp/deploy/glibc/images/overo
  • カーネル uImage-overo.bin
  • ルートファイルシステムイメージ omap3-console-image-overo.tar.bz2

SDカードを開発PCでマウントして下記の操作を行う。

この例では、SDのマウントポイントは下記のようになっている。

  • /media/boot bootloaderとカーネルイメージのパーティション
  • /media/rootfs ルートファイルシステム

カーネルイメージのコピー

$ cd $OVEROTOP/tmp/deploy/glibc/images/overo
$ cp uImage-overo.bin /media/boot/uImage

ルートファイルシステムの展開

$ cd /media/rootfs
$ sudo rm -rf * 既にルートファイルシステムがある場合は消去する
$ sudo tar xvaf $OVEROTOP/tmp/deploy/glibc/images/overo/omap3-console-image-overo.tar.bz2

$ umount /dev/sdd1
$ umount /dev/sdd2
/dev/sddはSDカードのデバイス名 アンマウントしたらSDをOveroに挿入して起動する。

SD起動

SDから起動したら、unameコマンドでカーネルが更新されていることを確認する。

root@overo:~# uname -a
Linux overo 2.6.36 #1 Sun Aug 7 11:59:43 JST 2011 armv7l GNU/Linux

packageを指定してbuild

4.2 Speed up package build (in case of errors)

If you run into problems (errors during build process), you do not want to parse all repository files again and again. In this case you can build a package directly.

A bitbake -b whereYourOEPackageDirIsbitbake/nano/nano_1.3.5.bb / will just build nano. All depends have already to be fullfilled for that (which is normally true, if your build stopped at nano).
$ bitbake -b $OVEROTOP/org.openembedded.dev/recipes/nano/nano_1.3.5.bb /