androidarch
⑴ 如何制定android交叉編譯工具鏈
經常搞嵌入式開發的朋友對於交叉編譯環境應該並不陌生,說白了,就是一組運行在x86 PC機的編譯工具,可以讓你在PC機上編譯出目標平台(例如ARM)可識別的二進制文件。Android平台也提供了這樣的交叉編譯工具鏈,就放在Android的NDK開發包的toolchains目錄下,因此,我們的Makefile文件中,只需給出相應的編譯工具即可。
廢話就先說到這,直接上例子,我們目標是把下面這個math.c文件編譯成一個靜態庫文件:
#include <stdio.h>
int add( int a , int b ) {
return a+b;
}
你需要編寫一個Makefile文件,這里假設你的Android ndk被安裝在 /opt/android/ndk 目錄下,當然,你可以根據自己的實際情況修改Makefile中相關路徑的定義,Makefile文件示例如下:
# Makefile Written by ticktick
# Show how to cross-compile c/c++ code for android platform
.PHONY: clean
NDKROOT=/opt/android/ndk
PLATFORM=$(NDKROOT)/platforms/android-14/arch-arm
CROSS_COMPILE=$(NDKROOT)/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
CC=$(CROSS_COMPILE)gcc
AR=$(CROSS_COMPILE)ar
LD=$(CROSS_COMPILE)ld
CFLAGS = -I$(PWD) -I$(PLATFORM)/usr/include -Wall -O2 -fPIC -DANDROID -DHAVE_PTHREAD -mfpu=neon -mfloat-abi=softfp
LDFLAGS =
TARGET = libmath.a
SRCS = $(wildcard *.c)
OBJS = $(SRCS:.c=.o)
all: $(OBJS)
$(AR) -rc $(TARGET) $(OBJS)
clean:
rm -f *.o *.a *.so
這里不講Makefile文件的基本原理,只說明一下針對Android環境的Makefile文件編寫的注意事項。
(1) CROSS_COMPILE
必須正確給出Android NDK編譯工具鏈的路徑,當在目錄中執行make命令的時候,編譯系統會根據 CROSS_COMPILE 前綴尋找對應的編譯命令。
(2) -I$(PLATFORM)/usr/include
由於Android平台沒有使用傳統的c語言庫libc,而是自己編寫了一套更加高效更適合嵌入式平台的c語言庫,所以系統頭文件目錄不能再使用默認的路徑,必須直到Android平台的頭文件目錄
(3) -Wall -O2 -fPIC -DANDROID -DHAVE_PTHREAD -mfpu=neon -mfloat-abi=softfp
這些參數的意義網上基本上都有介紹,我就不一一解釋了,並不都是必須添加的,但比較常用。
編譯方法:
寫好makefile文件,並且保存之後,就可以直接在當前目錄下執行make命令,編譯完成後,當前目錄下會生成 libmath.a ,即可直接拿到Android的jni工程中和使用了。
⑵ android kernel和標准linux kernel的區別
android kernel和標准linux kernel的區別
總的區別可以歸納如下:
ARCH -- 這是Android修改了arch/arm下面的一些文件:
arch/arm:
Chg: arch/arm/kernel/entry-armv.S
Chg: arch/arm/kernel/mole.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/vfpmole.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/moleconfig.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
Scheler -- 對於Scheler的改變非常小,我對它並沒有去研究。
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 mole 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 moles 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)
⑶ 有人用64位的arch 配置Androidsdk嗎
你沒有配置java的環境變數。 在Windows機器上,右鍵單擊我的電腦,選擇屬性->高級,點「環境變數」按鈕,在出現的對話框中: 系統變數配置: 1、變數名:classpath 變數值:.;C:\Program Files\Java\jdk1.5.0_06\lib\tools.jar;C:\Program Files\Java\jdk1.5.0_06\bin 2、變數名:java_home 變數值:C:\Program Files\Java\jdk1.5.0_06 3、變數名:path 變數值:C:\Program Files\Java\jdk1.5.0_06\bin 用戶變數: 1、變數名:Path 變數值:D:\android\android-sdk-windows-1.5_r2\tools (註:上面的路徑替換成自己本機的路徑)
⑷ 嵌入式linux和嵌入式android系統有什麼區別和聯系
嵌入式android源碼架構:uboot+linux kernel+android(包含文件系統,虛擬機,UI)
嵌入式linux:這是大部分人認識的linux uboot+linux kernel+文件系統+QT(UI),
當然兩者的linux 內核因為上層UI的不同會稍有差別,不過還是非常接近的,做過linux的人可以無縫切換到android底層開發,所以大家說的學習android系統,其實最重要的就是學習linux驅動,再加一下android下的專門的HAL,JNI,java等等,不過大公司android相關部分也是專門的人做的了。
甚至連QT都不用了,因為linux很多設備都是沒有UI的,所以要來幹啥?直接無界面,照樣是嵌入式linux。
現在大家說的什麼嵌入式debian,ubuntu,其實也是站在linux巨人的肩膀上,其實都不算是linux的分支,只算是linux的延伸,小變化而已。看到這里大家知道嵌入式linux的強大了吧,反正是比wince 強大N倍啊。
O(∩_∩)O~,所以啊,學習嵌入式android,其實底下就是學習uboot,linux內核啊,不會搞這些就像搞應用一樣,所以大家以為android就是java,是非常片面的。
以前老的,說了一下區別,可以參考一下
ARCH -- 這是Android修改了arch/arm下面的一些文件:
arch/arm:
Chg: arch/arm/kernel/entry-armv.S
Chg: arch/arm/kernel/mole.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/vfpmole.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/moleconfig.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
Scheler -- 對於Scheler的改變非常小,我對它並沒有去研究。
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 mole 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 moles 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
http://www.linuxfordevices.com/c ... id-to-a-new-device/
http://hi..com/smallbigwang/item/95c99ebcb0e9544cba0e1281
⑸ android asmtypes 是什麼意思
Google提供的Android包含了原始Android的目標機代碼,主機編譯工具、模擬環境,的代碼包經過解壓後(這里是Android2.2的源碼包),源代碼的第一層目錄結構如下:
|-- Makefile
|-- bionic (bionic C庫)
|-- bootable (啟動引導相關代碼)
|-- build (存放系統編譯規則及generic等基礎開發包配置)
|-- cts (Android兼容性測試套件標准)
|-- dalvik (dalvik JAVA虛擬機)
|-- development (應用程序開發相關)
|-- external (android使用的一些開源的模組)
|-- frameworks (核心框架——java及C++語言)
|-- hardware (主要保護硬解適配層HAL代碼)
|-- libcore
|-- ndk
|-- device
|-- out (編譯完成後的代碼輸出與此目錄)
|-- packages (應用程序包)
|-- prebuilt (x86和arm架構下預編譯的一些資源)
|-- sdk (sdk及模擬器)
|-- system (文件系統庫、應用及組件——C語言)
`-- vendor (廠商定製代碼)
bionic 目錄
|-- libc (C庫)
| |-- arch-arm (ARM架構,包含系統調用匯編實現)
| |-- arch-x86 (x86架構,包含系統調用匯編實現)
| |-- bionic (由C實現的功能,架構無關)
| |-- docs (文檔)
| |-- include (頭文件)
| |-- inet
| |-- kernel (Linux內核中的一些頭文件)
| |-- netbsd (?netbsd系統相關,具體作用不明)
| |-- private (?一些私有的頭文件)
| |-- stdio (stdio實現)
| |-- stdlib (stdlib實現)
| |-- string (string函數實現)
| |-- tools (幾個工具)
| |-- tzcode (時區相關代碼)
| |-- unistd (unistd實現)
| `-- zoneinfo (時區信息)
|-- libdl (libdl實現,dl是動態鏈接,提供訪問動態鏈接庫的功能)
|-- libm (libm數學庫的實現,)
| |-- alpha (apaha架構)
| |-- amd64 (amd64架構)
| |-- arm (arm架構)
| |-- bsdsrc (?bsd的源碼)
| |-- i386 (i386架構)
| |-- i387 (i387架構?)
| |-- ia64 (ia64架構)
| |-- include (頭文件)
| |-- man (數學函數,後綴名為.3,一些為freeBSD的庫文件)
| |-- powerpc (powerpc架構)
| |-- sparc64 (sparc64架構)
| `-- src (源代碼)
|-- libstdc++ (libstdc++ C++實現庫)
| |-- include (頭文件)
| `-- src (源碼)
|-- libthread_db (多線程程序的調試器庫)
| `-- include (頭文件)
`-- linker (動態鏈接器)
`-- arch (支持arm和x86兩種架構)
bootable 目錄
|-- bootloader (適合各種bootloader的通用代碼)
| `-- legacy (估計不能直接使用,可以參考)
| |-- arch_armv6 (V6架構,幾個簡單的匯編文件)
| |-- arch_msm7k (高通7k處理器架構的幾個基本驅動)
| |-- include (通用頭文件和高通7k架構頭文件)
| |-- libboot (啟動庫,都寫得很簡單)
| |-- libc (一些常用的c函數)
| |-- nandwrite (nandwirte函數實現)
| `-- usbloader (usbloader實現)
|-- diskinstaller (android鏡像打包器,x86可生產iso)
`-- recovery (系統恢復相關)
|-- edify (升級腳本使用的edify腳本語言)
|-- etc (init.rc恢復腳本)
|-- minui (一個簡單的UI)
|-- minzip (一個簡單的壓縮工具)
|-- mttils (mtd工具)
|-- res (資源)
| `-- images (一些圖片)
|-- tools (工具)
| `-- ota (OTA Over The Air Updates升級工具)
`-- updater (升級器)
build目錄
|-- core (核心編譯規則)
|-- history (歷史記錄)
|-- libs
| `-- host (主機端庫,有android 「cp」功能替換)
|-- target (目標機編譯對象)
| |-- board (開發)
| | |-- emulator (模擬器)
| | |-- generic (通用)
| | |-- idea6410 (自己添加的)
| | `-- sim (最簡單)
| `-- proct (開發對應的編譯規則)
| `-- security (密鑰相關)
`-- tools (編譯中主機使用的工具及腳本)
|-- acp (Android "acp" Command)
|-- apicheck (api檢查工具)
|-- applypatch (補丁工具)
|-- apriori (預鏈接工具)
|-- atree (tree工具)
|-- bin2asm (bin轉換為asm工具)
|-- check_prereq (檢查編譯時間戳工具)
|-- dexpreopt (模擬器相關工具,具體功能不明)
|-- droiddoc (?作用不明,java語言,網上有人說和JDK5有關)
|-- fs_config (This program takes a list of files and directories)
|-- fs_get_stats (獲取文件系統狀態)
|-- iself (判斷是否ELF格式)
|-- isprelinked (判斷是否prelinked)
|-- kcm (按鍵相關)
|-- lsd (List symbol dependencies)
|-- releasetools (生成鏡像的工具及腳本)
|-- rgb2565 (rgb轉換為565)
|-- signapk (apk簽名工具)
|-- soslim (strip工具)
`-- zipalign (zip archive alignment tool)
dalvik目錄 dalvik虛擬機
.
|-- dalvikvm (main.c的目錄)
|-- dexmp (dex反匯編)
|-- dexlist (List all methods in all concrete classes in a DEX file.)
|-- dexopt (預驗證與優化)
|-- docs (文檔)
|-- dvz (和zygote相關的一個命令)
|-- dx (dx工具,將多個java轉換為dex)
|-- hit (?java語言寫成)
|-- libcore (核心庫)
|-- libcore-disabled (?禁用的庫)
|-- libdex (dex的庫)
|-- libnativehelper (Support functions for Android's class libraries)
|-- tests (測試代碼)
|-- tools (工具)
`-- vm (虛擬機實現)
development 目錄 (開發者需要的一些常式及工具)
|-- apps (一些核心應用程序)
| |-- BluetoothDebug (藍牙調試程序)
| |-- CustomLocale (自定義區域設置)
| |-- Development (開發)
| |-- Fallback (和語言相關的一個程序)
| |-- FontLab (字型檔)
| |-- GestureBuilder (手勢動作)
| |-- NinePatchLab (?)
| |-- OBJViewer (OBJ查看器)
| |-- SdkSetup (SDK安裝器)
| |-- SpareParts (高級設置)
| |-- Term (遠程登錄)
| `-- launchperf (?)
|-- build (編譯腳本模板)
|-- cmds (有個monkey工具)
|-- data (配置數據)
|-- docs (文檔)
|-- host (主機端USB驅動等)
|-- ide (集成開發環境)
|-- ndk (本地開發套件——c語言開發套件)
|-- pdk (Plug Development Kit)
|-- samples (演示程序)
| |-- AliasActivity ()
| |-- ApiDemos (API演示程序)
| |-- BluetoothChat (藍牙聊天)
| |-- BrowserPlugin (瀏覽器插件)
| |-- BusinessCard (商業卡)
| |-- Compass (指南針)
| |-- ContactManager (聯系人管理器)
| |-- CubeLiveWall** (動態壁紙的一個簡單常式)
| |-- FixedGridLayout (像是布局)
| |-- GlobalTime (全球時間)
| |-- HelloActivity (Hello)
| |-- Home (Home)
| |-- JetBoy (jetBoy游戲)
| |-- LunarLander (貌似又是一個游戲)
| |-- MailSync (同步)
| |-- MultiResolution (多解析度)
| |-- MySampleRss (RSS)
| |-- NotePad (記事本)
| |-- RSSReader (RSS閱讀器)
| |-- SearchableDictionary (目錄搜索)
| |-- **JNI (JNI常式)
| |-- SkeletonApp (空殼APP)
| |-- Snake (snake程序)
| |-- SoftKeyboard (軟鍵盤)
| |-- Wiktionary (?維基)
| `-- Wiktionary**(?維基常式)
|-- scripts (腳本)
|-- sdk (sdk配置)
|-- simulator (?模擬器)
|-- testrunner (?測試用)
`-- tools (一些工具)
⑹ android kernel和標准linux kernel的區別
android kernel和標准linux kernel的區別
總的區別可以歸納如下:
ARCH -- 這是Android修改了arch/arm下面的一些文件:
arch/arm:
Chg: arch/arm/kernel/entry-armv.S
Chg: arch/arm/kernel/mole.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/vfpmole.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/moleconfig.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
Scheler -- 對於Scheler的改變非常小,我對它並沒有去研究。
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 mole 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 moles 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)
⑺ 怎麼重新編譯android 下面的動態庫
使用動態庫來編譯動態庫
A項目的android.mk文件如下:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := testa
LOCAL_SRC_FILES := testa.c
include $(BUILD_SHARED_LIBRARY)
生成的libtesta.so加入到E:\workspace\android-ndk-r8e\platforms\android-8\arch-arm\usr\lib\下面
項目B的文件目錄結構如下:
jni
jni/jni/
jni/prebuilt/
jni目錄下的mk文件如下:
include $(all-subdir-makefiles)
jni/prebuilt目錄下的mk文件如下:
LOCAL_PATH := $(call my-dir)
#include $(CLEAR_VARS)
LOCAL_MODULE := libtesta
LOCAL_SRC_FILES := libtesta.so
include $(PREBUILT_SHARED_LIBRARY)
同時把libtesta.so也放入該目錄下.
jni/jni目錄下的mk文件內容:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -ltesta
LOCAL_MODULE := testb
LOCAL_SRC_FILES := testb.c
include $(BUILD_SHARED_LIBRARY)
這樣生成libtestb.so文件, 同時eclipse在打包時會把libtesta.so, libtestb.so都加入到apk文件中,如果沒有prebuilt那一步,那麼在打包時會漏掉libtesta.so, 但編譯會通過,因為編譯讀取的是編譯系統的庫文件目錄(LOCAL_LDLIBS := -ltesta), 這點需要注意
java代碼:
System.loadLibrary("testa");
System.loadLibrary("testb");
注意先後關系
⑻ 怎樣製作Android的ARMv6版本根文件
您好!試下以下程序:
TARGET_ARCH_VERSION := armv6
RULES for ARMv6:
ifeq ($(TARGET_ARCH_VERSION),armv6)
$(warning ARMv6 support added)
ARCH_ARM_HAVE_THUMB_SUPPORT := true
ARCH_ARM_HAVE_THUMB_INTERWORKING := true
ARCH_ARM_HAVE_64BIT_DATA := true
ARCH_ARM_HAVE_HALFWORD_MULTIPLY := true
ARCH_ARM_HAVE_CLZ := true
ARCH_ARM_HAVE_FFS := true
arch_version_cflags := -march=armv5t -Wa,-march=armv6 -D__ARM_ARCH_6__
你可以修改 linux-arm.mk 把上面的加進去肯定可以用,望採納,謝謝!
⑼ ndk arm 編譯 顯示android-19\arch-arm\usr\lib: Permission denied
首先創建一個標準的Android項目vPlayer
android create project -n vPlayer -t 8 -p vPlayer -k me.abitno.vplayer -a PlayerView
然後在vPlayer目錄里
mkdir jni && cd jni
wget htt p:/ /ffmpe g.o rg/releases/ffmpeg-0.6.t ar.bz2
tar xf ffmpeg-0.6.tar.bz2 && mv ffmpeg-0.6 ffmpeg && cd ffmpeg
在ffmpeg下新建一個config.sh,內容如下,注意把PREBUILT和PLATFORM設置正確。另外裡面有些參數你也可以自行調整,我主要是為了配置一個播放器而這樣設置的。
#!/bin/bash
PREBUILT=/home/abitno/Android/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.4.0
PLATFORM=/home/abitno/Android/android-ndk-r4/build/platforms/android-8/arch-arm
⑽ [Android]關於百度API SuggestionSarch的問題,謝謝解答
1、這個問題建議到技術論壇或者程序員聯盟去問。
2、回答網路知道的人手裡多數沒有工具沒辦法調試。
3、可能有些jar包沒有包括進去。
4、自己寫的方法要注意引用全面或者參數傳遞。