[G2 Android Development] dr4stic:
It's not just a download and rebuild, if that's what you're asking (and, I'm not trying to upset the apple cart or anything).

The build started as the end of my trying to figure out what the problem was with CM and Gapps that required it to be re-flashed each time a rom update was flashed. I experimented with running commands by hand, dissecting upgrade scripts, found that contexts were either not being set or being lost, etc... etc... And at some point the only answer I could come up with was that it was the recovery. I tried the CM recovery, which is worse than the black death, and it worked fine. Since your TWRP is the latest, I didn't understand why it wasn't keeping contexts. At that point I decided to build my own TWRP, so I started from the only official docs I could find. That's what my base started as.... the cm-10.1 repos they have on their github for g2.

After realizing that simply wasn't going to work, I started re-working and basing off of CM. I didn't necessarily want to look at your work because in my mind yours was done right and based on latest CM. I eventually looked at it for some hints (hence my attribution). It wasn't until I realized your device repos looked odd to me that I realized what happened. Your device repos were based from back when the G2 stuff was barely starting out on CM-12.1... it was still very 12.0 (which, in itself was a ball of vomit for the g2). It lacked the selinux stuff (which is why it was losing contexts) and you also used an alternate kernel (unsurprisingly, cuz the CM stuff was still in a state of vomit). There are no judgements. At the time you built the recovery, it's what was available and working. I don't think the G2 got selinux turned up until some time in very early August.

So, I decided to fork copies of the latest CM device repos which all work now, base everything off the current CM kernel (I figured this was safest for compatibility). I actually looked through the TWRP sources to hunt for actual BoardCommonConfig.mk settings (the docs seemed VERY lacking) and an understanding of how they all interacted. I looked at your repo for hints, but I didn't just copy it. As a result I use more current settings (a few of yours are actually deprecated). I'm assuming because of the age of your repo that your builds were lokified and you bumped them after the fact. Mine have all the changes that came with 12.1 including a lack of loki and being bumped as part of the build process. The rc files are all stock CM. Many things simply don't exist from your version because the recovery environment seems REALLY restricted once it's built. The few things that I did borrow, I moved into more appropriate locations and file names to be more respectful of the build process.

So, to answer your question: it started as a rather long and annoying bug hunt, then turned into a long but fruitful learning experience, and once I had a version that worked, I posted it for the few folks on the CM forum for whom this is a real pain in the ass.

It certainly wasn't a quick process and a grab for glory.... hell, once I realized that the CM build process needed to build a full ROM to get all the appropriate files into the recovery image, each one of those device builds took over an hour to build.

I started a new thread because I wanted to have a specific place where I could respond to issues if they arose, or at least tell people that I didn't care about their piddly little problems. I wanted a little more control over the support process, to be able to modify the OP with pertinent issues and links as they came up. It's something I wish had happened with CM-12.1 "official" threads.

There are things that I'm not sure of, and I try to indicate as much in the OP. The thread regulars indicated the history of needing thermal support, but I'm not sure if I got it right. Neither your recovery nor mine actually got the thermal libraries or binary included in the file system, however the process seems to be running. Nor are the configuration files included on the file system. f2fs support seems to simply be an additional package, and since the official G2 repos theoretically have f2fs support, I added that and moved along. The tools seem to be included on the file system.

I'm in the process of posting my changes to github, probably tomorrow since I'm still sorta learning to do that and I have things to do tonight. You can see them then. If you post an updated version of your recovery with my modifications, I'll happily close this thread.