This guide covers the steps for flashing Android firmware into hardware device. These steps can be used to flash AOSP build into a hardware device. Please follow the steps in order.
Please follow the instructions on the Flashing Devices page for unlocking the device.
- Connect device to PC via USB cable. Make sure developer option and USB debugging is enabled.
- Run the command in a terminal to boot into bootloader:
adb reboot bootloader
We need to set ANDROID_PRODUCT_OUT variable to the AOSP output directory where boot.img
, system.img
and other files reside.
We need to execute the build commands once in the terminal. This updates the ANDROID_PRODUCT_OUT variable and sources fastboot command in the terminal. To do these we need to execute the two steps.
- Open terminal in <AOSP_ROOT> directory.
- Run the following commands:
. build/envsetup.sh
lunch aosp_target-name-eng
m
(Replace "target-name" with your device codename. For device target-names check Selecting a device build)
Please make sure the device is not disconnected while the flash is running. The device will automatically reboot after a successful flash. To flash the device run the command:
fastboot flashall -w
- If an error like
fastboot: usage: no command
is shown, that means fastboot is not sourced to your terminal or there are some other issues. If this happens, you need to use fastboot from your AOSP output directory. In that case use the fastboot from the directory -/out/soong/host/linux-x86/bin
.