目录层,out层,device 层,kernel 编译,Android编译等。
The Android device tree structure, is laid out as follows:
build/ – Build environment setup and makefiles
bionic/ – Android C library
dalvik/ – Android JVM
kernel/ – Linux kernel
framework/ – Android platform layer (system libraries and Java components)
system/ – Android system (utilities and libraries, fastboot, logcat, liblog)
external/ – Non-Android-specific Open Source projects required for Android
prebuilt/ – Precompiled binaries for building Android, e.g., cross-compilers
packages/ – Standard Android Java applications and components
development/ – Android reference applications and tools for developers
hardware/ – Hardware abstraction layer (audio, sensors) and some hardware-specific
wrappers
vendor/xxx/ – plat target definitions, e.g., msm8974_surf
vendor/xxx-proprietary – plat-proprietary components, e.g. MM, etc.
out/ – Built files created by user
out/host/ – Host executables created by the Android build
out/target/product/<product> – Target files
– appsboot.mbn – Applications boot loader
– boot.img – Android boot image (Linux kernel + root FS)
– system.img – Android components (/system)
– userdata.img – Android development applications and database
– root/ – Root FS directory, which compiles into ramdisk.img and merged into boot.img
– system/ – System FS directory, which compiles into system.img
– obj/ – Intermediate object files
• include/ – Compiled include files from components
• lib/
• STATIC_LIBRARIES/
• SHARED_LIBRARIES/
• EXECUTABLES/
• APPS/
symbols/ – Symbols for all target binaries
Android target tree structure
The Android target tree structure is laid out as follows:
/ – Root directory (ramdisk.img, read-only)
init.rc – Initialization config files (device config, service startups) init.qcom.rc
dev/ – Device nodes
proc/ – Process information
sys/ – System/kernel configuration
sbin/ – System startup binaries (ADB daemon; read-only)
system/ – From system.img (read-write)
– bin/ – Android system binaries
– lib/ – Android system libraries
– xbin/ – Nonessential binaries
– framework/ – Android framework components (Java)
– app/ – Android applications (Java)
– etc/ – Android configuration files
sdcard/ – Mount point for SD card
data/ – From userdata.img (read-write)
– app/ – User installed Android applications
– tombstones/ – Android crash logs
To build tiny Android, use:
$ make BUILD_TINY_ANDROID=true -j4
Build Linux kernel manually
To build the Linux kernel manually:
1. Set up the Android build environment (envsetup.sh/choosecombo).
2. Change to the kernel directory (kernel/).
3. Set up the correct kernel configuration with the following command:
make –j16
4. Build the kernel image with the following command:
make -j3 ARCH=arm CROSS_COMPILE=arm-eabi- zImage
5. If desired, build the optional kernel modules with this command:
make -j3 ARCH=arm CROSS_COMPILE=arm-eabi- modules
The resulting kernel image will appear in kernel/arch/arm/boot/zImage.
NOTE: In theory, it is possible to use –jn as long as ‘n’ is smaller than the number of processors in
the server where the build is being made.
6. To start with a clean tree, use the following commands:
a. To remove object files:
make clean
b. To remove all generated files:
make distclean
Build Android manually
1. Set up the Android build environment (envsetup.sh/choosecombo).
2. Change to the main Android directory.
3. Build with the following command:
make -j4
4. To build individual components, choose one of the following options:
To run make from the top of the tree, use the command:
m <component name> # E.g. m libril-qc-1
To build all of the modules in the current directory, change to the component directory
and use the following command:
mm
5. To delete individual component object files, choose one of the following options:
To delete a particular module, use the command:
m clean-<module name>
To delete a module within a given path, use these commands:
rm -rf out/target/product/*/obj/STATIC_LIBRARIES/
<module name>_intermediates
rm -rf out/target/product/*/obj/SHARED_LIBRARIES/
<module name>_intermediates
rm -rf out/target/product/*/obj/EXECUTABLES/
<module name>_intermediates