Android/zh tw
From Openmoko
Languages: |
English • العربية • Български • Česky • Dansk • Deutsch • Esperanto • Eesti • Español • فارسی • Suomi • Français • עברית • Magyar • Italiano • 한국어 • Nederlands • Norsk (bokmål) • Polski • Português • Română • Русский • Svenska • Slovenčina • Українська • 中文(中国大陆) • 中文(台灣) • Euskara • Català |
Android is one of the many distributions that currently work on the Openmoko phones. You can compare a distribution with an Operating System on normal computers. It gives the phone all the software needed for operating. For more information about the different flavors, see distributions.
Contents |
Updates
- 20081202 Koolu.com 在Koolu GIT Koolu GIT (Press Release已釋出給FreeRunner使用的 Android 源碼。
- 20081120 Koolu.com 推動銷售搭載 Android的Openmoko Freerunner 。如提供現有的FreeRunner 下載可搭載的Android。直到 December 2008。
- 20081104 第一個可以在FreeRunner上執行的 Android-image已經成功的被 Sean McNeil編譯出來! - sms 及通話可以使用,wifi 及藍芽則否。news-source
- 20081029 User:Cfriedt Benno 修改了Android's build system,因此可以放置JFFS2 image,而不是YAFFS。 不像是JFFS2,只可以mount 到唯讀的情況下,要掛載 YAFFS映像檔在它被寫入 flash 後才有可能使用。(it complains about the block device being of type '1' and not 'NAND'). JFFS2 仍然有標準的 Openmoko image 格式的優點 (請參考 燒製映像檔到FreeRunner 或 燒製映像檔到Neo 1973)。
- 20081023 User:Bricode 追蹤包含ARMv5規格的 Android source tree狀態,我建立了一個表格表示它會包含什麼內容,及patche檔的狀態。它可以在 http://spreadsheets.google.com/pub?key=pzDEXnU19gkeTjpD28t-7fw 這個網址找到。
- 20081022 User:Cfriedt 可以在移除了v5TE指令下 ,沒有錯誤的'trivially' 為ARMv4T編譯 Android source code。雖然它不預期它可以被執行,至少我針對 build/core/combo/arm-linux.mk做了一些小小的取代。關於此點,我可以繼續像執行v4T指令順序般的,重新執行 v5TE 指令。(或者,重新執行整個 hand-optimized v4T 指令組合)。
- 20081021 User:Cfriedt Android -> FreeRunner ,在我的部落格上有討論。
- 20081021 Google 釋出Apache free 及 open-source手機下,大部份的source code 、 license, 部份被涵蓋在現有的授權(licenses)下,如 Linux kernel 是屬於 GPLv2授權。
- 200810?? Koolu.com 宣佈他們將會 銷售搭載Android的Openmoko Freerunner ,這個計劃會在2008年11月開始,並且提供現有的FreeRunner用戶 免費下載可搭載在Freerunner上的Android 。 知名的 open-source 愛好者Jon "maddog" Hall 是Koolu的CTO及代表。
簡介
This page is dedicated to porting the Android OS to the Neo 1973 and Neo FreeRunner handsets. Since the Android OS was publically released on 20081021, work is currently underway to port Android to the Neo 1973 and FreeRunner handsets.
目標
- 有系統化的在Android codebase下使用提供給 ARMv4T 的patch檔。
- 提供在Android codebase在下Neo1973 與 Neo FreeRunner hardware-dependent patches 檔, 這項任務已經被 Openmoko 工程師完成,在不強迫變更 Android-specific upstream下。
- 在Distributions網頁中,提供有用的Android 檔案系統及kernel。
使用現有的二進位檔安裝
詳盡的在FreeRunner上安裝Android (使用 Sean McNeil的kernel及rootfs 套件,及 Qi bootloader) ,何以在http://www.copiesofcopies.org/webl/?p=34此網址找到。
早期目標
就如同 Ben Leslie 在 blog 中所提到的,在 source code釋出之前,Android 被設計為使用ARMv5TE 架構instruction set architecture (ISA),允許 DSP 擴充的指令。 相較於 ARMv5TE ISA, the Neo1973 及 FreeRunner 電話聽筒都著重在arm920t core,並可以應用到 ARMv4T ISA。
在源碼開放之前,kernel trap handlers 被用來 '模擬' ARMv5TE ISA。雖然這個結果在不同的案例下運作,trapping 是較花成本及效能的一種結果。甚至於,在沒有明確的暸解哪個狀況是被不同的指令所設定的情兄下,如Thumb Mode execution,這個結果成為沒有定論。
目前的狀態
隨著 Android釋出 source code,Open Source社群不再受限於使用binary-only 產品。The Open Handset Alliance (OHA)已經讓他們的source code 成為能讓大家致富及受益的產品。
目前,porting 以不同的循環模式運做。Patches需要透過 official Android channels提交。
Koolu, a Freerunner distributor, has released the source code of their Android port at http://git.koolu.com. See the #Building the Koolu Android Source instructions below for how to build an Android image for Freerunner.
To track the status of which parts of the Android source tree contain ARMv5 specific code, I've created a table of where it is contained, and the status of patches. It can be found at: http://spreadsheets.google.com/pub?key=pzDEXnU19gkeTjpD28t-7fw User:Bricode
Sean McNeil said that he was able to get Android running (including telephony) in his Freerunner source.
Ben Leslie mentioned on the android-porting list that he was able to get the 'Android' logo to appear on his Neo 1973.
Building the Koolu Android Source
- Configure your machine with the prerequisites documented in the Setting up your machine section of Google's build instructions.
- Install repo and download the source, as documented at http://trac.koolu.org/.
- After the build finishes you can put together a root file system by editing and running Sean McNeil's scripts, which are attached to this message. The first script (cp_android_OS) is used to copy the newly built files into a staging area. The second one (mkjffs2) makes a jffs2 image from the staging area. Be sure to edit the paths in the two files to match your environment. Alternatively, you can use the script below
- The result of the previos step is a file, androidfs.jffs2, which may be flashed to your Freerunner.
Building a jffs2 image
You can use this script:
#!/bin/sh currentdir=`pwd` ANDROID_OUT=out ANDROID_DEVICE=freerunner EXPORT_ROOT=$currentdir/build_jffs2_tmp Usage() { echo "Usage: $0 release|debug jffs2filename" } BuildImage() { if [ -d $1 ] then echo "[INFO] Copying from... $1" sudo rm -rf $EXPORT_ROOT mkdir $EXPORT_ROOT mkdir $EXPORT_ROOT/root # Copy the image... cd $1 tar cf - root | (cd $EXPORT_ROOT; sudo tar xf -) tar cf - system | (cd $EXPORT_ROOT/root; sudo tar xf -) # Change owner and permissions... cd $EXPORT_ROOT sudo chown -R root:root root sudo chmod -R 777 root cd $currentdir # Make the JFFS2 file mkfs.jffs2 --pad=0x700000 -o $2 -e 0x20000 -n -d$EXPORT_ROOT/root/ echo "[INFO] Image written to $2" sudo rm -rf $EXPORT_ROOT else echo "$1 does not exist!" fi } if [ $# != 2 ] then Usage else case $1 in release) BuildImage $ANDROID_OUT/target/product/$ANDROID_DEVICE $2 ;; debug) BuildImage $ANDROID_OUT/debug/target/product/$ANDROID_DEVICE $2 ;; *) Usage esac fi
There is currently no documented way to build a Freerunner/Android kernel. Sean McNeil has been releasing kernels at http://people.openmoko.org/sean_mcneil/. Most of the patches required to run Android have be incorporated into the andy-tracking kernel branch, which will eventually be the new stable kernel. Once all the patches are in the kernel, it should be possible to run Android with a stock kernel.
Windows Connectivity
It is possible to get Windows to at least recognize the Android "Ethernet Gadget" and charge the FreeRunner using the Android USB Windows driver (http://dl.google.com/android/android_usb_windows.zip) by modifying the android_usb.inf file in that package before attempting to install the driver. The following modifications are required:
Add the following to the [Google.NTx86] section of the android_usb.inf file:
; Neo FreeRunner %USB\VID_1457&PID_5117.DeviceDescRelease%=androidusb.Dev, USB\VID_1457&PID_5117 %USB\VID_1457&PID_5117&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_1457&PID_5117&MI_01
and add the following to the to the [Strings] section of the android_usb.inf file:
USB\VID_1457&PID_5117.DeviceDescRelease="Neo FreeRunner" USB\VID_1457&PID_5117&MI_01.DeviceDescRelease="Neo FreeRunner Composite ADB Interface"
The Windows version of adb does not appear to recognize the connected device yet but at least the FreeRunner charges and the device driver indicates that "This device is working properly."
How to Help
Getting Started
You can start by following the instructions to download and build the Android source from scratch. Please see http://source.android.com/download and follow the instructions for your architecture.
Publicize Your Efforts
It's generally a good idea to make your efforts known via wiki systems, public mailing lists, forums, and publically open version control systems.
Always take credit for your work but please don't do it in the form of comments. Some code is already hard enough to read without comments polluting the text. The best thing to do is to create a patch and put a header with your information at the top. Collaboration systems such as git might already do this for you (??).
If you create something new and have the ability to designate the license for it, please consider license compatibility issues.
Porting Strategy
- Analysis and leverage of the existing build system
- buid/core/combo/arm-linux.mk
- -D__ARCH_ARM_4__ -D__ARCH_ARM_4T__
- -march=armv4t -mcpu=arm920t
- fix various static references to 'armv5'
- buid/core/combo/arm-linux.mk
- Isolating ARMv5TE ISA dependent code
- e.g. grep -n -R -i "${armv5te_isa_pattern}" ~/android
- Abstracting
- ( C/C++ )
- Use inlined functions / #ifdef statments to implement functions in a portable manner
- For inlined assembler calls, it's acceptable for now to use generic C code instead, so long as later on we optimize it by hand.
- ( ASM )
- Proprocessor statements based on ISA / architecture, e.g. #ifdef __ARCH_ARM_5__ ... #endif #ifdef __ARCH_ARM_4__ ... #endif
- It's highly suggested that preprocessor statements should not be nested (i.e. make them mutually exclusive)
- Some people have suggested that we should not do #ifdef's based on ARCH or ISA, but rather based on an AndroidConfig.h which would define macros like PLD(...) #ifdef HAVE_ARM_PLD pld #else ... #endif .
- ( C/C++ )
For each ARMv5TE instruction, one could potentially
- Implement the instruction using general registers instead of DSP calls (i.e. eabi / softfloat)
- If that is a) nondeterministic, or b) slow, then sections of code need to be analyzed and hand-optimized for the ARMv4T isa
List of Unsupported Instructions
This is a list of opcodes, extracted from the Android source, that are unsupported for ARMv4T compliant processors (specifically the arm920t). The opcodes represent instructions available for ARMv5, ARMv5T, and ARMv5TE architectures, which are not present in the ARMv4T ISA. The list was obtained by exhaustively editing the recompiling the Android source code until it compiled without error.
Please keep in mind, that in some cases, translating these instructions into a sequence of ARMv4T instructions will be impossible and / or result in nondeterministic execution because of
- the requirement of additional context
- the tendencies of certain opcodes to change condition registers that may or may not be present in the arm920t core
Opcodes
|
Scanning for Files That Use the ARMv5TE ISA
Using the above list of opcodes, one can scan the Android source code for ARMv4T-incompatible instruction sequences.
Code:
#!/bin/sh # $1 is the android directory if [ $# -ne 1 ]; then exit -1 fi cd "${1}" opcodes="blx clz ldrd pld smlabb smlabt smlatt smlal smlawb smlawt smulbb smulbt smultt smulwb smulwt qadd qdadd qdsub qsub strd" for op in ${opcodes}; do echo "* ${op} =====================================" if [ ! -e .files.${op} ]; then files="$(grep -R -i "${op} " * 2>/dev/null)" files="$(echo $files | grep -v "^Binary file" | sed -e 's/:.*//')" files="$(echo $files| grep -v "CREDIT\|README\|^\(kernel/\|.git/\)\|\(\.txt\)$" | sort -u)" echo "${files}" > .files.${op} else files="$(cat .files.${op})" fi for fil in ${files}; do lines="$(grep -n -i "${op} " ${fil} | sed -e 's/:.*//g' )" lines="$(echo $lines | sed -e 's/ /,/g')" echo "** ${fil}: lines {${lines}}" done done |
Source Files in Android that Use the ARMv5TE ISA
The list of files below may or may not be complete. There might also be some assembly code that is generated with a python script (verification?).
|
Discussion
Notes
The file
system/core/libpixelflinger/codeflinger/ARMAssembler.cpp
will need special attention. It's responsible for dynamic generation of DSP code.
Suggestions
- User:Cfriedt 20081024 I'm not sure how feasible this is, given that the SMedia 3362 is heavily NDA'd. However, since the arm920t lacks a floating-point unit / DSP core, is it possible to use the SMedia chip for general-purpose math? This would help in the Android platform, at least, for things like audio and video codecs. Aside from an OpenGL ES driver, OpenMoko documentation for the SMedia would be highly appreciated.
Important Links
(Please Update Me)
Documentation
- Android Documentation
- ARM Documentation, (keywords: armv4t, armv5t, armv5te, arm920t, arm926ej-s)
- ARM Assembly Language Programming
- An Introduction to the GNU Assembler
- ARM Procedure Call Standard, ARM Calling Conventions
Instruction Set References
- ARM Architecture Reference Manual, The definitive ISA documentation
- ARM Instruction Set Quick Reference Card
- ARM and Thumb -2 Instruction Set Quick Reference Card
- ARMv4T (See section 1.4.13)
- ARMv5T (See section 4.16)
- ARM DSP Enhanced Instruction Set
- Procedure Call Standard for the ARM Architecture
Hardware Reference
Communities
- Android Public Mailing Lists
- Specifically, android-porting
- OpenMoko Mailing Lists
- Specifically, openmoko-kernel
- Android on FreeRunner at KoolU.com
- Openmoko Local Groups
- Openmoko:Community_Portal