[Nexus 5 General] chairshot215:
I have decided to rework the thread to ovoid any confusion as the intent of posting this thread was to ask questions about compiling custom Roms from AOSP source that someone like myself who gained their development experience on other devices that building from pure AOSP code was not an option and are not as familiar working with AOSP. In the past my own experience comes from using and modifying for example the Cyanogenmod source so after attempting to now base my Rom on AOSP this time around with Lollipop have run into a few unfamiliar differences. As each question or topic is addressed I will update the Op. The hope is not only will I find solutions or answers to my own questions but that others in the same position will also be able to find use of the discussions posted in this thread.

Compiling the AOSP source into a format that can be safely flashed using a custom recovery. This was a 3 part question the first was just simply how to compile AOSP in a format other then .img files that can be flashed using a custom recovery without the need of flashing through fastboot or needing to use the adb sideload option.

1, Compiling AOSP into the for of an update.zip.

This was answered in short by know.patience by suggesting to use the “make otapackage” command in place of "make" to start the build. Was also made aware that a few modifications would need to be made to avoid producing an update package that does not use the new block format but instead the old style zips we are most used to seeing.

2, Now can create an update.zip using the “make otapackage” command ran into an issue that by flashing the update.zip produced would in the process replace the custom recovery used to flash with the Nexus Stock recovery. This was answered by Lethargy who suggested and provided a Link for the following commit.

For getting rid of the AOSP recovery:

https://github.com/Lethargy/android_build/commit/48521e167c642db76c9d4f52b1c63f9abc7f707f

https://github.com/Lethargy/android_build/commit/1d9224bd45ef2b4f5601a157de2bfe3bb1c95558

3, Now can create an update.zip using the “make otapackage” and after applying the above commit are now able to flash the update.zip without replacing the recovery Lethargy also provided links for the following commits.

To get rid of the block-based zip format:

https://github.com/Lethargy/android_build/commit/4d458300d935a3a9d893a590286cb578dcf54db2

You'll also want to make sure you have this commit so it doesn't flash awfully slow in recovery (8~ minutes, but only around 1-2 minutes with this commit):

https://github.com/Lethargy/android_system_extras/commit/52f8d5fc3edfacd112827d0a41516c1dc5f4a468

This one isn't required but you may as well:

https://github.com/Lethargy/android_build/commit/242be9ae4f05e3cb1d39d635cac7147ff904700c

Compiling using the AOSP Master branch vs release branches. In following the directions provided on the Google development site are given the command for downloading the source code using the Master branch. Using the Master branch as apposed to a release branch such as android-5.0.2_r1 or lower have found that the source compiles just fine but have run into one issue and just a general question that a little explanation would be helpful for general understanding of the AOSP Master branch.

The issue is that after flashing a Rom compiled using the Master branch everything in the Rom works as expected other than the radio. I have so far using the same exact vendor blobs as compiling a release branch have not had a signal and baseband version is listed under about phone as unknown.

The general question is that the android version listed compiling a Rom using the Master branch is version 5.0.50.50.50.50. In general I have yet to understand what this version number represents and very little to no information available via the Google Box.

Between the both I now wounder if the Master branch is intended for actual use or if so what changes are required so the baseband version is recognized and radio / Ril will work?

Quick Answer:

Google first commits new code into master and then is later tagged with an update for realease so in generall many things can be broken and the master branch is and not intended to be stable so if building from master expect that things will be broke or buggy.

Compiling Rom and Kernel together. For those of us again used to compiling using say the CM code are now used to compiling the Kernel along with the rest of the code. I know it is easy to just compile the Kernel and include in the device tree but for those of us who would still like the Kernel compiles with the rest of the code there is no information available on the Google Developers site for doing so and there seems to be a few differences as have tried just using the lines used in the CM Hammerhead device repository. I have come across these commits from Cl3Kener that should help. Hate posting other developers code but is on Github so is there for the public at large. So far have only tested as is so will update if finding not all changes are necessary or can be modified.

Inline Kernel Building

https://github.com/OptiPop/device_lge_hammerhead/commit/7de8fd95b6df16cb6311161d5048874d69cf1cb1

https://github.com/OptiPop/device_lge_hammerhead/commit/87768896f4eb8fcd989ce3b8492ca65305513851

https://github.com/OptiPop/device_lge_hammerhead/commit/5460eb3aa76ea5d813f64a3b3bab6ace1be6de68

Adding Pre-Built APK's

Seems Sprint users need a few apk's for updating prl and what not that are included into the Stock release but are not part of the AOSP code. For some reason through vendor or even device have tried adding these apk's into the build. First try I created a sprint vendor section and received a few errors untill learning would need to add sprint into a vendor white list found in build. Will post link to file later. After found the extra "Services.jar" I found in the stock image not found in the aosp compiled Rom did copy into the build but the apk's had not. Looking in the other vendor blobs noticed lge adds "qcrilmsgtunnel.apk" so followed the example and even tried just adding the other spk's into lge expanding the list used for adding in "qcrilmsgtunnel.apk" but still no luck. Also have tried adding through the device files for Hammerhead just to get them into the Rom for testing and still no luck. If this was CM or any other Rom not using pure aosp this would have been a 5 minut project so need to do some aditional homework.

Again think this thread could be a good resource for developers who are new to building their Roms around AOSP so wanted to include everything I run into during the process of moving away from using a heavily modified CM based code as the base of my Rom to using AOSP in its place so developers who are or in the same process or for those in the future can use as a resource to quickly adjusting. I have been building CM based Roms like Starship for years and after hours of working on other aspects to suddenly be stumped by these small differences between platforms can be very frustrating.