chenxiaolong / aosproot

Apply Magisk boot image patch during AOSP build
GNU General Public License v3.0
18 stars 8 forks source link

NOTE: This repo was just a proof of concept and I currently don't intend to keep it up to date with AOSP and Magisk changes as I don't personally use it.

aosproot

aosproot is a simple way to apply the Magisk boot image patch as part of the AOSP build. This allows building a rooted custom firmware, while preserving AVB (Android Verified Boot).

For patching existing/prebuilt firmware, see avbroot. However, building open source Android firmware with aosproot included is preferable to using avbroot.

NOTE: This is currently a proof of concept implementation and has not yet been tested on a real device. It should, in theory, be functional. When applied to the GrapheneOS source, a Pixel 7 Pro (cheetah) build produces a rooted and signed init_boot.img.

Warnings and Caveats

Usage

  1. Place aosproot.xml in .repo/local_manifests/ at the root of the AOSP source code.

    mkdir -p .repo/local_manifests
    curl -L -o .repo/local_manifests/aosproot.xml \
        https://github.com/chenxiaolong/aosproot/raw/master/aosproot.xml
  2. Sync the repo.

    repo sync vendor/aosproot
  3. Source the build/envsetup.sh as usual for AOSP builds.

    source build/envsetup.sh
  4. Copy the Magisk APK into vendor/aosproot/magisk.apk. A symlink also works, though it makes the AOSP build less reproducible.

    cp /path/to/magisk.apk vendor/aosproot/magisk.apk
  5. Build aosproot.

    m aosproot
  6. Apply code patches to other repos to allow aosproot to be injected into the AOSP build process. The set of patches can be found in the patches/ directory. NOTE: This need to be rerun every time repo sync is run.

    aosproot patch_code
  7. Build AOSP as normal. The init_boot or boot image will be patched with Magisk automatically during the build process, prior to signing.

License

aosproot is licensed under GPLv3. Please see LICENSE for the full license text.