yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] opticaldh:
This is the first time I use an Android phone, so absolutely, I am a noob. I have a question about unlock bootloader.

Because this is a new phone, so I only need to unlock bootloader, which means I will skip step 3,4,5,6 in part C. Then for part D, after step 1,2,3,4, Can you tell me what steps is the next one?

For me, I think I should skip step 5-12, right?

Thanks.
[Nexus 4 General] vladm7:
Am I blind? I can't find images for Nexus 4 here:

https://developers.google.com/android/nexus/images
[Nexus 4 General] chrone:
Welcome to the club. If you only want to achieve unlock bootloader then you only need to fastboot oem unlock. It will wipe all of your data.

Sent from my Nexus 4
[Nexus 4 General] efrant:
You will likely need to flash both the stock boot image and system image (as per the instructions in the first post), as I think franco kernel changes some system files.

If all you want to do is unlock the bootloader, do all of the steps in A and B, C1, 2, 7, 8, and D1-4, 14, 15.

I will make a note of those steps in the first post when I get back from vacation.

As opticaldh said, use the other link. Google pulled the images from their site. I'll make a note of that as well.
[Nexus 4 General] Kick-Ass Joe:
Thank you op! You're the reason why I love xda and why I'm going to school for computer programing! :)

Sent from my Paranoid Android Nexus 4
[Nexus 4 General] trueblueram:
@efrant - good job mate, pulling em off the streets n into schools:D
[Nexus 4 General] w1ndhawk:
Whats the problem?

Hey efrant,

I have successfully used your guide to flash factory images/CWM and root my phone.

I am facing a minor problem:

When I flash CWM 6.0.2.3 (or 6.0.1.9 for that matter) it goes into recovery just fine on first boot. However, after the first boot it just keeps giving me the android robot with open chest when I go into recovery (basically CWM doesn't work after 1st boot). This wouldn't happen before I flashed factory images using your guide.

I am wondering if this a problem with the CWM itself or because something has changed since I flashed factory images. Any solution to this problem?

EDIT: Just checked. Same problem with TWRP also.

NOTE: Problem does not affect me in any way. Whenever I want to use recovery I can always reflash it since it works fine on first boot. But, it would be nice if I didn't have to reflash recovery everytime I want to use it.
[Nexus 4 General] trueblueram:
Please check that you are flashing cwm/twrp n not just booting it
[Nexus 4 General] w1ndhawk:
Sorry, could you explain that in 'noob' language.

I first go into bootloader mode and flash recovery using fastboot boot "recoveryname.img" command. Post flashing it boots fine into the recovery.

However, on the next reboot it shows the android robot with a red exclamation when I boot into recovery.

EDIT:

Okay ofcourse, I was booting and not flashing. Flashed it now. Thanks a lot buddy.
[Nexus 4 General] trueblueram:
Anytime:thumbup:
[Nexus 4 General] anwedr:
Thanks efrant.

I have yet to flash a custom kernel, but this is exactly what I was looking for.:):good:
[Nexus 4 General] adidas007:
So if I just want the root access, I need to stop at D3 and move on to E. Do I need to perform step D4 also?

Can you please give me the command to flash the custom recovery.

Thanks.
[Nexus 4 General] trueblueram:
fastboot flash recovery "recoveryname.img"
[Nexus 4 General] efrant:
To root, you need to unlock the bootloader first.

Unlock the bootloader: all of the steps in A and B, C1, 2, 7, 8, and D1-4, 14, 15.

Root: part E.

This has been answered recently many times already in this thread: fastboot flash recovery nameofyourcustomrecovery.img

You should have a read of the "Android for Nexus 4" 101 and FAQ thread (also stickied in this section).
[Nexus 4 General] Kush360:
dudes when i type fastboot boot "recovery.img" it says cannot load "recovery.img": error.

please help

tried downloading it thrice.

CWM 6.0.02.3

please help
[Nexus 4 General] undercover:
You need to

fastboot flash recovery customrecovery.img

_________________________________________

Sent from my fridge. Make : LG Model : N4
[Nexus 4 General] El Daddy:
Make sure the file isn't named recovery.img.img

Windows, by default, will auto name extensions. If you rename the file "recovery.img" its actual name is recovery.img.img.

So when renaming a file, leave out the extension. i.e. "recovery"
[Nexus 4 General] undercover:
Not sure if you late aware,so will just dump it here :)

fastboot erase cache

Actually breaks boot sequence and makes it get stuck on animation. Booted just fine,then flashed twrp, and decided to try erase cache. Bingo,boot is broken. Had to erase it from within recovery.
[Nexus 4 General] la3bna:
It seems that Google have pulled the Mako image from their site.

Cant find it here

I would like stock recovery.
[Nexus 4 General] jesselmary:
How to flash a factory image / return to stock / unlock / root #

very nice tutorials tricks How to flash a factory image / return to stock / unlock / root #...

I really appreciate this threads...
[Nexus 4 General] 3rdstring:
Check out the mirror in C - 3.
[Nexus 4 General] jchee81:
Thanks for the detailed guide Efrant, my new N4 is now rooted, and bootloader unlocked as per your instructions in first post.
[Nexus 4 General] parker_dhd:
EDIT: Never mind. Might have helped if I enabled debugging. *facepalm*

EDIT #2: So I think I got the bootloader unlocked but I'm running in to trouble with twrp. When I do "fastboot boot customrecovery.img" the command prompt seems to indicated everything is OKAY but my device is stuck on the white Google logo :(

********

FINAL EDIT:

So TWRP didn't work but ClockworkMod worked fine. :)
[Nexus 4 General] tameracingdriver:
Just chimed in to say good guide.

Followed the instructions step by step, did get the "X" boot up problem and the 8 Gb limit on the storage, followed the instructions to sort those, and all done.

Why can't all instructions be that good? :good:
[Nexus 4 General] rumnheim:
Accidently I format system and other things. I was using CWM on factory JOP40D. How can I flash factory image without losing CWM?
[Nexus 4 General] chrone:
Skip the flashing stock recovery part. :p

Sent from my Nexus 4
[Nexus 4 General] chrone:
i noticed that doing fastboot oem unlock command on 2 nexus 4s with hardware revision 11 didn't wipe the data at all.

did you guys experience this too? the two nexus 4s bought from a local phone store distributed by LG Indonesia, preinstalled with android 4.2 and updated ota to 4.2.1.
[Nexus 4 General] Stajdanley:
These steps were only necessary because he could not do the procedure from steps A-D15 in the OP, correct? If I am rooted, have custom recovery, and custom ROM, and I follow the steps in the OP, I will lose root and busybox along with returning everything to stock, right (except bootloader will still be unlocked)?

Also, Google reposted the Nexus 4 image today, so your link in step C should be good again :)

Thanks in advance!
[Nexus 4 General] efrant:
To answer your questions : Yes and yes.
[Nexus 4 General] rsreekantan:
USB port not functioning.

My USB port is not functioning properly - for example ./fastboot devices doesnt recognize by Galaxy Nexus. I'm trying to flash the stock Android 4.2.1 kernel. In the guide you say...

3) Download this file (stock JOP40D ROM, kernel/ramdisk, radio and recovery) and place it on your device; EDIT: New file will be uploaded soon.

I'm not sure how to do this since - do i do this directly from Android website onto my phone - so that it will end up on the downloads folder ? Since I cant transfer/run fastboot I'm not sure how to place it on the device. Sorry if its a stupid question. Also, it appears the `this file' link is not working properly or outdated.

Thanks
[Nexus 4 General] chrone:
I believe this thread is for nexus 4, different build for galaxy nexus. But if your usb is defective then you might to download from pc.

Sent from my Nexus 4
[Nexus 4 General] EddyOS:
Factory image is back online now...

https://dl.google.com/dl/android/aosp/occam-jop40d-factory-ca7602f0.tgz
[Nexus 4 General] dcolaco:
USB read error

Hey guys,

So i've been trying to flash the factory images onto my nexus 4 but i run into the following error when sending the system.img file:

sending 'system' (531285 KB)... ERROR: usb_read failed with status e00002ed

FAILED (status read failed (No such file or directory))

douglas-colacos-macbook-pro:adb-fastboot douglascolaco$

I have tried this on two different macs using all the usb ports and multiple cables and get the same issue. The other images flash fine, its just the system. I have done this several times with the galaxy nexus and it always worked flawlessly. Could someone please help me out. On other forums I read that if you do get the error, it works using a toolkit but no one could provide an explanation. I would rather use fastboot, and i do not have a windows pc to use the toolkit.

Thanks!

Doug
[Nexus 4 General] EddyOS:
You doing it manually or using the 'flash-all' batch file?
[Nexus 4 General] dcolaco:
Doing it all manually using these steps:

4) Reboot by typing: fastboot reboot-bootloader

5) Flash the bootloader: fastboot flash bootloader bootloader-mako-makoz10l.img (or whatever the name of the bootloader image that you downloaded).

6) Reboot: fastboot reboot-bootloader

7) Flash the radio: fastboot flash radio radio-mako-m9615a-cefwmazm-2.0.1700.33.img (or whatever the name is of the radio image that you downloaded).

8) Reboot: fastboot reboot-bootloader

9) Flash the system partition: fastboot flash system system.img

10) Optional (NOT optional for n00bs) -- Flash the data partition: fastboot flash userdata userdata.img Note: this command will wipe your device (including /sdcard), EVEN if your bootloader is already unlocked. See note 2 below.

11) Flash the kernel/ramdisk: fastboot flash boot boot.img

12) Optional (NOT optional for n00bs) -- Flash the recovery partition: fastboot flash recovery recovery.img

13) Erase the cache partition: fastboot erase cache

14) Reboot: fastboot reboot

15) Done! The first boot will likely take quite a bit longer than you are used to, as Android builds the Dalvik cache.

I tried the flash-all command as well and that got stuck at sending the system.img as well. Everything prior to that step works. I read somewhere that it could be a partition problem?
[Nexus 4 General] qqdawg:
my nexus 4 has google wallet preintsall, and the phone does has HSPA+, does that mean I should used the "Factory Images "takju" for Galaxy Nexus "maguro" (GSM/HSPA+) (with Google Wallet)" ROM instead of the OCCAM image?

thanks for your help
[Nexus 4 General] thephantom:
If you're flashing a Nexus 4, use occam. If you have a gsm Galaxy Nexus, then you use maguro. Don't mix and match them
[Nexus 4 General] qqdawg:
yup, I figure that out....

forgot to read "Galaxy Nexus".... hehehe

I follow your instruction to the T, dotted the i, it has been 15 minutes, it is stuck on the "X" screen....

I'll wait a little longer before trying to reboot it....

thanks for your help

---------- Post added at 11:32 AM ---------- Previous post was at 11:30 AM ----------

here is my output:

C:\RootNexus4>fastboot flash bootloader bootloader-mako-makoz10l.img

sending 'bootloader' (2188 KB)...

OKAY [ 0.139s]

writing 'bootloader'...

OKAY [ 0.330s]

finished. total time: 0.471s

C:\RootNexus4>fastboot reboot-bootloader

rebooting into bootloader...

OKAY [ 0.001s]

finished. total time: 0.001s

C:\RootNexus4>fastboot flash radio radio-mako-m9615a-cefwmazm-2.0.1700.33.img

sending 'radio' (54545 KB)...

OKAY [ 3.411s]

writing 'radio'...

OKAY [ 3.384s]

finished. total time: 6.796s

C:\RootNexus4>fastboot reboot-bootloader

rebooting into bootloader...

OKAY [ 0.002s]

finished. total time: 0.002s

C:\RootNexus4>fastboot flash system system.img

sending 'system' (531285 KB)...

OKAY [ 33.211s]

writing 'system'...

OKAY [ 35.753s]

finished. total time: 68.965s

C:\RootNexus4>fastboot flash userdata userdata.img

sending 'userdata' (98409 KB)...

OKAY [ 6.154s]

writing 'userdata'...

OKAY [ 6.173s]

finished. total time: 12.328s

C:\RootNexus4>fastboot flash boot boot.img

sending 'boot' (6166 KB)...

OKAY [ 0.388s]

writing 'boot'...

OKAY [ 0.393s]

finished. total time: 0.781s

C:\RootNexus4>Flash the recovery partition

'Flash' is not recognized as an internal or external command,

operable program or batch file.

C:\RootNexus4>fastboot flash recovery recovery.img

sending 'recovery' (6664 KB)...

OKAY [ 0.419s]

writing 'recovery'...

OKAY [ 0.428s]

finished. total time: 0.849s

C:\RootNexus4>fastboot erase cache

erasing 'cache'...

OKAY [ 0.027s]

finished. total time: 0.027s

C:\RootNexus4>fastboot reboot

rebooting...

finished. total time: 0.032s

---------- Post added at 11:48 AM ---------- Previous post was at 11:32 AM ----------

I reboot into the bootloader and flash boot and system. Then flash CWM. Then boot into CWM, and wipe data, and wipe cache. Then reboot.

now I'm back to stock.

Your instructions rock!!!!

---------- Post added at 12:18 PM ---------- Previous post was at 11:48 AM ----------

all set
[Nexus 4 General] meher91:
my phone's microphone is not working while making calls and google voice search but the only way it works is when i put the phone on loud speaker while making calls...it is not working anywhere else...wht do u think is the problem?

u think Factory Image Restore would solve the problem..?

if i follow the steps in OP and things does'nt help...can i bring the device back to its original state so that i can return it to google..?

Thnks..!
[Nexus 4 General] Swamp_cz:
I don't know if I'm stupid or something, but where do I find the fastboot.exe file?

I downloaded the image from occam, JOP40D, extracted the archive and its subarchive wth 7-zip everything in one directory (six IMG files etc.) and ran a command-prompt from that directory - however - no fastboot command works - because there is no fastboot!

What did I do wrong?

P.S.: I only want to root the phone, leaving it as stock as possible.
[Nexus 4 General] thephantom:
You're not stupid, don't worry. We all make mistakes. If it's just root you want, you don't need the occam images but it's good you have them downloaded for future use. The fastboot/adb files are at the end of the first post on page one. It's the platform tools zip. Then you need the supersu zip file also mentioned.

Flowed and Tapped from my Nexus
[Nexus 4 General] efrant:
The instructions in the first post ARE the way to take the device back to its original state.
[Nexus 4 General] vaibkulk:
I am on stock unrooted. Now I want to root unlock boot loader and flash CWM recovery so that I can flash Franco kernel

So I don't need to flash the system, boot and user data images right?

Just flash the boot loader image and unlock using fast boot and then root.
[Nexus 4 General] El Daddy:
You don't need to have root permissions to flash a kernel.

What you want to do is unlock the bootloader. Then flash a custom recovery. Then you can flash the kernel in recovery.

If you want root flash the su.zip as well
[Nexus 4 General] ashkan_mc:
Hi,

I am on rooted unlocked cm 10.1 and I want to go back to stock. I have this file : occam-jop40d-factory-ca7602f0.tgz ... It is stock ROM

Can I flash this file using odin pro mobile?
[Nexus 4 General] chrone:
no, need to be unzipped first and follow all the steps as posted at first post by efrant. :)
[Nexus 4 General] squalluca:
hi i'm helping a friend of mine who messed up resulting in a bot loop and wanted to go back to stock, we were following this guide but can't flash the system, fastboot says:

file:could not allocate 544035848 bytes

error:cannot load system.img :not enough space

we tried erasing and formatting the system partition but no luck...

someone knows how to fix this?

this is what df shows
[Nexus 4 General] efrant:
Can you post a screen shot of your command window when you try the commands in steps D4-D9?
[Nexus 4 General] joostburg:
Thanks for the great tut! I think i have found what caused the problem of hanging X nexus logo. In step 13 you have:

13) Erase the cache partition: fastboot erase cache

When you do this the system can't mount the cache partition anymore, i have fixed it with CWM to wipe the cache partition. Maybe we should format the partition instead of erasing?
[Nexus 4 General] squalluca:
righ now i can't because i was helping him trough skype cause he lives abroad, but from what he telled me all works right ( no errors ) until D9 where it gives the error i wrote before, we tried erasing and formatting the system partition, no errors but flash still gives the same error.

Btw when he gets back i'll say to re-follow the steps and i'll post a screen.

Thank you for helping man.
[Nexus 4 General] pafaisal:
Hi

I was using Galaxy Nexus and I had setup adb. Now I got a Nexus 4. Do I need to install driver again to use adb...? or I can contrinue with same setup of Galaxy nexus drivers...?
[Nexus 4 General] chrone:
did you install the universal naked driver v0.72? if it's so, no need to reinstall.
[Nexus 4 General] pafaisal:
Do I need to uninstall the previous driver...?
[Nexus 4 General] chrone:
No need to uninstall nor reinstall if you have already installed the universal naked driver v0.72. All nexus series are there.

Sent from my Nexus 4
[Nexus 4 General] squalluca:
Here's the screen, we tried the commands in a different order as suggested by someone in an other thread but tha same error appears
[Nexus 4 General] efrant:
Strange. I really have no idea what could be causing that.

These are the things I would check:

1) Are you using the latest version of fastboot?

2) Are you using a USB port on the back of your PC?

3) Are you using 1wayjonny's 0.72 driver?

4) Are you using the correct bootloader file? (I'm assuming you just renamed it for ease of typing -- if that is the case, then ignore this.)
[Nexus 4 General] danfalcas:
Link is down :( it only showed me upload options. Can you please tell me where can I download stock recovery :/
[Nexus 4 General] efrant:
I haven't had time to fully test and upload yet.
[Nexus 4 General] ran495:
hi sir efrant,

the stock JOP40D ROM link here doesnt work anymore. May i ask for another? Thanks!

youtube downloader
[Nexus 4 General] efrant:
Read the post above yours...
[Nexus 4 General] Girn:
@ efrant or anyone else.. I'm on stock ROM on faux kernel with xlouder.. In order to successfully flash 4.2.2 update. Does this seem right?

Fastboot devices

Fastboot flash system.IMG

Fastboot flash boot.IMG

Fastboot reboot

I know that's not exactly the commands but does the procedure seem right? Am I missing anything
[Nexus 4 General] thephantom:
Fastboot devices

Fastboot flash system system.img

Fastboot flash boot boot.img

Fastboot reboot

If you want ota, you might also add fastboot flash recovery recovery.img just to make sure if you're on custom recovery
[Nexus 4 General] trueblueram:
I downloaded the 4.2.2 ota zip and flashed it with cwm touch. Surely it can't be this easy.
[Nexus 4 General] efrant:
Yes, it is that easy (assuming you were stock to begin with). :)
[Nexus 4 General] chrone:
i did adb sideload this morning, wish i knew newest CWM make the OTA update that easy. haha. awesome! :good:
[Nexus 4 General] DarkenCypher:
I'm on aokp now. Can I not just flash the stock ROM? (After a full wipe of course.)
[Nexus 4 General] jishinya:
I'm on stock ROM, stock kernel, stock recovery, bootloader unlocked, and rooted. Is it possible to receive OTA updates? (I know I can either flash it via CWM or sideload it).
[Nexus 4 General] thephantom:
Yes
[Nexus 4 General] jishinya:
Weird. I tried to check for system updates, but to no avail.

So I thought mine isn't stock enough as I previously used Franco Kernel. So I flashed stock kernel reset zip (forgot where I got it from); fastboot flashed boot.img (I know this is a repeated steps similar to the previous stock kernel zip, but meh just in case) and system.img (both freshly downloaded from Nexus 4's occam img).

Went into apps > all apps > google framework services > clear data > check system updates; but still no OTA available. Am I missing something? As far as I know the 'root' (superSU) should not affect the OTA update/update check right?

Recovery's on stock too because I didn't disable the auto-flash-stock-recovery function (I only fastboot flash CWM when I need it).

Appreciated for your responses!
[Nexus 4 General] thephantom:
It's simply because when an ota is rolled out, not everyone gets them at the same time. It could take anywhere from seconds to days for one person to get it. If there are 2 Nexus devices on the table and both are turned on, even if they're in the same location there's no assurance both get it simultaneously. If you really can't wait, the ota zip file is out already for flashing
[Nexus 4 General] jishinya:
Ah, I see. I don't mind waiting as my priority is to test out whether if stock + unlocked + rooted can receive OTAs. Was kinda confused as I thought I missed out certain steps to ensure mine is "completely stock".

Since I didn't miss out any important steps, guess I'll wait for a few more days to test out the theory.

Thank you again for your help!
[Nexus 4 General] thephantom:
I'm not gonna spoil your experiment by giving the results away because self learning is always a welcome process so I'll just say, good luck and have fun!
[Nexus 4 General] yangkwong:
So, that mean the OTA update will not available if the "auto-flash-stock-recovery" function is enabled ?

Thanks
[Nexus 4 General] Admiral Nelson:
I think I've screwed up, I must have made a mistake somewhere along the way.

After following the instructions to return to stock, I can't get past the X on boot, which was mentioned in the OP as a possibility. As suggested, I try to enter recovery mode. When I see the android with the red exclamation mark, I hold power and up volume simultaneously, but nothing happens... until about 10 seconds later the device shuts off.

Thinking that maybe I needed to reflash the recovery partition, I found that the device was no longer recognized through the the usb/fastboot command prompt.

EDIT: Nevermind, foolish me I figured out how to enter recovery mode... I have to hold power and then hit vol up.
[Nexus 4 General] efrant:
Just out of curiosity, what is the purpose of waiting to see if you get the OTA notification? The beauty of a community like XDA is that we share, and as soon as one person here gets the update, it is available for all of us immediately.

Remember that OTA updates are not pushed to all devices at once. They are pushed out in batches, so if you are one of the unlucky ones, you could be waiting days or weeks or months before you receive the notification... But to what end? Why not just use the update that someone else already received, and be on the latest version as early as possible?
[Nexus 4 General] azrash:
Official image are out

Google Posts Factory Android 4.2.2 (JDQ39) Images For Nexus 4, 7, 10, And Galaxy Nexus (Yakju / Takju) http://www.androidpolice.com/2013/0...or-nexus-4-7-10-and-galaxy-nexus-yakju-takju/ via @AndroidPolice

Flowed from my Nexus 4
[Nexus 4 General] bleuf1sh:
can't i just use 7zip to get all the contents of the factory image

https://dl.google.com/dl/android/aosp/occam-jdq39-factory-345dc199.tgz

and then run the bat file that's in there? meaning... they leave the zip file as is and run fastboot -w update image-occam-jdq39.zip
[Nexus 4 General] efrant:
http://xdaforums.com/showpost.php?p=35053402&postcount=88
[Nexus 4 General] P8TRIOT:
From: https://developer.android.com/tools/extras/oem-usb.html

Isn't our Nexus 4's considered a developer phone? It is not listed there in the description. The reason I ask, according to the Android developer site, if you have a "developer" phone you need to NOT download the OEM drivers but the Google Drivers. Could someone clear this up for me?
[Nexus 4 General] efrant:
Yes, the Google drivers should work fine. Although I did link to the drivers in the first post...
[Nexus 4 General] El Daddy:
Has anyone figured out of the clearing cache with fastboot bug fixed with the latest bootloader?
[Nexus 4 General] P8TRIOT:
Shoulda looked a little harder sorry. So our Nexus 4's are "developer phones"?