使用 qemu 模擬器運行 aosp(基於 x86-64 Linux 內核)


環境准備

  • 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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM