yashsingh1/xdaforums huggingface dataset:
[ONE General] Vonnegut:
Quick post about how an OTA works.

In order to save bandwith, OTAs patches files already existing in our system. In other words, OTA zips don't come with a full txt/apk/jar/lib/whatever file and then just overwrite the old one. They come with files containing only the binary code which must be added. In this way, they can release an OTA of 20MB instead of one of 100MB. Can you see the point?

For example, let's say the OTA wants to patch the nextcamera.apk. A routine gets launched (in pascal) and remove some byte and add some more to the existing apk file. Of course this patching method do not work with each and every version of nextcamera.apk but only with one version of it (the more recent one).

That's why the script calculates and compares the HASH of each and every file that is going to be patched. If all of the the files that must be updated pass the test, the OTA will start patching them, otherwise the installation will be aborted. Even if the HASH of just one file differs from the expected HASH, the installation will stop. That's why ppl must be very careful if they want to edit the build.prop file or replace a library and so on.

Here's another example. Let's say that i have installed the Xposed framework. When Xposed gets activated (by pressing the install button inside the app), it replaces the app_process file in the system/bin (but only after making a backup of the original one).

Now, let's say that, i've just received an OTA that wants to update the app_process binary. If i don't replace the modified one (uninstalling Xposed from inside the app) before launching the script, i can be 101% sure that the installation will be aborted.

As for all of the other partitions (boot, aboot, modem, tz, LOGO etc etc) that might be updated with the OTA, the script overwrite them (if needed), so any custom kernel (or recovery if i didn't unflag the developer option) will be overwritten by brute force.

To sum it up: only changes in the system can stop an OTA installation. If an OTA fails, just take a recovery log and look what file didn't match the expected HASH.

Just for the sake of statistics, i can tell that an OTA updates on average about 450 files...so there are about 450 checks which must be passed in order for the installation to be succesfull.

P.S. Timmaaa, thank you for your work, you put up a very nice guide for beginners.
[ONE General] zuckerj:
Great explanation of the OTA process. Much appreciated.
[ONE General] spicediablo:
[MENTION=5427631]Vonnegut[/MENTION], thanks for the explanation. So I guess OTA installation will fail for my case as I have xposed and franco kernel installed. So the best way for me would be to flash the images using fastboot while retaining the user data?
[ONE General] Heisenberg:
Just disable Xposed and flash the stock boot.img before you take the update and you should be ok.

Transmitted via Bacon
[ONE General] spicediablo:
Means I follow section 9 of OP right?

But I'd like to retain my user data. Which command should I skip?
[ONE General] Heisenberg:
You want to follow Section 7, and you'll find the stock kernels in this thread:

http://xdaforums.com/showthread.php?t=2857110

Flashing the boot.img doesn't touch your user data so nothing to worry about there.

Transmitted via Bacon
[ONE General] spicediablo:
Ah now I get it. I came from Nexus 4 so I thought you wanted me to flash the system.img. So actually I just have to revert to stock kernel by fastboot flash boot boot.img and disable xposed. Anyway, is there a way for me to flash the ROM while keeping the user data intact(just in case I had other system changes that I wasn't aware of)? I used to be able to do that with my Nexus 4...
[ONE General] Heisenberg:
Are you talking about flashing a ROM or taking an OTA? Your data isn't affected when taking an OTA, but when flashing a ROM you should always wipe.

Transmitted via Bacon
[ONE General] spicediablo:
Flashing a ROM. I used to flash everything except user data when upgrading on my old nexus 4 i.e from 4.4.2 to 4.4.3...
[ONE General] Heisenberg:
If you're flashing a full ROM you should wipe system, factory reset, cache, and dalvik cache. And don't restore any system data with Titanium, only user apps (and their data).

Transmitted via Bacon
[ONE General] Vonnegut:
As for the kernel, it makes no difference if you keep it...the OTA will overwrite the boot partition anyway replacing franco with the new stock kernel.

I was quite clear on that point.

As for Xposed, uninstall it using the button inside the app. When the update is done, just reinstall it and reboot. There no need to remove the Xposed app itself or any module. Nice isn't it?

The OTA won't touch the userdata partition. Here's how the main block 179 (=mmcblk0) is split:

Number Size(Kb) Name Device
1 65536 [COLOR="Red"]modem[/COLOR] /dev/block/mmcblk0p1 (*) FAT16
2 512 [COLOR="red"]sbl1[/COLOR] /dev/block/mmcblk0p2 (*)
3 32 [COLOR="red"]dbi[/COLOR] /dev/block/mmcblk0p3 (*)
4 32 DDR /dev/block/mmcblk0p4
5 1024 [COLOR="red"]aboot[/COLOR] /dev/block/mmcblk0p5 (*)
6 500 [COLOR="red"]rpm[/COLOR] /dev/block/mmcblk0p6 (*)
7 16384 [COLOR="red"]boot[/COLOR] /dev/block/mmcblk0p7 (*)
8 500 [COLOR="red"]tz[/COLOR] /dev/block/mmcblk0p8 (*)
9 1024 pad /dev/block/mmcblk0p9
10 1536 modemst1 /dev/block/mmcblk0p10
11 1536 modemst2 /dev/block/mmcblk0p11
12 10240 oppodycnvbk /dev/block/mmcblk0p12
13 10240 oppostanvbk /dev/block/mmcblk0p13
14 1355776 [COLOR="red"]system[/COLOR] /dev/block/mmcblk0p14 (*) EXT4
15 32768 persist /dev/block/mmcblk0p15 EXT4
16 524288 cache /dev/block/mmcblk0p16 (*) EXT4
17 16384 recovery /dev/block/mmcblk0p17 (*)
18 1536 fsg /dev/block/mmcblk0p18
19 1 fsc /dev/block/mmcblk0p19
20 8 ssd /dev/block/mmcblk0p20
21 1024 misc /dev/block/mmcblk0p21
22 16384 [COLOR="red"]LOGO[/COLOR] /dev/block/mmcblk0p22 (*)
23 32768 DRIVER /dev/block/mmcblk0p23
24 32768 reserve1 /dev/block/mmcblk0p24
25 16384 reserve2 /dev/block/mmcblk0p25
26 8192 reserve3 /dev/block/mmcblk0p26
27 65536 reserve4 /dev/block/mmcblk0p27
28 58510540 userdata /dev/block/mmcblk0p28 (*) EXT4
29 294895 grow /dev/block/mmcblk0p29

Official CM OTAs can change one or more (or all) of the red colored partitions (and the recovery too, if you didn't unflag the option in setting --> developers).

Custom ROMs change only system and boot. Anyway, as Timmaaa already told you, whenever you install a

new

custom ROM, it's highly recomended to make a wipe of cache, dalvik cache and data too...that's called a clean flash. If you don't wipe the DATA partition because you feel lazy and you don't want to reinstall and set again all of the apps you've already installed (=dirty flashing) you will most likely found out that the Opo won't boot properly. Dirty flashing is only for ppl with some advanced knowledge about Android and ROMs.

P.S. Even if the OPO internal storage is located inside the userdata, you will never lose it (unless you voluntarily wipe it!) because custom recoveries won't touch the data/media/0 directory. If you want to know more how the userdata works in the OPO, read this http://teamw.in/DataMedia.
[ONE General] harrys1991:
good guide thanks
[ONE General] djha53k:
Any idea what to do with this???

http://xdaforums.com/oneplus-one/help/bricked-one-able-to-start-t2886698/post55658925#post55658925

I tried following this guide: http://xdaforums.com/oneplus-one/development/mod-reset-unlock-tamper-bit-t2820912

but failed horrible :crying:

I still have One in the state:

The command:

just reset One to the TWRP, but it does not unlock it.

and Im not able to install anything... for any fastboot command I got error:

I can get to Fastboot Mode or TWRP (2.8.0.1), but I cannot install anything...

Even when I "adb push" any ROM to the One, the TWRP install it, but once it boot up and Welcome (choose language) screen show up... the One immediately reset :(
[ONE General] Heisenberg:
You're already posting about this in at least five other threads. Are you aware that duplicate posting like that is against the rules?

Transmitted via Bacon
[ONE General] s ! l e n t:
nice compilation, thanks!
[ONE General] 3's&7's:
What a GREAT guide! This took 5 min to unlock, flash twrp, and supersu.

The best part is that I still retain this from earlier today and could do it again easily.
[ONE General] Heisenberg:
I'm very glad you found it useful. Thanks for your feedback.

Transmitted via Bacon
[ONE General] Haffa:
Nice guide
[ONE General] Chris9446:
Thank you for this compilation of guides.
[ONE General] hgeert:
Perfect guide, thanks
[ONE General] statman12:
I did a backup of these two file like in the guide but I dont see them on the root drive. Any ideas Thanks for a great guide. I ended up with the same results as the pic posted.

modemst1.bin

modemst2.bin

Never mind I rebooted and then hooked up my phone again and they were there. Weird!
[ONE General] Pure+:
So... I'm not positive of this is the right place. But a search yielded no results and I only see this thread with a Q&A tag so here goes...

I haven't done anything to my opo other than unlock root and install a recovery. And I'm wanting to switch to art runtime but I'm not sure about compatibility and performance. Any experience or expertise would be very much appreciated.

Thanks guys. And sorry if this isn't the right place. Couldn't find any where else.
[ONE General] Heisenberg:
ART is still a work in progress, but that doesn't mean it can't be used. Just be aware that not all apps are compatible yet and they simply won't run on it. I'd say just switch it over and see how you like it.

Transmitted via Bacon
[ONE General] mashmelloww:
GAHHHH!

]I'm not sure if I should be asking here but I need help. I was using this guide to help root my oneplus one as I'm a total beginner and I'm stuck on the first step (unlocking the bootloader). 'fastbook oem unlock' doesn't seem to do anything and the when I try 'fastbook flash recovery twrp.img' it fails with -

target reported max download size of 536870912 bytes

sending 'recovery' (4 KB)...

OKAY [ 0.004s]

writing 'recovery'...

FAILED (remote: image is not a boot image)

'fastbook oem device-info' tells me -

(bootloader) Device tampered: false

(bootloader) Device unlocked: true

(bootloader) Charger screen enabled: false

I don't know what to do and any help would be really appreciated.
[ONE General] Heisenberg:
What's the command you're using to flash the recovery? And what's the full filename of the recovery you're flashing?

Transmitted via Bacon
[ONE General] elrey311:
It's fastboot! It looks like you are typing fastbook. I don't know if that's what you are typing in your commands, but that is what you are typing here. You might want to check that.
[ONE General] Heisenberg:
That's just what he's typing here, you would get no results from typing it in a command prompt.

Transmitted via Bacon
[ONE General] ql3x:
Humm weird thing here, should be more like 13 000k sent. Make sure your command line is correct. And also make sure that you are on the directory containing your .img file.

For the fastbook oem unlock, your phone should reboot with a animated android logo, and reboot again.
[ONE General] CravingMender9:
You only have to do the oem unlock once. Looks like it is already unlocked.

As for flashing recovery, you type something like this:

fastboot flash recovery recovery_file_name.img

Make sure that the recovery is downloaded properly. It should be a .img file (not zip or anything. If it is, extract the .img from inside it and use that). If you are on windows, the extension may be hidden. Please ensure you are flashing the correct recovery image file.
[ONE General] LostPr0ph3t:
Big thanks [MENTION=4153349]timmaaa[/MENTION]!

Now I finally know hot to make a fast and simple EFS backup :)

But one question: how to use the script? Just flash it in recovery? What then? Will I get a .zip? How to restore?

I think this would be helpfull if you could add this to the OP!

Thanks!
[ONE General] Heisenberg:
It's a Windows script that utilises adb/fastboot.

Transmitted via Bacon
[ONE General] Native7i:
I know it's not the best place to mention this. In xda phone description it says OPO have stereo speakers. But it claims as dual mono speakers.
[ONE General] Heisenberg:
You're right, that has nothing to do with this thread whatsoever.

Transmitted via Bacon
[ONE General] chandanbs:
Thread needs a critical update.

Hello,

There is a serious gotcha in the following section::

2. How To Install A Custom Recovery On Your Device

Correct command to be keyed while in fastboot is

fastboot flash recovery recovery.img

Please update the thread contents.
[ONE General] Heisenberg:
Yeah I edited the entire thread a few days ago and was changing the layout of that line, guess I forgot to complete it. Whoops. Good catch.

Transmitted via Bacon
[ONE General] ashok:
Guys what ever i do after latest custom recovery i am unable to install twrp even after showing the it installs properly
[ONE General] TotoIsBack:
Thank you for this complete guide
[ONE General] bubblebuddyi:
Step 4, SU link is down, internal error 500
[ONE General] Heisenberg:
Please don't ever quote the OP on XDA, all it does is clog up the page. There's nothing wrong with the SuperSU link for me, loads fine. Even if there was there's nothing I can do about it because it isn't my page.

Transmitted via Bacon
[ONE General] bubblebuddyi:
It got your attention didn't it? Lol
[ONE General] Heisenberg:
A simple post would have gotten my attention, this is my thread so I'm obviously subscribed to it. Please remove the OP from your quote. There's something wrong on your end, the link and the site are working properly.

Transmitted via Bacon
[ONE General] Uqbar:
I still end up with stock recovery

1. fastboot oem unlock

...

OKAY [ 0.002s]

finished. total time: 0.002s

Device reboots and wipes.

2. fastboot oem device-info

...

(bootloader) Device tampered: true

(bootloader) Device unlocked: true

(bootloader) Charger screen enabled: false

OKAY [ 0.005s]

finished. total time: 0.005s

3. fastboot flash recovery openrecovery-twrp-2.8.0.1-bacon.img

sending 'recovery' (12314 KB)...

OKAY [ 0.388s]

writing 'recovery'...

OKAY [ 0.283s]

finished. total time: 0.671s

4. fastboot format cache

erasing 'cache'...

OKAY [ 0.113s]

formatting 'cache' partition...

Creating filesystem with parameters:

Size: 536870912

Block size: 4096

Blocks per group: 32768

Inodes per group: 8192

Inode size: 256

Journal blocks: 2048

Label:

Blocks: 131072

Block groups: 4

Reserved block group size: 31

Created filesystem with 11/32768 inodes and 4206/131072 blocks

sending 'cache' (10432 KB)...

writing 'cache'...

OKAY [ 0.841s]

finished. total time: 0.953s

5. fastboot reboot

rebooting...

finished. total time: 0.005s

At this point I still end up in stock recovery, not the well known TWRP menu.

TWRP file has been downloaded and checked against its MD5 sum which is

d03de30d110d0075a2a6c5cf5f2706a2 openrecovery-twrp-2.8.0.1-bacon.img

matching the on from TechErrata web site.

I have repeated the steps more than once... still the same situation.

What am I missing here?

[UPDATE 1] The same happens with PhilZ Touch recovery IMG file from the ZIP file.
[ONE General] CBpbxEcmecmBeH:
Reboot to recovery?

adb reboot recovery or the equvalent fastboot command
[ONE General] Uqbar:
Apart of the fact that I can reboot to recovery from the power button menu, why should that be different from VOL- + POWER?

Anyway, it doesn't work.
[ONE General] CBpbxEcmecmBeH:
I thought that, at least when updating recovery, when you flash the image you reboot to it immediately.. I don't know, at least worth a try if nothing else works no? :)
[ONE General] Uqbar:
I followed timmaaa's guide.

As you do everything from fastboot mode, it looks like I don't have a "reboot to recovery" option there.

Instead, I reboot to system, then to recovery.

That's all I have done so far... unsuccessfully...
[ONE General] altitud63:
[SIZE=+1]8. How To Flash The XNPH33R Fastboot Images[/SIZE]

Please note: This procedure requires an unlocked bootloader. This procedure will factory reset your device! All user data (settings, apps, data on internal storage) will be wiped!

[MENTION=4153349]timmaaa[/MENTION] This mean I will lose my "sdcard" files, like pics, music, etc.? Thank´s in advance
[ONE General] Heisenberg:
That's right, it completely wipes your virtual sd card.

Transmitted via Bacon
[ONE General] altitud63:
Thank´s a lot for the info. Is there some way to restore the phone without lose all?
[ONE General] Heisenberg:
The best way to do it is just to connect your phone to your PC and backup anything that's important to you (music, images, videos, etc), then afterwards you can move it back to your phone again.

Transmitted via Bacon
[ONE General] ralpheboyo:
can some pls help....keep getting this message: Never mind ....solved my issue...

ralpheeee@ralpheeee:~/android-sdk-windows/platform-tools$ sudo fastboot update -w cm-11.0-XNPH33R-bacon-signed-fastboot.zip
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
--------------------------------------------
Bootloader Version...:
Baseband Version.....:
Serial Number........: 4d75f4e
--------------------------------------------
checking product...
OKAY [ 0.003s]
sending 'boot' (5560 KB)...
OKAY [ 0.178s]
writing 'boot'...
OKAY [ 0.114s]
sending 'recovery' (7412 KB)...
OKAY [ 0.236s]
writing 'recovery'...
OKAY [ 0.150s]
erasing 'system'...
OKAY [ 0.251s]
sending 'system' (774540 KB)...
FAILED (remote: data too large)
finished. total time: 0.949s
ralpheeee@ralpheeee:~/android-sdk-windows/platform-tools$
[ONE General] rajesh1136:
I just need root access to install adremover and some other basic utilities. do i need to go throw step of unlock bootloader and to root.

If i follow the process, will i receive OTA later ?
[ONE General] Heisenberg:
Yes, in order to gain root access you must have a custom recovery installed, and in order to install a custom recovery you must have an unlocked bootloader. So your process will be like this:

>Back up anything important on your virtual sd card to your PC.

>Unlock your bootloader.

>Install TWRP recovery.

>Install SuperSU.

>Copy your files from your PC back to your phone.

You'll still be able to receive OTA updates even with an unlocked bootloader and a custom recovery installed.

Transmitted via Bacon
[ONE General] rajesh1136:
i read somewhere TWRP recovery is not allowing OTA for OPO. Is it true ? Can someone say which is better CMW or TWRP
[ONE General] Heisenberg:
That isn't true. I use TWRP and I receive OTA updates, and even flash the updates with TWRP. In my opinion TWRP is far superior to CWM.

Transmitted via Bacon
[ONE General] rajesh1136:
Rooted :)
[ONE General] Heisenberg:
[emoji106] [emoji106] [emoji1]

Transmitted via Bacon
[ONE General] angelus255:
imei back up before rooting

Hi, I want to root my OPO but as far as I read around the web, many people lost their imei while rooting the device.

Thus how can I back up imei before rooting?

I'm not living in any launch country and if I mess up with my device, it'll be pain in the s.

Can smo help me with that? :confused:​
[ONE General] Heisenberg:
To say 'many' people have lost their IMEI is a huge overstatement. Only a few people have, and as far as I know it hasn't happened simply from rooting, it's happened during ROM flashes or nandroid restores. Anyway, the section of my guide that you've quoted does exactly that, so that's what you need to do.

Transmitted via Bacon
[ONE General] androfanatic:
thanks a lot for the awesome guides..
[ONE General] spicediablo:
I have just downloaded the fastboot zip for 38R. Please let me know if the instructions in OP is valid for this zip?
[ONE General] Heisenberg:
Yes, except obviously the last command will differ slightly because of the different build number.

Transmitted via Bacon
[ONE General] spicediablo:
This is how my folder should look?
[ONE General] kairock:
1st of all great job on this guide. it helped me a ton. however just following this guide didn't cut it for me, as it is missing some stuff. maybe u might wan to update it a little? i was trying to unlock bootloader, flash custom recovery and flash the stock 33r rom.

the 1st part i had a problem with was, ironically, the 1st. 1. How To Unlock Your Bootloader. fastboot devices did not detect my phone even though i had installed the driver which you linked.

i got the solution from another topic, where i had to dl samsung drivers...

next part i got stuck with was 8. How To Flash The XNPH33R Fastboot Images. its missing some steps there. following it i ended up with just the 'powered by android' startup which seems to be stuck.

the solution was i had to manually flash the other img files in the fastboot image zip, in addition to the ones you pointed out.

fastboot update -w cm-11.0-XNPH33R-bacon-signed-fastboot.zip <--- and i didn't use this line for that last attempt which got my phone to boot up.

keep in mind this was my 1st time so i am completely new, beginner. but i'm just pointing out stuff so a completely new beginner like me will know about it.

please forgive me if i say wrongly or it may have been addressedt. i am glad to have found your guide. thanks again!
[ONE General] Heisenberg:
Yeah it looks right to me.

Transmitted via Bacon
[ONE General] Heisenberg:
If you can get me the link to the Samsung drivers I'll gladly add them as an optional version.

Transmitted via Bacon
[ONE General] spicediablo:
Got this error message, please help...

Content of zip attached for reference...
[ONE General] Heisenberg:
Have you tried booting the phone?

Transmitted via Bacon
[ONE General] spicediablo:
Yes, i fastboot reboot after this message and luckily phone booted up no problem. But I'm still on Franco kernel which means the flash didn't go through...
[ONE General] Heisenberg:
You can just flash the full 38R ROM zip.

Transmitted via Bacon
[ONE General] spicediablo:
I am flashing full 38R rom, am I not? Sorry I'm a bit confused by your instructions...
[ONE General] Heisenberg:
No you're flashing the fastboot images, you can just flash the ROM zip through recovery if you want to.

Transmitted via Bacon
[ONE General] spicediablo:
That would wipe my data right? I wanna retain my data...
[ONE General] Heisenberg:
Only if you do it yourself through the wipe menu in TWRP.

Transmitted via Bacon
[ONE General] spicediablo:
So I place the zip file into my phone and just flash using cwm without losing my user data right?
[ONE General] Heisenberg:
You just flash it like you would flash any ROM.

Transmitted via Bacon
[ONE General] spicediablo:
I have been using fastboot a lot so less flashing using custom recovery....;)
[ONE General] mhmtlcn:
Root?

Thank you for the great guide!!

I unlocked bootloader.

Installed TWRP custom recovery and made nandroid backup by using it.

Do I need to root my device to use this backup if smth goes wrong in the future?
[ONE General] Heisenberg:
No, you don't need to root your device. The only thing you need in order to use your backup is TWRP recovery, so you can restore it.

Transmitted via Bacon
[ONE General] spicediablo:
I need a different kinda file for recovery flash? My downloaded 38r file is for fastboot...
[ONE General] Heisenberg:
Go here:

http://xdaforums.com/showthread.php?t=2906746

Get the recovery flashable version.

Transmitted via Bacon
[ONE General] spicediablo:
So you don't know why my fastboot is returning that error? Really hope I can do through fastboot way ..
[ONE General] 3's&7's:
How exactly did you fix this, I am experiencing the exact same issue?
[ONE General] ralpheboyo:
follow instructions until you reach the zip part...all i did then was sudo fastboot flash system system.img ...think thats was it...
[ONE General] spicediablo:
I'm having this same problem too... It's driving me crazy trying to solve this problem...
[ONE General] 3's&7's:
Fixed.

Need to download the entire Android SDK (eclipse) and update the tools to latest version. Once ADB was updated, I was able to push the system .img
[ONE General] Heisenberg:
But why do you want to do it the fastboot way? The recovery flashable way is far easier and you get exactly the same result.

Transmitted via Bacon