Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> android4.0下的linux3.0的變化

android4.0下的linux3.0的變化

編輯:關於Android編程

Linux Kernel for Android 4.0
--- 初稿 2011-11-25
1. android 4.0 system be released
2011-10-19上午10點,google發布了代號為Ice Cream Sandwich(簡稱ICS,冰淇淋三明治)的android4.0系統。十大特性:

4)、 同步升級Linux內核 更新3.0以上版本

2. linux kernel 3.0
源碼下載:ftp://ftp.kernel.org/pub/linux/kernel/v3.0/
2.1.發布時間:2011-07-21
2.2.版本號變化:Linux2.6.39 ----》 linux3.0
無裡程碑式的變化。一種說法是為了紀念Linux 20年,邁向第3個10年。
2.3.主要新特性如下:
更新日志:http://kernelnewbies.org/Linux_3.0
1)、Btrfs文件系統自動碎片整理、性能改進和檢查;
Btrfs(Butter FS),目標在取代Linux目前的ext3文件系統,改善ext3的限制,特別是單一文件的大小,總文件系統大小及加入文件校驗和。已在ubuntu10.10、openSUSE11.3和Fedora 16中得到了應用。
2)、支持sendmmsg()系統調用(syscall);
一個批處理sendmsg()系統調用,UDP發送性能提升20%,接口發送性能提30%.
3)、XEN dom0 支持;
Xen 是一個高性能的虛擬化解決方案,可提升虛擬機性能。
4)、增加 Cleancache 支持;
封裝的相關內核API,目前內核中主要在ext3、ext4、btrfs、ocsfs2等文件系統部分相關代碼中有調用。
5)、Berkeley 即時包過濾器;
配合libpcap/tcpdump提升包過濾規則的運行效率。
6)、無線廣域網(WLAN)喚醒支持;
7)、實現非特殊授權的 ICMP_ECHO (ping 命令);
8)、支持setns()系統調用(syscall);
更好地命名空間管理。
9)、高精度計時器Alarm-timers的支持
可以在通過 RTC 設備喚醒掛起狀態的系統。The concept for Alarm-timers was inspired by the Android Alarm driver, and the interface to userland uses the POSIX clock and timers interface.
3. Linux Kernel for Android
Android基於linux,但其linux內核跟標准的linux內核有所差異。
1)、android沒有使用linux的X窗口系統;
2)、android沒有采用glibc作為C庫,另開發了一套Bionic Libc來代替glibc;
3)、增加了一些android專用的驅動程序
Android對標准linux內核及驅動的增強改進部分:
3.1. Android Alarm
用於將設備從睡眠狀態喚醒,同時提供一個在設備睡眠時仍會運行的基准。
源碼位置:drives/rtc/alarm.c
設備節點名:/dev/alarm
該部分code,Linux 3.0版本在linux2.6.32版本的基礎上有2次改動更新:
1)、Don't use save_time_delta.
2)、Update hrtimer if alarm at the head of the queue is reprogrammed.
3.2. Ashmem(匿名共享內存)
為進程間提供大塊共享內存。相比於malloc等傳統的內存分配機制,其優勢是通過內核驅動提供了輔助內核的內存回收算法機制。
源碼位置:kernel/mm/ashmem.c
設備節點名:/dev/ashmem
Linux 3.0版本在linux2.6.32版本的基礎上有5次改動更新:
1)、Implement read in ashmem driver.
2)、Fix ASHMEM_SET_PROT_MASK.
3)、Update arguments of shrinker for 2.6.35.
4)、Support lseek in ashmem driver.
5)、Fix arguments to ashmem_shrink.
3.3. Low Memory Killer(低內存管理)
根據需要殺死進程以釋放需要的內存。
源碼位置:drivers/staging/android/lowmemorykiller.c
Linux 3.0版本在linux2.6.32版本的基礎上有9次改動更新:
1)、Don't try to kill the same pid over and over.
2)、Substantially reduce overhead during reclaim.
3)、Fix task_struct leak.
4)、Remove bitrotted codepath.
5)、Update arguments of shrinker for 2.6.35.
6)、Don't unregister notifier from atomic context.
7)、Don't wait more than one second for a process to die.
8)、Ignore shmem pages in page-cache.
9)、Fix arguments to lowmem_shrink.
3.4. Logger(日志設備)
為方便android應用開發過程中使用log信息來調試程序。
源碼位置:drivers/staging/android/logger.c
設備節點名:/dev/log/main /dev/log/event /dev/log/radio
Linux 3.0版本在linux2.6.32版本的基礎上無改動更新。
3.5. Android PMEM
向用戶空間提供連續的物理內存區域(DSP這類設備只能工作在連續的物理內存上)。
源碼位置:drivers/misc/pmem.c
該部分源碼augustatek有在linux2.6.32版本的基礎上改動更新:
1)、add pmem node create/destroy entries.
2)、change dsp mem map.
3)、add 7700 support.
3.6. switch
用於檢測一些開關量(耳塞插入、USB設備插入等)。
源碼位置:drivers/switch/switch_class.c
drivers/switch/switch_gpio.c
Linux 3.0版本在linux2.6.32版本的基礎上無改動更新。
3.7. Timed GPIO
將普通的GPIO驅動和內核定時器進行綁定,實現受時鐘控制的GPIO.
源碼位置:drivers/staging/android/timed_gpio.c
drivers/staging/android/timed_output.c
Linux 3.0版本在linux2.6.32版本的基礎上有1次改動更新:
1)、Properly discard invalid timeout values.
3.8. Android Ram Console
為了提供調試功能,將調試日志信息寫入Ram Console設備裡,該設備是一個基於Ram的buffer.
源碼位置:drivers/staging/android/ram_console.c
Linux 3.0版本在linux2.6.32版本的基礎上無改動更新。
3.9. Android Binder
是OpenBinder的Linux實現,為android系統運行提供進程間的通信機制。
Binder驅動源碼位置:drivers/staging/android/binder.c
設備節點名:/dev/binder
Linux 3.0版本在linux2.6.32版本基礎上的改動更新:
1)、Use seq_file for debug interface.
2)、Move debugging information from products to debugfs.
3)、Create dedicated workqueue for binder deffered work.
4)、Fix memory corruption via page aliasing.
3.10. Android電源管理(PM)
電源管理是實現低功耗的一種方式,是從應用程序到內核框架,再到設備驅動和硬件設備都要系統考慮的一個系統工程。
源碼位置:kernel/power/
Linux 3.0版本在linux2.6.32版本基礎上的改動更新:
1)、Fix operator precedence bug.
2)、call __get_wall_to_monotonic() instead of using wall_to_monotonic.
3)、use get_xtime_and_monotonic_and_sleep_offset in get_expired_time.
4)、Free memory bitmaps if opening /dev/snapshot fails.
5)、Merge commit ‘v3.0-rc5’.
該部分源碼augustatek有在linux2.6.32版本的基礎上改動更新:
1)、Add sleep in suspend().
2)、Add arm power down support.
3)、remove the sleep to solve “wakeup too long”.
3.11. USB Gadget驅動
源碼位置:drivers/usb/gadget/android.c
drivers/usb/gadget/f_adb.c
drivers/usb/gadget/f_accessory.c (new file)
drivers/usb/gadget/f_mtp.c (new file)
drivers/usb/gadget/f_mass_storage.c
Linux 3.0版本在linux2.6.32版本基礎上的改動更新:
1)、Add userspace notifications for USB state changes.
2)、Remove unused function android_usb_set_connected().
3)、Add usb_composite_force_reset utility to force enumeration.
4)、Fix section mismatch warning.
5)、Disable MTP when RNDIS function is enabled.
6)、Remove WAKEUP flag from bmAttributes.
7)、Fixed Android gadget function discovery & product matching.
8)、android Fix gadget descriptor compliance for IAD's.
9)、Support switching vendor ID when configuration changes.
10)、Fix problem switching vendor IDs.
11)、New gadget driver for android USB accesories.
12)、Misc improvements and cleanup:
- Add URI string.
- Replace type string with a description string.
- Add a control call to retrieve accessory protocol version (currently 1).
- Driver read() and write() calls now fail after USB disconnect until driver file is closed and reopened.
- Misc cleanup work
13)、Clear accessory strings when USB is disconnected.
14)、Clear previous strings on ACCESSORY_GET_PROTOCOL.
15)、Clear disconnected flag when driver file is opened.
16)、Add string for accessory's unique serial number.
17)、Set bNumEndpoints to correct value of 2.
18)、Update android gadget driver.
* Functions and the device descriptor are configured from user space:
echo 0 > /sys/class/android_usb/android0/enable
echo adb,acm > /sys/class/android_usb/android0/functions
echo 2 > /sys/class/android_usb/android0/f_acm/instances
echo 1 > /sys/class/android_usb/android0/enable
* Driver does not require platform data anymore.
* Moved function initialization to android.c instead of each function file.
* Replaced switches by uevents.
19)、Add PTP variant of MTP USB function.
20)、dequeue request on error in adb_read.
該部分源碼augustatek有在linux2.6.32版本的基礎上改動更新:
1)、fix usb pm and adb suspend issues.
2)、prevent system suspend when enabling adb.
3)、add android usb adb functions.
4)、system crash if disconnect usb cable during file transfer.
5)、usb cable plug in and out sometimes can cause kernel panic.
3.12. 文件系統部分(UBIFS、Yaffs2)
UBIFS:
源碼位置:fs/ubifs/
ubifs源碼一直處於更新狀態,每個linux內核版本對應的ubifs源碼都有變化,從linux2.6.32至linux3.0共有6次merge動作。
The UBI File-System source code git tree has two branches: master and linux-next
Master:contains the most recent stuff which is often incomplete, buggy, or not tested very well.
linux-next:contains more or less stable patches goes to main-line.
該部分源碼augustatek有在linux2.6.32版本的基礎上改動更新:
1)、Use continuous memory and async mode to resolve “ubifs is bad for sync mode”.
Yaffs2:
源碼位置:fs/yaffs2/
Linux 3.0版本在linux2.6.32版本基礎上的改動更新:
1)、Don’t force YAFFS_TRACE_ALWAYS for all trace levels.
該部分源碼augustatek有在linux2.6.32版本的基礎上改動更新:
1)、Update yaffs2 from official site to fix un-expected android system perm issue.
3.13. MTD驅動
Linux3.0版本在linux2.6.32的基礎上有針對UBIFS的相關merge動作,此外還有一些針對不同廠商nand的更新改動。
3.14. 顯示驅動(Framebuffer)
android2.2至android4.0期間,android對framebuffer部分的改動更新有:
1)、Add fb_edid_add_monspecs for parsing extended edid information.
2)、Put the partial update magic value into the fix_screen struct.
3)、Add support for RGBX 8888 image format.
4)、Fix framebuffer console(Don’t allow non panning updates to bypass the wait for the panel to turn on).
5)、Set the correct pack pattern for XRGB/ARGB.
6)、Add ION Memory Manager.
3.15. 視頻驅動(V4L2)
Linux 3.0版本在linux2.6.32版本基礎上的改動更新:
1)、增加了對一些camera sensors的支持;
2)、Add a media-bus API for configuring v4l2 subdev pixel and frame formats.
新增的API有
+ enum_mbus_fmt: enumerate pixel formats, provided by a video data source
+ g_mbus_fmt: get the current pixel format, provided by a video data source
+ try_mbus_fmt: try to set a pixel format on a video data source
+ s_mbus_fmt: set a pixel format on a video data source
3.16. 音頻驅動(ALSA)
Linux3.0使用版本alsa-driver-1.0.24,android4.0中alsa-lib已不被使用,取而代之的是tinyalsa.
Linux2.6.32使用版本alsa-driver-1.0.21
3.17. Event輸入設備驅動  www.2cto.com
Linux 3.0版本在linux2.6.32版本基礎上的改動更新:
1)、增加了對一些input device的支持;
2)、Implement input filters;
+ filter: separates normal event handlers from "filters".
3)、add support for disabling gpios through sysfs;
Now gpio-keys input driver exports 4 new attributes to userland through sysfs: /sys/devices/platform/gpio-keys/keys [ro] /sys/devices/platform/gpio-keys/switches [ro] /sys/devices/platform/gpio-keys/disabled_keys [rw] /sys/devices/platform/gpio-keys/disables_switches [rw]
3.18. Wifi
3.19. Bluetooth
作者:zhengmeifu
  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved