轉自:http://blog.csdn.net/yiyaaixuexi/article/details/8330645linux
SEAndroid(Security-Enhanced Android),是將本來運用在Linux操做系統上的MAC強制存取控管套件SELinux,移植到Android平臺上。能夠用來強化Android操做系統對App的存取控管,創建相似沙箱的執行隔離效果,來確保每個App之間的獨立運做,也所以能夠阻止惡意App對系統或其它應用程序的攻擊。android
SEAndroid的中心理念是,即便root權限被篡奪,只求阻止應用的惡意行爲。git
git clone https://bitbucket.org/seandroid/manifests.git mkdir seandroid cd seandroid repo init -u https://android.googlesource.com/platform/manifest repo sync cp ../manifests/local_manifest.xml .repo repo sync
若是已有Android系統源碼,能夠直接使用github
Base Version SE Branch
android-4.2.1_r1 seandroid-4.2
android-4.1.2_r1 seandroid-4.1.2
android-4.1.1_r6.1 seandroid-4.1.1
android-4.0.4_r2.1 seandroid-4.0.4
git clone -b seandroid-4.0.4 https://bitbucket.org/seandroid/manifests.git
mkdir Android_src
cd Android_src
cp ../manifests/local_manifest.xml .repo/
repo sync
export PREFIX=/path/to/your/aospclone cd $PREFIX/kernel/goldfish make ARCH=arm goldfish_armv7_defconfig
make ARCH=arm CROSS_COMPILE=$PREFIX/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
如下是編譯Android 4.0.4的常見錯誤,這些錯誤的解決辦法收錄自互聯網。express
Google group有個專門的Android Building組,有興趣的能夠加入。windows
################# Fix 1 ##########################
Error:函數
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::sp<AaptDir> >’ are not found by unqualified lookup測試
host Executable: test-librsloader (out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader)
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Signals.o):在函數‘PrintStackTrace’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Unix/Signals.inc:219:對‘dladdr’未定義的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Unix/Signals.inc:231:對‘dladdr’未定義的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Threading.o):在函數‘llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:96:對‘pthread_create’未定義的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:100:對‘pthread_join’未定義的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:91:對‘pthread_attr_setstacksize’未定義的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o):在函數‘llvm::sys::MutexImpl::MutexImpl(bool)’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:69:對‘pthread_mutexattr_init’未定義的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:75:對‘pthread_mutexattr_settype’未定義的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:80:對‘pthread_mutexattr_setpshared’未定義的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:89:對‘pthread_mutexattr_destroy’未定義的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o):在函數‘llvm::sys::MutexImpl::tryacquire()’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:143:對‘pthread_mutex_trylock’未定義的引用
collect2: 錯誤: ld 返回 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] 錯誤 1ui
Fix:this
$vi external/llvm/llvm-host-build.mk +
LOCAL_LDLIBS := -lpthread -ldl
emulator -show-kernel -kernel kernel/goldfish/arch/arm/boot/zImage