如何理解Android的根树的目录结构?结构、目录、Android

2023-09-12 08:23:24 作者:短暂-爱情

我已经下载了Android源$ C ​​$ C。我想作一些修改源$ C ​​$ C嵌入目前不存在某些功能。但这里的问题是,我不能够理解的来源$ C ​​$ C是有组织的,什么样的文件可能是找到在哪里。所以,如果有人可以帮助我了解,这将是非常有益的。

I have downloaded the android source code. And i want to make some modifications to the source code to embed some functionality which currently does not exist. But the problem here is that i am not able to understand how the source code is organised, what kind of files could be find where. So if someone could help me understand that it would be really helpful.

推荐答案

下面是短版你会发现,当你下载的Andr​​oid源。我会留下一些小的目录和深入挖掘了几个比较重要的。基本上,你会得到什么(基于当前的冰淇淋三明治版本),排名不分先后:

Here is short version of what you will find when you download the Android source. I will leave out some minor directories and dig deeper into a couple of the important ones. Basically what you will get (based on the current Ice Cream Sandwich release), in alphabetical order:

仿生 - C运行时为Android。需要注意的是Android的未使用的glibc最喜欢的Linux发行版。取而代之的是C语言库被称为仿生,并在BSD衍生的来源主要是基于。在此文件夹中找到源为C库,数学等核心运行时库。 可启动 - 启动和启动相关的code。其中一些是旧的,因为它是通过引导加载程序在多个设备上实现的FASTBOOT协议信息可能是有趣的,如Nexus的那些。 构建 - 构建系统实施,包括所有的核心制作文件模板。一个重要的文件,这里是envsetup.sh脚本与平台源工作时会帮助你很多。在shell运行此脚本将使命令来设置环境变量,构建特定的模块和grep源$ C ​​$ C文件。 中旅 - 的兼容性测试。测试套件,以确保构建符合Android的规范。 的Dalvik - 源$ C ​​$ C的Dalvik虚拟机执行 发展 - 相关的发展,如源$ C ​​$ C SDK和NDK工具项目。一般情况下不与目标平台的工作,当你触摸一个文件夹。 设备 - 产品的具体code为不同的设备。这是找硬件模块针对不同的Nexus设备,修建配置和更多的地方。 外部 - 包含源$ C ​​$ C所有外部开源项目,如SQLite的是,FreeType和WebKit 框架 - 这个文件夹是必不可少到Android,因为它包含了框架的来源。在这里,你会发现关键业务的实施,如系统服务器与封装和活动管理。许多Java应用程序的API和机库之间的映射也是在这里完成的。 硬件 - 硬件相关的源$ C ​​$ C,如Android的硬件抽象层技术规范和实施。此文件夹还包含了基准无线接口层实现(与调制解调器端进行通信)。 libcore - 阿帕奇和谐 libnativehelper - 辅助功能使用JNI使用 (内核) - 不属于默认源下载的,但你可以访问此code通过手动或通过添加存储库,以回购工具下载。包含Linux内核的Andr​​oid版本的源代码。 手续 - 构建输出将被放在这里,你运行后作出。该文件夹结构是出于/目标/产品/。在默认的内部仿真器的输出将被放置在输出/目标/产品/通用的。在这里,你会发现仿真器使用的图像开始(或下载和闪现的设备,如果你正在建设一个硬件目标)。 包 - 包含源$ C ​​$ C为默认应用程序,如联系人,日历,浏览器。 prebuilt - 包含分布在二进制形式,为方便起见文件。例子包括交叉编译工具链的不同发展机器。 系统 - 为核心的Andr​​oid系统源$ C ​​$ C文件。这是开始的Dalvik虚拟机之前,并启用了任何基于Java服务的最小Linux系统。这包括源$ C ​​$ c代表init进程和默认init.rc脚本提供了平台的动态配置 工具 - 各种IDE工具 Bionic - the C-runtime for Android. Note that Android is not using glibc like most Linux distributions. Instead the c-library is called bionic and is based mostly on BSD-derived sources. In this folder you will find the source for the c-library, math and other core runtime libraries. Bootable - boot and startup related code. Some of it is legacy, the fastboot protocol info could be interesting since it is implemented by boot loaders in a number of devices such as the Nexus ones. Build - the build system implementation including all the core make file templates. An important file here is the envsetup.sh script that will help you a lot when working with the platform source. Running this script in a shell will enable commands to setup environment variables, build specific modules and grep in source code files. Cts - the compatability tests. The test suite to ensure that a build complies with the Android specification. Dalvik - the source code for the implementation of the Dalvik Virtual Machine Development - projects related to development such as the source code for the sdk and ndk tools. Normally not a folder you touch when working with the platform for a target. Device - product specific code for different devices. This is the place to find hardware modules for the different Nexus devices, build configurations and more. External - contains source code for all external open source projects such as SQLite, Freetype and webkit. Frameworks - this folder is essential to Android since it contains the sources for the framework. Here you will find the implementation of key services such as the System Server with the Package- and Activity managers. A lot of the mapping between the java application APIs and the native libraries is also done here. Hardware - hardware related source code such as the Android hardware abstraction layer specification and implementation. This folder also contains the reference radio interface layer (to communicate with the modem side) implementation. libcore - Apache Harmony. libnativehelper - Helper functions for use with JNI. (Kernel) - not part of the default source download but you can get access to this code either by downloading it manually or by adding the repository to the repo tool. Contains the sources for the Android version of the Linux kernel. Out - the build output will be placed here after you run make. The folder structure is out/target/product/. In the default build for the emulator the output will be placed in out/target/product/generic. This is where you will find the images used by the emulator to start (or to be downloaded and flashed to a device if you are building for a hardware target). Packages - contains the source code for the default applications such as contacts, calendar, browser. Prebuilt - contains files that are distributed in binary form for convenience. Examples include the cross compilations toolchains for different development machines. System - source code files for the core Android system. That is the minimal Linux system that is started before the Dalvik VM and any java based services are enabled. This includes the source code for the init process and the default init.rc script that provide the dynamic configuration of the platform tools - Various IDE tools.

除了上面你也有隐藏的.repo目录包含源回购工具。它还拥有你想跟踪这个Android源项目是什么混帐存储库清单指定。如果你有自己的补充,你可以自动在这里添加本地清单跟踪。

Beyond the above you also have the hidden .repo directory that contains the source for the repo utility. It also holds the manifest specifying what git repositories you want to track for this Android source project. If you have your own additions you could automatically track them by adding a local manifest here.

有关的平台框架的修改有源$ C ​​$ C树的设备/样本文件夹中提供了一些指导。这将告诉你如何添加的API到Android,而无需修改核心框架。

For modifications of the platform framework there are some instructions available in the device/sample folder of the source code tree. That will show you how to add APIs to Android without having to modify the core framework.