Android/zh cn

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(New page: {{Languages|Android}} {{Distributions|Android}} = 更新 = * 20081202 [http://www.koolu.com Koolu.com] has released the source code for the FreeRunner port of Android in their git reposit...)
 
Line 2: Line 2:
 
{{Distributions|Android}}
 
{{Distributions|Android}}
  
= 更新 =
+
= Updates =
* 20081202 [http://www.koolu.com Koolu.com] has released the source code for the FreeRunner port of Android in their git repositories at [http://git.koolu.org/ Koolu GIT] ([http://koolu.com/Press-Release/ Press Release])
+
* 20081202 [http://www.koolu.com Koolu.com] [http://git.koolu.org/ Koolu GIT] [http://git.koolu.org/ Koolu GIT] ([http://koolu.com/Press-Release/ Press Release]已释出给FreeRunner使用的 Android 源码。
* 20081120 [http://www.koolu.com Koolu.com] has pushed back selling the OpenMoko Freerunner with Android pre-installed , as well as offering free downloads of the Freerunner port of Android to existing Freerunner owners. Untill December 2008
+
* 20081104 The first Android-image has been successfully created by Sean McNeil!  - sms and calling works, wifi and bluetooth doesn't. [http://onlinedev.blogspot.com/2008/11/porting-android-phase-3-done.html ''news-source'']
+
* 20081029 [[User:Cfriedt]] [http://benno.id.au Benno] has modified Android's build system so that it will output a JFFS2 image instead of YAFFS . Unlike JFFS2, which [http://wiki.openmoko.org/wiki/Userspace_root_image can be mounted read-only from an image], mounting a YAFFS image is not possible unless it's already been written to flash (it complains about the block device being of type '1' and not 'NAND'). JFFS2 also has the benefit that it's a standard OpenMoko image format (See [[Flashing the Neo FreeRunner]] or [[Flashing the Neo 1973]])
+
* 20081023 [[User:Bricode]] 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
+
* 20081022 [[User:Cfriedt]] I was able to 'trivially' compile all of the Android source code without error for the ARMv4T architecture by removing v5TE instructions. Although it will definitely not run anything predictably, at least now that I know the build system will work with a few simple substitutions in build/core/combo/arm-linux.mk. At this point I am able to go ahead and re-implement v5TE instructions as v4T instruction sequences instead (or re-implement entire sections of assembly with hand-optimized v4T instructions).
+
* 20081021 [[User:Cfriedt]] Android -> FreeRunner updates on my [http://perpetual-notion.blogspot.com/search/label/android blog]
+
* 20081021 Google released the majority [http://source.android.com/download source code] for the phone under Apache free and open-source [http://source.android.com/license license], with portions covered by other existing licenses, such as the Linux kernel under GPLv2.
+
* 200810?? [http://www.koolu.com Koolu.com] has announced that they will be '''selling the OpenMoko Freerunner with Android pre-installed''' beginning in November 2008, as well as offering '''free downloads of the Freerunner port of Android''' to existing Freerunner owners. Well-known open-source advocate [http://koolu.com/The-Koolu-Team/maddog.html Jon "maddog" Hall] is CTO and Ambassador for Koolu.
+
  
= 介绍 =
+
* 20081120 [http://www.koolu.com Koolu.com] 推动销售搭载 Android的Openmoko Freerunner 。如提供现有的FreeRunner 下载可搭载的Android。直到 December 2008。
This page is dedicated to porting the [http://www.android.com Android OS] to the [[Neo 1973]] and [[Neo FreeRunner]] handsets. Since the Android OS was [http://source.android.com/posts/opensource  publically released] on 20081021, [http://benno.id.au/blog/2007/11/21/android-neo1973 work] [http://perpetual-notion.blogspot.com/search/label/android is] [http://groups.google.com/group/android-porting currently underway] to port Android to the [[Neo1973 Hardware|Neo 1973]] and [[Neo_FreeRunner_GTA02_Hardware|FreeRunner]] handsets.
+
 
 +
* 20081104 第一个可以在FreeRunner上执行的 Android-image已经成功的被 Sean McNeil编译出来!  - sms 及通话可以使用,wifi 及蓝芽则否。[http://onlinedev.blogspot.com/2008/11/porting-android-phase-3-done.html ''news-source'']
 +
 
 +
* 20081029 [[User:Cfriedt]] [http://benno.id.au Benno] 修改了Android's build system,因此可以放置JFFS2 image,而不是YAFFS。 不像是JFFS2,只可以[http://wiki.openmoko.org/wiki/Userspace_root_image mount 到只读的情况下],要挂载 YAFFS映像档在它被写入 flash 后才有可能使用。(it complains about the block device being of type '1' and not 'NAND'). JFFS2 仍然有标准的 Openmoko image 格式的优点 (请参考 [[Flashing the Neo FreeRunner|烧制映像档到FreeRunner]] 或 [[Flashing the Neo 1973|烧制映像档到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 ,在我的[http://perpetual-notion.blogspot.com/search/label/android 部落格]上有讨论。
 +
 
 +
* 20081021 Google 释出Apache free 及 open-source手机下,大部份的[http://source.android.com/download source code] 、 [http://source.android.com/license license], 部份被涵盖在现有的授权(licenses)下,如 Linux kernel 是属于 GPLv2授权。
 +
 
 +
* 200810?? [http://www.koolu.com Koolu.com] 宣布他们将会 '''销售搭载Android的Openmoko Freerunner ''',这个计划会在2008年11月开始,并且提供现有的FreeRunner用户 '''免费下载可搭载在Freerunner上的Android''' 。 知名的 open-source 爱好者[http://koolu.com/The-Koolu-Team/maddog.html Jon "maddog" Hall] 是Koolu的CTO及代表。
 +
 
 +
= 简介 =
 +
本网页撰写的目地在于将[http://www.android.com Android OS] 移植到 [[Neo 1973]] [[Neo FreeRunner]] 手机上。Android OS 于2008年10月21日[http://source.android.com/posts/opensource  公开的发布]  。
 +
下列的信息,可以提供您暸解在 [[Neo1973 Hardware|Neo 1973]]及 [[Neo_FreeRunner_GTA02_Hardware|FreeRunner]] [http://benno.id.au/blog/2007/11/21/android-neo1973 移植工作] [http://perpetual-notion.blogspot.com/search/label/android 目前的运作情形]  
 +
[http://groups.google.com/group/android-porting 及现状]
  
 
== 目标 ==
 
== 目标 ==
# Systematically introduce patches for ARMv4T in the Android codebase
+
# 有系统化的在Android codebase下使用提供给 ARMv4T 的patch檔。
# Provide Neo1973 and Neo FreeRunner hardware-dependent patches in the Android codebase, leveraging the work already done by the Openmoko developers, without forcing Android-specific changes upstream
+
# 提供在Android codebase在下Neo1973 与 Neo FreeRunner hardware-dependent patches 文件, 这项任务已经被 Openmoko 工程师完成,在不强迫变更 Android-specific upstream下。
# Provide a useable Android filesystem and kernel on the [[Distributions]] page that conform to current Openmoko installation routines
+
# [[Distributions]]网页中,提供有用的Android 档案系统及kernel。
  
== 安装 ==
+
== 使用现有的二进制文件安装 ==
  
Detailed instructions for installing Android on the Freerunner (using Sean McNeil's kernel and rootfs packages, and the Qi bootloader) can be found [http://www.copiesofcopies.org/webl/?p=34 here].
+
详尽的在FreeRunner上安装Android (使用 Sean McNeil的kernel及rootfs 套件,及 Qi bootloader) ,何以在[http://www.copiesofcopies.org/webl/?p=34 http://www.copiesofcopies.org/webl/?p=34]此网址找到。
  
== 早期尝试 ==
+
== 早期目标 ==
As [http://benno.id.au Ben Leslie] had pointed out on his [http://benno.id.au/blog/2007/11/21/android-neo1973 blog] far before the source code was released, [http://www.android.com Android] was originally designed to work with the ARMv5TE [http://en.wikipedia.org/wiki/Instruction_set_architecture instruction set architecture] (ISA), which allows for [http://en.wikipedia.org/wiki/ARM_architecture#DSP_Enhancement_Instructions DSP enhanced instructions]. Contrary to the ARMv5TE ISA, the Neo1973 and FreeRunner handsets both feature an arm920t core, which comply to the ARMv4T ISA.
+
就如同 [http://benno.id.au Ben Leslie] [http://benno.id.au/blog/2007/11/21/android-neo1973 blog] 中所提到的,在 source code释出之前,[http://www.android.com Android] 被设计为使用ARMv5TE 架构[http://en.wikipedia.org/wiki/Instruction_set_architecture instruction set architecture] (ISA),允许 [http://en.wikipedia.org/wiki/ARM_architecture#DSP_Enhancement_Instructions DSP 扩充的指令]。 相较于 ARMv5TE ISA, the Neo1973 FreeRunner 电话听筒都着重在arm920t core,并可以应用到 ARMv4T ISA。
  
Before the source code was released, kernel trap handlers were implemented to 'emulate' the ARMv5TE ISA. Although the results worked in many cases, trapping is costly and performance suffered as a result. Moreover, without explicitly knowing which conditions were set by various instructions, such as Thumb Mode execution, the result became nondeterministic.
+
在源码开放之前,kernel trap handlers 被用来 '模拟' ARMv5TE ISA。虽然这个结果在不同的案例下运作,trapping 是较花成本及效能的一种结果。甚至于,在没有明确的暸解哪个状况是被不同的指令所设定的情兄下,如Thumb Mode execution,这个结果成为没有定论。
  
== 当前状态 ==
+
== 目前的状态 ==
  
With the release of the Android [http://source.android.com source code], the Open Source community is no longer limited to dealing with a binary-only product. The Open Handset Alliance (OHA) has let their source code become their product for everyone enrich and benefit from.
+
随着 Android释出 [http://source.android.com source code],Open Source社群不再受限于使用binary-only 产品。The Open Handset Alliance (OHA)已经让他们的source code 成为能让大家致富及受益的产品。
  
Currently, porting efforts are underway in many circles. Patches should be submitted via the [http://source.android.com/submit-patches official Android channels].
+
目前,porting 以不同的循环模式运做。Patches需要透过  [http://source.android.com/submit-patches official Android channels]提交。
  
[http://www.koolu.com Koolu], a Freerunner distributor, has released the source code of their Android port at [http://git.koolu.com http://git.koolu.com]. See the [[#Building the Koolu Android Source]] instructions below for how to build an Android image for Freerunner.
+
[http://www.koolu.com Koolu],Freerunner 的经销商, 在[http://git.koolu.com http://git.koolu.com]释出了他们搭载FreeRunner的源码。参考 [[#Building the Koolu Android Source]]下的说明可以暸解到如何制作供给Freerunner使用的Android image。
  
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]]
+
为了要追踪Android source tree的哪个部份包含了特定的 ARMv5 程序,我制作了包含patches状态的表格。这个表格可以在 http://spreadsheets.google.com/pub?key=pzDEXnU19gkeTjpD28t-7fw 找到。[[User:Bricode]]
  
[[User:Seanmcneil3|Sean McNeil]] said that he was able to get Android running (including telephony) in his Freerunner [http://3v1n0.tuxfamily.org/tumblelog/post/368 source].
+
[[User:Seanmcneil3|Sean McNeil]] [http://3v1n0.tuxfamily.org/tumblelog/post/368 指出]他可以在FreeRunner上执行包含通话功能的 Android。
  
Ben Leslie mentioned on the android-porting list that he was able to get the 'Android' logo to appear on his Neo 1973.
+
Ben Leslie 也在android-porting list上指出他可以在Neo 1973 show出他的Android logo。
  
=== 编译 Koolu Android 代码 ===
+
=== 建立Koolu Android Source ===
  
# Configure your machine with the prerequisites documented in the [http://source.android.com/download#TOC-Setting-up-your-machine Setting up your machine] section of Google's build instructions.
+
# 参考[http://source.android.com/download#TOC-Setting-up-your-machine Setting up your machine] 中的Google build 说明,进行设定。
# Install <tt>repo</tt> and download the source, as documented at http://trac.koolu.org/.
+
# 安装 <tt>repo</tt> 并下载源码,你可以在 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 [http://lists.openmoko.org/pipermail/community/2008-December/036982.html 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 [[#Building a jffs2 image|below]]
+
# 在完成build后,你可以藉由[http://lists.openmoko.org/pipermail/community/2008-December/036982.html 的讯息]编辑及执行McNeil的 scripts,将root file system 放在一起。第一个 script (cp_android_OS) 用来复制最新的built files到 staging area。  第二个(mkjffs2) 则从staging area会制作一个jffs2 image。请确定在二个档案中编辑你的路径。或者,你可以使用[[#Building a jffs2 image|以下的]]script
# The result of the previos step is a file, <tt>androidfs.jffs2</tt>, which may be flashed to your Freerunner.
+
# 上面执行的结果是<tt>androidfs.jffs2</tt>的档案,它可以被烧进你的Freerunner。
  
==== 生成jffs2 镜像====
+
==== 制作jffs2 image ====
You can use this script:
+
你可以使用以下的script:
 
<pre>
 
<pre>
 
#!/bin/sh
 
#!/bin/sh
Line 119: Line 129:
 
</pre>
 
</pre>
  
There is currently no documented way to build a Freerunner/Android kernel. [[User:Seanmcneil3|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 <tt>andy-tracking</tt> 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 连接 ===
+
目前并没有与建置 Freerunner/Android kernel相关的说明文件。[[User:Seanmcneil3|Sean McNeil]] 目前已经在 http://people.openmoko.org/sean_mcneil/ 这个位置释出Kernel。大部份的patche 需要与<tt>andy-tracking</tt> kernel branch 配合执行,而此Kernel终将成为最稳定的kernel版本。 一旦所有的 patche都放到 kernel后,即可在stock kernel上执行 Android 。
  
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:
+
=== 与 Windows 连结性 ===
  
Add the following to the [Google.NTx86] section of the android_usb.inf file:
+
让 Windows 能组织 Android "网络零件(Ethernet Gadget)" ,并且使用Android USB Windows driver (http://dl.google.com/android/android_usb_windows.zip) 充电,在你安装驱动程序前,你可以透过修改套件中的android_usb.inf 档案,来完成这项工作。你必须做出下面的修改动作:
 +
 
 +
将下面[Google.NTx86] 的内容加到android_usb.inf 档案中:
  
 
<pre>
 
<pre>
Line 133: Line 144:
 
</pre>
 
</pre>
  
and add the following to the to the [Strings] section of the android_usb.inf file:
+
并且在android_usb.inf档案的 [Strings] 区块下加入以下的内容:
  
 
<pre>
 
<pre>
Line 140: Line 151:
 
</pre>
 
</pre>
  
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."
+
adb的Windows版本并不会出现,并且连接到装置上,但至少FreeRunner会开始充电,装置驱动程序会出现"This device is working properly(此装置的功能运作正常)"的讯息。
  
= How to Help =
+
= 取得帮助 =
  
 
== Getting Started ==
 
== 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 http://source.android.com/download] and follow the instructions for your architecture.
+
你可以藉由下面的操作指引下载及建立Android source,请参考 [http://source.android.com/download http://source.android.com/download]并且依照你的架构参考操作指引。
  
== 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.
+
最好的方法是透过 wiki systems、公开的 mailing list、讨论群组及公开的系统来发表你的作品。
  
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 (??).
+
对于你的工作,永远加入自己的credit,但请不要使用批注的方式,因为有些程序在没有批注的情况下已经不易阅读困难,这个方式将增加困难度。最好的情况是,建立patch,并且在表头放入你的个人连络信息。但协同运作的系统,如git可能已经帮你完成这个工作了。
  
If you create something new and have the ability to designate the license for it, please consider license compatibility issues.
+
若你建立了新的东西,并且能够指定它的授权,请考虑授权兼容性上的问题。
  
== Porting Strategy ==
+
== Porting 策略 ==
  
* Analysis and leverage of the existing build system
+
* 分析它对现有的build system的影响力
 
** buid/core/combo/arm-linux.mk
 
** buid/core/combo/arm-linux.mk
 
*** -D__ARCH_ARM_4__ -D__ARCH_ARM_4T__
 
*** -D__ARCH_ARM_4__ -D__ARCH_ARM_4T__
 
*** -march=armv4t -mcpu=arm920t
 
*** -march=armv4t -mcpu=arm920t
** fix various static references to 'armv5'
+
** 修补不同的静态参考数据到 'armv5'
* Isolating ARMv5TE ISA dependent code
+
* 隔离 ARMv5TE ISA 相依的程序代码
 
** e.g. grep -n -R -i "${armv5te_isa_pattern}" ~/android
 
** e.g. grep -n -R -i "${armv5te_isa_pattern}" ~/android
* Abstracting
+
* 摘要
 
** ( C/C++ )
 
** ( C/C++ )
*** Use inlined functions / #ifdef statments to implement functions in a portable manner
+
*** 使用 inlined functions / #ifdef 状态式来完成移植性的功能
*** 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.
+
*** 针对 inlined assembler calls,目前使用一般的 C 程序也是可以被接受的,之后,我们再用手动的方式来进行最佳化的工作。
 
** ( ASM )
 
** ( ASM )
*** Proprocessor statements based on ISA / architecture, e.g. #ifdef __ARCH_ARM_5__ ... #endif #ifdef __ARCH_ARM_4__ ... #endif
+
*** 处理器的状态是根据 ISA / architecture,如 #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 .
+
*** 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 .  
  
For each ARMv5TE instruction, one could potentially
+
针对ARMv5TE 指令(instruction),可能潜藏着:
* Implement the instruction using general registers instead of DSP calls (i.e. eabi / softfloat)
+
* 使用一般的registers(登录子),而不是使用 DSP 呼叫 (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
+
* 若它是 a) 无法判别的 或者 b) 速度缓慢,则这个区段的程序则必须要分析,针对ARMv4T isa,必须使用hand-optimized 的方法
  
== 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.
+
以下是opcodes列表,它是自Android Source解压缩出来的,它不支持ARMv4T 兼容的处理器 (尤其是 arm920t)opcodes 代表ARMv5、ARMv5T及ARMv5TE 架构下可以使用的指令。它无法在 ARMv4T ISA下执行。这个列表耗费了许多时间编辑,直到编译无误的状态下,才会列出。
  
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
+
请牢记一件事,在一些状况下,将这些指令顺序的传送到ARMv4T 指令下是不可能的,或者是会出现无预期的结果:
* the requirement of additional context
+
* 必须要有额外的context。
* the tendencies of certain opcodes to change condition registers that may or may not be present in the arm920t core
+
* opcodes变更登录子的状态,可能无法表现在 arm920t 核心上
  
 
=== Opcodes ===
 
=== Opcodes ===
Line 419: Line 430:
 
}}
 
}}
  
=== Scanning for Files That Use the ARMv5TE ISA ===
+
=== 扫瞄使用ARMv5TE ISA的档案 ===
 +
 
 +
使用下列的opcodes,可以扫瞄到与ARMv4T与不兼容的 Android source code指令顺序。
  
Using the above list of opcodes, one can scan the Android source code for ARMv4T-incompatible instruction sequences.
 
  
 
'''Code:'''
 
'''Code:'''
Line 465: Line 477:
 
}}
 
}}
  
=== Source Files in Android that Use the ARMv5TE ISA ===
+
=== 在Android下使用 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?).
+
以下的档案可能是完整的,也可能是不完整的。也可能有些程序内容是透过 python script产生的.
  
 
{{scroll box|height=150px|text=
 
{{scroll box|height=150px|text=
Line 614: Line 626:
 
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {200,315,321,331,368,371}
 
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {200,315,321,331,368,371}
 
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h: lines {122,142}
 
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h: lines {122,142}
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h: lines {133,136,140,172,186,
+
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h: lines {133,136,140,172,186,201}
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h: lines {128,131,158,172}
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {116}
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {184}
 +
* qdsub =====================================
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {302}
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {275}
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h: lines {124,147}
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {140}
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {165}
 +
* qsub =====================================
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {167}
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {162}
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h: lines {121,138}
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {88,127}
 +
** external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {70,133}
 +
* strd =====================================
 +
** dalvik/vm/mterp/armv5/OP_APUT_WIDE.S: lines {31}
 +
** dalvik/vm/mterp/armv5/OP_IPUT_WIDE.S: lines {39}
 +
** dalvik/vm/mterp/armv5/OP_IPUT_WIDE_QUICK.S: lines {14}
 +
** dalvik/vm/mterp/armv5/OP_SPUT_WIDE.S: lines {21}
 +
** dalvik/vm/mterp/out/InterpAsm-armv5.S: lines {2834,7530,8331,8542}
 +
** dalvik/vm/oo/Object.h: lines {589}
 +
** external/opencore/fileformats/avi/parser/include/pv_avifile_streamlist.h: lines {179}
 +
** external/opencore/fileformats/avi/parser/src/pv_avifile_streamlist.cpp: lines {153}
 +
** system/core/libpixelflinger/rotate90CW_4x4_16v6.S: lines {47,52,56,60}
 +
}}
 +
 
 +
=== 讨论 ===
 +
 
 +
=== 附注 ===
 +
档案
 +
<pre>
 +
system/core/libpixelflinger/codeflinger/ARMAssembler.cpp
 +
</pre>
 +
 
 +
必须要特别的注意。它负责动态产生DSP程序。
 +
 
 +
== 建议 ==
 +
* [[User:Cfriedt]] 20081024 我不确定它的可行性多高,因为[http://wiki.openmoko.org/wiki/Neo_FreeRunner_Hardware_Issues#SMedia_3362_Documentation_.26_OpenGL_ES_Drivers SMedia 3362 被NDA保护]。 然而,arm920t 缺乏浮点单元 / DSP core,它可能使用 SMedia chip 产生特定目地的方法?这对Android 平台来讲很有用,至少像是audio及 video codecs。 撇开OpenGL ES 驱动程序,欢迎提供针对SMedia 的 Openmoko文件。
 +
 
 +
= 重要连结 =
 +
(欢迎大家在这里加入重要连结)
 +
 
 +
== 文件 ==
 +
* [http://source.android.com/documentation Android Documentation]
 +
* [http://www.arm.com/documentation/ ARM Documentation], (keywords: armv4t, armv5t, armv5te, arm920t, arm926ej-s)
 +
* [http://www.arm.com/miscPDFs/9658.pdf ARM Assembly Language Programming]
 +
* [http://www.cse.unsw.edu.au/~cs3221/labs/assembler-intro.pdf An Introduction to the GNU Assembler]
 +
* [http://www.heyrick.co.uk/assembler/apcsintro.html ARM Procedure Call Standard], [http://en.wikipedia.org/wiki/Calling_convention#ARM ARM Calling Conventions]
 +
 
 +
== 指令设定参考 ==
 +
* [http://www.arm.com/miscPDFs/14128.pdf ARM Architecture Reference Manual],最后的ISA文件
 +
 
 +
* [http://www.simplemachines.it/doc/QRC0001H_rvct_v2.1_arm.pdf 设定Quick Reference Card的ARM 指令]
 +
* [http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001l/QRC0001_UAL.pdf 设定Quick Reference Card 的ARM及Thumb -2 指令]
 +
* [http://infocenter.arm.com/help/topic/com.arm.doc.dvi0025b/DVI0025.pdf ARMv4T] (请参考1.4.13小节)
 +
* [http://infocenter.arm.com/help/topic/com.arm.doc.dvi0014a/DVI0014A_ARM10T_PO.pdf ARMv5T] (请参考 4.16小节)
 +
* [http://www.arm.com/pdfs/ARM-DSP.pdf ARM DSP 延伸指令集]
 +
* [http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042c/IHI0042C_aapcs.pdf ARM架构下的Procedure Call Standard ]
 +
 
 +
== 硬件参考 ==
 +
 
 +
* [[Neo1973 Hardware]]
 +
* [[Neo FreeRunner GTA02 Hardware]]
 +
 
 +
== 社群讨论 ==
 +
* [http://source.android.com/discuss Android Public Mailing Lists]
 +
** Specifically, [http://groups.google.com/group/android-porting android-porting]
 +
* [http://lists.openmoko.org/mailman/listinfo OpenMoko Mailing Lists]
 +
** Specifically, [http://lists.openmoko.org/mailman/listinfo/openmoko-kernel openmoko-kernel]
 +
* [http://forum.koolu.org/viewforum.php?f=10 Android on FreeRunner] at KoolU.com
 +
* [[Openmoko Local Groups]]
 +
* [[Openmoko:Community_Portal]]
 +
 
 +
= 请参考 =
 +
 
 +
* [[Debug_Board]]
 +
 
 +
= 其它连结 =
 +
== Youtube video /Android on FreeRunner ==
 +
 
 +
[http://tw.youtube.com/watch?v=m4NbsLmF9j0 Video 1]
 +
 
 +
[http://tw.youtube.com/watch?v=r6Op-7tNTiw Video 2]
 +
 
 +
 
 +
 
 +
[[Category:Distributions]]

Revision as of 10:59, 11 December 2008

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

  • 20081120 Koolu.com 推动销售搭载 Android的Openmoko Freerunner 。如提供现有的FreeRunner 下载可搭载的Android。直到 December 2008。
  • 20081104 第一个可以在FreeRunner上执行的 Android-image已经成功的被 Sean McNeil编译出来! - sms 及通话可以使用,wifi 及蓝芽则否。news-source
  • 20081022 User:Cfriedt 可以在移除了v5TE指令下 ,没有错误的'trivially' 为ARMv4T编译 Android source code。虽然它不预期它可以被执行,至少我针对 build/core/combo/arm-linux.mk做了一些小小的取代。关于此点,我可以继续像执行v4T指令顺序般的,重新执行 v5TE 指令。(或者,重新执行整个 hand-optimized v4T 指令组合)。
  • 20081021 Google 释出Apache free 及 open-source手机下,大部份的source codelicense, 部份被涵盖在现有的授权(licenses)下,如 Linux kernel 是属于 GPLv2授权。
  • 200810?? Koolu.com 宣布他们将会 销售搭载Android的Openmoko Freerunner ,这个计划会在2008年11月开始,并且提供现有的FreeRunner用户 免费下载可搭载在Freerunner上的Android 。 知名的 open-source 爱好者Jon "maddog" Hall 是Koolu的CTO及代表。

简介

本网页撰写的目地在于将Android OS 移植到 Neo 1973Neo FreeRunner 手机上。Android OS 于2008年10月21日公开的发布 。 下列的信息,可以提供您暸解在 Neo 1973FreeRunner 移植工作 目前的运作情形 及现状

目标

  1. 有系统化的在Android codebase下使用提供给 ARMv4T 的patch檔。
  2. 提供在Android codebase在下Neo1973 与 Neo FreeRunner hardware-dependent patches 文件, 这项任务已经被 Openmoko 工程师完成,在不强迫变更 Android-specific upstream下。
  3. Distributions网页中,提供有用的Android 档案系统及kernel。

使用现有的二进制文件安装

详尽的在FreeRunner上安装Android (使用 Sean McNeil的kernel及rootfs 套件,及 Qi bootloader) ,何以在http://www.copiesofcopies.org/webl/?p=34此网址找到。

早期目标

就如同 Ben Leslieblog 中所提到的,在 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,Freerunner 的经销商, 在http://git.koolu.com释出了他们搭载FreeRunner的源码。参考 #Building the Koolu Android Source下的说明可以暸解到如何制作供给Freerunner使用的Android image。

为了要追踪Android source tree的哪个部份包含了特定的 ARMv5 程序,我制作了包含patches状态的表格。这个表格可以在 http://spreadsheets.google.com/pub?key=pzDEXnU19gkeTjpD28t-7fw 找到。User:Bricode

Sean McNeil 指出他可以在FreeRunner上执行包含通话功能的 Android。

Ben Leslie 也在android-porting list上指出他可以在Neo 1973 show出他的Android logo。

建立Koolu Android Source

  1. 参考Setting up your machine 中的Google build 说明,进行设定。
  2. 安装 repo 并下载源码,你可以在 http://trac.koolu.org/找到它的文件。
  3. 在完成build后,你可以藉由的讯息编辑及执行McNeil的 scripts,将root file system 放在一起。第一个 script (cp_android_OS) 用来复制最新的built files到 staging area。 第二个(mkjffs2) 则从staging area会制作一个jffs2 image。请确定在二个档案中编辑你的路径。或者,你可以使用以下的script
  4. 上面执行的结果是androidfs.jffs2的档案,它可以被烧进你的Freerunner。

制作jffs2 image

你可以使用以下的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


目前并没有与建置 Freerunner/Android kernel相关的说明文件。Sean McNeil 目前已经在 http://people.openmoko.org/sean_mcneil/ 这个位置释出Kernel。大部份的patche 需要与andy-tracking kernel branch 配合执行,而此Kernel终将成为最稳定的kernel版本。 一旦所有的 patche都放到 kernel后,即可在stock kernel上执行 Android 。

与 Windows 连结性

让 Windows 能组织 Android "网络零件(Ethernet Gadget)" ,并且使用Android USB Windows driver (http://dl.google.com/android/android_usb_windows.zip) 充电,在你安装驱动程序前,你可以透过修改套件中的android_usb.inf 档案,来完成这项工作。你必须做出下面的修改动作:

将下面[Google.NTx86] 的内容加到android_usb.inf 档案中:

; 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

并且在android_usb.inf档案的 [Strings] 区块下加入以下的内容:

USB\VID_1457&PID_5117.DeviceDescRelease="Neo FreeRunner"
USB\VID_1457&PID_5117&MI_01.DeviceDescRelease="Neo FreeRunner Composite ADB Interface"

adb的Windows版本并不会出现,并且连接到装置上,但至少FreeRunner会开始充电,装置驱动程序会出现"This device is working properly(此装置的功能运作正常)"的讯息。

取得帮助

Getting Started

你可以藉由下面的操作指引下载及建立Android source,请参考 http://source.android.com/download并且依照你的架构参考操作指引。

发布你的作品

最好的方法是透过 wiki systems、公开的 mailing list、讨论群组及公开的系统来发表你的作品。

对于你的工作,永远加入自己的credit,但请不要使用批注的方式,因为有些程序在没有批注的情况下已经不易阅读困难,这个方式将增加困难度。最好的情况是,建立patch,并且在表头放入你的个人连络信息。但协同运作的系统,如git可能已经帮你完成这个工作了。

若你建立了新的东西,并且能够指定它的授权,请考虑授权兼容性上的问题。

Porting 策略

  • 分析它对现有的build system的影响力
    • buid/core/combo/arm-linux.mk
      • -D__ARCH_ARM_4__ -D__ARCH_ARM_4T__
      • -march=armv4t -mcpu=arm920t
    • 修补不同的静态参考数据到 'armv5'
  • 隔离 ARMv5TE ISA 相依的程序代码
    • e.g. grep -n -R -i "${armv5te_isa_pattern}" ~/android
  • 摘要
    • ( C/C++ )
      • 使用 inlined functions / #ifdef 状态式来完成移植性的功能
      • 针对 inlined assembler calls,目前使用一般的 C 程序也是可以被接受的,之后,我们再用手动的方式来进行最佳化的工作。
    • ( ASM )
      • 处理器的状态是根据 ISA / architecture,如 #ifdef __ARCH_ARM_5__ ... #endif #ifdef __ARCH_ARM_4__ ... #endif
      • 强烈的建议处理器状态应该不要套迭在一起(如让他们彼此独占)
      • 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 .

针对ARMv5TE 指令(instruction),可能潜藏着:

  • 使用一般的registers(登录子),而不是使用 DSP 呼叫 (如 eabi / softfloat)
  • 若它是 a) 无法判别的 或者 b) 速度缓慢,则这个区段的程序则必须要分析,针对ARMv4T isa,必须使用hand-optimized 的方法

不支持的指令

以下是opcodes列表,它是自Android Source解压缩出来的,它不支持ARMv4T 兼容的处理器 (尤其是 arm920t)。 opcodes 代表ARMv5、ARMv5T及ARMv5TE 架构下可以使用的指令。它无法在 ARMv4T ISA下执行。这个列表耗费了许多时间编辑,直到编译无误的状态下,才会列出。

请牢记一件事,在一些状况下,将这些指令顺序的传送到ARMv4T 指令下是不可能的,或者是会出现无预期的结果:

  • 必须要有额外的context。
  • opcodes变更登录子的状态,可能无法表现在 arm920t 核心上

Opcodes

Opcode Desription [PDF] Page Number C ASM
BLX(1) Branch, Link, and Exchange 166 N/A (Unused in Android) N/A (Unused in Android)
BLX(2) Branch, Link, and Exchange 168

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_BLX
... (inline asm) ...
#else
... (inline asm with equivalent blx code, as shown to the right) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_BLX
#define BLX(a) \
blx a
#else
#define BLX(a) \
mov pc,lr \
bx a
#endif
CLZ Count Leading Zeros 175

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_CLZ
... (inline asm) ...
#else
... (inline asm with equivalent clz code, as shown to the right) ...
#endif

User:Cfriedt 20081029

#ifdef HAVE_CLZ
#define CLZ(Rd,Rm) \
clz Rd,Rm
#else
#define CLZ(Rd,Rm) \
...
#endif
...
CLZ(Rd,Rm)
LDRD Load Registers Doubleword 200

User:Cfriedt 20081028 Substitute different inline assembly code with something like

#ifdef HAVE_LDRD
... (inline asm) ...
#else
... (inline asm with ldrd substituted) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_LDRD
#define LDRD(a,b) \
ldrd a,b
#else
#define LDRD(a,b) \
...
#endif
PLD Preload Data 240

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_PLD
... (inline asm) ...
#else
... (inline asm with pld removed) ...
#endif

User:Cfriedt 20081028 Remove or substitute with a macro reference such as

#ifdef HAVE_PLD
#define PLD(a,b) \
pld a,b
#else
#define PLD(a,b)
#endif
...
PLD(r0,#0)
SMLA<x><y> Signed Multiply-Accumulate 291
SMLAL<x><y> Signed Multiply Accumulate Long 298
SMLAW<y> Signed Multiply-Accumulate Word 302
SMUL<x><y> Signed Multiply 316
SMULW<y> Signed Multiply Word 320
QADD Saturating Add 242
QDADD Saturating Double and Add 249
QDSUB Saturating Double and Subtract 251
QSUB Saturating Subtract 253
STRD Store Registers Doubleword 349

User:Cfriedt 20081028 Substitute different inline assembly code with something like

#ifdef HAVE_STRD
... (inline asm) ...
#else
... (inline asm without strd) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_STRD
#define STRD(a,b) \
strd a,b
#else
#define STRD(a,b) \
...
#endif


扫瞄使用ARMv5TE ISA的档案

使用下列的opcodes,可以扫瞄到与ARMv4T与不兼容的 Android source code指令顺序。


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


在Android下使用 ARMv5TE ISA 的源文件

以下的档案可能是完整的,也可能是不完整的。也可能有些程序内容是透过 python script产生的.


  • blx =====================================
    • bionic/libc/tools/gensyscalls.py: lines {168,186}
    • bootloader/legacy/nandwrite/init.S: lines {77}
    • bootloader/legacy/usbloader/init.S: lines {95}
    • dalvik/vm/arch/arm/CallEABI.S: lines {239}
    • dalvik/vm/arch/arm/CallOldABI.S: lines {145}
    • development/emulator/qtools/thumbdis.cpp: lines {187,265}
    • external/qemu/target-arm/translate.c: lines {1151,1971,2444}
    • external/qemu/trace.c: lines {774,1353,1358}
    • system/core/libpixelflinger/codeflinger/disassem.c: lines {416}
  • clz =====================================
    • development/emulator/qtools/armdis.cpp: lines {654}
    • external/opencore/codecs_v2/audio/aac/dec/src/pv_normalize.h: lines {67,84}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h: lines {137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h: lines {78,95}
    • external/opencore/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.h: lines {67,84}
    • external/opencore/codecs_v2/video/avc_h264/dec/src/vlc.cpp: lines {23}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h: lines {125,162,168,204,218}
    • external/qemu/target-arm/translate.c: lines {1247}
    • external/skia/libcorecg/Sk64.cpp: lines {340,341,343}
    • external/skia/libcorecg/SkMatrix.cpp: lines {500,501}
    • external/skia/libsgl/effects/SkColorMatrixFilter.cpp: lines {135}
    • external/skia/libsgl/sgl/SkBitmap.cpp: lines {945,946,947}
    • external/skia/libsgl/sgl/SkBitmapShader.cpp: lines {32,33,34}
    • external/skia/libsgl/sgl/SkGraphics.cpp: lines {429,437}
  • ldrd =====================================
    • dalvik/vm/mterp/armv5/OP_AGET_WIDE.S: lines {28}
    • dalvik/vm/mterp/armv5/OP_IGET_WIDE.S: lines {37}
    • dalvik/vm/mterp/armv5/OP_IGET_WIDE_QUICK.S: lines {10}
    • dalvik/vm/mterp/armv5/OP_SGET_WIDE.S: lines {17}
    • dalvik/vm/mterp/out/InterpAsm-armv5.S: lines {2653,7464,8318,8390}
    • system/core/libpixelflinger/rotate90CW_4x4_16v6.S: lines {40,41,42,43}
  • pld =====================================
    • bionic/libc/arch-arm/bionic/memcmp.S: lines {37,44,45,56,57,107,108,195,196}
    • bionic/libc/arch-arm/bionic/memcmp16.S: lines {37,44,45,67,68,116,117,198,199}
    • bionic/libc/arch-arm/bionic/memcpy.S: lines {55,56,57,145,266,293,320}
    • bionic/libc/arch-arm/bionic/strlen.c: lines {59,65}
    • bionic/libc/kernel/arch-arm/asm/arch/irqs.h: lines {162}
    • external/elfutils/src/Makefile: lines {243}
    • external/elfutils/src/Makefile.am: lines {32}
    • external/elfutils/src/Makefile.in: lines {243}
    • external/jpeg/jidctfst.S: lines {69,235,247}
    • external/qemu/target-arm/translate.c: lines {1149}
    • system/core/libpixelflinger/codeflinger/ARMAssembler.cpp: lines {368}
    • system/core/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp: lines {104,108,117}
    • system/core/libpixelflinger/t32cb16blend.S: lines {111,112,134,143}
  • smlabb =====================================
    • external/jpeg/jidctfst.S: lines {110,115,155,156}
    • external/neven/Embedded/common/src/b_BasicEm/Math.c: lines {584,589}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {147,166}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {120,129}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {514,533}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {418,429}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {202}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {250}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/dct_inline.h: lines {119,155,167,278,326,341}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h: lines {178,225,437,517}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {405,436}
  • smlabt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {184}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {138}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/dct_inline.h: lines {131,143,294,310}
  • smlatt =====================================
    • external/neven/Embedded/common/src/b_BasicEm/Math.c: lines {585,590}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {157}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {441}
  • smlal =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v4.h: lines {179,223,236,257,267}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v4_gcc.h: lines {264,341}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {178,188,198}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_dct_9.s: lines {84,90,96,101,109,114,116,118,121,132,138,150,163,165,167,174,176,178}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_dct_9_gcc.s: lines {73,79,86,90,98,103,105,107,110,121,127,139,152,154,156,163,165,167}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18.asm: lines {143,162,178,188,192,199,207,217,225,231,237,241,244}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18.s: lines {145,164,180,190,194,201,209,219,227,233,239,243,246}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18_gcc.s: lines {143,162,178,188,192,199,207,217,225,231,237,241,244}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window.asm: lines {62,63,66,72,76,77,81,82,85,90,94,97,99,100,103,108,113,114,118,119,122,129,136,137,176,179,183,187,190,193}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window.s: lines {67,68,71,77,81,82,86,87,90,95,99,102,104,105,108,113,118,119,123,124,127,134,141,142,181,184,188,192,195,198}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window_gcc.s: lines {65,66,69,75,79,80,84,85,88,93,97,100,102,103,106,111,116,117,121,122,125,132,139,140,179,182,186,190,193,196}
    • external/opencore/codecs_v2/audio/mp3/dec/src/pv_mp3dec_fxd_op_arm.h: lines {148}
    • external/qemu/trace.c: lines {813}
    • frameworks/base/opengl/libagl/iterators.S: lines {66,67}
    • frameworks/base/opengl/libagl/matrix.h: lines {67,68,96,126,127,282,283,314,315,316}
  • smlawb =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {203,259}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {166,416}
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {93,109}
    • frameworks/base/opengl/libagl/matrix.h: lines {163,203}
  • smlawt =====================================
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {114}
    • frameworks/base/opengl/libagl/matrix.h: lines {162,202,243,244}
  • smulbb =====================================
    • external/jpeg/jidctfst.S: lines {109,114,151,153}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {79}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {71,81}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {207,251,297,348,361,375,427,440,487}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {199,234,274,314,316,326,367,369,404}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h: lines {121,137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h: lines {123,142}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h: lines {122,140}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h: lines {132,134,138,164,177,191}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h: lines {127,129,150,163}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h: lines {121,141}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {115,139,151,163,189,190,212}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {112,113,164,183,201,218,265}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h: lines {250,457,531}
    • external/skia/include/corecg/SkMath.h: lines {170}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {420,462}
    • system/core/libpixelflinger/t32cb16blend.S: lines {39,66,74,82}
  • smulbt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {115}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {109}
    • system/core/libpixelflinger/codeflinger/texturing.cpp: lines {1091}
    • system/core/libpixelflinger/t32cb16blend.S: lines {47,55}
  • smultt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {131}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {100}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {467}
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {73}
  • smulwb =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {221}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {373}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {222}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {283}
    • external/opencore/codecs_v2/audio/sbc/enc/src/sbcenc_filter.h: lines {33}
    • frameworks/base/opengl/libagl/matrix.h: lines {161,201,242}
  • smulwt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {202,240}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {385,415}
  • qadd =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {64}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {60}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {130,256}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {128,235}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h: lines {122,137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h: lines {123,145}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {71,102,152,176,192}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {91,115,148,202,234}
    • external/openssl/crypto/bn/bn_prime.c: lines {454,455}
  • qdadd =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/calc_sbr_synfilterbank.cpp: lines {116,162}
    • external/opencore/codecs_v2/audio/aac/dec/src/trans4m_freq_2_time_fxp.cpp: lines {472,494}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {212,356,370,385,435,449}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {200,315,321,331,368,371}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h: lines {122,142}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h: lines {133,136,140,172,186,201}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h: lines {128,131,158,172}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {116}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {184}
  • qdsub =====================================
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {302}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {275}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h: lines {124,147}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {140}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {165}
  • qsub =====================================
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {167}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {162}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h: lines {121,138}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {88,127}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {70,133}
  • strd =====================================
    • dalvik/vm/mterp/armv5/OP_APUT_WIDE.S: lines {31}
    • dalvik/vm/mterp/armv5/OP_IPUT_WIDE.S: lines {39}
    • dalvik/vm/mterp/armv5/OP_IPUT_WIDE_QUICK.S: lines {14}
    • dalvik/vm/mterp/armv5/OP_SPUT_WIDE.S: lines {21}
    • dalvik/vm/mterp/out/InterpAsm-armv5.S: lines {2834,7530,8331,8542}
    • dalvik/vm/oo/Object.h: lines {589}
    • external/opencore/fileformats/avi/parser/include/pv_avifile_streamlist.h: lines {179}
    • external/opencore/fileformats/avi/parser/src/pv_avifile_streamlist.cpp: lines {153}
    • system/core/libpixelflinger/rotate90CW_4x4_16v6.S: lines {47,52,56,60}


讨论

附注

档案

system/core/libpixelflinger/codeflinger/ARMAssembler.cpp

必须要特别的注意。它负责动态产生DSP程序。

建议

  • User:Cfriedt 20081024 我不确定它的可行性多高,因为SMedia 3362 被NDA保护。 然而,arm920t 缺乏浮点单元 / DSP core,它可能使用 SMedia chip 产生特定目地的方法?这对Android 平台来讲很有用,至少像是audio及 video codecs。 撇开OpenGL ES 驱动程序,欢迎提供针对SMedia 的 Openmoko文件。

重要连结

(欢迎大家在这里加入重要连结)

文件

指令设定参考

硬件参考

社群讨论

请参考

其它连结

Youtube video /Android on FreeRunner

Video 1

Video 2

Personal tools

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.

更新

  • 20081202 Koolu.com has released the source code for the FreeRunner port of Android in their git repositories at Koolu GIT (Press Release)
  • 20081120 Koolu.com has pushed back selling the OpenMoko Freerunner with Android pre-installed , as well as offering free downloads of the Freerunner port of Android to existing Freerunner owners. Untill December 2008
  • 20081104 The first Android-image has been successfully created by Sean McNeil! - sms and calling works, wifi and bluetooth doesn't. news-source
  • 20081029 User:Cfriedt Benno has modified Android's build system so that it will output a JFFS2 image instead of YAFFS . Unlike JFFS2, which can be mounted read-only from an image, mounting a YAFFS image is not possible unless it's already been written to flash (it complains about the block device being of type '1' and not 'NAND'). JFFS2 also has the benefit that it's a standard OpenMoko image format (See Flashing the Neo FreeRunner or Flashing the Neo 1973)
  • 20081023 User:Bricode 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
  • 20081022 User:Cfriedt I was able to 'trivially' compile all of the Android source code without error for the ARMv4T architecture by removing v5TE instructions. Although it will definitely not run anything predictably, at least now that I know the build system will work with a few simple substitutions in build/core/combo/arm-linux.mk. At this point I am able to go ahead and re-implement v5TE instructions as v4T instruction sequences instead (or re-implement entire sections of assembly with hand-optimized v4T instructions).
  • 20081021 User:Cfriedt Android -> FreeRunner updates on my blog
  • 20081021 Google released the majority source code for the phone under Apache free and open-source license, with portions covered by other existing licenses, such as the Linux kernel under GPLv2.
  • 200810?? Koolu.com has announced that they will be selling the OpenMoko Freerunner with Android pre-installed beginning in November 2008, as well as offering free downloads of the Freerunner port of Android to existing Freerunner owners. Well-known open-source advocate Jon "maddog" Hall is CTO and Ambassador for Koolu.

介绍

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.

目标

  1. Systematically introduce patches for ARMv4T in the Android codebase
  2. Provide Neo1973 and Neo FreeRunner hardware-dependent patches in the Android codebase, leveraging the work already done by the Openmoko developers, without forcing Android-specific changes upstream
  3. Provide a useable Android filesystem and kernel on the Distributions page that conform to current Openmoko installation routines

安装

Detailed instructions for installing Android on the Freerunner (using Sean McNeil's kernel and rootfs packages, and the Qi bootloader) can be found here.

早期尝试

As Ben Leslie had pointed out on his blog far before the source code was released, Android was originally designed to work with the ARMv5TE instruction set architecture (ISA), which allows for DSP enhanced instructions. Contrary to the ARMv5TE ISA, the Neo1973 and FreeRunner handsets both feature an arm920t core, which comply to the ARMv4T ISA.

Before the source code was released, kernel trap handlers were implemented to 'emulate' the ARMv5TE ISA. Although the results worked in many cases, trapping is costly and performance suffered as a result. Moreover, without explicitly knowing which conditions were set by various instructions, such as Thumb Mode execution, the result became nondeterministic.

当前状态

With the release of the Android source code, the Open Source community is no longer limited to dealing with a binary-only product. The Open Handset Alliance (OHA) has let their source code become their product for everyone enrich and benefit from.

Currently, porting efforts are underway in many circles. Patches should be submitted via the 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.

编译 Koolu Android 代码

  1. Configure your machine with the prerequisites documented in the Setting up your machine section of Google's build instructions.
  2. Install repo and download the source, as documented at http://trac.koolu.org/.
  3. 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
  4. The result of the previos step is a file, androidfs.jffs2, which may be flashed to your Freerunner.

生成jffs2 镜像

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 连接

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'
  • 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 .

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

Opcode Desription [PDF] Page Number C ASM
BLX(1) Branch, Link, and Exchange 166 N/A (Unused in Android) N/A (Unused in Android)
BLX(2) Branch, Link, and Exchange 168

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_BLX
... (inline asm) ...
#else
... (inline asm with equivalent blx code, as shown to the right) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_BLX
#define BLX(a) \
blx a
#else
#define BLX(a) \
mov pc,lr \
bx a
#endif
CLZ Count Leading Zeros 175

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_CLZ
... (inline asm) ...
#else
... (inline asm with equivalent clz code, as shown to the right) ...
#endif

User:Cfriedt 20081029

#ifdef HAVE_CLZ
#define CLZ(Rd,Rm) \
clz Rd,Rm
#else
#define CLZ(Rd,Rm) \
...
#endif
...
CLZ(Rd,Rm)
LDRD Load Registers Doubleword 200

User:Cfriedt 20081028 Substitute different inline assembly code with something like

#ifdef HAVE_LDRD
... (inline asm) ...
#else
... (inline asm with ldrd substituted) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_LDRD
#define LDRD(a,b) \
ldrd a,b
#else
#define LDRD(a,b) \
...
#endif
PLD Preload Data 240

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_PLD
... (inline asm) ...
#else
... (inline asm with pld removed) ...
#endif

User:Cfriedt 20081028 Remove or substitute with a macro reference such as

#ifdef HAVE_PLD
#define PLD(a,b) \
pld a,b
#else
#define PLD(a,b)
#endif
...
PLD(r0,#0)
SMLA<x><y> Signed Multiply-Accumulate 291
SMLAL<x><y> Signed Multiply Accumulate Long 298
SMLAW<y> Signed Multiply-Accumulate Word 302
SMUL<x><y> Signed Multiply 316
SMULW<y> Signed Multiply Word 320
QADD Saturating Add 242
QDADD Saturating Double and Add 249
QDSUB Saturating Double and Subtract 251
QSUB Saturating Subtract 253
STRD Store Registers Doubleword 349

User:Cfriedt 20081028 Substitute different inline assembly code with something like

#ifdef HAVE_STRD
... (inline asm) ...
#else
... (inline asm without strd) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_STRD
#define STRD(a,b) \
strd a,b
#else
#define STRD(a,b) \
...
#endif


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?).

{{scroll box|height=150px|text=

  • blx =====================================
    • bionic/libc/tools/gensyscalls.py: lines {168,186}
    • bootloader/legacy/nandwrite/init.S: lines {77}
    • bootloader/legacy/usbloader/init.S: lines {95}
    • dalvik/vm/arch/arm/CallEABI.S: lines {239}
    • dalvik/vm/arch/arm/CallOldABI.S: lines {145}
    • development/emulator/qtools/thumbdis.cpp: lines {187,265}
    • external/qemu/target-arm/translate.c: lines {1151,1971,2444}
    • external/qemu/trace.c: lines {774,1353,1358}
    • system/core/libpixelflinger/codeflinger/disassem.c: lines {416}
  • clz =====================================
    • development/emulator/qtools/armdis.cpp: lines {654}
    • external/opencore/codecs_v2/audio/aac/dec/src/pv_normalize.h: lines {67,84}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h: lines {137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h: lines {78,95}
    • external/opencore/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.h: lines {67,84}
    • external/opencore/codecs_v2/video/avc_h264/dec/src/vlc.cpp: lines {23}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h: lines {125,162,168,204,218}
    • external/qemu/target-arm/translate.c: lines {1247}
    • external/skia/libcorecg/Sk64.cpp: lines {340,341,343}
    • external/skia/libcorecg/SkMatrix.cpp: lines {500,501}
    • external/skia/libsgl/effects/SkColorMatrixFilter.cpp: lines {135}
    • external/skia/libsgl/sgl/SkBitmap.cpp: lines {945,946,947}
    • external/skia/libsgl/sgl/SkBitmapShader.cpp: lines {32,33,34}
    • external/skia/libsgl/sgl/SkGraphics.cpp: lines {429,437}
  • ldrd =====================================
    • dalvik/vm/mterp/armv5/OP_AGET_WIDE.S: lines {28}
    • dalvik/vm/mterp/armv5/OP_IGET_WIDE.S: lines {37}
    • dalvik/vm/mterp/armv5/OP_IGET_WIDE_QUICK.S: lines {10}
    • dalvik/vm/mterp/armv5/OP_SGET_WIDE.S: lines {17}
    • dalvik/vm/mterp/out/InterpAsm-armv5.S: lines {2653,7464,8318,8390}
    • system/core/libpixelflinger/rotate90CW_4x4_16v6.S: lines {40,41,42,43}
  • pld =====================================
    • bionic/libc/arch-arm/bionic/memcmp.S: lines {37,44,45,56,57,107,108,195,196}
    • bionic/libc/arch-arm/bionic/memcmp16.S: lines {37,44,45,67,68,116,117,198,199}
    • bionic/libc/arch-arm/bionic/memcpy.S: lines {55,56,57,145,266,293,320}
    • bionic/libc/arch-arm/bionic/strlen.c: lines {59,65}
    • bionic/libc/kernel/arch-arm/asm/arch/irqs.h: lines {162}
    • external/elfutils/src/Makefile: lines {243}
    • external/elfutils/src/Makefile.am: lines {32}
    • external/elfutils/src/Makefile.in: lines {243}
    • external/jpeg/jidctfst.S: lines {69,235,247}
    • external/qemu/target-arm/translate.c: lines {1149}
    • system/core/libpixelflinger/codeflinger/ARMAssembler.cpp: lines {368}
    • system/core/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp: lines {104,108,117}
    • system/core/libpixelflinger/t32cb16blend.S: lines {111,112,134,143}
  • smlabb =====================================
    • external/jpeg/jidctfst.S: lines {110,115,155,156}
    • external/neven/Embedded/common/src/b_BasicEm/Math.c: lines {584,589}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {147,166}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {120,129}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {514,533}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {418,429}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {202}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {250}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/dct_inline.h: lines {119,155,167,278,326,341}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h: lines {178,225,437,517}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {405,436}
  • smlabt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {184}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {138}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/dct_inline.h: lines {131,143,294,310}
  • smlatt =====================================
    • external/neven/Embedded/common/src/b_BasicEm/Math.c: lines {585,590}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {157}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {441}
  • smlal =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v4.h: lines {179,223,236,257,267}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v4_gcc.h: lines {264,341}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {178,188,198}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_dct_9.s: lines {84,90,96,101,109,114,116,118,121,132,138,150,163,165,167,174,176,178}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_dct_9_gcc.s: lines {73,79,86,90,98,103,105,107,110,121,127,139,152,154,156,163,165,167}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18.asm: lines {143,162,178,188,192,199,207,217,225,231,237,241,244}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18.s: lines {145,164,180,190,194,201,209,219,227,233,239,243,246}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18_gcc.s: lines {143,162,178,188,192,199,207,217,225,231,237,241,244}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window.asm: lines {62,63,66,72,76,77,81,82,85,90,94,97,99,100,103,108,113,114,118,119,122,129,136,137,176,179,183,187,190,193}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window.s: lines {67,68,71,77,81,82,86,87,90,95,99,102,104,105,108,113,118,119,123,124,127,134,141,142,181,184,188,192,195,198}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window_gcc.s: lines {65,66,69,75,79,80,84,85,88,93,97,100,102,103,106,111,116,117,121,122,125,132,139,140,179,182,186,190,193,196}
    • external/opencore/codecs_v2/audio/mp3/dec/src/pv_mp3dec_fxd_op_arm.h: lines {148}
    • external/qemu/trace.c: lines {813}
    • frameworks/base/opengl/libagl/iterators.S: lines {66,67}
    • frameworks/base/opengl/libagl/matrix.h: lines {67,68,96,126,127,282,283,314,315,316}
  • smlawb =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {203,259}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {166,416}
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {93,109}
    • frameworks/base/opengl/libagl/matrix.h: lines {163,203}
  • smlawt =====================================
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {114}
    • frameworks/base/opengl/libagl/matrix.h: lines {162,202,243,244}
  • smulbb =====================================
    • external/jpeg/jidctfst.S: lines {109,114,151,153}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {79}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {71,81}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {207,251,297,348,361,375,427,440,487}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {199,234,274,314,316,326,367,369,404}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h: lines {121,137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h: lines {123,142}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h: lines {122,140}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h: lines {132,134,138,164,177,191}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h: lines {127,129,150,163}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h: lines {121,141}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {115,139,151,163,189,190,212}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {112,113,164,183,201,218,265}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h: lines {250,457,531}
    • external/skia/include/corecg/SkMath.h: lines {170}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {420,462}
    • system/core/libpixelflinger/t32cb16blend.S: lines {39,66,74,82}
  • smulbt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {115}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {109}
    • system/core/libpixelflinger/codeflinger/texturing.cpp: lines {1091}
    • system/core/libpixelflinger/t32cb16blend.S: lines {47,55}
  • smultt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {131}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {100}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {467}
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {73}
  • smulwb =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {221}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {373}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {222}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {283}
    • external/opencore/codecs_v2/audio/sbc/enc/src/sbcenc_filter.h: lines {33}
    • frameworks/base/opengl/libagl/matrix.h: lines {161,201,242}
  • smulwt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {202,240}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {385,415}
  • qadd =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {64}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {60}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {130,256}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {128,235}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h: lines {122,137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h: lines {123,145}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {71,102,152,176,192}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {91,115,148,202,234}
    • external/openssl/crypto/bn/bn_prime.c: lines {454,455}
  • qdadd =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/calc_sbr_synfilterbank.cpp: lines {116,162}
    • external/opencore/codecs_v2/audio/aac/dec/src/trans4m_freq_2_time_fxp.cpp: lines {472,494}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {212,356,370,385,435,449}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {200,315,321,331,368,371}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h: lines {122,142}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h: lines {133,136,140,172,186,