您的位置:首页 > 移动开发 > Android开发

android系统源码结构大致分析

2014-02-14 22:49 519 查看
android源码项目结构分析

1.android源码的是一个类似于应用软件的项目,那么android源码这个项目就必定需要模块化,这一点需要清楚。

那么我们就来看看源码的目录模块:

ls

bionic cts device hardware libcore out sdk

bootable dalvik external initpath.sh Makefile packages system

build development frameworks kernel ndk prebuilt

除了initpath.sh是我自定义脚步和makefile,一共25个目录,就是说一共25个模块,其中out是编译器生成的,

一个一个看。

bionic:bionic翻译为仿生学的模块,字面上是支持超级体系结构,

大概意思就是提供c库来支持类似于生物的超级的体系结构。

{

Android.mk libc(c库) libm(math库) libthread_db(Debugging with GDB) MAINTAINERS

CleanSpec.mk libdl(动态库) libstdc++(c++的标准库) linker(链接器)
ThirdPartyProject.prop

}

vim bionic/MAINTAINERS

Bionic support for SuperH

-------------------------

Bionic support for SuperH architecture is written by

Shin-ichiro KAWASAKI <shinichiro.kawasaki.mg@hitachi.com>

and Contributed to Android by Hitachi, Ltd. and Renesas Solutions Corp.

vim bionic/Android.mk

LOCAL_PATH := $(call my-dir)

ifneq ($(TARGET_SIMULATOR),true)
#如果TARGET_SIMULATOR为1,即软件仿真

include $(call all-subdir-makefiles)#包含子makefiles

else

# The host dalvikvm needs Android's concatenated & indexed timezone data.

include $(LOCAL_PATH)/libc/zoneinfo/Android.mk #包含时区数据

endif

vim bionic/ThirdPartyProject.prop

# Copyright 2011 Google Inc. All Rights Reserved.

#Fri Jul 16 10:03:08 PDT 2010 #第三部分项目支持

currentVersion=Unknown

version=Unknown

isNative=true

feedurl=http\://www.openbsd.org/security.html

name=openbsd

keywords=openbsd

onDevice=true

homepage=http\://openbsd.org

bootable:bootable是启动linux内核相关的引导代码。

{

bootloader(boot) diskinstaller(disk装载器) recovery(恢复)

}

bootloader:启动程序(英语:boot loader,也称启动加载器,引导程序)位于计算机或其他计算机应用上,

是指引导操作系统启动的程序。http://zh.wikipedia.org/wiki/%E5%95%9F%E5%8B%95%E7%A8%8B%E5%BC%8F

电源==>>BIOS==>>MBR==>>NTLDR、GNU GRUB==>>操作系统

diskinstaller:disk装载器

recovery:恢复器

build:build存放系统编译规则,基本都是一些shell脚本和.mk文件。

{

buildspec.mk.default CleanSpec.mk core envsetup.sh libs target tools

}

vim build/envsetup.sh

Invoke ". build/envsetup.sh" from your shell to add the following functions to yourenvironment:

- croot: Changes directory to the top of the tree.

- m: Makes from the top of the tree.

- mm: Builds all of the modules in the current directory.

- mmm: Builds all of the modules in the supplied directories.

- cgrep: Greps on all local C/C++ files.

- jgrep: Greps on all local Java files.

- resgrep: Greps on all local res/*.xml files.

- godir: Go to the directory containing a file.

Look at the source to view more functions. The complete list is:

cts:cts是android兼容性测试套件标准。

{

Android.mk CleanSpec.mk CtsTestCaseList.mk development tests

apps CtsHostLibraryList.mk CtsTestCoverage.mk libs tools

}

dalvik:dalvik虚拟机,其执行javac编译完成的.class文件

{

Android.mk dexdump docs hit MODULE_LICENSE_APACHE2 tests

CleanSpec.mk dexlist dvz libdex NOTICE tools

dalvikvm dexopt dx libnativehelper README.txt vm

}

development:高层的开发和调试工具,即应用程序开发相关,包括蓝牙调试程序,子库,浏览器插件以及home页面等等。

{

apps cmds host pdk sdk testrunner

build data ide samples sdk_overlay tools

CleanSpec.mk docs ndk scripts simulator tutorials

}

device:一些设备模块。

{

common google htc sample samsung

}

external:android使用的一些从外面取得的开源组件,报告webkit内核,sqlite,多媒体框架,图形引擎等。

{

apache-http elfutils jdiff nist-sip strace

astl embunit jhead oauth svox

bison emma jpeg openssl tagsoup

blktrace esd jsr305 oprofile tcpdump

bluetooth expat junit ping tinyxml

bouncycastle fdlibm kernel-headers ppp tremolo

bsdiff freetype libffi proguard v8

bzip2 fsck_msdos libgsm protobuf webkit

chromium genext2fs libnfc-nxp qemu wpa_supplicant

clearsilver giflib libpcap quake wpa_supplicant_6

dbus grub libpng safe-iop xmlwriter

dhcpcd gtest libvpx skia yaffs2

dnsmasq guava libxml2 sonivox zlib

dropbear icu4c mtpd speex

e2fsprogs iproute2 netcat sqlite

easymock ipsec-tools netperf srec

elfcopy iptables neven stlport

}

frameworks:核心框架使用java和c++语言编写。

{

base ex opt

}

hardware:部分厂家开源的HAL代码。

{

broadcom libhardware libhardware_legacy msm7k qcom ril ti

}

kernel:android内核的源码。

{

common goldfish msm

goldfish:

{

arch drivers Kbuild modules.order scripts vmlinux

block firmware kernel Module.symvers security vmlinux.o

COPYING fs lib net sound

CREDITS include MAINTAINERS README System.map

crypto init Makefile REPORTING-BUGS usr

Documentation ipc mm samples virt

}

}

libcore:编译后会生成一些代码库。

{

AndroidManifest.xml expectations junit run-core-tests-on-ri

Android.mk icu luni sqlite-jdbc

CleanSpec.mk include NativeCode.mk support

dalvik JavaLibrary.mk NOTICE ThirdPartyProject.prop

dom json run-core-tests xml

}

ndk:ndk工具建造器

{

Android.mk CleanSpec.mk documentation.html ndk-build README.TXT tests

build docs GNUmakefile ndk-gdb sources toolchains

}

out:编译链接后生成的模块,包含system.img,userdata.img,diskram.img等。

{

casecheck.txt CaseCheck.txt host target tmp versions_checked.mk

}

packages:应用程序包,闹钟,日历,相机,电话等等

{

apps experimental inputmethods providers wallpapers

}

prebuilt:x86和arm架构下cpu与编译的一些资源。

{

android-arm android-x86 darwin-x86 linux-x86_64 windows

Android.mk CleanSpec.mk darwin-x86_64 ndk windows-x86_64

android-sh common linux-x86 sdk

}

sdk:编译后得到sdk包和模拟器。

{

androidprefs CleanSpec.mk emulator layoutopt templates

anttasks ddms eventanalyzer ninepatch traceview

apkbuilder docs files screenshot

archquery draw9patch hierarchyviewer sdklauncher

build dumpeventlog layoutlib_api sdkmanager

changes.txt eclipse layoutlib_utils sdkstats

}

system:用c语言编写的文件系统库,应用及组件

{

bluetooth core extras media netd vold wlan

}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: