yashsingh1/xdaforums huggingface dataset:
[G2 General] garyd9:
That's interesting. I wonder if you wiped or modified another partition (laf?) that causes it to jump directly to the partition named "recovery."

As for the issue you are describing, I believe that the bootloader (aboot) doesn't validate a partition that you aren't trying to boot into. So, if you attempt to normally boot, only the partition named "boot" (normal kernel) will get validated. If you attempt to boot into the partition named "recovery", it will attempt to validate only "recovery."

So, if you have an unmodified 'boot', you'd be able to boot normally regardless of what might have changed in 'recovery'... However, you wouldn't be able to boot into the recovery partition. Does this describe what you are experiencing?
[G2 General] chillstep1998:
You can indeed go into fastboot mode. ( once :) )

You just need to flash a corrupted kernel.

Once I tried to compile my own kernel. But I fuc... uhm... messed it up somehow. It flashed normally, but on boot it gave me an error and dropped me into

fastboot

.
[G2 General] garyd9:
To prevent any confusion, please describe what you saw as fastboot mode. (There's normal boot, recovery, fastboot, download, and that LG thing that says to press 'power' to wipe the device.)

normal boot is.. well.. a normal boot.

recovery is what AndroidUser00110001 and I are talking about, and has options for installing updates and wiping the device.

download is a black screen with a blueish rectangle in the middle with some tiny dots/squares inside the box and the word "downloading" (This mode seems to be BEFORE the bootloader (partition named 'aboot') in the boot sequence.

The "LG thing" is something that I don't think anyone has named, but is a white'ish screen with black lettering saying something to the effect of "press the power button to factory data reset. (On the 20c bootloaders, it's slightly different; giving you "yes/no" options)

I've never seen fastboot, so I can't describe it.
[G2 General] AndroidUser00110001:
[MENTION=487933]garyd[/MENTION] if boot chain is broke in certain way then fastboot comes up. Where you can use fastboot flash blah blah blah. It allows you to flash most .IMG files. One thing it does not allow on G2 is system partition.
[G2 General] chillstep1998:
I think this has to do with the additional partition that is included in lg's kernels. (I can't remember what it was called... something with 3 letters)

There is an unpackbootimg that supports this partition and one that doesn't. (I used latter).

From there i normally compiled my kernel, repacked the it and put it into an update.zip.

Then I proceeded to flash from recovery.

Everything went as I expected, but when I booted, I got a black window with low-res white text on it. There were some lines saying something like:

[random number] *blah

[random number] *signature verification error /*Don't quote me on that , I can't really remember*/

[random number] *fastboot mode

From there you can do things like

fastboot boot imagename

or fastboot

flash partitionname imagename

. (I tried and it worked.)
[G2 General] djkinetic:
and easy way to get dropped into fastboot is to wipe recovery via dd. also the g2 has one more mode, its called qusb bulkmode, in this mode all 30+ partitions of the g2 will be mounted as mass storage, not something that you wanna screw with especially in windows. this usually happens by blanking out or booting a bad aboot.img
[G2 General] garyd9:
"fastboot boot imagefile" works?! If so, that might be a way to bypass the bootloader's image validation.

The three letter image you were referring to - is that the device tree (dtb or dts)?
[G2 General] savoca:
No, it will still only allow a stock image.
[G2 General] chillstep1998:
Yes. That was it.

But I dont know if it will work on LG's KitKat, as I only tested this on the old version.

.

.

.

Sorry if this is completely stupid, or obvious that it won't work, but i got another idea:

Would it be possible to take the old bootloader and plug it in as a second bootloader (like on Kindle Fire)?
[G2 General] garyd9:
yes, I believe that the stock kitkat kernel does use the device tree image.

I have no idea, but I don't think that the 10d bootloader would be considered a valid "boot" partition for the 20c bootloader. The bootloader expects a boot/recovery partition to contain a kernel image, a ramdisk, and a device tree.
[G2 General] chillstep1998:
I don't know if I'm right, but a second bootloader would be loaded no matter what, because why would there be one if it wasn't needed (if that makes sense :silly: )

There are currently two Android devices that come with such a 2nd BL intended. I remember reading somewhere on this forum that a 2nd BL is set up by adding some lines to the beginning of the bootloader (?) , where all partitions are defined.
[G2 General] SnakeHaveYou:
So.. qusb bulkmode =/= fastboot?

That's really important, the part that you need to wipe the recovery..

But, i was able to enter this gusb bulkmode by overwriting the recovery with the Philz without loki..
[G2 General] chillstep1998:
As far as I understand from various sources, it is indeed fastboot, but the fastest possible transfer speed. This on the other hand comes with the drawback, that there is no verification if the file got transferred correctly. Its like:

PC: Ima send u a file k?

Phone: k

Phone: Wait there was an error!!!

PC: Stfu I'm working!

Joke aside, we might be able to exploit this by somehow producing an error in this procedure (?).
[G2 General] AndroidUser00110001:
That's what happened to my v500 when I tried to flash it v510 but did not change the partition tables :D
[G2 General] AndroidUser00110001:
Phone reboots and fails security check and tells user to STFU and put correct software back on phone. The issue is not flashing anything to phone. Issue is bypassing security check for device to boot after file flashed to phone.
[G2 General] chillstep1998:
Ok, I got it. I'm gonna experiment a bit and tell you what i find (or not).
[G2 General] JackpotClavin:
somebody should try this: https://github.com/JackpotClavin/an...mmit/7b6187a0e5fb8ca59888cacf5f5b863baa8d1064

I've booted 4.4 sources with my 4.2 aboot with it, and even did a little bit of cyanogenmod work where I got it booting, and it runs pretty smooth too.

read the entire git commit for instructions on how to setup the command line after you compile the kernel with that git commit in it.
[G2 General] pendroz:
Great news

Thank you to everyone who contributed :good:
[G2 General] AndroidUser00110001:
Sweet!
[G2 General] garyd9:
wow. I've wiped my phone twice now today. The first time due to a "reboot recovery" with no params, and the second time after I trashed aboot. (The LG tool does a wipe on a device when restoring it.)

I think I need to stop screwing with my phone today. Maybe I'll mess with my wife's instead. :D
[G2 General] JackpotClavin:
Like you had a bad aboot and it didn't get bricked? I thought having a completely borked aboot would result in a bricked device. What happened after the aboot got messed up?
[G2 General] garyd9:
I was typing too fast in testing something and managed to dd out to aboot instead of boot. (Dumb... but that's what I get for using a windows cmd prompt to "adb shell" instead of using a real terminal window from ubuntu or something.)

Anyway, I was able to get back into download mode (hold power until phone turns off, plug in USB while pressing vol up.) Once in d/l mode, I used the LG flash tool.

BTW, anyone know of a good way to run adb shell in Win7 that has real terminal emulation? There was once a putty version that had adb intergrated, but its an older version of adb -- android 4.2+ wants the new more secure adb.
[G2 General] jrgilbert79:
So that puts download mode before aboot possibly a hardware chip. It would be crazy of you could make your own kdz file I wonder what security is on download mode
[G2 General] garyd9:
Not really... there could be several layers of boot loaders. "aboot" is just the last boot loader before the normal kernel (or recovery.)
[G2 General] AndroidUser00110001:
I have been wiping my phone at least twice an hour the past few days :)
[G2 General] AndroidUser00110001:
Nope download mode not on chip. I hosed a v500 to the point where there was no download mode. I'll have to look back on what partitions I flashed on it to screw it up so bad that only bulk mode came up.
[G2 General] JackpotClavin:
Oh okay. It didn't boot it into qhsusb_bulk mode did it? Because if you're in that mode, the device's partitions are listed as /dev/sdb(1 - 36) on linux, and you can dd if=/home/linux/aboot.img of=/dev/sdb5 and you can unbork your aboot like that without having to restore. You can also write boot and recovery partitions like that using the dd command, just make sure you use the correct partition number for what you're intending to flash. A great thread here for that http://xdaforums.com/showthread.php?t=2582142

Also, has anybody compiled a kernel with that devtree patch that I posted earlier? I'm curious if it works for your devices like it did mine. The reason I ask is because I cannot emulate your phones' devices because the Verizon variant does not have an official 4.4 build so I'm not sure if there's another partition (tz or sbl) that's gonna interfere with booting a kernel with a aboot from Jellybean.
[G2 General] AndroidUser00110001:
Oh BTW...why would LG use test keys in production software? If that has any relevance...
[G2 General] AndroidUser00110001:
Ha! Where were you when I needed this info... I searched but I guess not good enough. Oh well ended up with v510 instead...

After checking thread I notice the thread started after I bricked my device and sent it back...

Do you know of a way to rewrite the partition table? Not asking for G2 but for the G Pad. There is difference partition table between the v500 and v510.
[G2 General] JackpotClavin:
Haha when I found that thread I had hosed both my boot and recovery partitions and had no means of rescuing my device. I was minutes away from booting into windows and flashing the stock image which would have killed my /data and TWRP backups and photos and whatnot..
[G2 General] garyd9:
No, basically I was typing fast, but using adb shell in a windows prompt (and not a real terminal emulator.) So, "tab" completions exist, but you don't see them... so, I might type something like: of=/dev/blo<tab>/plat<tab>/msm<tab>/by_na<tab>/boo<tab>. If I'm using a linux terminal (console, xterm, gterm, etc) I'll see the tab completions. If I'm using windows, I'll just see 8 spaces, but I know that the stuff was filled in (just not displayed.)

In that case, I started the partition name as "aboo" by accident, but didn't notice because the command line was already a mess of half-paths and spaces. As soon as it started, though, I realized what I did and whacked ctrl-c. Of course, no human could possibly hit 'ctrl-c' before at least a byte was written, which would immediately invalidate the bootloader.

At that point, I already knew I was in trouble, so pressed/held power to hard power off, and started the flash tool to plug in on download mode. I didn't even try to boot normally -- I don't know (and wanted to avoid) whatever kind of destructive havoc LG might create if you attempt to boot an invalid aboot.

The moral of the story is that even an experienced developer screws up on occasion. However, we try (try... don't always succeed) to have a plan in place to recover for when we screw up.
[G2 General] AndroidUser00110001:
I thought I screwed up my G2 the other day when I flashed the system.img from D802 KitKat and rebooted without flashing superuser first. I was not able to restore to stock with d800 tot because lg flash tool thought I had 802. When I flashed 802 restore file phone booted up fine but touch input was screwed up and the phone would not stay on long enough to get adb enabled to root and fix issue. Lucky for me someone pointed me in the direction of DLL file that did not check device before flash and I was able to restore phone to proper default software.

Still does not beat my own all time goof with ROMs...
[G2 General] garyd9:
woah... that's extremely useful. I'm going to request that it be made sticky...

No. However, it's not what you think. It's much worse: I was trying to build up to that level by starting with an original (JB) kernel, with original sources from LG, and I never managed to get a bootable kernel. It got to the point that I figured I needed to walk away from it before I got (much more) pissed that something so simple was eluding me.

I'm not sure wtf I was doing wrong. I basically took an unmodified boot.img, pulled out the ramdisk, decompressed (lz4) and unpacked (cpio -i) it. I then made the "known" dtb related patches to the LG source (well documented and originated with wootever as far as I'm aware), compiled zImage, modules, and dtbs. Used dtbTool, repacked the ramdisk (mkbootfs), and remade the boot image (mkbootimg or mkboot.) loki_patch'd for the 10d bootloader (it was 10d source) and installed the kernel. Booted to LG logo, and then nothing else.

Repeat several dozen times with different variations. I also managed to find that there was another missing dtb (att-g2-v2-2 or something like that) that the existing patches didn't address.

I even tried to pull other people's source and their compile/build scripts and ramdisk images (if the source was based on stock source and not based on cm11), but still had absolutely no luck. (In a couple cases, I was getting MODULE_MISMATCH compile time errors... duh..)

I also tried a few different toolchains - starting with google's own 4.6 toolchain (search for a google owned page documenting compiling kernels and it has a link to the base 4.6 toolchain.) Then I tried with a 4.7 and 4.8 toolchain also with no luck.

Okay, that's a rant... sorry. I'm sure my error was something obvious, but when you get stuck in a mental rut, the only good way to solve the problem is to step away for a bit...
[G2 General] JackpotClavin:
Darn that doesn't sound good. If I cook up an AT&T recovery image sometime tonight can you try to loki it with the aboot that allows for the loki exploit?
[G2 General] garyd9:
Not tonight... I just got 20d (kk) back on and restored the last titanium backups I copied to my PC. If you want to spend some serious time on it this weekend, I'd be game.
[G2 General] AndroidUser00110001:
Private message me and tell me what you need done. Or if you are on lg-g2 on freenode we can talk there. I'll be free to play in an hour...
[G2 General] savoca:
[MENTION=3727492]JackpotClavin[/MENTION] I did use that commit and it works fine on my ls980.

Can confirm the devtree commit gives me a bootimg KK rom, I tried on D800/D801 system.img's

I'll edit this post with boot.img's for D800 and D801. Only works for 4.2.2 bootstack and allows KK Stock Roms to be loaded, and keeps custom recovery. The old aboot reads the old offsets so don't try compiling with those new offsets, also the kernel needs to be built as the new aboot only supports zImage's with appended dts.

These can be used as official as they're completely stock/unmodified, using the same toolchain as LG aswell.

http://savoca.co/galbi/KK_d800.zip

http://savoca.co/galbi/KK_d801.zip

Work these into your stock KK roms and you will have a working custom recovery on the JB bootstack. It may be smart to upgrade your rpm/tz partitons to the KK ones aswell. Can confirm this is safe too, tried both sets on ls980.
[G2 General] easyguy:
Does all this sound like we are getting closer to custom recovery?
[G2 General] JackpotClavin:
Awesome! By bootstack do you mean just the aboot from 4.2 or are there more partitions than that?
[G2 General] savoca:
All 4.2.2: aboot, rpm, tz, sbl1, sdi, dbi, laf.

The only thing that was 4.4.2 was system.img
[G2 General] garyd9:
...sounds like we now have a solution for recovery AND kitkat... (assuming a older bootloader.)

When devs work together, nothing is impossible.
[G2 General] AndroidUser00110001:
Just to confirm...All 4.2.2: aboot, rpm, tz, sbl1, sdi, dbi, laf. and 4.4.2 system.img with your boot.img?

Damn and I was actually gonna take a small break and play some games on new rig. Just got the vid card I wanted too...lol. I need to eat, restore phone to 10o since I am on KK now and will flash what you posted.
[G2 General] Koopa777:
My expression right now.
[G2 General] savoca:
Yes and we are back in action.

dd the new system.img in recovery then sideload the zip. Obviously devs can start baking it into Roms.

I will post each variant when their source is released, just to guarantee vanilla kernel compiling.
[G2 General] dawkpaul:
Thanks!

Thanks to both [MENTION=3727492]JackpotClavin[/MENTION] and [MENTION=4316709]Savoca[/MENTION] for the important leap here.

Thanks also to [MENTION=336863]garyd9[/MENTION] and [MENTION=4218641]AndroidUser00110001[/MENTION] for all of the input.

Now we can finally move to LG 4.4.2 with impunity.
[G2 General] AndroidUser00110001:
OK this may be a dumb question or may have impact...which 4.2.2 version? A&T had update from 10o to 10d that changed loki method so I am thinking it may make a difference with you just compiled.

Screw eating and playing...restoring phone now. I am going to guess 10o for now since it was what was originally used...

EDIT...I meant 10d to 10o...
[G2 General] JackpotClavin:
Awesome! Thanks for reporting your findings.

I was able to play around with the 4.4 kernel on CM11 and I could tell the knock-on feature and powering on the screen with the button was significantly faster than the current kernel. Unfortunately I had to go back to regular CM11 because I had no audio or cell service with the 4.4 kernel source's kernel. It's gonna be good for all ROMs once the 4.4 source gets incorporated :)
[G2 General] garyd9:
I don't quite understand this statement... I thought the only thing that needed aboot offsets was loki_patch.
[G2 General] savoca:
Anything that is currently Loki patchable is compatible.

This is for mkbootimg, 4.2.2 boot.img has different ramdisk_offsets and tags_offsets from 4.4.2 boot.img.

We have to use the 4.2.2 one when we make the bootimg so the old aboot can still read it properly.
[G2 General] AndroidUser00110001:
Rooted and back on 4.2.2 with recovery installed. Have this so down pat it takes me a minute :)

[MENTION=4316709]Savoca[/MENTION] so all I really need to do now is flash your boot with 4.4.2 system.img. I am making that package now to flash.

I hope this a night where my wife works late :D
[G2 General] JackpotClavin:
I think it's regarding how the 4.4 source uses a zImage-dtb, which has the devtree baked into the kernel itself; as opposed to a regular zImage that the 4.2 kernel sources would make, and we would have to throw the devtree in the boot image as it was being combined with the ramdisk. So the 4.4 boot images were not looking for a specific address for the devtree as it was actually part of the kernel itself. So we must keep everything as if it was still 4.2, to appease aboot
[G2 General] bps119:
Don't mean to derail the thread, but [MENTION=1376725]Jackpot[/MENTION]calvin, [MENTION=4316709]Savoca[/MENTION], [MENTION=336863]garyd9[/MENTION], and [MENTION=4218641]AndroidUser00110001[/MENTION], you are all appreciated much more than you will ever know. On behalf of the g2 community, I thank you for your tireless efforts here.
[G2 General] garyd9:
mix-n-match'ing images! People are going to have to start naming files in the update.zip files to reflect what they come from (and what they are compatible with.)

No longer "boot.img", but "boot-bl422-sys442.img"
[G2 General] AndroidUser00110001:
[MENTION=4316709]Savoca[/MENTION]

My results...

Stuck at LG screen with flashing notification light..

What I did...

I restored to AT&T 10d 4.2.2 firmware

Rooted and installed recovery

Added system.img to your boot.img pacakge..yes added line to updater-script to flash system.img..

Booted into recovery and did the normal wipe of cache, data, dalvik cache and system.

Flashed the zip file, no errors

Rebooted and stuck at LG screen :(

So the 10d and 10o software makes no difference? Loki that worked on 10d did no work on 10o so new recoveries had to be made. AOSP based ROMS that worked on 10d did not work on 10o...

Just giving you as much info as I can...
[G2 General] garyd9:
pft. I didn't do much work this time. I basically just gathered and repeated information. (and trashed my phone a couple times.) I think [MENTION=3727492]JackpotClavin[/MENTION] came up with the magic bullet of the needed device tree stuff. If you ever meet him, buy him a beer. :)
[G2 General] AndroidUser00110001:
I was thinking that and it is going to be hell for the end user. Flash this package first if you on KitKat. Flash this if you on 10o...flash this on 10d. All before you can flash a custom ROM.

And this all depends on if CM or whoever updates their source too...

LOL best bet would be if you want to flash custom software than just flashback to what works currently :D
[G2 General] garyd9:
I think we just need to shift everyone back to a JB bootloader. Actually, we should be able to modify loki_patch to return a specific value if its an incompatible bootloader (or it might already be done), and then trap that in the edify script to display a message such as "You need a compatible bootloader. Search on xda-developers.com for \"g2 compatible bootloader\""
[G2 General] AndroidUser00110001:
Yes I agree because of the headaches it is going to cause devs, hackers and end users but for reasons I cannot explain part of me still wants to move forward even though I am just learning this part of Android and because I want recovery for the G Flex too :) I think they are using the same method on it too but have had very little time to look into it.
[G2 General] AndroidUser00110001:
Sorry to repeat myself but this thread is moving fast and want to make sure you saw my results...

My results...

Stuck at LG screen with flashing notification light..

What I did...

I restored to AT&T 10d 4.2.2 firmware

Rooted and installed recovery

Added system.img to your boot.img pacakge..yes added line to updater-script to flash system.img..

Booted into recovery and did the normal wipe of cache, data, dalvik cache and system.

Flashed the zip file, no errors

Rebooted and stuck at LG screen

So the 10d and 10o software makes no difference? Loki that worked on 10d did no work on 10o so new recoveries had to be made. AOSP based ROMS that worked on 10d did not work on 10o...

Just giving you as much info as I can...

Anything else you have in mind I will be more than happy to try.
[G2 General] JackpotClavin:
Do you have adb access?

And can't we infer that if they have a custom recovery installed, it means they have a compatible boot loader? Since there's no way to boot an insecure image on an incompatible bootloader
[G2 General] savoca:
Update your rpm and tz to the 4.4.2 partitions. Not sure why it'd fail for you. I got booting in the att rom. I also compiled the d800 kernel out of the d801 source (which worked for sprint) if you want, tomorrow I can build out of d800 source.
[G2 General] AndroidUser00110001:
No adb.
[G2 General] AndroidUser00110001:
Will do.

If you point me to your changes in stock d800 source then I can compile the ROM too if you out of time. I think I may wait till tomorrow too..I am burnt playing with G2. The KitKat update came at wrong time. I was in the middle of making device tree for the G Pad GPE when KK dropped for G2 and grabbed all my attention. LOL I should have stuck to what I knew I could accomplish and not start some new journey...
[G2 General] razrlover:
[MENTION=4218641]AndroidUser00110001[/MENTION], [MENTION=4316709]Savoca[/MENTION], [MENTION=3727492]JackpotClavin[/MENTION], [MENTION=336863]garyd9[/MENTION], you guys are amazing!!
[G2 General] G-Bus:
Thanks for the work you guys are putting into this.
[G2 General] zPacKRat:
I'm sure the devs appreciate the kudos, however keep them to the thanks button in order to keep this on topic.
[G2 General] ledvedder:
In for any updates. Any news on xposed?
[G2 General] garyd9:
Sure

Sent from my LG-D800