AndroidをVMwareにインストールしてみる。
方法はVMware上にUbuntuをインストールしてそのうえでAndroidをkernelからビルドして、それをVMWareの別ドライブにコピーし、最後にそのドライブを別のVMWareからAndroidして起動する
初めにUbuntuの仮想マシンは下記URLからダウンロード
http://www.ubuntulinux.jp/products/JA-Localized/vmware
Androidビルドにはメモリが必要なので、Ubuntu仮想マシンには1.5GBを割り当てた。
以降は仮想マシンUbuntuを起動して作業
$ cd $ git clone git://android.git.kernel.org/kernel/common.git kernel $ cd kernel $ git checkout --track -b android-2.6.29 origin/android-2.6.29
kernelディレクトリにDownlodされる
$ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf \ libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl \ libncurses5-dev zlib1g-dev emacs
$ cd ~ $ mkdir bin $ export PATH=$PATH:~/bin $ echo “export PATH=$PATH:~/bin” >> ~/.bashrc $ export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.16 $ echo “export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.16″ >> ~/.bashrc
$ curl http://android.git.kernel.org/repo > ~/bin/repo $ chmod a+x ~/bin/repo
・リポジトリの初期化
$ mkdir cupcake $ cd cupcake $ repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake Getting repo ... from git://android.git.kernel.org/tools/repo.git warning: no common commits remote: Counting objects: 898, done. remote: Compressing objects: 100% (327/327), done. remote: Total 898 (delta 589), reused 852 (delta 551) Receiving objects: 100% (898/898), 270.20 KiB | 263 KiB/s, done. Resolving deltas: 100% (589/589), done. From git://android.git.kernel.org/tools/repo * [new branch] master -> origin/master (略) Your Name [okada]: <==Enter Your Email [okada@ubuntu-vm.(none)]: <==Enter Your identity is: okada <okada@ubuntu-vm.(none)> is this correct [yes/no]? <== yes repo initialized in /home/okada/cupcake
※ ユーザ名、メールアドレスはそのままEnter 最後は「yes」
「.repo」というディレクトリを確認できればOK
・リポジトリのダウンロード
$ repo sync Initializing project platform/bionic ... warning: no common commits remote: Counting objects: 2695, done. remote: Compressing objects: 100% (1181/1181), done. remote: Total 2695 (delta 1638), reused 2483 (delta 1472) (略) From git://android.git.kernel.org/platform/vendor/htc/dream-open * [new branch] cupcake -> korg/cupcake * [new branch] donut -> korg/donut * [new branch] master -> korg/master Fetching projects: 100% (117/117), done. <==ここが100% Checking out files: 100% (7703/7703), done.ut files: 45% (3510/7703) Checking out files: 100% (2553/2553), done.ut files: 25% (654/2553) Checking out files: 100% (3804/3804), done.out files: 35% (1355/3804) Checking out files: 100% (2860/2860), done.out files: 32% (926/2860) Checking out files: 100% (7311/7311), done.out files: 24% (1795/7311) Checking out files: 100% (5912/5912), done.out files: 9% (575/5912) Checking out files: 100% (1098/1098), done. out files: 10% (120/1098) Syncing work tree: 100% (116/116), done.
Fetching projects: 100%"が表示されるとDownload完了。出ないときは「repo sync」を再実行
以下のファイルをx86用のソースをDownloadする為作成
.repo/local_manifest.xml
<?xml version="1.0" encoding="UTF-8"?> <manifest> <project name="platform/vendor/asus/eee_701" path="vendor/asus/eee_701"> </project> </manifest>
x86用のソースの取得
$ repo sync Fetching projects: 99% (117/118) Initializing project platform/vendor/asus/eee_701 ... warning: no common commits remote: Counting objects: 33, done. remote: Compressing obremote: jects: 100% (31/31), done. remote: Total 33 (delta 2), reused 30 (delta 2) Unpacking objects: 100% (33/33), done. From git://android.git.kernel.org/platform/vendor/asus/eee_701 * [new branch] cupcake -> korg/cupcake * [new branch] master -> korg/master Fetching projects: 100% (118/118), done.
"Fetching projects: 100%"が表示されればOK
cupcake/vendor/asusというフォルダが追加される
kernelソースを移動
$mv ~/kernel ~/cupcake/
以下からパッチをホームディレクトリにDownload
http://code.google.com/p/patch-hosting-for-android-x86-support/downloads/list
$ cd ~ $ patch -d ~/cupcake/vendor/asus/eee_701 < 0001-1.-added-scripts-to-build-install-image.patch $ patch -p1 < ~/0001-fixed-different-build-breaks-added-mouse-cursor-sup.patch patching file Android.mk patching file AndroidBoard.mk patching file disk_img.conf patching file eee_701.mk patching file init.rc patching file make_boot_img.sh $ cd ~/cupcake/frameworks/base $ patch -p1 < ~/touchscreen.patch patching file Android.mk patching file core/java/android/view/RawInputEvent.java patching file include/ui/EventHub.h patching file preloaded-classes.arm patching file preloaded-classes.x86 patching file services/java/com/android/server/KeyInputQueue.java patching file services/java/com/android/server/WindowManagerService.java patching file services/jni/com_android_server_BatteryService.cpp $ cd ~/cupcake/kernel $ patch -p1 < ~/alarm.patch patching file drivers/rtc/alarm.c $ patch -p1 < ~/atl1e.patch <==このパッチは古いと出るのでEnterをいれすべてスキップする patching file drivers/net/atl1e/atl1e.h Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. $ patch -p1 < ~/atl2-2.2.3.patch <==このパッチは古いと出るのでEnterをいれすべてスキップする patching file drivers/net/Kconfig <==1つだけpatchがあたるようだ Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. $ patch -d ~/cupcake/external/e2fsprogs < ~/e2fsprogs.patch patching file Android.mk $ patch -d ~/cupcake/external/qemu < ~/qemu_gnu.patch patching file Makefile.android
※ -dオプションを付ける時は最後に"/"を付けない
$cd ~/cupcake
frameworks/base/services/java/com/android/server/PowerManagerService.javaを修正
// assume nothing is on yet mUserState = mPowerState = 0; ↓ mUserState = mPowerState = SCREEN_BRIGHT;
変更しなとキーボードが動作しないようだ
・Androidのビルド
$ TARGET_ARCH=x86 TARGET_PRODUCT=eee_701 DISABLE_DEXPREOPT=true make -j4 installer_img build/core/product_config.mk:261: WARNING: adding test OTA key ============================================ TARGET_PRODUCT=eee_701 TARGET_BUILD_VARIANT=eng TARGET_SIMULATOR= TARGET_BUILD_TYPE=release TARGET_ARCH=x86 HOST_ARCH=x86 HOST_OS=linux HOST_BUILD_TYPE=release BUILD_ID= ============================================ (略) I/diskutils( 3394): Writing RAW \ image 'out/target/product/eee_701/installer/installer_data.img' \ to 'out/target/product/eee_701/installer.img' (offset=5623808) I/diskutils( 3394): Wrote 450465792 bytes to \ out/target/product/eee_701/installer.img @ 5623808 File edit complete. Wrote 2 images. Done with bootable installer image -[ out/target/product/eee_701/installer.img ]
※ "Done with bootable installer image -[ out/target/product/eee_701/installer.img ]-"
が表示されていれば完了
・カーネルのビルド
$ cd kernel $ make i386_defconfig (略) HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # $ make menuconfig
以下を変更
General setup ---> (0) Default panic timeout [ ] Configure standard kernel features (for small systems) ---> [*] Enable the Anonymous Shared Memory Subsystem <==「*」を挿入 [ ] Disable heap randomization Choose SLAB allocator (SLUB (Unqueued Allocator)) --->
Power management and ACPI options ---> [ ] Test suspend/resume and wakealarm during bootup [*] Wake lock <==「*」を挿入 [*] Hibernation (aka 'suspend to disk')
Device Drivers ---> [*] Misc devices ---> [ ] Android pmem allocator <==「*」を削除 < > Device driver for IBM RSA service processor [*] Fusion MPT device support ---> <==「*」を挿入 --- Fusion MPT device support <*> Fusion MPT ScsiHost drivers for SPI <==「*」を挿入 [*] Network device support ---> -*- PHY Device support and infrastructure ---> [*] Ethernet (10 or 100Mbit) ---> <==「*」を挿入 [*] Ethernet (1000 Mbit) ---> [*] EISA, VLB, PCI and on board controllers <==「*」を挿入 <*> AMD PCnet32 PCI support <==「*」を挿入
その後
$ make bzImage && make modules $ sudo make modules_install $ mkinitramfs -o ~/initrd.img 2.6.27 <=initrd イメージ作成Kernelが2.6.29なので
ubuntuにAndroid仮想マシンのHDDを/dev/sdbとしてマウントするためShutdown。
OSタイプ:other 2.6x Linux (32bit) メモリ:512MB CPU:1 HDD:作成 ※サイズは4GBくらい NIC:あり(ブリッジ)
作成したHDDを第2HDDに指定してubuntuを起動。以下の作業はubuntu上から行う
$ sudo fdisk /dev/sdb コマンド:n p 領域番号 (1-4):1 最初 シリンダ (1-522, default 1): (Enterを押す) 終点シリンダまたは・・・: (Enterを押す) コマンド:a 領域番号 (1-4):1 コマンド:w $ sudo mkfs.ext3 /dev/sdb1 $ sudo mount /dev/sdb1 /mnt
$ sudo grub-install --root-directory=/mnt /dev/sdb
メニューファイル作成
/mnt/boot/grub/menu.lst
default 0 timeout 3 title Android root (hd0,0) kernel /boot/bzImage root=/dev/sda1 rw vga=788 init=/init initrd /boot/initrd.img
$ sudo cp ~/cupcake/kernel/arch/x86/boot/bzImage ~/initrd.img /mnt/boot $ cd ~/cupcake/out/target/product/eee_701/ $ sudo su # cp -a root/* /mnt # cp -a system/* /mnt/system # cp -a data/* /mnt/data <=dataディレクトリは存在するがその中にファイルが存在しなようだ # cd /mnt/system/usr # chmod -R 777 keychars # chmod -R 777 keylayout # exit
/mnt/init.rc
以下の部分をコメントアウト # mount rootfs rootfs / ro remount # mount ext3 /dev/block/sda6 /system # mount ext3 /dev/block/sda6 /system ro remount # mount ext3 /dev/block/sda8 /data # mount ext3 /dev/block/sda5 /cache
最終行に以下を追加 service network /system/bin/sh /system/etc/init.network.sh
/mnt/system/etc/init.network.sh
#!/system/bin/sh netcfg eth0 dhcp setprop net.dns1 **.**.**.** <- DNSサーバのIPアドレス
$ sudo chmod a+x /mnt/system/etc/init.network.sh
ubuntuを終了してAndroid仮想マシンを起動する
Alt + F1
Alt +F7
1. コンソールを開く 2. # reboot -p
Androidのキーボードは101キーボードで認識