android kernel和标准linux kernel的区别

2024-11-17 07:41:20
推荐回答(2个)
回答1:

android kernel和标准linux kernel的区别
总的区别可以归纳如下:
ARCH -- 这是Android修改了arch/arm下面的一些文件:
arch/arm:
Chg: arch/arm/kernel/entry-armv.S
Chg: arch/arm/kernel/module.c
Chg: arch/arm/kernel/process.c
Chg: arch/arm/kernel/ptrace.c
Chg: arch/arm/kernel/setup.c
Chg: arch/arm/kernel/signal.c
Chg: arch/arm/kernel/traps.c
Chg: arch/arm/mm/cache-v6.S
Chg: arch/arm/vfp/entry.S
Chg: arch/arm/vfp/vfp.h
Chg: arch/arm/vfp/vfphw.S
Chg: arch/arm/vfp/vfpmodule.c
Goldfish -- 这是Android为了模拟器所开发的一个虚拟硬件平台。Goldfish执行arm926T指令(在2.6.29中,goldfish也支持ATMv7指令),但是在实际的设备中,该虚拟平台的文件不会被编译。
arch/arm/mach-goldfish:
New: arch/arm/mach-goldfish/audio.c
New: arch/arm/mach-goldfish/board-goldfish.c
New: arch/arm/mach-goldfish/pdev_bus.c
New: arch/arm/mach-goldfish/pm.c
New: arch/arm/mach-goldfish/switch.c
New: arch/arm/mach-goldfish/timer.c
YAFFS2 -- 和PC把文件存储在硬盘上不一样, 移动设备一般把Flash作为存储设备。尤其是NAND flash应用非常广泛(绝大多数手机用的都是NAND flash,三星的一些手机使用的是OneNAND)。NAND flash具有低成本和高密度的优点。
YAFFS2 是“Yet Another Flash File System, 2nd edition" 的简称。 它提供在Linux内核和NAND flash设备 之前高效率的接口。 YAFFS2并没有包含在标准的Linux内核中, Google把它添加到了Android的kernel
fs/yaffs2:
New: fs/yaffs2/devextras.h
New: fs/yaffs2/Kconfig
New: fs/yaffs2/Makefile
New: fs/yaffs2/moduleconfig.h
New: fs/yaffs2/yaffs_checkptrw.c
New: fs/yaffs2/yaffs_checkptrw.h
New: fs/yaffs2/yaffs_ecc.c
New: fs/yaffs2/yaffs_ecc.h
New: fs/yaffs2/yaffs_fs.c
New: fs/yaffs2/yaffs_getblockinfo.h
New: fs/yaffs2/yaffs_guts.c
New: fs/yaffs2/yaffs_guts.h
New: fs/yaffs2/yaffsinterface.h
New: fs/yaffs2/yaffs_mtdif1.c
New: fs/yaffs2/yaffs_mtdif1.h
New: fs/yaffs2/yaffs_mtdif2.c
New: fs/yaffs2/yaffs_mtdif2.h
New: fs/yaffs2/yaffs_mtdif.c
New: fs/yaffs2/yaffs_mtdif.h
New: fs/yaffs2/yaffs_nand.c
New: fs/yaffs2/yaffs_nandemul2k.h
New: fs/yaffs2/yaffs_nand.h
New: fs/yaffs2/yaffs_packedtags1.c
New: fs/yaffs2/yaffs_packedtags1.h
New: fs/yaffs2/yaffs_packedtags2.c
New: fs/yaffs2/yaffs_packedtags2.h
New: fs/yaffs2/yaffs_qsort.c
New: fs/yaffs2/yaffs_qsort.h
New: fs/yaffs2/yaffs_tagscompat.c
New: fs/yaffs2/yaffs_tagscompat.h
New: fs/yaffs2/yaffs_tagsvalidity.c
New: fs/yaffs2/yaffs_tagsvalidity.h
New: fs/yaffs2/yportenv.h
Bluetooth -- Google为Bluetooth打上了patch,fix了一些Bluetooth的bug
drivers/bluetooth:
Chg: drivers/bluetooth/bfusb.c
Chg: drivers/bluetooth/bt3c_cs.c
Chg: drivers/bluetooth/btusb.c
Chg: drivers/bluetooth/hci_h4.c
Chg: drivers/bluetooth/hci_ll.c
Scheduler -- 对于Scheduler的改变非常小,我对它并没有去研究。
Chg: kernel/sched.c

New Android Functionality -- 除了fix一些bug以及其他一些小的更改,Android增加了一些新的功能,介绍如下:
IPC Binder -- The IPC Binder is an Inter-Process Communication (IPC) mechanism. It allows processes to provide services to other processes via a set of higher-level APIs than are available in standard Linux. An Internet search indicated that the Binder concept originated at Be, Inc., and then made its way into Palm's software, before Google wrote a new Binder for Android.
New: drivers/staging/android/binder.c
Low Memory Killer -- Android adds a low-memory killer that, each time it's called, scans the list of running Linux processes, and kills one. It was not clear in our cursory examination why Android adds a low-memory killer on top of the already existing one in the standard Linux kernel.
New: drivers/staging/android/lowmemorykiller.c
Ashmem -- Ashmem is an Anonymous SHared MEMory system that adds interfaces so processes can share named blocks of memory. As an example, the system could use Ashmem to store icons, which multiple processes could then access when drawing their UI. The advantage of Ashmem over traditional Linux shared memory is that it provides a means for the kernel to reclaim these shared memory blocks if they are not currently in use. If a process then tries to access a shared memory block the kernel has freed, it will receive an error, and will then need to reallocate the block and reload the data.
New: mm/ashmem.c
RAM Console and Log Device -- To aid in debugging, Android adds the ability to store kernel log messages to a RAM buffer. Additionally, Android adds a separate logging module so that user processes can read and write user log messages.
New: drivers/staging/android/ram_console.c
Android Debug Bridge -- Debugging embedded devices can best be described as challenging. To make debugging easier, Google created the Android Debug Bridge (ADB), which is a protocol that runs over a USB link between a hardware device running Android and a developer writing applications on a desktop PC.
drivers/usb/gadget:
New: drivers/usb/gadget/android.c
Chg: drivers/usb/gadget/composite.c
Chg: drivers/usb/gadget/f_acm.c
New: drivers/usb/gadget/f_acm.h
New: drivers/usb/gadget/f_adb.c
New: drivers/usb/gadget/f_adb.h
New: drivers/usb/gadget/f_mass_storage.c
New: drivers/usb/gadget/f_mass_storage.h

Android also adds a new real-time clock, switch support, and timed GPIO support. We list the impacted files for these new modules at the end of this document.
Power Management -- Power management is one of the most difficult pieces to get right in mobile devices, so we split it out into a group separate from the other pieces. It's interesting to note that Google added a new power management system to Linux, rather than reuse what already existed. We list the impacted files at the end of this document.
kernel/power:
New: kernel/power/consoleearlysuspend.c
New: kernel/power/earlysuspend.c
New: kernel/power/fbearlysuspend.c
Chg: kernel/power/main.c
Chg: kernel/power/power.h
Chg: kernel/power/process.c
New: kernel/power/userwakelock.c
New: kernel/power/wakelock.c
Miscellaneous Changes -- In addition to the above, we found a number of changes that could best be described as, 'Miscellaneous.' Among other things, these changes include additional debugging support, keypad light controls, and management of TCP networking.
(freedom_asic)

回答2:

Android 系统的Kernel 主要增加如下内容“
1. 基于 ARM 架构增加 Gold-Fish 平台 , 相应增加的目录如下 :
kernel/arch/arm/mach-goldfish
kernel/include/asm-arm/arch-goldfish
Gold-Fish 平台采用的是 ARM926T CPU 作为 BaseBand 处理器 , 该 CPU 主频至少为 200MHZ.而要流畅运行Android 系统的CPU 主频至少要在400MHZ 以上,也就是说如果你要上Android 系统,最好是选用基于ARM11 及以上平台进行开发。
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