Add commands in Fastboot for Android
Fastboot is the default debug method for android. Its advantage is that it is used before linux kernel
.
Default commands supported by fastboot:
usage: fastboot [ ] commands:update
reflash device fromupdate.zipflashall flash boot+ recovery + systemflash
[
] write a file to a flashpartitionerase
erase a flashpartitionformat
format a flashpartitiongetvar
display abootloader variableboot
[
] download and boot kernelflash:raw boot
[
] create bootimage and flash itdevices list allconnected devicescontinue continuewith autobootreboot rebootdevice normallyreboot-bootloader reboot deviceinto bootloaderhelp show thishelp messageoptions:-w erase userdata and cache (andformat if supported by partition type)-u do not first erase partitionbefore formatting-s
specify device serial number or path todevice port-l with "devices", lists devicepaths-p
specify product name-c
override kernel commandline-i
specify a custom USB vendor id-b
specify a custom kernel baseaddress-n
specify the nand page size.default: 2048-S
[K|M|G] automatically sparse filesgreater than size. 0 to disable
Fastboot provides extended command symbols
fastboot oem command args
The following uses fastboot oem hello test to describe how to scale
(1) In bootable/bootloader/lk/app/mt_boot/fastboot. c
Add a new register to the fastboot_init function.
// The first parameter is the command name // The second parameter is the command execution function // The third parameter is whether the fastboot_register ("oem hello", __oem_hello, FALSE );
(2) Implement the cmd_oem_hello Function
Void pai_oem_hello (const char * arg, void * data, unsigned size ){
// Note that args starts with the end of command, that is, "args" if (! Strncmp (arg, "OK", strlen ("OK") {fastboot_okey ("OK") ;}else {fastboot_fail ("Not OK ");}}
(3). Interaction with PC
You can use the three defined functions to interact with the PC.
fastboot_okey(const char* result);fastboot_fail(const char* reason);fastboot_info(const char* reason);
Note that the length of the Three printed strings cannot exceed 64-1-4 = 59 characters.
Reprinted please indicate the source: Zhou mu Shui CSDN blog http://blog.csdn.net/zhoumushui
My GitHub: Zhou mu Shui's GitHub https://github.com/zhoumushui