Hit a wall while hacking away on your unlocked Nexus 4? Don't Panic!! Whether you think you bricked your device, desire a clean slate to start over, or just want to play with some fastboot commands.. Nexus devices are the recipients of full Factory Images straight from Google, ensuring that we can recover from even the ugliest of situations and restore our device to brand new, out-of-the-box condition at any time. You will need a few files and a little familiarity with entering commands in a terminal / command prompt, but mostly just the ability to read and follow instructions. It's so easy, your grandma could do it! [WARN]Restoring the Factory Images will wipe EVERYTHING on your device, including the internal sdcard partition. If you can boot it up at all right now, you may wish to copy your photos, music, etc to your computer before we begin, else they will be lost. We are notresponsible for your device and anything you do to it, but we will do our best to help[/WARN]
[/TAB][TAB=Setup and Files]A few items you will need before we begin..
1. Factory Image The latest Factory Image for your device -- 4.3 (JWR66V) -- direct download link from Google:https://dl.google.com/dl/android/aos...y-08d2b697.tgz
A link to the page where you can find the files yourself, if for some reason the direct link is not working:https://developers.google.com/android/nexus/images
Please check the md5 checksum after downloading. If you get anything other than: 9d33973a61fa9266244fc43397888703 -- you should redownload. If you don't know how to check an md5 on your operating system, Google it!
2. ADB and fastboot files Unless you used some kind of toolkit when you originally unlocked/rooted your device, you should have these already. They may be located in your Android SDK /platform-tools directory if you have that installed, or wherever you downloaded them to before. Make sure you know where they are. If you need to grab them again, I totally stole these from smarter people than me (namely PaulOBrien) and just took out stuff we don't need, and renamed it to avoid confusion for you guys. Download from here: https://dl.dropbox.com/u/47300967/ne...b-fastboot.zip
*Mac users: Some Mac users have reported freeze-ups and other issues when the process gets to sending the system.img over to the device. ACusers bshimrak and andr0idralphie were able to solve this by using updated adb and fastboot files, and bshimrak was kind enough to provide me those files, which I am mirroring here: https://dl.dropboxusercontent.com/u/...ndroid-MAC.zip
Mac users may need to use these adb and fastboot files. The steps should remain the same.
3. Drivers If you are on a Windows system (linux and mac need not bother with these): Universal Naked Driver 0.72.zip
Warning: Uninstall any previous driver package's you may have installed and also manually remove drivers by attaching your phone and going to Windows device manager and right click the entry for your phone and select "Uninstall" on the next prompt make sure to select "Delete the driver software for this device" then hit OK and reboot before installing these drivers
HUGE thanks to 1wayjonny at xda for these drivers!
[/TAB][TAB=Step-by-Step]Are you still with me? Great... let's get started!
Here are the GENERAL INSTRUCTIONS TO RESTORE THE STOCK IMAGES. Make sure you know how to do it for your computer/setup and thatADB and fastboot is set up on your computer. Know the exact folder containing the fastboot files you will be using.
[NOTE]Throughout these instructions I will be entering our commands in the format:
Code:
fastboot … … …
However, you must remember to modify just the beginning part to reference the appropriate file for your system.
For Windows this should look like:
Code:
fastboot-windows … … …
For Linux (note that sudo may be required before entering fastboot commands):
Code:
sudo fastboot-linux … … …
For Mac (note that ./ is required before entering the commands on a Mac):
Code:
./fastboot-mac … … …
[/NOTE]
[INFO]1. Extract the files from the Factory Image we downloaded from Google. The BEST app you can use for this is 7zip. I suggest Googling it and finding a version for your OS. Using other file archive apps (i.e. winrar, winzip, etc) may result in errors. Dive through the folders and you will find a number of files we are going to fastboot to your device. We want to place all of these files into the directory we located earlier which contains our "fastboot" file. Move or copy them over to that folder.
2. Open a command prompt inside the folder we have set up our files in. On Windows this can be done by holding shift as you right-click in the folder, then select "Open command window here". On Mac or on a Linux system you want to open a terminal/command prompt and navigate to that folder using "cd" or "change directory" commands. For example, if you grabbed the zip I posted earlier and extracted it on your desktop, your folder is called "nexus4-adb-fastboot" on your desktop, and you would enter:
Code:
cd desktop
cd nexus4-adb-fastboot
Now your command prompt is ready in the correct directory for all of the following commands.
3. Boot into the bootloader/fastboot mode. Power down the phone, then hold Volume Down and Power until you see the familiar green robot, and a string of text on the left that begins with "fastboot mode" in red letters. You may also get here if your phone is powered on and plugged into the computer already by simply typing
Code:
fastboot reboot bootloader
in the prompt and hitting Enter. Regardless.. Plug it in now. If possible try to use a USB port in the rear of your computer, rather than the front. Yes, this can make a difference!
4. Let's make sure fastboot is recognizing your device. Type this command and hit Enter:
Code:
fastboot devices
You should see "List of attached devices" Followed by a string of numbers. If you do not see this, you do not have your drivers installed correctly! You may need to remove them and try just reinstalling from the Setup tab earlier. If you got the expected response, let's move on to fastbooting you back to stock...
5. This first command is going to wipe all your old EVERYTHING from the device. This step isn't always needed, but it's a great idea to do it anyway. The code we use later to flash the Factory Image will also wipe it, but you may sometimes avoid bugs by doing it manually first. Type each of these lines followed by Enter between them, waiting for one to finish before moving on to the next:
Code:
fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
a
fastboot erase userda
t
6. These commands are going to flash the Factory Image to your device. Each command will flash a different component/image required to go to stock. You can copy and paste each command, but if they don't work type them in. There's a general "language" that's being spoken here, so as long as you understand that language you'll be able to get the general jibe of what's going on. Also, make sure each command is COMPLETE before going to the next.
Code:
fastboot flash bootloader bootloader-mako-makoz20i.img
fastboot reboot-bootloader
fastboot flash radio radio-mako-m9615a-cefwmazm-2.0.1700.84.img
fastboot reboot-bootloader
fastboot –w update image-occam-jwr66v.zip
When the final command completes the phone should reboot itself. Let it do this without touching anything, all the way to the Welcome screen. Leave your command prompt window open, we aren't done just yet!
7. If you intend to keep your device unlocked and get back to playing with it, then you are done! Have fun! However, if you would like to re-lock your bootloader now that you have a stock device again, simply reboot into the bootloader just like we did earlier. In the command prompt type:
Code:
fastboot oem lock
fastboot reboot-bootloader
Hitting enter between each line, of course. Now you can boot up into your stock, locked phone. If you want to unlock that bootloader again (remember, doing so will wipe everything just as it did the first time) just boot into the bootloader again and use:
Code:
fastboot oem unlock
And that's it.. you have in your hands a completely restored, stock device and can get back to tinkering with it as much as you like. If you have any questions, comments, concerns.. just post them and myself or someone else will help you out as soon as we can. Also check the Troubleshooting tab for some solutions to common questions or errors. Credit to everyone who I stole borrowed files and verbatim for this guide
Happy fastbooting![/INFO]
[/TAB][TAB=Troubleshooting]Answers and Solutions to Common Issues
Q. When entering the commands I see the error "fastboot is not a recognized command"
A. Your command prompt just isn't looking in the correct location. Remember you had to locate the directory which contains your fastboot file, move all of the files extracted from the Factory Image to that directory, and then either tell the command prompt to look in that directory or open the command window from within that directory. Go back to Step 2 of the step-by-step and try again.
Q. Everything seemed to work.. but when I was flashing the image I saw these (or similar) messages:
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
A. Safe to ignore these.
Q. After the process completes I am getting stuck at the Android X or boot logo and cannot get past it.
A. Boot back into the bootloader and try locking and then unlocking it, simply using:
fastboot oem lock
followed by
fastboot oem unlock
And accept it on the phone. Sometimes the wipe this does is needed to fully clear the old data and caches.
Q. I got an error saying "FAILED (command write failed (Unknown error))"
A. Try using a different USB port. It's usually best, if possible, to use one in the back of your computer rather than the front.
Q. Message indicates the fastboot command is not in the correct syntax.. or I got an error sending the system portion.. or it seemed to freeze when sending system and won't boot up now.
A. Besides trying a different USB port, also try entering the final command switching up the "-w" portion to follow the "update" command, as in:
fastboot update –w image-occam-jop40d.zip
Q. I got an error saying "FAILED (remote: (BadParameter))"
A. Your computer did not like flashing the last file, the big .zip containing the various parts of your system (specifically the boot, system, recovery, and userdata sections). Unzip that file, and make sure to move the extracted files once again to the same directory as your fastboot file. Now you are going to flash each of them one at a time, as in:
Code:
fastboot flash boot boot.img
fastboot flash system system.img
fastboot flash recovery recovery.img
fastboot flash userdata userdata.img
Please be sure to only enter these lines one at a time and let each one finish before entering the next. When done reboot.
No comments:
Post a Comment