欢迎光临散文网 会员登陆 & 注册

[QEMU]在QEMU中运行Android ARM64

2022-12-31 12:18 作者:-小白之家-  | 我要投稿

我比较懒,教程大概写下,具体出现问题使用 必应 \ 谷歌 大法

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 内核:

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.构建内核

ARCH=arm64 make ranchu_defconfig

ARCH=arm64 make CROSS_COMPILE=aarch64-linux-gnu- -j8

【建议在arch/arm64/configs/ranchu_defconfig中删除 CONFIG_DEBUG_INFO=Y】

【部分QEMU相关驱动检查是否打开】

4.构建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 服务器的互联网连接。

6.现在下载并应用Linaro制作的补丁:

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补丁:

pushd system/core

wget http://people.linaro.org/~alex.bennee/android/android-init-tweaks.diff

patch -p1 < android-init-tweaks.diff

popd

9.为 ARMv8 构建 Android

source build/envsetup.sh

lunch ranchu-userdebug

m -j8

最后一步需要近一个小时的时间。

10.构建 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



[QEMU]在QEMU中运行Android ARM64的评论 (共 条)

分享到微博请遵守国家法律