Add commands in Fastboot for Android

Source: Internet
Author: User

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


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.