[[Software/Android]]~
[[Software/Android/bc9]]~
[[Software/Android/bc9/kernel(2/2)]]
#contents

*Android 対応にした kernel を含む gumstix 用 Linux 環境の作成1 [#u931a512]

**gumstix の build 環境の作成 [#n90e5424]
bc9 (gumstix) の build 環境を作成します。~
ビルド環境 は [[OpenEmbedded:http://wiki.openembedded.net/index.php/Main_Page]] の build 環境 (bitbake) を [[Gumstix,Inc.:http://www.gumstix.com/]] が gumstix 向けに調整したものを使用します。~
(以降、gumstix OEと表記します)~
あらかじめ gumstix 開発者ホームページにある gumstix ビルド環境の setup 手順を把握しておいて下さい。
-[[gumstix developer site - Getting started:http://www.gumstix.net/Software/cat/Getting-started/111.html]]
-[[gumstix developer site - Setting up a build environment:http://www.gumstix.net/Software/view/Getting-started/Setting-up-a-build-environment/111.html]]
-[[gumstix developer site - Replacing the file system image:http://www.gumstix.net/Software/view/Getting-started/Replacing-the-file-system-image/111.html]]

**source の check out [#xf2a0b44]
 $ mkdir ~/gumstix 
 $ cd ~/gumstix 
 $ svn co https://gumstix.svn.sourceforge.net/svnroot/gumstix/trunk gumstix-oe

**環境変数の設定 [#q5b8d57a]
永続的に設定してしまう場合は
 $ cat gumstix-oe/extras/profile >> ~/.bashrc
一時的に環境変数を設定する場合は、
 $ . ~/gumstix/gumstix-oe/extras/profile
あるいは
 $ source  ~/gumstix/gumstix-oe/extras/profile
とします。

**ソースコードのキャッシュ保存設定 [#oc5ae68a]
gumstix OE は build 作業の途中でソースコードをダウンロードしてくる造りになっているので、~
build 作業毎にダウンロード作業を繰り返さずに済むよう、ソースコードを保存するディレクトリを設定します。~
まずキャッシュ管理用の新しいグループを追加し、作業ユーザをそのグループに加えます。
 $ sudo groupadd oe
 $ sudo usermod -a -G oe {your_username}
つぎに保存ディレクトリを作成してオーナー、パーミッションを適切に設定します。
 $ sudo mkdir /usr/share/sources
 $ sudo chgrp oe /usr/share/sources
 $ sudo chmod 0775 /usr/share/sources
 $ sudo chmod ug+s /usr/share/sources

**build 内容の調整 [#gb8f4576]
gumstix verdex pro の現在の標準 kernel version は 2.6.21 ですが、~
Android R1 の kernel は 2.6.25 に独自の driver を追加したものです。~
そこでソースコードの差分の少ない 2.6.24 に gumstix の kernel を version up した上で patch を作成しました。~
この patch が bitbake による build 作業中に適用され、Android 対応 kernel が build されるようにします。~
以下のような手順になります。~

+~build される kernel version の変更~
 ~/gumstix/gumstix-oe/com.gumstix.collection/conf/machine/include/gumstix.inc
を以下のように修正します。
 diff -u gumstix.inc.original gumstix.inc 
 --- gumstix.inc.original	2009-03-27 21:30:00.000000000 +0900
 +++ gumstix.inc	2009-03-24 22:48:10.000000000 +0900
 @@ -35,7 +35,7 @@
  PREFERRED_PROVIDER_bluez-utils-dbus = "bluez-utils"
  PREFERRED_PROVIDER_gsmd="libgsmd"
  
 -PREFERRED_VERSION_gumstix-kernel = "2.6.21"
 +PREFERRED_VERSION_gumstix-kernel = "2.6.24"
  PREFERRED_VERSION_udev = "118"
  PREFERRED_VERSION_gnuplot = "4.0.0"
  PREFERRED_VERSION_dropbear = "0.47"
+~build される system イメージの調整~
 ~/gumstix/gumstix-oe/com.gumstix.collection/conf/machine/gumstix-custom-verdex.conf
を以下のように修正。
 diff -u gumstix-custom-verdex.conf.original gumstix-custom-verdex.conf
 --- gumstix-custom-verdex.conf.original	2009-03-30 15:02:26.000000000 +0900
 +++ gumstix-custom-verdex.conf	2009-03-25 13:48:26.000000000 +0900
 @@ -9,8 +9,8 @@
  
  #
  # Your flash size = Total flash (in MB) - 1 (for linux kernel partition)
 -ROOT_FLASH_SIZE = "15"
 -#ROOT_FLASH_SIZE = "31"
 +#ROOT_FLASH_SIZE = "15"
 +ROOT_FLASH_SIZE = "31"
  
  #
  # Enable use of virtual terminal for LCD on tty1 if USE_VT = "1"
+~build しないモジュールの除去~
gumstix の kernel version を 2.6.24 にすると wifistix モジュールが build できないことが分かっていますので、~
あらかじめ build 内容から取り除いておきます。
 ~/gumstix/gumstix-oe/com.gumstix.collection/packages/tasks/task-base-gumstix.bb
を以下のように修正します。
 --- task-base-gumstix.bb.original	2009-03-26 17:09:52.000000000 +0900
 +++ task-base-gumstix.bb	2009-03-30 17:10:04.000000000 +0900
 @@ -201,7 +201,6 @@
   
  RDEPENDS_task-base-gumstix-wifi = "\
      task-base-gumstix-pcmcia \
 -    wifistix-modules \
      wireless-tools \
      wpa-supplicant \
+~kernel build 時に当てられる patch の追加~
bitbake の設定ファイル
 ~gumstix/gumstix-oe/com.gumstix.collection/packages/linux/gumstix-kernel_2.6.24.bb
を以下のように修正します。
 diff -u gumstix-kernel_2.6.24.bb.original gumstix-kernel_2.6.24.bb
 --- gumstix-kernel_2.6.24.bb.original	2009-03-26 19:23:32.000000000 +0900
 +++ gumstix-kernel_2.6.24.bb	2009-03-27 22:01:53.000000000 +0900
 @@ -46,7 +46,8 @@
         file://smc911x-fixup.patch;patch=1 \
         file://smc91x-fail-if-no-chip.patch;patch=1 \
         file://one-wire.patch;patch=1 \
 +       file://diff-kernel-original-android.patch;patch=1 \
         ${@base_contains('MACHINE_FEATURES', 'rgb16','file://pxafb-backto16.patch;patch=1', '',d)} \
         "
上記で bitbake 設定ファイルの patch 作業に新たに追加した patch はこちらです。~
&ref(diff-kernel-original-android.patch);~
以下の内容を実行します。~
・Android に必要なドライバーの追加~
・Kconfig や Makefile の修正~
・フレームバッファドライバ(pxafb.c) への修正~
ダウンロードして~
 ~gumstix/gumstix-oe/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.24/
に配置してください。~
+~タッチスクリーンドライバの修正~
&ref(tsc2003.c);~
これは Android 対応修正を加えた touchscreen のドライバ(tsc2003.c)です。~
gumstix-kernel_2.6.24.bb 内の実行手順の関係で patch に含めず別ファイルにしています。~
ダウンロードして~
 ~gumstix/gumstix-oe/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.24/
にある元の tsc2003.c と置き換えて下さい。~
&color(red){2009年5月28日追記  修正版をuploadしました。Android 起動時にtouchscreenの操作性が向上します。};~
&color(red){以前の版をお使いの方は修正版をビルドして古いものと入れ替えて下さい。};~
+~defconfig の修正 ~
上記の patch を追加すると kernel config にも Android 用の追加項目が必要になります。~
&ref(defconfig);~
Android に必要な config を入れたこの defconfig をダウンロードして~
 ~gumstix/gumstix-oe/com.gumstix.collection/packages/linux/gumstix-kernel-2.6.24/gumstix-custom-verdex/
にある元の defconfig と入れ替えてください。~

**build [#oa7f4d8e]
build内容の調整が済んだら以下のコマンドで build を行います。
 bitbake gumstix-basic-image
最初の build 時にソースコードのダウンロードや ARM 用 Cross Toolchain の build を行い、~
本体内の FlashROM へインストールできる system イメージファイルと kernel イメージファイルが生成されます。
 $ ls -1 ~/gumstix/gumstix-oe/tmp/deploy/glibc/images/gumstix-custom-verdex/
 Angstrom-gumstix-basic-image-glibc-ipk-2007.9-test-20090330-gumstix-custom-verdex.rootfs.jffs2
 gumstix-basic-image-gumstix-custom-verdex.jffs2(上のAngstorm...への simlink です。)
 modules-2.6.24-r1-gumstix-custom-verdex.tgz
 uImage-2.6.24-r1-gumstix-custom-verdex.bin
追加で以下の build を行うと、
 bitbake gumstix-directfb-image
以下のような名前の、 DirectFB を含んだ system イメージファイルが生成されます。
 Angstrom-gumstix-directfb-image-glibc-ipk-2007.9-test-20090330-gumstix-custom-verdex.rootfs.jffs2
 gumstix-directfb-image-gumstix-custom-verdex.jffs2(上のAngstorm...への simlink です。)
df_dok、df_neo など DirectFB のテストアプリケーションを使用して Android を起動する前の Linux 起動の段階で~
フレームバッファー描画の確認ができるので便利です。

[[Software/Android/bc9/kernel(2/2)]]

-----------------
RIGHT:by 大塚聡史

BC::labsへの質問は、bc9-dev @ googlegroups.com までお願い致します。
トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   最終更新のRSS