fastboot.js is an implementation of the fastboot protocol in JavaScript. It runs in web browsers using the WebUSB API, which is currently supported by Chrome.
This work was funded by GrapheneOS.
Many users, particularly those with less technical experience, have trouble flashing custom operating systems on Android devices. This is not necessarily their fault; there are many steps in the process that can go wrong. Broken or outdated Android platform tools, missed commands or steps, and many other factors can cause problems during flashing.
WebUSB makes it possible to move most of the complexity into the browser, where the environment is much more controlled and most of the steps can be automated. This makes it easier for users to flash ROMs onto their devices and is more likely to result in success.
Google's Android Flash Tool for AOSP CI images and Pixel factory images is already taking advantage of this, but unfortunately, it is proprietary and closed-source. Furthermore, it only supports flashing the aforementioned images from Google, so flashing custom ROMs with it is not possible. This is where fastboot.js comes in: it is an open-source library that can be used to create web installers for flashing anything.
The following fastboot features are supported:
- Running commands (erase, lock, unlock, getvar, reboot, etc.)
- Flashing raw, bootloader, sparse, and custom AVB key images
- Flashing AOSP factory image zips (update.zip)
- Flashing images larger than the bootloader's maximum download size (by splitting sparse images)
A basic demo of fastboot.js can be found here. The source code is included in this repository.