summaryrefslogtreecommitdiff
path: root/fastboot/util.cpp
AgeCommit message (Collapse)Author
2019-06-28fastboot: add a wipe-super command.David Anderson
Usage: fastboot wipe-super [super_empty.img] This command will read the given super_empty.img (using the default one in ANDROID_PRODUCT_OUT if not specified), and flash by generating a temporary super.img with no partition data. This command will even work on retrofit devices. This command is intended to be used either during device bringup or with scripts that will manually flash individual dynamic partitions, in place of using "fastboot flashall". Bug: 136282057 Test: fastboot wipe-super on retrofit and non-retrofit device Change-Id: Icab368a63ff36fcce9ac9304eb3966dd38bd78c4
2018-09-25fastboot: remove engine.cpp/engine.hTom Cherry
Replace the remnants of engine.cpp with better functionality in FastBootDriver. Particularly, add prolog() and epilog() callbacks to FastBootDriver for printing actions and their result to the console. Then clean up the rest of fastboot.cpp to directly use FastBootDriver. Test: fastboot works Change-Id: I0ff01d6a10f75e9dc1c82b46c6e9bb3bc4c68638
2018-09-21fastboot: clean up CheckRequirementsTom Cherry
CheckRequirements() had various issues that are cleaned up here, 1) Move from C string parsing to C++ 2) Moved from C data structures to C++, including fixing memory leaks. 3) Removed the 'cur_product' global and the 'query_save' function that stores it 4) Actually writing tests for the parsing function for android-info.txt 5) Check that a variable needs to be checked for a given product before trying to read it. Previously, fastboot would fail if a variable isn't recognized on a device, even if the check should be ignored. A lot of flexibility is allowed for the input strings, to keep backwards compatibility with the previous parsers. Test: fastboot works, unit tests Change-Id: Idc3bba8b8fe829d8eefe5f6c495e63a9441c0b60
2018-09-05fastboot: remove command queueTom Cherry
There is little advantage and increasingly much disadvantage to queueing up fastboot commands before executing them. This change removes the queue in the most simple way possible to enable further clean up. Test: fastboot works Change-Id: I9abab05df07ed167dbe6a42e1eb9eab8f8d4f157
2018-07-19Refactor libfastbootAaron Wisner
This change creates a nice and clean API for issuing fastboot commands without using the fastboot tool itself. Test: fastboot tool itself (now using libfastboot2) on sailfish, walleye, and other devices. Test: flash bootloader bootloader.img Test: flash radio radio.img Test: -w update img.zip Test: Manually getvar and reboot commands. Bug: 111126621 Change-Id: I0022536b204ce0c5ad8329367fd522fa3c57877d
2018-04-02Improve fastboot verbose output.Elliott Hughes
Move some verbose messages so they're only output with -v. Remove some misleading verbose messages altogether (such as "wiping userdata..."). Properly log all the commands sent and responses received. Example: $ fastboot -v flashall ... Sending sparse 'system' 2/2 (443712 KB) fastboot: verbose: sending command "download:1b1500d0" fastboot: verbose: received DATA 1b1500d0 fastboot: verbose: sending data (1024 bytes) fastboot: verbose: sending data (165596160 bytes) fastboot: verbose: sending data (1024 bytes) fastboot: verbose: sending data (267762688 bytes) fastboot: verbose: sending data (1024 bytes) fastboot: verbose: sending data (20978688 bytes) fastboot: verbose: sending data (1024 bytes) fastboot: verbose: sending data (7168 bytes) fastboot: verbose: sending data (1024 bytes) fastboot: verbose: sending data (3072 bytes) fastboot: verbose: sending data (1024 bytes) fastboot: verbose: sending data (3072 bytes) fastboot: verbose: sending data (1024 bytes) fastboot: verbose: sending data (3072 bytes) fastboot: verbose: sending data (208 bytes) fastboot: verbose: received OKAY OKAY [ 13.871s] Writing sparse 'system' 2/2 fastboot: verbose: sending command "flash:system" fastboot: verbose: received OKAY OKAY [ 3.228s] Rebooting fastboot: verbose: sending command "reboot" fastboot: verbose: received OKAY Finished. Total time: 36.939s Bug: http://b/30953083 Bug: http://b/74444116 Test: `fastboot -v flashall` Change-Id: I2cca198daa062fd1fb732218343263803b111e38
2018-04-02Modernize fastboot output format.Elliott Hughes
After: -------------------------------------------- Bootloader Version...: 0.5 Baseband Version.....: 0.5 Serial Number........: serialv1.0 -------------------------------------------- Checking product OKAY [ 0.032s] Sending 'boot' (9962 KB) OKAY [ 0.350s] Writing 'boot' OKAY [ 0.143s] Sending 'dts' (14 KB) OKAY [ 0.068s] Writing 'dts' OKAY [ 0.048s] Sending sparse 'system' 1/2 (460796 KB) OKAY [ 14.383s] Writing sparse 'system' 1/2 OKAY [ 4.138s] Sending sparse 'system' 2/2 (443712 KB) OKAY [ 13.871s] Writing sparse 'system' 2/2 OKAY [ 3.246s] Rebooting Finished. Total time: 36.962s For a failure: extracting android-info.txt (0 MB) to RAM... -------------------------------------------- Bootloader Version...: 0.5 Baseband Version.....: 0.5 Serial Number........: serialv1.0 -------------------------------------------- Checking product FAILED Device product is 'hikey960'. Update requires 'marlin' or 'sailfish'. fastboot: error: requirements not met! This change also adds a -v/--verbose flag, but doesn't make much use of it yet (http://b/30953083 will need it). Bug: N/A Test: manual Change-Id: I7d19f5775859ffad5f3be5707b37dcb6e180917f
2018-03-28Add "require partition-exists=" support.Elliott Hughes
The Pixel 2 system images release was a bit of a disaster because anyone using an old version of fastboot would blindly flash too few partitions, potentially bricking their device. This change lets us add a line to the android-info.txt file for a device with a new partition. Also error out sooner in such cases by checking the requirements immediately, rather than optimistically unpacking everything first. Switch Action over to C++ to fix memory issues. Bug: http://b/77158188 (partition checking) Bug: http://b/74444116 (error out sooner) Test: manual testing with a modified android-info.txt Change-Id: I58b426cad410107e368f35f5725216d07281dd97
2015-06-23Move fastboot to C++.Elliott Hughes
Minimal conversion. Change-Id: I32cbf125be481a8757720d10fa303c38a7fd5e38