简体   繁体   English

在 Android 模拟器上运行自定义 ROM

[英]Run custom ROM on Android Emulator

I downloaded a third-party ROM, and I want to run it on the emulator first before flash it into the phone.我下载了一个第三方ROM,我想先在模拟器上运行它,然后再将它刷入手机。 Here is the contents of cm-11-20140911-NIGHTLY-p3110.zip :这是cm-11-20140911-NIGHTLY-p3110.zip的内容:

 1. boot.img
 2. file_contexts
 3. META-INF/
 4. recovery/
 5. system/

I unpacked boot.img using the script unpack-bootimg.pl and get boot.img-kernel , and boot.img-ramdisk.cpio.gz.我使用脚本unpack-bootimg.pl解压boot.img并获得boot.img-kernelboot.img-ramdisk.cpio.gz. Then I repacked the system using the make_ext4fs and got system.img .然后我使用make_ext4fs重新make_ext4fs系统并得到system.img

I created an AVD and execute:我创建了一个 AVD 并执行:

emulator -system ~/cm11/system_new.img -ramdisk ~/cm11/boot.img-ramdisk.cpio.gz -kernel ~/cm11/boot.img-kernel -avd and442

but all I got is nothing, the emulator screen is just black.但我得到的只是什么,模拟器屏幕只是黑色。 There is no log message from adb -s emulator-5554 .没有来自adb -s emulator-5554日志消息。

Now I am confused:现在我很困惑:

  • can the third-party ROM be tested by the emulator?第三方ROM可以用模拟器测试吗?
  • Am I doing the right way?我做对了吗?

Yeah, why not.是的,为什么不呢。

We can flash a third-party ROM on Android AVD.我们可以在 Android AVD 上刷入第三方 ROM。 But first you must know the following things:但首先你必须知道以下几点:

1. The Android Emulator is itself a device, like your Moto G or Xperia 1. Android Emulator 本身就是一个设备,就像你的Moto GXperia

2. Every ROM is device-specific (supports a device-specific Kernel) 2. 每个 ROM 都是特定于设备的(支持特定于设备的内核)

(on many sites/blogs you got information like you have to replace system.img file from .android\\avd\\avdname.avd, but it is technically incorrect, because you also require ramdisk.img .) (在许多站点/博客上,您得到的信息是您必须从 .android\\avd\\avdname.avd 替换system.img文件,但技术上不正确,因为您还需要ramdisk.img 。)

To do this, you need to create your own AOSP repository by downloading the particular repository and have to build your own .img files)为此,您需要通过下载特定存储库来创建自己的 AOSP 存储库,并且必须构建自己的 .img 文件)

  • You can do it in two ways:您可以通过两种方式做到这一点:
  1. replace files system.img and ramdisk.img from location .android\\avd\\avdname.avd从位置.android\\avd\\avdname.avd替换文件system.imgramdisk.img

  2. Build your own AOSP.构建您自己的 AOSP。 Before... make in "lunch" select target as: Emulator (like: genericX86), ie, generate all emulator specific .img files之前...在“午餐”中选择目标为:模拟器(如:genericX86),即生成所有模拟器特定的.img文件

I have tried many things.我尝试了很多东西。 It's a bit critical, but interesting.这有点关键,但很有趣。 The following links may help you:以下链接可能对您有所帮助:

To run your cooked ROM on Emulator (link down. Try this , from archive.org).在模拟器上运行你的熟 ROM (链接向下。试试这个,来自 archive.org)。

To Create AOSP Project 创建 AOSP 项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM