# 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:
```
```
3. 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](https://source.codeaurora.org/quic/la/la/vendor/manifest/tree/LA.UM.9.1.r1-11100-SMxxx0.0.xml?h=release) from [here](https://source.codeaurora.org/quic/la/la/vendor/manifest/tree/?h=release) (not the default_ variant, more on that later).
You can add that manifest as .repo/local_manifests/vendor.xml
4. 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:
```
```
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.
5. 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:
```
```
6. 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`
7. Apply a change to the msmnile tree. In order to build ABL you should apply [this commit](https://github.com/ArianK16a/device_qcom_msmnile/commit/5e5f213fc3901466efe900764d0ca45ad599a1d9), so that booting recovery will work with your built abl.
8. 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
9. 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
```
10. 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!