转自: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