原文网址:http://bbs.chinaunix.net/thread-2009602-1-1.html


Google的Android操作系统已经成功面市,因为Android操作系统是基于Linux-2.6.25内核的,并且目前所有的源代码也都全部开放,因此可以简单地加以分析以方便以后向其他平台的移植工作.

首先需要了解的就是Android的一些基本情况,并下载Android的源代码以方便分析.

Android的官方站点:

http://www.android.com/

Android Source 的官方安装方法:

http://source.android.com/download
Android的中文站点:

http://www.androidin.com/

源代码包的相应联结地址:
http://www.androidin.com/android-2337-1-1.html

我们可以采用Android官方站点推荐方式来下载Android的源代码,也可以从Android中文站点直接下载源代码程序包,随后再更新和同步.

当采用Android官方推荐方式下载或者需要更新你的源代码时,都需要git工具支持, 当你的系统没有安装git或者git版本过低时,建议从下面的地址更新到最新的git包.(Android要求git版本必须大于1.5.4)

http://git.or.cz/

给git自动升级的方式:

git clone git://git.kernel.org/pub/scm/git/git.git


如果采用下载源代码包的方式,下载并展开后,在 .repo/repo 目录下有同步执行的文件repo, 你可以将其拷贝到你的PATH所在路径以备使用,例如/usr/bin等等. 或者也可以从Android站点得到最新的repo文件并复制到PATH所在路径.

wget http://android.git.kernel.org/repo

源代码包解开后,其主目录下存在repo_sync.sh文件, 其主要是执行repo sync以实现和Android站点同步代码包的目的, 当执行出错后将再一次运行repo sync命令直到同步正常结束,但原文件包含错误,建议改成下面的程序原文件中少了一个空格)

#!/bin/bash
echo "============start repo sync================="
repo sync
while [ $? = 1 ]; do
echo "============sync failed, re-sync again ====="
sleep 3
repo sync
done


这样, 运行sh repo_sync.sh就可以自动实现本地代码包的同步和更新动作了.

我在Fedora Core 6上经过同步之后, du -h ./mydroid, 占用空间大约是2.1G



在kernel子目录下存放的就是Android的Linux Kernel了, 通过和标准的Linux 2.6.25 Kernel的对比,我们可以发现,其主要增加了以下的内容:


1. 基于ARM架构增加Gold-Fish平台,相应增加的目录如下:

kernel/arch/arm/mach-goldfish

kernel/include/asm-arm/arch-goldfish

Gold-Fish平台采用的是ARM926T CPU作为BaseBand处理器, 该CPU主频至少为200M HZ. 采用MSM7201A CPU(ARM 11)作为主CPU, 其主频为528M HZ.


2. 增加了yaffs2 FLASH文件系统,相应增加的目录为:

kernel/fs/yaffs2

实际上,Android包经过编译后生成的system.img和ramdisk.img文件就是yaffs2格式的包.


3. 增加了Android的相关Driver,相应目录为:

kernel/drivers/android


主要分为:

Android IPC系统: Binder

Android 日志系统: Logger

Android 电源管理: Power

Android 闹钟管理: Alarm

Android 内存控制台: Ram_console

Android 时钟控制的gpio: Timed_gpio


4. 增加了switch处理, 相应的目录为:

kernel/drivers/switch/


5. 增加了一种新的共享内存处理方式, 相应增加的文件为:

kernel/mm/ashmem.c


6.其他为Linux-2.6.25内核所做的补丁等等,例如BlueTooth, 在此不做详细分析



另外GoldFish平台相关的驱动文件如下:

1. 字符输出设备:

kernel/drivers/char/goldfish_tty.c

2. 图象显示设备: (Frame Buffer)

kernel/drivers/video/goldfishfb.c

3. 键盘输入设备:

kernel/drivers/input/keyboard/goldfish_events.c

4. RTC设备: (Real Time Clock)

kernel/drivers/rtc/rtc-goldfish.c

5. USB Device设备:

kernel/drivers/usb/gadget/android_adb.c

6. SD卡设备:

kernel/drivers/mmc/host/goldfish.c

7. FLASH设备:

kernel/drivers/mtd/devices/goldfish_nand.c

kernel/drivers/mtd/devices/goldfish_nand_reg.h

8. LED设备:

kernel/drivers/leds/ledtrig-sleep.c

9. 电源设备:

kernel/drivers/power/goldfish_battery.c

10. 音频设备:

kernel/arch/arm/mach-goldfish/audio.c

11. 电源管理:

kernel/arch/arm/mach-goldfish/pm.c

12. 时钟管理:

kernel/arch/arm/mach-goldfish/timer.c



更多相关文章

  1. iOS Airplay--Airtunes音乐播放在Android盒子和手机上的实现 (终
  2. Android(安卓)USB Gadget复合设备驱动(打印机)测试方法
  3. 远程调测:Chrome on Android之三 调测WebView
  4. Android之Bluetooth
  5. Android应用程序启动过程源代码分析
  6. Google Android应用开发03 Android(安卓)SDK介绍
  7. 获取Android(安卓)SDK 源代码并在Eclipse中关联查看的方法
  8. AnDroidDraw.apk的安装
  9. 如何获取android源代码

随机推荐

  1. Android应用程序的调试方法
  2. Android热插拔事件处理流程
  3. Android调节屏幕亮度工具类BrightnessUti
  4. Android Http请求方法汇总
  5. fill_parent和wrap_content 区别和使用效
  6. 今天在网上看到了Google的GPhone的消息,学
  7. Android 设置ProgressBar 的颜色
  8. 一个项目搞明白Android 启动模式和taskAf
  9. Android:Implementing material design i
  10. android API key 如何获取