如何在fastboot 里面添加新的命令

fastboot 是android 默认的一种debug 方法,它的好处是在进入linux kernel 之前即可操作。

默认fastboot 支持的命令:

usage: fastboot [ <option> ] <command>

commands:

update <filename>                                  reflash device from update.zip

flashall                                                     flash boot + recovery + system

flash <partition> [ <filename> ]              write a file to a flash partition

erase <partition>                                     erase a flash partition

format <partition>                                   format a flash partition

getvar <variable>                                    display a bootloader variable

boot <kernel> [ <ramdisk> ]                   download and boot kernel

flash:raw boot <kernel> [ <ramdisk> ]    create bootimage and flash it

devices                                                     list all connected devices

continue                                                    continue with autoboot

reboot                                                       reboot device normally

reboot-bootloader                                      reboot device into bootloader

help                                                           show this help message

options:

-w                                       erase userdata and cache (and format if supported by partition type)

-u                                        do not first erase partition before formatting

-s <specific device>             specify device serial number or path to device port

-l                                         with "devices", lists device paths

-p <product>                             specify product name

-c <cmdline>                             override kernel commandline

-i <vendor id>                           specify a custom USB vendor id

-b <base_addr>                         specify a custom kernel base address

-n <page size>                           specify the nand page size. default: 2048

-S <size>[K|M|G]                       automatically sparse files greater than size.  0 to disable

fastboot 提供了扩展的命令符号

fastboot oem command args

下面以fastboot oem hello test 来说明如何扩展

(1).在alps/bootable/bootloader/lk/app/mt_boot/fastboot.c

的fastboot_init 函数中添加一个新的register

//第一个参数是命令的名称

//第二个参数是命令的执行函数

//第三个参数是在security IC 中是否还提供此命令

fastboot_register("oem hello", cmd_oem_hello, FALSE);

(2). 实现cmd_oem_hello 函数

void cmd_oem_hello(const char *arg, void *data, unsigned size) {

//注意args 是以command 结束开始,即" args"

if(!strncmp(arg, " OK", strlen(" OK"))){

fastboot_okey("OK");

}else{

fastboot_fail("Not OK");

}

}

(3). 与PC 端交互

您可以使用下面已经定义好的三个函数与PC 端交互

fastboot_okey(const char* result);

fastboot_fail(const char* reason);

fastboot_info(const char* reason);

注意这三个打印字符串的长度都不能超过64-1-4 = 59 个字符

时间: 2024-08-29 20:40:14

如何在fastboot 里面添加新的命令的相关文章

如何在caffe中添加新的Layer

如何在caffe中添加新的Layer 本文分为两部分,先写一个入门的教程,然后再给出自己添加maxout与NIN的layer的方法 (一) 其实在Github上已经有答案了(https://github.com/BVLC/caffe/issues/684) Here's roughly the process I follow. Add a class declaration for your layer to the appropriate one of common_layers.hpp, 

如何在caffe中添加新类型的layer

如何在caffe中添加新类型的layer 参考:https://github.com/BVLC/caffe/issues/684 Add a class declaration for your layer to the appropriate one of common_layers.hpp,data_layers.hpp, loss_layers.hpp, neuron_layers.hpp, or vision_layers.hpp. Include an inline implement

怎样在fastboot 里面加入新的命令

fastboot 是android 默认的一种debug 方法.它的优点是在进入linux kernel 之前就可以操作. 默认fastboot 支持的命令: usage: fastboot [ <option> ] <command> commands: update <filename>                                  reflash device from update.zip flashall                  

如何在Pycharm中添加新的模块

在使用Pycharm编写程序时,我们时常需要调用某些模块,但有些模块事先是没有的,我们需要把模块添加上去. 最近在学习爬虫,写了下面几行代码: 结果出现错误 错误ModuleNotFoundError: No module named 'bs4'的意思是未找到名为bs4的模块,我们就需要pycharm上安装'bs4'这个模块.方法如下: 1.点击File,选择Default Settings选项 2.选择project interpreter选项 3.点击3.6.3选项(我的为python3.6

OpenWrt的luci web管理器添加新菜单

OpenWrt的luci web管理器添加新菜单 本篇博客主要描述luci添加菜单的两个实例,即CBI和View(Template): 添加新元素到luci中去 添加新的顶级选项卡标签(主菜单) 添加cbi标签的代码 添加cbi配置文件 添加view标签代码 关键字 luci cbi view template fulinux 添加新元素到luci中去 这里将向大家展示如何在luci中添加新标签的方法. 作为一个实例我将向大家展示luci添加新标签的两种方法: CBI 2.View(templa

Android在Fastboot里添加命令

fastboot 是android 默认的一种debug 方法,它的好处是在进入linux kernel 之前 即可操作. 默认fastboot 支持的命令: <span style="font-size:14px;">usage: fastboot [ <option> ] <command> commands: update <filename> reflash device from update.zip flashall flas

android如何在Codebase中添加一级新的ProjectConfig.mk文件

如何在Codebase中添加一个新的ProjectConfig.mk文件,使得其优先级大于 mediatek/config/$project/ProjectConfig.mk ProjectConfig.mk 优先级大于$project目录下的ProjectConfig.mk文件 [Solution] Step1. 在mediatek/config下面添加自己的文件夹名称,如testconfig,在其中放入贵司自己的ProjectConfig.mk Step2. 修改文件mediatek/bui

如何在xshell会话上添加新端口转发规则

为使用通过加密隧道的端口转发服务,应定义各个应用程序的端口转发规则.本集主要讲解如何在xshell会话中添加新端口转发规则. 如何在会话上添加新端口转发规则: 1.打开会话对话框. 2.选择你要编辑端口转发规则的会话. 3.点击标准按钮的[属性]. 4.在[类别]中选择[连接: SSH: 隧道]. 5.点击[添加]打开转发规则对话框. 6.在[类型]目录选择连接类型. 7. 在[源主机]中输入localhost或IP地址. 8.在[侦听端口]中输入端口号或选择服务名称. 9.在[目标主机]中输入

如何在github的wiki中添加新的图片

本文简单介绍在github的wiki中添加新的图片对方法 在github的wiki中,可以展现图片,可是,怎么添加图片,从网页上展示的信息来看,不是很清楚. 添加图片,基本上就是通过下面几步来完成: 1. clone wiki 2.创建图片目录 3.在图片目录中添加图片 4.在wiki中引用图片 具体操作步骤如下: 1. clone wiki git clone https://github.com/xx/xx.wiki.git 该url可以从clone this wiki locally 拿到