android 技术1-概要
概念介紹
android 框架
android 分層圖如下:
Linux Kernel: 完全開源,GPLv2協議
Libraryies: 含少量開源庫,如OpenGL ES,Webkit等
Android Runtime: android 優化的JAVA虛擬機,更適合嵌入式系統。
Application Framework和Application是android sdk 和系統框架層中間件及最上層應用層。
android 如何避開GPLV2傳染性的
簡單的講GPLv2協議,只要你對源代碼有更改就必須向社會公開,而且對于這種修改文本的流通不準許附加修改者自己作出的限制。(1) 首先,最關鍵點Linus Torvalds在Linux內核的版權文件COPYING中最前面增加了下面一段話,保證了Linux內核的商業用途不被GPLv2傳染。
NOTE! This copyright does *not* cover user programs that use kernel services by normal system calls - this is merely considered normal use of the kernel, and does *not* fall under the heading of "derived work". Also note that the GPL below is copyrighted by the Free Software Foundation, but the instance of code that it refers to (the Linux kernel) is copyrighted by me and others who actually wrote it.Also note that the only valid version of the GPL as far as the kernel is concerned is _this_ particular version of the license (ie v2, not v2.2 or v3.x or whatever), unless explicitly otherwise stated.Linus Torvalds----------------------------------------GNU GENERAL PUBLIC LICENSEVersion 2, June 1991翻譯過來就是說這個版權不覆蓋通過正常系統調用來使用Linux內核服務的用戶程序。有了這一點Linux內核 的GPLv2不會傳染內核之上。系統調用是操作系統內核提供一系列具備預定功能的函數接口供應用程序調用。系統調用把應用程序的請求傳給內核,內核調用相應的函數完成所需的處理,再將處理結果返回給應用程序。
(2) 其次linux系統下c庫一般是glibc庫。glibc是GNU的,屬于GPL授權,也有傳染性。libc是google 改寫優化的Free BSD Bionic庫,屬于BSD協議。可以選擇性開源,也不具傳染性。
(3) 通過以上兩點,android很好的規避了GNU/Linux GPL協議的傳染性。
linux內核和android 關系
1、 Android 為什么會選擇linux
(1) 強大的內存管理和進程管理方案
(2) 基于權限的安全模式
(3) 支持共享庫
(4) 經過認證的驅動模型
(5) Linux本身就是開源項目
2、Android 版本和Linux內核版本如下:
Android Version |API Level |Linux Kernel in AOSP ---------------------------------------------------- 1.5 Cupcake |3 |2.6.27 1.6 Donut |4 |2.6.29 2.0/1 Eclair |5-7 |2.6.29 2.2.x Froyo |8 |2.6.32 2.3.x Gingerbread |9, 10 |2.6.35 3.x.x Honeycomb |11-13 |2.6.36 4.0.x Ice Cream San|14, 15 |3.0.1 4.1.x Jelly Bean |16 |3.0.31 4.2.x Jelly Bean |17 |3.4.0 4.3 Jelly Bean |18 |3.4.39 4.4 Kit Kat |19, 20 |3.10 5.x Lollipop |21, 22 |3.16.1 6.0 Marshmallow |23 |3.18.10 7.0 Nougat |24 |4.4.1 7.1 Nougat |25 |4.4.1 (To be updated)android 系統驅動
Android在Linux內核中增加的主要是一些驅動程序,這些驅動程主要分為兩種:Android專有驅動和Android使用的設備驅動1、Android 幾個重要的專有驅動
(1) Binder驅動(Binder Driver):
Android Binder 是基于 OpenBinder 框架的一個驅 動,用于提供 Android 平臺的進程間通信(IPC)。而原來的 Linux 系統上層應用的進程間通信主要是 D-Bus,采用消息總線方式來進行 IPC。
源代碼位于 drivers/staging/android/binder.c
(2) 低內存管理器 Low Memory Killer
Android 中的低內存管理器和 Linux 標準的 OOM(Out Of Memory) 相比,其機制更加靈活。它可以根據需要殺死進程來釋放需要的內存。
(3) 匿名共享內存(Ashmem)
匿名共享內存為進程間提供大塊共享內存,同時為內核提供回收和管理這個內存的機制。如果一個程序嘗試訪問 Kernel 釋放的一個共享內存塊,它會收到一個錯誤提示,然后重新分配內存并重載數據。
(4) Logger: 輕量級的log驅動。
(5) Android PMEM
PMEM 主要作用就是向用戶空間提供連續的物理內存區域。 讓 GPU 或 VPU 緩沖區共享 CPU 核心,DSP 和某些設備只能工作在連續的物理內存上,源代碼位于 drivers/misc/pmem.c.
2、Android常用的設備驅動
Android中常使用的設備主要有Framebuffer驅動、輸入設備驅動、v412攝像頭—視頻驅動、OSS音頻驅動、ALSA音頻驅動、MTD驅動、藍牙驅動、Wlan驅動等。
引文
[1] https://nga.178.com/read.php?tid=27070511&rand=940
[2] https://www.cnblogs.com/developer-huawei/p/13540071.html
[3] https://blog.csdn.net/xiphi_6/article/details/117574853
[4] https://blog.csdn.net/canpool/article/details/119305926
[5] https://blog.csdn.net/weixin_33845477/article/details/92043349
[6] https://blog.csdn.net/kobebryant0/article/details/21159137?spm=1001.2014.3001.5502 [7]https://www.itdaan.com/blog/2012/06/15/7f3f2c7c16a06109e48f8b917811196a.html
[8] https://blog.csdn.net/juana1/article/details/6648518
[9] https://blog.csdn.net/baidu_38661691/article/details/97399533
[10] https://blog.csdn.net/qq_40395874/article/details/118911182
總結
以上是生活随笔為你收集整理的android 技术1-概要的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 项目管理知识体系-项目绩效域
- 下一篇: 博士五年总结