yashsingh1/xdaforums huggingface dataset:
[ONE General] EddyOS:
So, you've unlocked your bootloader and are enjoying some rooted goodness on your phone. You then realise you've got an issue with the phone and forgot to make a backup of your stock ROM! Not to fear, this guide is for you! This will reset the phone back to it's out-the-box state, locked bootloader and all, running the latest ZNH2KAS3P0 build so you can return it for RMA/sell it. This also works to go back to CM13.1.2 from Oxygen OS.

It's recommended that you have adb/fastboot in your System Path. This makes it easier to run commands as you don't always have to 'in' your adb/fastboot folder to run the commands. This guide should help you with this but if you don't want to do this, please copy/extract any files into your adb/fastboot folder before continuing...

1. Download the factory image

Cyanogen released the factory image for the OPO but didn't include any batch files to automate the process. I've repackaged the images into two seperate ZIPs:

ZNH2KAS3P0 16GB: DOWNLOAD

md5: be471f6bfc707f86a0af1eb175ec9aad

ZNH2KAS3P0 64GB: DOWNLOAD

md5: c371bc0cb4ef67999d21f5275c5a587b

*** These ZIPs are not flashable so cannot be flashed via TWRP ***

2. Extract the factory image

Using your favourite file extraction program to extract the package to your Desktop (I use 7-ZIP). *** Remember, if you don't have adb/fastboot in your Path, extract the image into your adb/fastboot folder ***

3. Flash the factory image

Once you've unlocked the bootloader, and rebooted the phone, turn the phone off and back on into fastboot mode and reconnect it to the PC. You can now run the flash-all.bat (Windows) or flash-all.sh (Linux) file. These automate the flashing process. Once complete, the phone will reboot.

*** Some users have had issues using the script in Linux so in these cases extract the ZIP file and flash each IMG individually ***

fastboot flash modem NON-HLOS.bin

fastboot flash sbl1 sbl1.mbn

fastboot flash dbi sdi.mbn

fastboot flash aboot emmc_appsboot.mbn

fastboot flash rpm rpm.mbn

fastboot flash tz tz.mbn

fastboot flash LOGO logo.bin

fastboot flash oppostanvbk static_nvbk.bin

fastboot flash recovery recovery.img

fastboot flash system system.img

fastboot flash boot boot.img

fastboot flash cache cache.img

fastboot flash userdata userdata.img (the filename is the same in both ZIPs so make sure you're using the right one for your device)

fastboot reboot

4. Reset the tamper flag/lock the bootloader

There is a flag/bit on the phone that is triggered when you unlock the bootloader and even relocking it won't change this flag back to standard. Luckily, @Mnt-XDA has a script that you can flash which resets these flags so OP/anyone else is none the wiser! To do this, read and follow THIS thread

5. Reboot the phone

Says it all really - you're done! :D
[ONE General] RalphLauren:
And why do you need to unlock the bootloader to flash the factory image ????
[ONE General] EddyOS:
Because you need access to flash the partitions. If the bootloader is locked you cannot do this. If you're device is still locked from day 1, this guide isn't for you as you're already 100% stock and a factory reset will do this job just fine :D

EDIT: Actually, it's a bit redundant as why would you need this if you're NOT unlocked! I'll edit the OP
[ONE General] RalphLauren:
Somehow I was thinking that if the signatures match, flashing the FACTORY image would be allowed without unlocking bootloader, hence the question has arisen.

In a way, you are right that if someone is 100% stock, why to bother flash a stock...

But the reasons could be different, like from pure laboratory experiment to the unable to install OTA (for whatever reason) and need to update OS...
[ONE General] indesisiv:
May be worth including this work here by Mnt-XDA

If you are returning to stock for selling / returning etc people may want to reset the tamper flag too.
[ONE General] EddyOS:
I know what you mean, but it's the same with Nexus devices - you cannot flash the image unless the bootloader is unlocked
[ONE General] EddyOS:
Yeah was looking to add that in at some point, this is still a work in progress as it were...I'll add it in when I get a chance :)

EDIT: Added
[ONE General] lemonspeakers:
To make this thread more useful for those who aren't familiar with command line, make sure to tell them to:

1) Download the zip file and extract it onto desktop (what a mess)

2) command line cd desktop

3) Enter each one of those command lines

4) Be happy in the end.
[ONE General] EddyOS:
To be fair, of someone doesn't know how to do that they really shouldn't be here in the first place! :D
[ONE General] banjotrold:
This should be a sticky!
[ONE General] OuncE718:
I agree! This definitely should be a sticky.
[ONE General] kevinga:
Which one of these files would be the kernel? I am having wifi issues and am wondering if I would be able to reflash and fix it.

fastboot flash modem NON-HLOS.bin

fastboot flash sbl1 sbl1.mbn

fastboot flash dbi sdi.mbn

fastboot flash aboot emmc_appsboot.mbn

fastboot flash rpm rpm.mbn

fastboot flash tz tz.mbn

fastboot flash LOGO logo.bin

fastboot flash boot boot.img

fastboot flash cache cache.img

fastboot flash recovery recovery.img

fastboot flash system system.img

fastboot flash userdata userdata_64g.img (or userdata.img for 16G version)

fastboot oem lock (if you wish to relock the bootloader. If not, ignore this part)

fastboot reboot
[ONE General] EddyOS:
boot.img
[ONE General] kevinga:
Thank you. Any reason why I can't just fast boot the boot.img file only (ala carte)? I am on CM11s rooted with TWRP.
[ONE General] kevinga:
I fastboot flashed the boot.img file sucessfully. It did not fix my wifi problem. So, I tried fastboot flashing the NON-HLOS.bin file. It appears to have an error code. Here is the result.

Microsoft Windows [Version 6.1.7601]

Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Kevin work>cd desktop/android-sdk-windows/platform-tools

C:\Users\Kevin work\Desktop\android-sdk-windows\platform-tools>fastboot devices

9f66970a fastboot

C:\Users\Kevin work\Desktop\android-sdk-windows\platform-tools>fastboot flash mo

dem NON-HLOS.bin

target reported max download size of 536870912 bytes

sending 'modem' (56241 KB)...

FAILED (data transfer failure (Too many open files in system))

finished. total time: 0.306s

C:\Users\Kevin work\Desktop\android-sdk-windows\platform-tools>fastboot reboot

< waiting for device >

^C

C:\Users\Kevin work\Desktop\android-sdk-windows\platform-tools>

Any idea as to why it failed?
[ONE General] Xeon_IV:
reboot time

I had done all the steps above but stuck at the boot screen now for 10 minutes is it so post to take this long
[ONE General] kevinga:
As you can see from my command prompt script mine did not want to reboot. I ended up unplugging the phone and rebooting.
[ONE General] Xeon_IV:
i get this message on mine

C:\>fastboot flash system system.img

sending 'system' (765700 KB)...

FAILED (remote: data too large)

finished. total time: 0.015s

and will not restore any ideas please

---------- Post added at 10:41 AM ---------- Previous post was at 10:35 AM ----------

I just want to get back to stock and quit playing with rooting for my customizations now its dead
[ONE General] EddyOS:
Is your phone the Chinese OPO or the CM OPO?
[ONE General] Xeon_IV:
CM OPO coming from paranois android
[ONE General] Toxic17:
EddyOS

I take it you will be releasing a new 38R update soon?
[ONE General] EddyOS:
Yep, as soon as it's available (I'm checking pretty much every hour at the mo!!)
[ONE General] Toxic17:
Thanks for the files, I couldn't update any other way. Much appreciated!;)
[ONE General] leafs44:
I've recently seen the "powered by android logo" change to a more modern one. After flashing one of these images, I saw that it went back to the old one. Does anyone know what changed that's causing this?
[ONE General] epunk:
So I tried flashing using this method, ended up in a bootloop with no OS, like others have mentioned in page 18 as well.

Tried both the .bat method as well as flashing the individual files, the result ends up being the same, get the One+ logo for a few seconds then it reboots, and like this, continuously.

Same happens after flashing using the OnePlus One toolbox V3.

Unfortunately I was stupid enough not to have a nandroid backup.

Is there something am I missing? Anything else I may try?

EDIT: Found out what's wrong... corrupted EFS partition.

Follow the steps from http://xdaforums.com/oneplus-one/help/fix-brickloop-audio-fx-fc-efs-corrupt-t2879061

Download the Never Settle package.

execute the following from fastboot mode:

fastboot erase persist

fastboot flash persist persist.img

fastboot erase reserve4

fastboot flash reserve4 reserve4.img

This finally worked for me!
[ONE General] EddyOS:
It's the new image in the latest nightlies, once the new factory image comes out it'll be in that too
[ONE General] EddyOS:
Image is out now so will update OP later today :)

EDIT: Updated, enjoy! :D
[ONE General] plantunes:
I need urgent help please...

Today I had to clean my OPO...but I forgot that previously I had deleted some important files with titanium backup.

Now, I cannot use it.

Then I found this thread and I downloaded the adb files and the latest rom.

Done like it's said on the thread and after some reboots and some OKAYS....i get the following message:

sending 'system' (801285 KB)...

FAILED (remote: data too large)

How can I solve this?
[ONE General] mcgrabowski:
Scroll back some posts and do what I and others have had to do, extract the files from the zip and flash them individually. I was getting that same error trying to flash everything together with the script. Doing it manually worked for me and many others just fine.
[ONE General] EddyOS:
This usually means you're not using the latest SDK from Google. Update using the SDK Manager and it should then work
[ONE General] andywright1982:
Hi Guys

I have managed to get back to stock using this method but when i checke the unlocked and tampered part both are showing as true.

As i have no custom recovery now, how do I get these both back to false? I have read the other thread in the OP but it doesnt work when I flash in standard recovery.

Thanks for any help
[ONE General] EddyOS:
It says in the guide you have to boot TWRP (e.g. fastboot boot recovery.img). You then use that to flash the ZIP I link to
[ONE General] CrAzYoNi:
Question!

Hi all!

Ignore my post, I've didn't read the whole first post so I've missed the answer for my own question, feeling lame now :rolleyes:

Thanks for the poster, amazing job!
[ONE General] DragonGamerist:
Resetting and Fixing Issues

If I my phone does not detect my internal storage and has a ton of issues, will this guide fully reset it and fix all of my problems (CM Lockscreen stopped working, AudioFX stopped working, no internal sdcard, etc)? Also, will internal storage be wiped?
[ONE General] 3's&7's:
I too am challenged with the "sending system" FAILED (too large). I tried one of these toolkits, not sure what the point is, lol...commands are command (did not help either).
[ONE General] 3's&7's:
Glad I caught this post. Individually, I continue to not be able to flash system (the same too large message).
[ONE General] razielpr:
Hi all I'm having a big problem with my One Plus I downloaded some files using utorrent on my phone it was music but they were rar when I uncompressed the file my phone went crazy now it boots but it freezes and reboots all the time I have flashed almost all roms available for this phone with the same results the only rom that works is the Color OS but with no data, no wifi and no Bluetooth any help would be great I'm going to use this guide as my last resort but hope someone can help me with this.
[ONE General] DragonGamerist:
Unlocked/ Locked Bootloader?

Along with my previous question, do I need a locked bootloader before performing this? Also, do I have to relock the bootloader? All I want to do is return all of the files in the phone and system to stock and not have any issues after booting up.
[ONE General] droodski:
I am having problems with the insutructionis on where to put these files exactly..

How can I just flash this through custom recovery??????????

I use flash-all.bat and it says cna't find any of the files.. please be more specific on this
[ONE General] jjvcuyler:
Update you fastboot and adb binaries.
[ONE General] itsdacj:
Does this flash stock recovery?

EDIT: Looks like it does.
[ONE General] 3's&7's:
Yes it does
[ONE General] bashrulz:
Help me out!

I'm on 38R and using AK-Kernel if i want to go Franco kernel do i have to flash Stock Kernel first and then go to Franco Kernel?

Please let me know :/
[ONE General] 3's&7's:
I have swapped between those two kernels myself without issue. But I too would like to hear from more experienced voices.

My question is:

*I want to flash a new ROM

*My current ROM has a custom kernel installed

*Do I need to flash stock kernel (adb) and then flash (recovery) the desired ROM?
[ONE General] EddyOS:
No, you can just flash the kernel/ROM over whatever you've currently got (and this isn't really the thread to ask these sorts of questions)
[ONE General] 3's&7's:
Thanks for the answer.

It is appropriate if I want flash to AK again which is why I asked.
[ONE General] ahac85:
hi im flashing back to 25R and its seems to be a while on sending sparse "system" <522292kb> what shall i do? shall i unplug and try again, dnt want to brick the device??
[ONE General] rahditzz:
You might wanna add to the guide that it wont work if you run flash-all.bat as administrator.. :D
[ONE General] EddyOS:
The fact I don't mention TO run it as administrator would suggest you don't need to ;)
[ONE General] th3xeroeagle:
hey anyone know how to flash the modems and stuff i forgot the file names like the sb1 .bin etc i saw a guide somewhere but cant find it anymore (they are included in the .zip on cyanogen website)

EDIT: found it in CM11S thread
[ONE General] vdn20:
Are there complete steps somewhere that is consolidated in one place? Or if someone can tell me what to do from the different pages for me to downgrade my firmware? Plan to do downgrade to 33R this weekend, but not sure what steps are required.
[ONE General] hellshinoda:
I have followed all the steps and have returned to latest stock but have not relocked or fixed the Tamper Flag. I have also read the other thread but I'm quite confused and doesn't know what zips to flash.
[ONE General] Amro90:
Download a TWRP image from here: http://techerrata.com/browse/twrp2/bacon

Boot your phone into fastboot

Open TWRP using command "fastboot boot <path/name of the recovery twrp img>"

Flash this file in TWRP: OnePlusOne-BootUnlocker.zip
[ONE General] alberto91pa:
hi guys i am trying this tutorial.

Can I put this zip into the phone, boot from TWRP recovery and flash from it?

Or have I to do from line command? (I have mac)

thank you
[ONE General] EddyOS:
You HAVE to use a command window, it's not a flashable ZIP
[ONE General] aminushki:
Thank you soooo much !!! This worked for me ! I did not Reset the tamper flag/lock the bootloader . But other than that followed all the steps and it worked like a charm !

Will there be any problems if I keep the bootloader unlocked ?

Thanks again - this was a life saver !
[ONE General] bongofred:
Ok, noob question here, what is the difference between the 16GB and 64Gb rom? Cyanogen is only offering one image for both.
[ONE General] jgcaap:
The size format of internal card, that's why on the img you have userdata for each
[ONE General] Tricksodave:
awesome post

Thanks for this great post! Being a total newbie to these types of phones, coming from iphones....:D
[ONE General] asnarain:
I followed all the steps correctly and flashed the stock ROM. Now, what happens is, it goes to the "Welcome to CyanogenMod screen" and restarts automatically. This was original issue to begin with. Any help with this is greatly appreciated. Thanks!
[ONE General] novadi:
Thanks for your sharing.
[ONE General] HaTrED_:
Seems like you've got a corrupted partition. I think this will help you :

http://xdaforums.com/showthread.php?p=55488755
[ONE General] asnarain:
Thanks! That fixed the problem!
[ONE General] kazzarok:
What is inside the flash-all.bat

Can someone post it here please
[ONE General] Toxic17:
EddieOS

44S factory Image is up...

https://cyngn.com/products/oneplusone/

http://builds.cyngn.com/factory/bacon/cm-11.0-XNPH38R-bacon-signed-fastboot.zip

http://builds.cyngn.com/factory/bacon/cm-11.0-XNPH38R-bacon-boot-debuggable.img
[ONE General] SD-B:
how to wipe clean when not rooted, etc, just stock?

Im not a geek...... :)

I need to find out how to get my phone back to how it was the day it arrived.

I have not rooted the phone I have not done anything to it but got a bit too eager on downloading apps.

Downloaded a Launcher program and various files that were connected and they didn't seek to like each other much.

Hence I began to get issues with the phone camera not working, I would be typing an SMS and the screen would suddenly go out of whack, large and anything i typed was picking up the wrong letters so i ws unable to do any text messages.

This all happened over 1 day and i suspected i had one too many apps and something was conflicting.

I did what i assumed was a simple restore earlier tonight and all seemed fine.

Installed many email address for work i use and then plugged in the phone to USB to charge and up popped the android transfer app ( i use Mac )......and i could see folders for the same launcher program that i believed was the cause of all this, etc

But so far the camera pears to be working and so does the SMS app BUT i would rather not start loading up my preferences and a few apps like this.

What can I do to delete whats on it and just wipe it clean again?

TIA
[ONE General] EddyOS:
I shall update the OP this morning! Cheers! :D

EDIT: Those links are for 38R, 44S isn't there yet
[ONE General] Toxic17:
my bad. could have swarn they were there yesterday. :o
[ONE General] :
Thanks for the Guide, everything works fine.
[ONE General] Miraries:
Hard bricked?

Hi,

I tried doing this but when I got to:

"C:\Users\\Desktop\AndroidSDKSlim\android-sdk-windows\platform-tools>fastboot flash dbi sdi.mbn

< waiting for device >"

everything stopped. The device doesn't react to anything except connecting to the computer, after which Windows gives me a driver malfunction error. Which I assume means the device is still on. I can't seem to shut it down.

Any suggestions?
[ONE General] Davez92:
Why CM is delaing so much the release of 44S factory image? I really don't understand that. It's about two weeks that i'm waiting for it.
[ONE General] EddyOS:
It always seems to be delayed. Perhaps they're working on CM12S ;)
[ONE General] Davez92:
Don't think so. Cm12 is still under devolopment so we will see an early version of cm12s maybe after Christmas.
[ONE General] EddyOS:
I was joking, hence the ;)
[ONE General] Toxic17:
Did you have the phone in fastboot mode?

If you connect your phone then run a command prompt where your adb is installed. Then type

fastboot devices

It should list your phone. If not then it's a driver/connection issue.
[ONE General] Miraries:
No progress

Well, it was in fastboot while flashing the images...

I tried everything I could think of... The device doesn't show anything. No devices when I run fastboot or adb either.

When using Ubuntu, it doesn't get listed anywhere, no notifications of it connecting or anything.

So it's definitely a 'driver/connection issue'... What should I do in that case?

I'm currently trying to install the drivers from Color images...

I really don't know what could have gone wrong, I used the official images... I don't know what's the case with warranty/repair since I'm currently not in one of the launching countries.
[ONE General] carburano:
44s factory image is up!

Builds.cyngn.com/factory/bacon/cm-11.0-XNPH44S-bacon-signed-fastboot.zip
[ONE General] EddyOS:
Yep, just downloading it now. OP to be updated later on this afternoon (finally)
[ONE General] EddyOS:
OP updated to new 44S builds
[ONE General] The_Benwa:
Thanks OP, worked like a charm!
[ONE General] FiletMignon:
Awesome bens!

Worked perfectly, and got me back root access to device. Thank you so very much!
[ONE General] Xabier1121:
Still trying to get this figured out, I bought an OPO from someone with the knowledge of it boot looping, but that's as far as it's going so far.

Sent from my LG-D950
[ONE General] apatal:
Can you still access the bootloader?
[ONE General] Xabier1121:
I honestly done know. I know I can get it into fastboot mode. Aside from that it's beyond me. I'm familiar with custom rooms and what not, but this one is much different then what I'm used to.

Sent from my LG-D950
[ONE General] EddyOS:
Fastboot mode IS the bootloader so once in that mode connect it to the PC and either flash the factory image or flash a custom recovery and custom ROM
[ONE General] Xabier1121:
Can this be done with Odin, or do I have to use the toolbox?

Sent from my LG-D950
[ONE General] EddyOS:
Odin is for Samsung phones, and you don't need a toolbox as the OP tells you everything you need to know
[ONE General] Xabier1121:
Thank you, that's what I thought but I've seen someone use it with HTC as well. Thanks for the corrected direction. If I have more questions I'll be sure to post.

Sent from my LG-D950
[ONE General] Xabier1121:
so I can get my oneplus into fast boot mode, but my computer doesn't read that it's connected. any suggestions?
[ONE General] miguepereira77:
Fastboot / ADB / Device Drivers - Installation - …: http://youtu.be/maLWScgXflk
[ONE General] Xabier1121:
Thank you much! I got it! Turned out I had the directory wrong in cmd. Lol.

Sent from my LG-D950
[ONE General] hennix:
Is there any way to get bootloader locked and tampered flag back to normel? i am on 44s :(
[ONE General] mchauhan:
Visit this thread mentioned on first page by OP. It has several scripts to toggle these flags.

http://xdaforums.com/oneplus-one/development/mod-reset-unlock-tamper-bit-t2820912
[ONE General] vandizzam:
Is there a flash all file in the latest images?
[ONE General] jimmydee62:
need help

I have tried both automate and manual install every time I get to the point of flash system.img I get error message FAILED<remote data to large>. Can anyone tell me what I have to do to fix this?