在任何嵌入式開發板上安裝 Android 好像是近幾年的習俗慣例?!所以也就來試了一下,而今年的目標定的半年目標是在開發板上安裝 Android 和進行效能調適,再遠一點則是 Webkit 方面的事。只是當我了解更多了之後,發現 Android Porting 其實沒那麼簡單,另外,做完 porting 不代表能用。
最初想只拿 Android Open Source 跟板子相關檔案後,親自一步步調教,後來發現這些事就是國內外有名的 project 在搞得,看來一個人弄真的太累了 XD 除此之外,網路上絕大部分的 porting 筆記都只是把別人設定好的安裝方式跑一次就結束了 Orz 看到這讓我輕鬆(失落)了不少。
Android 4.0 ICS 使用 rowboat Prebuilt Images:
$ wget http://rowboat.googlecode.com/files/beagleboard-xm.tar.gz
$ md5sum beagleboard-xm.tar.gz
1255347a549530fc6653772d1711a305 beagleboard-xm.tar.gz (@2012-02-04)
$ tar -xvf beagleboard-xm.tar.gz
$ cd beagleboard-xm
$ sudo ./mkmmc-android.sh /dev/sdX
Assuming Default Locations for Prebuilt Images
All data on /dev/sdX now will be destroyed! Continue? [y/n]
y
[Unmounting all existing partitions on the device ]
umount: /dev/sdX: not mounted
umount: /dev/sdX1: not mounted
umount: /dev/sdX2: not mounted
umount: /dev/sdX3: not mounted
[Partitioning /dev/sdX...]
Disk /dev/sdb doesn't contain a valid partition table
DISK SIZE - 3951034368 bytes
CYLINDERS - 480
[Making filesystems...]
[Copying files...]
[Copying START_HERE floder to boot partition]
[Copying all clips to data partition]
[Done]
重新把 microSD 插入,修改 rootfs 權限部份,否則開機會看到 Kernel panic - not syncing: No init found. 訊息
$ sudo chmod 777 -R /media/rootfs/
$ sync
$ umount /dev/sdX*
之後安置好 beagleboard-xM 後,開機約 12 分鐘就可以看到 Android ICS 介面,可以透過滑鼠去操作,只是操作上滿卡的!還滿常出現 ANR (Application is Not Responding)。果真 porting 是一回事,能不能用又是另一回事了。
Android 2.3 Gingerbread 使用 TI Prebuilt Images:
$ wget http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/TI_Android_DevKit/TI_Android_GingerBread_2_3_DevKit_1_0/exports/TI_Android_GingerBread_2_3_DevKit_1_0.tar.gz
$ md5sum TI_Android_GingerBread_2_3_DevKit_1_0.tar.gz
ff14ff771aa067dff5cc40106527d119 TI_Android_GingerBread_2_3_DevKit_1_0.tar.gz (@2012-02-03)
$ tar -xvf TI_Android_GingerBread_2_3_DevKit_1_0.tar.gz
$ cd TI_Android_GingerBread_2_3_DevKit_1_0/Prebuilt_Images/beagleboard-xm
$ sudo ./mkmmc-android.sh /dev/sdX
Assuming Default Locations for Prebuilt Images
All data on /dev/sdX now will be destroyed! Continue? [y/n]
y
[Unmounting all existing partitions on the device ]
umount: /dev/sdX: not mounted
umount: /dev/sdX1: not mounted
umount: /dev/sdX2: not mounted
umount: /dev/sdX3: not mounted
[Partitioning /dev/sdX...]
Disk /dev/sdb doesn't contain a valid partition table
DISK SIZE - 3951034368 bytes
CYLINDERS - 480
[Making filesystems...]
[Copying files...]
[Copying START_HERE floder to boot partition]
[Copying all clips to data partition]
[Done]
之後安置好 beagleboard-xM 後,開機約 23 分鐘就可以看到 Android Gingerbread 介面,但是USB滑鼠鍵盤沒被啟用,在加上我也沒觸控面板,所以測試就停在這邊。
至於手動編譯及安裝 Android 的流程,方向大概如下:
- get toolchain & AOSP & kernel & u-boot & x-load (有些 project 已內含不需額外再抓)
- build u-boot (x-boot)
- build x-load (MLO)
- build AOSP (uImage & tools)
- build android_rootfs (透過 AOSP 產出 /out/target/product/beagleboard 裡的 root 跟 system 來建立)
- build boot.scr
- export to microSD
以 TI-Android-GingerBread-2.3-DevKit-1.0_DeveloperGuide 為例:
取得 android source code (patched):
$ mkdir ~/rowboat-android && cd ~/rowboat-android
$ repo init -u git://gitorious.org/rowboat/manifest.git -m TI-Android-GingerBread-2.3-DevKit-1.0.xml
$ repo sync
取得 TI_Android_DevKit:
$ cd ~/
$ wget http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/TI_Android_DevKit/TI_Android_GingerBread_2_3_DevKit_1_0/exports/TI_Android_GingerBread_2_3_DevKit_1_0.tar.gz
$ tar -xvf TI_Android_GingerBread_2_3_DevKit_1_0.tar.gz
$ ls -R TI_Android_GingerBread_2_3_DevKit_1_0/Tools/
TI_Android_GingerBread_2_3_DevKit_1_0/Tools/:
flashing-utility.tar.gz mk-bootscr mk-mmc pinmux-utility.tar.gz signGP
TI_Android_GingerBread_2_3_DevKit_1_0/Tools/mk-bootscr:
mkbootscr mkimage README
TI_Android_GingerBread_2_3_DevKit_1_0/Tools/mk-mmc:
mkmmc-android.sh README.txt
TI_Android_GingerBread_2_3_DevKit_1_0/Tools/signGP:
signGP signGP.c
環境準備:
$ mkdir ~/rowboat-android-build
$ vim ~/.bashrc
export USE_CCACHE=1
export PATH=/home/user/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin:/home/user/bin:$PATH
建立 x-load:
$ cd ~/rowboat-android/x-load-omap3
$ make CROSS_COMPILE=arm-eabi- distclean
$ make CROSS_COMPILE=arm-eabi- omap3beagle_config
$ make CROSS_COMPILE=arm-eabi-
$ cp x-load.bin ~/rowboat-android-build/
$ cp ~/TI_Android_GingerBread_2_3_DevKit_1_0/Tools/signGP/signGP ~/rowboat-android-build/
$ cd ~/rowboat-android-build/
$ $ ./signGP ./x-load.bin
$ mv x-load.bin.ift MLO
建立 u-boot:
$ cd ~/rowboat-android/u-boot-omap3/
$ make CROSS_COMPILE=arm-eabi- distclean
$ make CROSS_COMPILE=arm-eabi- omap3_beagle_config
$ make CROSS_COMPILE=arm-eabi-
$ cp u-boot.bin ~/rowboat-android-build/
$ cp tools/mkimage ~/bin
建立 kernel:
$ cd ~/rowboat-android/kernel
$ make ARCH=arm CROSS_COMPILE=arm-eabi- distclean
$ make ARCH=arm CROSS_COMPILE=arm-eabi- omap3_beagle_android_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-eabi- uImage
$ cp arch/arm/boot/uImage ~/rowboat-android-build/
建立 android rootfs:
$ cd ~/rowboat-android/
$ time make TARGET_PRODUCT=beagleboard OMAPES=5.x -j8
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3
TARGET_PRODUCT=omap3evm
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=GRH55
============================================
...
real 106m20.076s (依機器情況而定,此例是在 Virtualbox 中的 Ubuntu 10.04 desktop,而 Host CPU 是 AMD x4 945)
user 115m30.980s
sys 7m31.390s
$ cd out/target/product/beagleboard
$ mkdir android_rootfs
$ cp -r root/* android_rootfs
$ cp -r system android_rootfs
$ sudo ../../../../build/tools/mktarball.sh ../../../host/linux-x86/bin/fs_get_stats android_rootfs . rootfs rootfs.tar.bz2
$ cp rootfs.tar.bz2 ~/rowboat-android-build/
建立 boot.scr:
$ cp ~/TI_Android_GingerBread_2_3_DevKit_1_0/Tools/mk-bootscr/mkbootscr ~/rowboat-android-build/
$ cd ~/rowboat-android-build/
$ ./mk-bootscr
匯入 microSD:
$ cd ~/rowboat-android-build/
$ cp -r ~/TI_Android_GingerBread_2_3_DevKit_1_0/Prebuilt_Images/beagleboard-xm/Media_Clips/ ~/rowboat-android-build/
$ cp ~/TI_Android_GingerBread_2_3_DevKit_1_0/Prebuilt_Images/beagleboard-xm/mkmmc-android.sh ~/rowboat-android-build/
$ sudo ./mkmmc-android /dev/sdX MLO u-boot.bin uImage boot.scr rootfs.tar.bz2 Media_Clips
All data on /dev/sdX now will be destroyed! Continue? [y/n]
y
[Unmounting all existing partitions on the device ]
umount: /dev/sdX: not mounted
umount: /dev/sdX1: not mounted
umount: /dev/sdx2: not mounted
umount: /dev/sdX3: not mounted
[Partitioning /dev/sdX...]
Disk /dev/sdX doesn't contain a valid partition table
DISK SIZE - 3951034368 bytes
CYLINDERS - 480
[Making filesystems...]
[Copying files...]
[Copying START_HERE floder to boot partition]
[Copying all clips to data partition]
[Done]
參考資料:
http://code.google.com/p/rowboat/wiki/ICSonBeagleboard
http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3-DevKit-1.0_DeveloperGuide
http://androside.com/page_contents/page_android_beagleGingerPorting.html
沒有留言:
張貼留言