How to understand the directory structure of the android root tree?

I downloaded the Android source code. And I want to make some changes to the source code in order to implement some functions that do not currently exist. But the problem here is that I can’t understand how the source code is organized, which files can be found where. Therefore, if someone can help me understand that it will be very helpful.

+47
android
Jan 28 2018-12-12T00:
source share
1 answer

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

  • Bionic - C-runtime for Android. Note that Android does not use glibc, like most Linux distributions. Instead, the c-library is called bionic and is mainly based on BSD sources. In this folder you will find the source for the c-library, math, and other core runtime libraries.
  • Boot code to download and run. Some of them are outdated, the fastboot protocol information may be interesting, since it is implemented by bootloaders in a number of devices, such as Nexus.
  • Build - an implementation of the build system, including all major file templates. The important file here is the envsetup.sh script, which will help you when working with the platform source. Running this script in a shell will allow teams to set up environment variables, build specific modules and grep in source code files.
  • Cts - compatibility tests. A set of tests to ensure that the build meets Android specifications.
  • Dalvik is the source code for implementing the Dalvik virtual machine.
  • Development - development projects, such as the source code for the sdk and ndk tools. This is usually not the folder that you touch when working with the platform for the purpose.
  • Device - product code for different devices. This is the place to search for hardware modules for various Nexus devices, create configurations, etc.
  • External - contains the source code for all external open source projects, such as SQLite, Freetype and webkit.
  • Frames - this folder is important for Android, as it contains sources for the framework. Here you will find the implementation of key services, such as a system server, with package and action managers. There are also many comparisons between Java APIs and native libraries.
  • Hardware and software source code, such as the specification and implementation of the Android hardware abstraction layer. This folder also contains a link to the interface interface (for communication with the modem side).
  • libcore - Apache Harmony.
  • libnativehelper - helper functions for use with JNI.
  • (Kernel) - is not part of the default download, but you can access this code either by downloading it manually or by adding a repository to the repo tool. Contains sources for the Linux Linux kernel version.
  • Out - assembly output will be posted here after make is launched. The folder structure is missing / target / product /. In the default assembly for the emulator, the output will be placed in out / target / product / generic. Here you will find images used by the emulator to run (or to download and play on the device if you are building 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 cross-compilation for different development machines.
  • System - source code files for the base Android system. This is the smallest Linux system that starts before the Dalvik virtual machine and all java-based services appear. This includes the source code for the init process and the default init.rc script, which provides dynamic platform configuration.
  • tools - Various IDE tools.

In addition to the above, you also have a hidden .repo directory that contains the source of the repo utility. It also contains a manifest specifying which git repositories you want to track for this Android source project. If you have your own add-ons, you can automatically track them by adding a local manifest here.

For platform modifications, there are some instructions available in the device / sample folder in the source tree. This will show you how to add the API on Android without changing the basic structure.

+127
Jan 28 '12 at 18:27
source share



All Articles