Skip to content

Instantly share code, notes, and snippets.

@ArianK16a
Last active September 10, 2021 19:11
Show Gist options
  • Save ArianK16a/b20a5129c490f4cd1509341a023ef444 to your computer and use it in GitHub Desktop.
Save ArianK16a/b20a5129c490f4cd1509341a023ef444 to your computer and use it in GitHub Desktop.

How to build abl.elf for TP1803

  1. Initialize the tree: # repo init -u https://source.codeaurora.org/quic/la/la/system/manifest.git -b release

  2. Specify the system manifest you want to use: I wanted to use the LA.QSSI.11.0.r1-13000.02-qssi.0 tag, so i added .repo/manifest.xml with the following content:

<manifest>
    <include name="LA.QSSI.11.0.r1-13000.02-qssi.0.xml"/>
</manifest>
  1. Add the vendor manifest I wanted to use the LA.UM.9.1.r1-11100-SMxxx0.0.xml tag, so i grabbed the according manifest from here (not the default_ variant, more on that later). You can add that manifest as .repo/local_manifests/vendor.xml

  2. Fix double default conflict Now we face the issue that both, the system and the vendor manifest, declare a different default remote. To fix this, we can just comment out the default remote in the vendor manifest, like this:

<!--
  <remote fetch="https://source.codeaurora.org/quic/la/" name="caf" review="codeaurora.org"/>
  <default remote="caf" revision="LA.UM.9.1.r1"/>
-->

The difference to the default remote of the system manifest is the revision, but that is not an issue because our vendor manifest specifies the exact revision of all repos. The default_*.xml manifest's don't do this. Now we are all set to sync our caf tree, but we want to add vendor/qcom/proprietary first.

  1. Add custom repositories We can create a new local manifest, i named it z_bsp.xml (i went for the z_ prefix because i want it to be included after vendor.xml, we will override a repository of it). My z_bsp.xml looks like this:
<manifest>
<?xml version="1.0" encoding="UTF-8"?>
    <remote fetch="ssh://git@github.com" name="ssh" />

    <!-- Remove the default msmnile tree -->
    <remove-project name="platform/vendor/qcom/msmnile" />

    <!-- Sync the modified msmnile tree and it's proprietary vendor repository -->
    <project name="tadiphone-caf/device_qcom_msmnile" path="device/qcom/msmnile" remote="ssh" revision="eleven" />
    <project name="tadiphone-caf/vendor_qcom_msmnile" path="vendor/qcom/msmnile" remote="ssh" revision="eleven" />

    <!-- Sync the BSP, it will be responsible for signing the avb image -->
    <project name="tadiphone-caf/vendor_qcom_proprietary" path="vendor/qcom/proprietary" remote="ssh" revision="eleven" />
</manifest>
  1. Sync all the repositories I used this command, but just repo sync will be enough: repo sync -j 16 --fail-fast --force-sync -c --no-clone-bundle --no-tags --prune -q

  2. Apply a change to the msmnile tree. In order to build ABL you should apply this commit, so that booting recovery will work with your built abl.

  3. Update the bootloader repository; you can find it at bootable/bootloader/edk2. The bootloader will work as is without changes, but you should apply some changes for it to work correctly:

    1. Correct the button scan codes: https://github.com/ArianK16a/android_bootable_bootloader_edk2/commit/45769ae28c21530ecf779f5683cfd6a27e6a2cbe
    2. Remove bootloader lock/unlock commands: https://github.com/ArianK16a/android_bootable_bootloader_edk2/commit/0a6d07894da311ae2444c37d32dd7967dd1c5856
    3. (optional) Never display verified boot menu: https://github.com/ArianK16a/android_bootable_bootloader_edk2/commit/8b5fab17685b414afa0932bf407dfb0df20fe1fc
    4. (optional) Enable offline charging: https://github.com/ArianK16a/android_bootable_bootloader_edk2/commit/000a06406d953761174408a1564d82f1173f3a78
    5. (optional) You can apply some cosmetic changes: https://github.com/ArianK16a/android_bootable_bootloader_edk2/commits/8b5fab17685b414afa0932bf407dfb0df20fe1fc
  4. Build the abl image. After you got all the repositories right, you can start building it. To do so, you need to follow these commands in the root of the synced tree:

. build/envsetup.sh
lunch msmnile-userdebug
make aboot
  1. After your build succeeded, you will find the abl image in out/target/product/msmnile/abl.elf. You can flash it from fastboot like this: fastboot flash abl out/target/product/msmnile/abl.elf

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment