问题描述: 在Android 11开发的时候,想快速调试把单独编译好的模块push 到 /system 目录下,结果发现remount failed
C:>adb root
restarting adbd as root
C:>adb remount
Skipping /system for remount
Skipping /vendor for remount
Skipping /product for remount
No partitions to remount
remount failed
强行push 也是显示错误
Z:framework> adb push .\framework.jar /system/
adb: error: failed to copy '.\framework.jar' to '/system/framework.jar':
remote couldn't create file: Read-only file system
.\framework.jar: 1 file pushed, 0 skipped. 43.0 MB/s (29967488 bytes in 0.665s)
remote couldn't create file: Read-only file system
MTK解释: 原因是android P版本后google启用avb(Android Verified Boot)2.0,verified boot and DM-verity默认启用策略发生了变化。
DM-Verity behavior changes from vboot1.0 to avb2.0.
On vboot1.0, dm-verity is turned off on eng build and is enabled on userdebug/user build.
DM-verity could be disabled with adb (not fastboot) on userdebug build without unlocking device first.
DM-Verity could not be disabled on user build.
On avb2.0, dm-verity behavior are the same on all build variants.
It’s turned on by default and could only be disabled after device is unlocked.
dm-verity disable flag is moved from system image dm-verity metadata(vboot1.0) to vbmeta image(avb2.0), and you have two ways to disable it: adb and fastboot.
解决办法:
- Android P + kernel-4.4 or kernel-3.18
download preloader with verified boot disabled which location is the same as scatter file //preloader_<PROJECT>_SBOOT_DIS.bin
adb root
adb disable-verity
adb reboot
adb root
adb remount
- Android P + kernel-4.9 or after
1. download preloader with verified boot disabled which location is the same as scatter file. //preloader_<PROJECT>_SBOOT_DIS.bin
2.boot to Home Screen
3.go to setting -> system -> Developer options -> OEM unlocking
4.adb reboot bootloader
5.fastboot flashing unlock
6.press volume up key
7.fastboot reboot
8.adb root
9.adb disable-verity
10.adb reboot
11.adb root
12.adb remount
注意事项:
-
第一步需要先确认out目录有没有编译出
preloader_<PROJECT>_SBOOT_DIS.bin
这个文件,是和下载时选择的Android_scatter.txt
同级目录
如果没有这个文件,那么需要先在系统里找到对应BoardConfig.mk
,ifneq ($(wildcard vendor/mediatek/internal/sboot_disable),) BOARD_BUILD_SBOOT_DIS:=yes else BOARD_BUILD_SBOOT_DIS:=no // 把这个no 改为yes endif
把这个no 改为yes, 然后重编烧录开机,之后再进行后面的步骤。
-
第三步是要在开发者模式里找到
OEM unlocking
并打开
-
成功之后remount 是这样
Z:> adb remount Using overlayfs for /system Using overlayfs for /vendor Using overlayfs for /product Now reboot your device for settings to take effect remount succeeded
总结: android 真的好难呀!