-
Notifications
You must be signed in to change notification settings - Fork 17
Building and running x86_64 Android Emulator with ecryptfs support
The following steps will guide you to download, build, install and run the x86 Android Emulator image with ecryptfs and EFS-Tools support.
Updated on 21/04/2015 to support Android Lollipop mr1(android-5.1.0_r5 with 3.10 Linux kernel)
-
Install repo client
mkdir ~/bin PATH=~/bin:$PATH curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo
-
Get AOSP source code:
AOSP_TREE=$PWD/AOSP mkdir $AOSP_TREE cd $AOSP_TREE repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.0_r5 repo sync -j8
-
Get the source code
git clone https://github.com/catalinionita/Ecryptfs-Tools-for-Android.git $AOSP_TREE/external/efs-tools
-
Apply integration patches
cd $AOSP_TREE external/efs-tools/integration/apply_patches.sh
-
Setup build environment
Follow the steps in the AOSP wiki to install all required packages for your Linux distribution: http://source.android.com/source/initializing.html#setting-up-a-linux-build-environment
-
Build Emulator image
source build/envsetup.sh lunch aosp_x86_64-eng make update-api make -j8
-
Get kernel source code
git clone https://android.googlesource.com/kernel/goldfish.git $AOSP_TREE/goldfish-kernel cd $AOSP_TREE/goldfish-kernel git checkout android-goldfish-3.10
-
Create kernel build config
make ARCH=x86_64 x86_64_emu_defconfig
-
Edit and add the following to kernel config ($AOSP_TREE/goldfish-kernel/.config) file:
CONFIG_KEYS=y CONFIG_CRYPTO=y CONFIG_CRYPTO_ALGAPI=y CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MD5=y CONFIG_CRYPTO_ECB=y CONFIG_CRYPTO_CBC=y CONFIG_CRYPTO_AES=y CONFIG_ECRYPT_FS=y
-
Disable SELinux support by commenting CONFIG_SECURITY_SELINUX in kernel config ($AOSP_TREE/goldfish-kernel/.config)
-
Build kernel
export CROSS_COMPILE=$AOSP_TREE/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin/x86_64-linux-android- make ARCH=x86_64 CC="${CROSS_COMPILE}gcc -mno-android" bzImage
emulator -kernel $AOSP_TREE/goldfish-kernel/arch/x86/boot/bzImage -skin WXGA800-7in -prop fw.max_users=8 -prop fw.show_multiuserui=1 -qemu -m 1024 -enable-kvm
It will start a 7 inch emulator with multi-user support. See all emulator options at http://developer.android.com/tools/help/emulator.html