Chinaunix首页 | 论坛 | 博客
  • 博客访问: 120519
  • 博文数量: 16
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 222
  • 用 户 组: 普通用户
  • 注册时间: 2014-07-23 22:32
个人简介

这个博客已经停止更新,请访问blog.mxslly.com

文章分类
文章存档

2018年(4)

2016年(3)

2015年(8)

2014年(1)

我的朋友

分类: Android平台

2015-02-24 23:17:21

最近想为我的三星i699i移植CM,这是我翻译自wiki.Cyanogenmod的资料,英语水平有限,大家能理解就可以了
Doc: the cm source cm
源代码

Each of the main directories has different stuff in it. Here are just a few off the top of my head to get you started. The description is fairly flippant and incomplete and perhaps inaccurate, and I'm going to skip some directories because it'll get unwieldy (and I don't know necessarily what every directory does), but it's just to give you a vague idea of some of the more important folders...

每个主要的目录都有不同的cm系统组件在里面。这里只是一些我为了让你入门说的粗浅的见解。这些描述是相当粗略、不完整或许还有不准确,而且我会跳过一些复杂不好介绍的目录(其实我自己都不确切知道每个目录的作用),但是这只是给你对一些更重要的文件夹的一个大概的概念。

Note:

This is seriously all just typed off the cuff, without really much thought. It's certainly an incomplete description. The best way to discover what to play with is just to start exploring, changing stuff, and building. The directory names are usually indicative of what you'll find inside, and the best source of documentation is the code itself.

注意:

这只是带你入门。这些确实是一个不完全的描述。最好的发现去玩什么的方法就是开始探索,改变组件和编译。目录的名字通常会暗示你会在里面发现什么。最好的文档资源其实就是代码本身。

目录

 [

·        

·        

·        

·        

·        

·         6 device/

·        

·        

·        

·        

·        

·        

·        

·        

·        

·        

·        

·        

bionic/

bioni c

 is the Android mobile-friendly version of . You generally don't need to touch anything in here. Lots of cpu-specific stuff and better not to stick your nose in here, although  did manage to speed up performance on some devices by tweaking various things. If you're a coding ninja, you can play with this. But on the other hand, if you were a coding ninja you probably aren't reading this.

Bionic是为安卓移动优化版本的c库函数。通常你没有必要碰里面的任何东西。许多和CPU相关的组件而且……不过话说回来最好不要碰了,即使linaro这种东西是专门来加速一些设备的表现通过加速各种东西。如果你是一个代码专家当然你可以碰。但另一方面如果你是一个代码专家你也不可能读这些东西。

build/编译

The scripts and various files that are used for the actual  process. Take a look in here if you're curious what steps are taken to make all the parts of Android compile, as well as various "make" commands. (Some of the flags used for compiling have been further enhanced by CyanogenMod for Google non-supported platforms.) Some familiarity with GNU make and the  are helpful. There's also documentation  and here.

许多脚本和各种文件被使用为了编译过程。如果你好奇于为了生成安卓的所有部分什么步骤被采取了,以及各种make命令。(一些被使用的编译标志被Cyanogenmod增强了,为了一些谷歌不支持的平台)一些对gnumakemake编译系统的熟悉是有帮助的。也有一些文档在这里。

bootable/启动相关的

Among other things, the source for  recovery is in here.

除了其他的东西,clockworkmod recovery的源代码资源是在这里。

dalvik/dalvik虚拟机

 is the virtual machine that runs the java apps. It's how you can write an app and it'll run on any android machine, regardless of the underlying architecture. In the "Lollipop" 5.0 version of Android, Dalvik was replaced with , the Android Run Time.

Dalvik是用来运行java应用的虚拟机。Java应用是你写一个应用程序的方式而且它能运行在任何安卓机器上而不管底层的架构。在棒棒糖安卓5.0版本里dalvikART——安卓运行时环境代替。

art/安卓运行时环境

ART (Android RunTime) is a replacement for Dalvik introduced in Android 4.4 (KitKat). Rather than "just-in-time" compilation, ART pre-compiles every app in advance for faster execution later.

ART一个在安卓4.4奇巧中引入的dalvik虚拟机的代替。不是“及时的”编译,ART事先预编译每一个应用,这样可以在后来的执行时取得更好的速度。

device/设备

device/ contains part (if not all) of the board support packages and configurations for a 'particular' device, and is organized as device//. So the files for the Nexus 7 tablet are under device/asus/grouper/, the files for Nexus 4 phone are under device/lge/mako/, etc. The device/ folder, therefore, is where to put the customized stuff for EACH particular device running Android. So-- if you want to do a port of Android for a particular device that currently has no source, you should probably start by finding a similar device (with a similar underlying platform) and use it as a "base" for modifying for that device. Do take a peek into device/asus/grouper to see the various files that are used to build for the Nexus 7 and compare with other devices.

设备文件夹包含部分(如果不是全部)的板子支持包和为特定设备的配置文件,而且被组织成像device/销售商/开发代号名  的样子。所以Nexus 7平板的文件是在device/asus/grouperNexus 4手机是在device/lgd/mako,等等。因此这个设备文件夹是为每个特定的运行安卓的设备放置专门定制的组件的地方。如果你想去为一种特定的目前没有源代码的设备适配一个安卓的版本,你应该通过找到一个相似的设备(就是有相似的底层架构)开始,而且使用他的代码作为基础来修改适配这个设备。可以稍微看看device/asus/grouper来了解用来为nexus 7编译的各种文件并且可以和其他设备相比较。

Note:注意

Many of the  files that control Android core functionality and verbiage (strings) can be overridden by new .xml files that you place in the device-specific device/[vendor]/[codename]/overlay folder.

许多控制安卓核心功能的xml文件可能被你放进去的新的xml文件忽视,在这个设备特定的文件夹里面。

Note:注意

Just downloading the source code for CyanogenMod does *not* download the device/ directories for every single device that has been ported to CyanogenMod (that would be a LOT of extra folders you probably don't need or want). To get the device folder for a particular device, use thebreakfast command from the root of the source code. So to get the grouper device (and kernel) folders, you'd type breakfast grouper and then repo sync and it should appear.

只是下载cm的源码是不会下载device目录的,这个目录是为了每个已经被适配到cyanogenmod的特定的设备(这样就不会有很多额外的你可能不需要不想要的文件夹)。那么为了得到某个特定的设备的文件夹,就应该从源码的根目录使用breakfast命令。比如为了得到grouper设备(和内核)的文件夹,你应该输入breakfast grouper 然后repo sync然后你要的就会出现。

docs/doc文档

Contains the source code for the  website.

包含为了安卓开源网站的源代码。

external/外部组件

This is where non-android specific utilities go. Lots of the stuff in here are just regular open source projects that are used by Android (or CyanogenMod) and just have the Android.mk make files to work with the Android build system.

这是非特定用于安卓的工具去的地方。许多在这里的组件只是一般的开源项目,这些项目被安卓(或者cyanogenmod)使用,而且仅仅有Android.mk make文件来配合安卓编译系统工作。

frameworks/框架

This refers to the core Android . It's the stuff that makes Android, Android. The frameworks contain the Android user experience and the abstracted "hooks" that programmers use to build Android apps. So, for example, this folder contains the Java windows-manipulation and activity stuff and java sound support and Android graphics layers and Android media stuff and UI as well as services and basically the Android API in general. There are also some platform-specific optimization here as well that CyanogenMod adds for Qualcomm, OMAP, and other manufacturers to get the best performance out of specific architectures. This folder has many different parts, but if you want to play with the Android platform itself and its basic functionality, this is probably the place to look.

这指代的是核心安卓框架。他是组成安卓的组件。这个框架包括安卓用户的体验和程序员使用来构建安卓应用的抽象的钩子。所以例如这个文件夹大体上包含java的窗口处理、活动组件、Java声音支持、安卓图形层、安卓媒体组件、UI、服务和基本的安卓API。这里也有一些平台特定的优化,这是cyanogenmod为高通、OMAP和其他生厂商添加的,为了通过特定的架构得到最好的表现。这个文件夹有不同的部分,但是如果你想接触安卓平台本身和它的基本的功能,这可能是应该看的地方。

hardware/硬件

Platform/hardware-specific libraries and such go in this folder. For example, the code in hardware/ti is used to support devices using a chipset by Texas Instruments.

特定的平台/硬件的库在这个文件夹里。例如在hardware/ti里的代码被用来支持使用德州仪器芯片组的设备。

kernel/内核

Like device/kernel/ directories are organized like kernel// and inside there you'll find the source for the kernel. This source may be downloaded "on the fly" by the CyanogenMod build system. See the note in the device/ section above about using the breakfast command to auto-include a particular device's kernel/ directory when you repo sync to auto-update the codebase.

devicekernel目录被组织得像kernel/生产商/开发代号。在那里面你会发现内核的代码。这个资源可以被cyanogenmod编译系统远程下载。看device部分的注意,关于使用breakfast命令来自动包含某个特定设备的内核目录,在你repo sync来自动更新代码库的时候。

ndk/

See here. Tools for allowing cross-platform C code to be included in Android apps (as JNI shared libraries, apparently). Used if you're writing C-based apps, but I've never used any of this or even poked my nose in there. See /ndk/docs/OVERVIEW.html for more.

看这里。这些工具允许跨平台的c代码包含在安卓应用中(像JNI共享库,似乎)。如果你写基于c的应用这些工具会被使用,但是我从没有使用过任何这些东西,甚至看都没看一眼这些东西。

out/输出

The output of your build will go in here by default. When you type cd $OUT after building, you're actually getting a shortcut toout/target/product/. This is the only folder that should have stuff added to it (or changed) when you're doing a build. stuff that will become the system folder on your device goes in system. Stuff that will become your ramdisk goes in root. The various stages and temporary scripts used to create yourrecovery.img and boot.img and your kernel go here as well. The object files get built into the obj directory. And there are generic compiler tools and other build (such as from the ndk) and such that get built in out/ as well. When you do a make clobber, you're just getting rid of out/.

你的编译的输出会默认放在这里。当你在编译后键入cd $OUT时,你会得到一个通向out/terget/product/设备名 的捷径。这是在编译时有组件添加上去(或者改变)的唯一的文件夹。会在你的设备上变成系统文件夹的组件会进入system这个文件夹。会变成你的内存盘的组件会进入root文件夹。用来创建你的recovery镜像和boot镜像和你的内核的各种阶段和临时脚本文件也会来这里。目标文件会被编译进obj目录。也有通用的编译器和其他的东西(比如来自ndk),这些也会被编译到out文件夹。在你输入make clobber时,你只是去除了out文件夹。

packages/

packages/apps/ is where Android standalone apps, such as the Settings app, the Browser, the Launcher (in CM10's case it's called Trebuchet), and other apps go. Note that many of these apps are integrated directly with functionality within the frameworks/ directory. So the settings changed in the Settings app will correlate to stuff in the frameworks/ folder. Non-app packages such as input methods and wallpapers go here as well.

Packages/apps/是安卓独立的应用的地方,例如设置应用、浏览器、启动器(在cm10的例子中被称作trebuchet)和其他的应用。注意到许多应用被直接集成在frameworks目录里。所以在设置应用里的设置的改变会和frameworks文件夹的组件相联系。非应用包例如输入法和墙纸也会来这里。

prebuilt/ (and prebuilts/)预编译

These folders contain prebuilt  for cross-compiling on linux and darwin (MacOS X) and a few tools for Windows. Cross-compiling allows you to build Android for an architecture (such as ARM-based CPU) from another architecture (such as x86_64).

这些文件夹包含预编译工具链,包括在linuxDarwinMacOS X)和一些Windows平台的工具。交叉编译允许你在一个架构上(比如x86_64架构)为另一种架构(比如基于ARMCPU)编译安卓。

system/系统

Lower-level linuxy system stuff such as  support, the shell (which you can use to type commands into your device), etc. are here.

这里是低层的linux系统组件,比如netd(就是network daemon,网络守护进程,译者注),fastboot的支持,shell(就是你用来向你的设备输入命令的东西)等等。

vendor/供应商

The /vendor folder contains stuff particular to a  build such as CyanogenMod. It's also the place where proprietary blobs are extracted from the device, again using the same vendor/device codename convention as under device/.

Vendor文件夹包含针对特定供应商例如cyanogenmod的组件。它也是属性文件从设备提取的地方,在device文件夹下再一次使用相同的设备/供应商代码惯例。

Based On: http://forum.xda-developers.com/showthread.php?p=30802167#post30802167

See also

·         .

·        

·        

 

阅读(1722) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~