环境准备

  • curlwgetgit命令可用
  • repo命令可用

android emulator

下载

mkdir emu-2.5-release
cd emu-2.5-release
repo init -u https://android.googlesource.com/platform/manifest -b emu-2.5-release
repo sync -j 4 # 4为并行线程数,根据机器自行调整

编译

cd external/qemu
./android/rebuild.sh --no-tests

android kernel

下载

git clone https://android.googlesource.com/kernel/goldfish
cd goldfish
git checkout android-goldfish-4.4-dev

编译

make O=build x86_64_ranchu_defconfig
make O=build bzImage -j 4 # 4为并行线程数,根据机器自行调整

aosp

下载

mkdir aosp
cd aosp
repo init -u https://android.googlesource.com/platform/manifest -b android-9.0.0_r42
repo sync -j 4 # 4为并行线程数,根据机器自行调整

编译

source build/envsetup.sh
lunch aosp_x86_64-eng
m -j 4 # 4为并行线程数,根据机器自行调整

启动

sudo chown $USER /dev/kvm
/path/to/emu-2.5-release/external/qemu/objs/emulator -cores 8 -show-kernel -no-snapshot -memory 8192 -kernel /path/to/goldfish/build/arch/x86/boot/bzImage