• Android kernel和标准Linux Kernel的差异


     在这里 http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/Porting-Android-to-a-new-device/ 发现一篇分析Android kernel与标准kernel的差异的文章,但是,作者用的是2.6.25的内核,我发现在Android2.6.29内核中,与之前相比,有了很多改变,因此在上面link中的文章的基础上,重新分析了2.6.29版本的Android kernel和标准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把它添加到了Androidkernel

      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 --  GoogleBluetooth打上了patchfix了一些Bluetoothbug

      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.

    附: 差异表:

       1. arch/arm: 
       2.     Chg: arch/arm/kernel/entry-armv.S 
       3.     Chg: arch/arm/kernel/module.c 
       4.     Chg: arch/arm/kernel/process.c 
       5.     Chg: arch/arm/kernel/ptrace.c 
       6.     Chg: arch/arm/kernel/setup.c 
       7.     Chg: arch/arm/kernel/signal.c 
       8.     Chg: arch/arm/kernel/traps.c 
       9.     Chg: arch/arm/mm/cache-v6.S 
      10.     Chg: arch/arm/vfp/entry.S 
      11.     Chg: arch/arm/vfp/vfp.h 
      12.     Chg: arch/arm/vfp/vfphw.S 
      13.     Chg: arch/arm/vfp/vfpmodule.c 
      14.  
      15. arch/arm/mach-goldfish: 
      16.     New: arch/arm/mach-goldfish/audio.c 
      17.     New: arch/arm/mach-goldfish/board-goldfish.c 
      18.     New: arch/arm/mach-goldfish/pdev_bus.c 
      19.     New: arch/arm/mach-goldfish/pm.c 
      20.     New: arch/arm/mach-goldfish/switch.c 
      21.     New: arch/arm/mach-goldfish/timer.c 
      22.  
      23. block: 
      24.     Chg: block/blk-core.c 
      25.     Chg: block/genhd.c 
      26.  
      27. drivers/base/power: 
      28.     Chg: drivers/base/power/main.c 
      29.  
      30. drivers/bluetooth: 
      31.     Chg: drivers/bluetooth/bfusb.c 
      32.     Chg: drivers/bluetooth/bt3c_cs.c 
      33.     Chg: drivers/bluetooth/btusb.c 
      34.     Chg: drivers/bluetooth/hci_h4.c 
      35.     Chg: drivers/bluetooth/hci_ll.c 
      36.  
      37. drivers/char: 
      38.     New: drivers/char/dcc_tty.c 
      39.     New: drivers/char/goldfish_tty.c 
      40.     Chg: drivers/char/mem.c 
      41.  
      42. drivers/cpufreq: 
      43.     Chg: drivers/cpufreq/cpufreq_conservative.c 
      44.     Chg: drivers/cpufreq/cpufreq_ondemand.c 
      45.  
      46. drivers/i2c: 
      47.     New: drivers/i2c/chips/pca963x.c 
      48.  
      49. drivers/input: 
      50.     Chg: drivers/input/evdev.c 
      51.     Chg: drivers/input/input.c 
      52.     New: drivers/input/keyboard/goldfish_events.c 
      53.     New: drivers/input/keyreset.c 
      54.     New: drivers/input/misc/gpio_axis.c 
      55.     New: drivers/input/misc/gpio_event.c 
      56.     New: drivers/input/misc/gpio_input.c 
      57.     New: drivers/input/misc/gpio_matrix.c 
      58.     New: drivers/input/misc/gpio_output.c 
      59.     New: drivers/input/misc/keychord.c 
      60.     New: drivers/input/touchscreen/synaptics_i2c_rmi.c 
      61.  
      62. drivers/leds: 
      63.     New: drivers/leds/ledtrig-sleep.c 
      64.  
      65. drivers/misc: 
      66.     New: drivers/misc/apanic.c 
      67.     New: drivers/misc/kernel_debugger.c 
      68.     New: drivers/misc/pmem.c 
      69.     New: drivers/misc/qemutrace 
      70.     New: drivers/misc/uid_stat.c 
      71.     New: drivers/misc/wl127x-rfkill.c 
      72.  
      73. drivers/mmc: 
      74.     Chg: drivers/mmc/card/block.c 
      75.     Chg: drivers/mmc/core/bus.c 
      76.     Chg: drivers/mmc/core/core.c 
      77.     Chg: drivers/mmc/core/debugfs.c 
      78.     Chg: drivers/mmc/core/sd.c 
      79.     Chg: drivers/mmc/core/sdio_bus.c 
      80.     Chg: drivers/mmc/core/sdio.c 
      81.     Chg: drivers/mmc/core/sdio_io.c 
      82.     New: drivers/mmc/host/goldfish.c 
      83.  
      84. drivers/mtd: 
      85.     New: drivers/mtd/devices/goldfish_nand.c 
      86.     New: drivers/mtd/devices/goldfish_nand_reg.h 
      87.     Chg: drivers/mtd/nand/nand_base.c 
      88.  
      89. drivers/net: 
      90.     New: drivers/net/pppolac.c 
      91.     New: drivers/net/pppopns.c 
      92.  
      93. drivers/power: 
      94.     New: drivers/power/goldfish_battery.c 
      95.  
      96. drivers/rtc: 
      97.     New: drivers/rtc/alarm.c 
      98.     Chg: drivers/rtc/class.c 
      99.     New: drivers/rtc/rtc-goldfish.c 
     100.  
     101. drivers/serial: 
     102.     Chg: drivers/serial/serial_core.c 
     103.  
     104. drivers/staging/android: 
     105.     New: drivers/staging/android/binder.c 
     106.     New: drivers/staging/android/lowmemorykiller.c 
     107.     New: drivers/staging/android/ram_console.c 
     108.     New: drivers/staging/android/timed_gpio.c 
     109.     New: drivers/staging/android/timed_gpio.h 
     110.     New: drivers/staging/android/timed_output.c 
     111.     New: drivers/staging/android/timed_output.h 
     112.  
     113. drivers/switch: 
     114.     New: drivers/switch/switch_class.c 
     115.     New: drivers/switch/switch_gpio.c 
     116.  
     117. drivers/usb/gadget: 
     118.     New: drivers/usb/gadget/android.c 
     119.     Chg: drivers/usb/gadget/composite.c 
     120.     Chg: drivers/usb/gadget/f_acm.c 
     121.     New: drivers/usb/gadget/f_acm.h 
     122.     New: drivers/usb/gadget/f_adb.c 
     123.     New: drivers/usb/gadget/f_adb.h 
     124.     New: drivers/usb/gadget/f_mass_storage.c 
     125.     New: drivers/usb/gadget/f_mass_storage.h 
     126.  
     127. drivers/video: 
     128.     New: drivers/video/goldfishfb.c 
     129.  
     130. fs: 
     131.     Chg: fs/exec.c 
     132.     Chg: fs/fat/cache.c 
     133.     Chg: fs/fat/dir.c 
     134.     Chg: fs/fat/fatent.c 
     135.     Chg: fs/fat/fat.h 
     136.     Chg: fs/fat/file.c 
     137.     Chg: fs/fat/inode.c 
     138.     Chg: fs/fat/misc.c 
     139.     Chg: fs/fat/namei_msdos.c 
     140.     Chg: fs/fat/namei_vfat.c 
     141.     Chg: fs/fs-writeback.c 
     142.     Chg: fs/partitions/check.c 
     143.     Chg: fs/proc/base.c 
     144.  
     145. fs/yaffs2/: 
     146.  
     147. kernel: 
     148.     Chg: kernel/cgroup.c 
     149.     Chg: kernel/cgroup_freezer.c 
     150.     Chg: kernel/cpuset.c 
     151.     Chg: kernel/exit.c 
     152.     Chg: kernel/fork.c 
     153.     Chg: kernel/futex.c 
     154.     Chg: kernel/panic.c 
     155.     Chg: kernel/posix-cpu-timers.c 
     156.     Chg: kernel/printk.c 
     157.     Chg: kernel/ptrace.c 
     158.     Chg: kernel/sched.c 
     159.     Chg: kernel/sysctl.c 
     160.     Chg: kernel/time/tick-sched.c 
     161.  
     162. kernel/power: 
     163.     New: kernel/power/consoleearlysuspend.c 
     164.     New: kernel/power/earlysuspend.c 
     165.     New: kernel/power/fbearlysuspend.c 
     166.     Chg: kernel/power/main.c 
     167.     Chg: kernel/power/power.h 
     168.     Chg: kernel/power/process.c 
     169.     New: kernel/power/userwakelock.c 
     170.     New: kernel/power/wakelock.c 
     171.  
     172. lib: 
     173.     Chg: lib/genalloc.c 
     174.  
     175. mm: 
     176.     New: mm/ashmem.c 
     177.     Chg: mm/mmap.c 
     178.     Chg: mm/page_alloc.c 
     179.     Chg: mm/shmem.c 
     180.  
     181. net: 
     182.     Chg: net/bluetooth/af_bluetooth.c 
     183.     Chg: net/bluetooth/cmtp/core.c 
     184.     Chg: net/bluetooth/hci_conn.c 
     185.     Chg: net/bluetooth/hci_core.c 
     186.     Chg: net/bluetooth/hci_event.c 
     187.     Chg: net/bluetooth/hci_sysfs.c 
     188.     Chg: net/bluetooth/l2cap.c 
     189.     Chg: net/bluetooth/rfcomm/core.c 
     190.     Chg: net/bluetooth/rfcomm/sock.c 
     191.     Chg: net/bluetooth/sco.c 
     192.     Chg: net/core/dev.c 
     193.     Chg: net/ipv4/af_inet.c 
     194.     Chg: net/ipv4/devinet.c 
     195.     New: net/ipv4/sysfs_net_ipv4.c 
     196.     Chg: net/ipv4/tcp_ipv4.c 
     197.     Chg: net/ipv6/af_inet6.c 
     198.     Chg: net/rfkill/rfkill.c 
     199.     Chg: net/socket.c 
     200.  
     201. security: 
     202.     Chg: security/commoncap.c 
     203.     Chg: security/security.c 

    本文出自 “Mobile and Linux Deve..” 博客,请务必保留此出处http://buaadallas.blog.51cto.com/399160/377436


  • 相关阅读:
    Redis 扛 Mysq 并发方案小记
    CURL 访问 HTTPS 的坑 [后记]
    PHP CURL HTTPS Error: "SSL certificate problem: unable to get local issuer certificate"
    PHP 使用 cURL HTTPS 协议证书认证问题
    HTTPS 学习笔记 (1)
    Windows CMD 仿 Mac Terminal open 命令 打开指定目录资源管理器
    Win10 Hyper-V 配置
    Windows10 下精简和配置 MySQL 5.6
    Win10 + Nginx 1.10 + PHP 7 + Redis 配置方法
    sublime text 配置 builder [build system]
  • 原文地址:https://www.cnblogs.com/p2liu/p/6048777.html
Copyright © 2020-2023  润新知