跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[Android] 尝试在 Mac 的 AVD 里运行第三方 GSI

发表于

突发奇想,既然我的 MacBook 也是 ARM 架构,那是不是也可以在 Android Studio 的模拟器( AVD )里面运行其他第三方镜像,于是就开始了这次尝试。

实际上我除了开发调试以外基本不会使用这个模拟器,所以纯粹是出于整活的乐趣,能跑得起来就算成功,实际体验倒是无所谓。

AVD 的镜像里有个 system.img ,一开始我以为直接替换就完事,后来发现这个 system.img 并不是安卓里那个 ext4 的 system 分区,它其实是一个 qemu raw 镜像,里面有两个分区,分别是 vbmeta 和 super ,熟悉搞机的应该知道安卓的 super 分区,这里就不多解释了。

而这个 super 分区里面包含 5 个分区,用 lpunpack 解包之后可以分别获得 vendor.img product.img system.img system_ext.img system_dlkm.img ,这里面的 system.img 才是替换的目标。替换成第三方镜像(这里我用的是 Andy Yan 大佬的 Lineage 21 GSI )之后,用 lpmake 重新打包成新的 super.img 。

将 super.img 写入上面说的 AVD 的 system.img 的 super 分区里,大致操作就是用 losetup 给 system.img 创建一个 loop 设备,使用 kpartx 映射分区,直接通过 cat 写入分区,最后 detach 即可。

不过直接运行还是有一些 SELinux 上的问题,只有将 SELinux 设为 permissive 才能开机。就如同上面说的,只要能正常进入系统就算成功,所以还是挺满意的。接下来有空我打算也试试其他有意思的 GSI 镜像。

https://imgur.com/EhOQNbm EhOQNbm.png

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.