[QEMU]在QEMU中運行Android ARM64
我比較懶,教程大概寫下,具體出現(xiàn)問題使用 必應(yīng) \ 谷歌 大法
1.您需要安裝 ARM 64 位工具鏈、一些依賴項和工具:
sudo apt-get install gcc-aarch64-linux-gnu build-essentials git bison zlib1g-dev libglib2.0-dev libpixman-1-dev gperf android-tools-adb vncviewer
2.交叉編譯適用于 Android 的 Linux 內(nèi)核:
mkdir -p ~/edev/linaro
git clone https://git.linaro.org/people/christoffer.dall/linux-android.git
cd linux-android
git checkout ranchu-linaro-beta1
3.構(gòu)建內(nèi)核
ARCH=arm64 make ranchu_defconfig
ARCH=arm64 make CROSS_COMPILE=aarch64-linux-gnu- -j8
【建議在arch/arm64/configs/ranchu_defconfig中刪除 CONFIG_DEBUG_INFO=Y】
【部分QEMU相關(guān)驅(qū)動檢查是否打開】
4.構(gòu)建Android開源項目(AOSP)
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
5.獲取 AOSP 源代碼(主代碼如下,或 l-preview 分支):
cd ..
mkdir AOSP
repo init -u https://android.googlesource.com/platform/manifest
repo sync
可能需要點時間【建議 V】,具體取決于您與 Google 服務(wù)器的互聯(lián)網(wǎng)連接。
6.現(xiàn)在下載并應(yīng)用Linaro制作的補(bǔ)?。?/p>
wget http://people.linaro.org/~christoffer.dall/linaro-devices.tar.gz
tar -xvf linaro-devices.tar.gz
7.配置 git:
git config --global user.email "name@email.com"
git config --global user.name "Your Name"
8.qemu補(bǔ)?。?/p>
pushd system/core
wget http://people.linaro.org/~alex.bennee/android/android-init-tweaks.diff
patch -p1 < android-init-tweaks.diff
popd
9.為 ARMv8 構(gòu)建 Android
source build/envsetup.sh
lunch ranchu-userdebug
m -j8
最后一步需要近一個小時的時間。
10.構(gòu)建 QEMU:
cd ..
git clone https://git.linaro.org/people/peter.maydell/qemu-arm.git
cd qemu-arm
git checkout ranchu-linaro-beta1
./configure
make -j8
11.運行 QEMU:
cd ..
ln -s linux-android/arch/arm64/boot/ ranchu-kernel
ln -s AOSP/out/target/product/ranchu/ ranchu-build
adb start-server
./qemu-arm/aarch64-softmmu/qemu-system-aarch64 -cpu cortex-a57 -machine type=ranchu -m 4096 \
-kernel ./ranchu-kernel/Image -append 'console=ttyAMA0,38400 keep_bootcon' -monitor stdio \
-initrd ranchu-build/ramdisk.img -drive index=2,id=userdata,file=ranchu-build/userdata.img \
-device virtio-blk-device,drive=userdata -device virtio-blk-device,drive=cache \
-drive index=1,id=cache,file=ranchu-build/cache.img -device virtio-blk-device,drive=system \
-drive index=0,id=system,file=ranchu-build/system.img -netdev user,id=mynet \
-device virtio-net-device,netdev=mynet -show-cursor
如果一切正常你會看見輸出
QEMU 7.1.0 monitor - type 'help' for more information
console on port 5554, ADB on port 5555
VNC server running on `127.0.0.1:5900'
啟動 vncviewer 以訪問 Android 用戶界面:
127.0.0.1:5900