To flash a system image:
- Download the appropriate system image for your device from:
Factory Images for Nexus Devices cd
to the directory where the file is stored then unarchive it:$ tar -xvzf <filename>
- Connect your device to your computer over USB (make sure USB Debugging is selected under Settings > Developer Options)TIP: on my system the following commands must be run as root. To do that properly
su -
to root then execute the following:# export PATH=$PATH:/home/<user>/android-sdk/tools/:\ /home/<user>/android-sdk/platform-tools/
- Start the device in fastboot mode with one of the following methods:
- Using the adb tool: With the device powered on, execute:
# adb reboot bootloader
- Using a key combo: turn the device off, then turn it on and immediately hold down the relevant key combination for your device
- Using the adb tool: With the device powered on, execute:
- to display whether you’re correctly connected to your device run:
# fastboot devices list badcafe00 fastboot
- If necessary, unlock the device’s bootloader by running:
# fastboot oem unlock
NOTE: The target device will show you a confirmation screen. This command erases all data!!!
cd
to the unzipped system image directory- Execute the
flash-all
script. This script installs the necessary bootloader, baseband firmware(s), and operating system:# ./flash-all.sh sending 'bootloader' (3911 KB)... OKAY [ 0.170s] writing 'bootloader'... OKAY [ 1.388s] finished. total time: 1.559s rebooting into bootloader... OKAY [ 0.005s] finished. total time: 0.056s archive does not contain 'boot.sig' archive does not contain 'recovery.sig' archive does not contain 'system.sig' archive does not contain 'vendor.img' Creating filesystem with parameters: Size: 28856791040 Block size: 4096 Blocks per group: 32768 Inodes per group: 8192 Inode size: 256 Journal blocks: 32768 Label: Blocks: 7045115 Block groups: 215 Reserved block group size: 1024 Created filesystem with 11/1761280 inodes and 154578/7045115 blocks Creating filesystem with parameters: Size: 587202560 Block size: 4096 Blocks per group: 32768 Inodes per group: 7168 Inode size: 256 Journal blocks: 2240 Label: Blocks: 143360 Block groups: 5 Reserved block group size: 39 Created filesystem with 11/35840 inodes and 4616/143360 blocks -------------------------------------------- Bootloader Version...: FLO-04.04 Baseband Version.....: none Serial Number........: 06273f26 -------------------------------------------- checking product... OKAY [ 0.003s] checking version-bootloader... OKAY [ 0.004s] sending 'boot' (7182 KB)... OKAY [ 0.294s] writing 'boot'... OKAY [ 0.386s] sending 'recovery' (7768 KB)... OKAY [ 0.317s] writing 'recovery'... OKAY [ 0.296s] erasing 'system'... OKAY [ 1.170s] sending 'system' (799293 KB)... OKAY [ 32.173s] writing 'system'... OKAY [ 35.771s] erasing 'userdata'... OKAY [ 24.776s] sending 'userdata' (139085 KB)... OKAY [ 5.464s] writing 'userdata'... OKAY [ 6.017s] erasing 'cache'... OKAY [ 0.464s] sending 'cache' (10984 KB)... OKAY [ 0.437s] writing 'cache'... OKAY [ 0.488s] rebooting... finished. total time: 108.130s
- Once the script finishes, your device reboots. You should now lock the bootloader for security. Start the device in fastboot mode again, as described above.
- Execute one more time:
# fastboot oem lock
NOTE: Locking the bootloader does not wipe any data. In case you’ll want to flash it again it’ll force you to run
fastboot oem unlock
which will wipe the data instead.