[[Software/Android]]~
[[Software/Android/bc9]]~
[[Software/Android/bc9/userland(2/2)]]~
#contents
*Android userland の作成1 [#w185e6d6]


オープンソース版 Android のソースコードを入手し、自分で build して利用します。
-[[Get source ‎(Android Open Source Project):http://source.android.com/download]]

build に必要なアプリケーションやパッケージは上記を参照して予め設定しておいて下さい。


**source の入手 [#jb910f43]
+作業用ディレクトリを作成し、
 $ mkdir mydroid
 $ cd mydroid
+repo 初期化。今回は master branch を使用します。(2009年3月20日時点のものを使用しています。)~
 $ repo init -u git://android.git.kernel.org/platform/manifest.git
+ソースコードを checkout。
 $ repo sync
以下のファイル・ディレクトリがあることを確認して下さい。
 $ ls
 Makefile  build        external    kernel     system
 bionic    dalvik       frameworks  packages     
 bootable  development  hardware    prebuilt              


**gumstix用修正 [#y405877f]
gumstix 上で動作させるため、build の前にソースコードに若干の修正を加えました。~
(必須ではないかも知れませんが、当方ではこの設定でうまく動くようになりました。)~
&color(red){2009年4月の cupcake ブランチからの merge 作業の影響で、master ブランチの最新の source code を使う場合はさらに追加の修正が必要になる可能性があります。};~
(参考 http://androidzaurus.seesaa.net/article/116995835.html )~
&color(red){2009年5月1日追記  4月30日時点で repo sync した cupcake ブランチも bc9 で起動できました。};~
&color(red){repo sync したまま build したものでは起動時に警告ダイアログが出た状態で固まってしまいますので、上記の androidzaurus さんの加えられたような電源管理状態を変える patch が必要です。};~
&color(red){また BootAnimation が変更されましたので、新しい source code を使用する場合 BootAnimation.cpp の修正は不要です。};~
+~pmem 不使用設定~
(参考 http://groups.google.co.jp/group/android-embedded-japan/browse_thread/thread/bc549dab23f6cbac#)~
特定のアプリケーションの動作のため大きな連続メモリ領域の確保を行う pmem が有効になっていると~
gumstix 上で Android がうまく動作しなかったので、
 ~/mydroid/system/core/init/devices.c
を以下のように変更し、無効にします。
  diff -u devices.c.original devices.c 
 --- devices.c.original	2009-03-30 19:05:50.000000000 +0900
 +++ devices.c	2009-03-11 19:13:54.000000000 +0900
 @@ -109,9 +109,9 @@
      { "/dev/eac",           0660,   AID_ROOT,       AID_AUDIO,      0 },
      { "/dev/cam",           0660,   AID_ROOT,       AID_CAMERA,     0 },
      { "/dev/pmem",          0660,   AID_SYSTEM,     AID_GRAPHICS,   0 },
 -    { "/dev/pmem_gpu",      0660,   AID_SYSTEM,     AID_GRAPHICS,   1 },
 -    { "/dev/pmem_adsp",     0660,   AID_SYSTEM,     AID_AUDIO,      1 },
 -    { "/dev/pmem_camera",   0660,   AID_SYSTEM,     AID_CAMERA,     1 },
 +    { "/dev/pmem_gpu",      0660,   AID_SYSTEM,     AID_GRAPHICS,   0 },
 +    { "/dev/pmem_adsp",     0660,   AID_SYSTEM,     AID_AUDIO,      0 },
 +    { "/dev/pmem_camera",   0660,   AID_SYSTEM,     AID_CAMERA,     0 },
      { "/dev/oncrpc/",       0660,   AID_ROOT,       AID_SYSTEM,     1 },
      { "/dev/adsp/",         0660,   AID_SYSTEM,     AID_AUDIO,      1 },
      { "/dev/mt9t013",       0660,   AID_SYSTEM,     AID_SYSTEM,     0 },
+~Boot animation 表示位置修正~
起動時に表示される Android のロゴと Android Robot 点滅アニメーションの表示位置を正しくするため、以下の変更を加えます。~
(参考 https://review.source.android.com/Gerrit#change,1552 )
~
・ソースコードの修正~
 ~/mydroid/frameworks/base/libs/surfaceflinger/BootAnimation.cpp
を以下のように修正します。
 diff -u BootAnimation.cpp.original BootAnimation.cpp 
 --- BootAnimation.cpp.original	2009-03-30 19:53:25.000000000 +0900
 +++ BootAnimation.cpp	2009-03-25 20:59:04.000000000 +0900
 @@ -196,6 +196,7 @@
      return r;
  }
  
 +static const int RIGHT_MARGIN = 112; 
 
  bool BootAnimation::android()
  {
 -    initTexture(&mAndroid[0], mAssets, "images/android_320x480.png");
 +    initTexture(&mAndroid[0], mAssets, "images/android_480x272.png");
      initTexture(&mAndroid[1], mAssets, "images/boot_robot.png");
      initTexture(&mAndroid[2], mAssets, "images/boot_robot_glow.png");
  
 @@ -219,24 +221,28 @@
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
      const int steps = 8;
 +    int x = (mWidth - mAndroid[0].w)/2;
 +    int y = (mHeight - mAndroid[0].h)/2;
 +    x = (x < 0) ? 0 : x;
 +    y = (y < 0) ? 0 : y; 
      for (int i=1 ; i<steps ; i++) {
          float fade = i / float(steps);
          glColor4f(1, 1, 1, fade*fade);
          glClear(GL_COLOR_BUFFER_BIT);
 -        glDrawTexiOES(0, 0, 0, mAndroid[0].w, mAndroid[0].h);
 +        glDrawTexiOES(x, y, 0, mAndroid[0].w, mAndroid[0].h);
          eglSwapBuffers(mDisplay, mSurface);
      }
  
      // draw last frame
      glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
      glDisable(GL_BLEND);
 -    glDrawTexiOES(0, 0, 0, mAndroid[0].w, mAndroid[0].h);
 +    glDrawTexiOES(x, y, 0, mAndroid[0].w, mAndroid[0].h);
      eglSwapBuffers(mDisplay, mSurface);
      
      
      // update rect for the robot
 -    const int x = mWidth - mAndroid[1].w - 33;
 -    const int y = (mHeight - mAndroid[1].h)/2 - 1;
 +    x = mWidth - (mWidth - mAndroid[0].w)/2 - mAndroid[1].w - RIGHT_MARGIN;
 +    y = (mHeight - mAndroid[1].h)/2 - 1; 
      const Rect updateRect(x, y, x+mAndroid[1].w, y+mAndroid[1].h);
  
     // draw and update only what we need
・画像ファイルの入れ替え~
BootAnimation.cpp の中で呼び出して表示している画像ファイル
 ~/mydroid/frameworks/base/core/res/assets/images/android_320x480.png
を元に gumstix の LCD に合わせた画像ファイル android_480x272.png を作成し、同じディレクトリに配置します。~
&ref(android_480x272.png);~
+~キーイベントチェックの変更 ~
(参考 http://ozetchi.cocolog-nifty.com/amerika/2009/02/post-6a82.html ) ~
 ~mydroid/frameworks/base/services/java/com/android/server/KeyInputQueue.java
のキー入力送信を待つ thread 内のチェックを外し必ず入力を拾うように修正します。~
(電源管理との関係で入力が拾えなくなるのを防ぐため)~
 diff -u KeyInputQueue.java.original KeyInputQueue.java
 --- KeyInputQueue.java.original	2009-03-30 19:23:51.000000000 +0900
 +++ KeyInputQueue.java	2009-03-11 12:31:56.000000000 +0900
 @@ -247,7 +247,7 @@
                      }
                       
                      if (!send) {
 -                        continue;
 +//                        continue;
                      }
                      
                      synchronized (mFirst) {

**build [#t986a662]
上記の修正を加えたら、mydroid ディレクトリに移動し build します。
 $ cd ~/mydroid
 $ make

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

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

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