Search code examples
androidkerneladbandroid-source

How disable dm-verity on Android Devices without using ADB?


I'm building AOSP from source code, and I want to be able to flash a Google Apps package onto the ROM. However, when the phone reboots, the google apps are not applied, and someone has said that it might be because of DM-Verity.

I want to know how to disable this DM-Verity protection, which should be able to be disabled in the kernel source code. How can I get started on doing this?

I know there is an ADB command "adb disable-verity" which works, but I want my build to have dm-verity disabled by default.

Can someone help me with this? Thanks :)


Solution

  • As far as I could understand from AOSP makefiles, DM-Verity is enabled by device's partition at build time.

    So, for example, if you plan to disable it for System partition you need to find PRODUCT_SYSTEM_VERITY_PARTITION macro inside your target Makefiles, remove/comment it and then build again.

    The exact location can vary since Makefile hierarchy is kind of customizable, but I found it inside device.mk for Huawei target on AOSP repo.

    EDIT:

    Another possibility is to disable DM-verity at all on verity.mk located here, but you need to test if disabling it triggers other errors during the build.