In this guide I will be going over the process of how you can take the ROM you have built on your Android build machine which we setup in this tutorial and flash it to a device from Windows.
In order to follow this guide, you will need the following:
- Successfully built android on your AOSP build machine.
- Access to the AOSP out directory - we are using samba in this guide
- Your physical Android device will need to be unlocked and flashable
Downloading the Platform tools
First thing we will need to do is head over to developer.android.com and download the SDK Platform Tools. You will need to download these for Windows. We will then need to extract the files and put them somewhere sensible in windows so that you don't accidently delete them later on. I will be storing them in my user directory
In this directory you will find a few key files:
adb.exe. If you dont have these, make sure you have downloaded the right zip and try again.
Adding the platform tools to your path
We now need to add this directory to our path. This will make it so that we can access these binaries/executables from any powershell/command prompt window regardless of where we are. To do this, open up your
File Explorer - I recommended the short cut
Windows key + E. Find the This
PC link, right click it and click
This should launch the
System Properties window. In this, click
Advanced System Settings.
In this new window, click
In the box at the top where it says
User variables for USER, click
Path and then
Edit.... You then want to click new and then enter the path which you have your platform tool stored in. e.g
You then need to click
OK to this.
If you then open up a powershell window, you should be able to type in
adb and get the help message.
Setting the Android out environment variable
In order to be able to flash our entire AOSP image, we will be using the
fastboot flashall command. To do this, we need to tell fastboot where to find our Android files. These will be stored in the
out\target\product\walleye of your AOSP directory. To access these from my windows machine, I have them mounted over a samba share.
Back in the
Environment Variables window, we want to add a new variable for our user. Click the
New... button. In here, enter
ANDROID_PRODUCT_OUT as the variable name and the value as the output directory and click
OK. We are now done with these windows so click
OK to all windows we have opened.
Flashing our device
Our environment is now setup so you can now open up a new Powershell window. Your going to want to boot your phone into the bootloader. If you already have developer mode enabled on the device, you can do this through adb using this command.
adb reboot bootloader
Once in the bootloader, you can use the flash all command. The
-w flag is used to tell fastboot to wipe the data partition. If this is your first time flashing the device with your custom image, you will need to do this or the device may bootloop.
fastboot flashall -w
The output should be something like this.