android fastboot命令,Android在Fastboot里添加命令

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

即可操作。

默认fastboot 支持的命令:usage: fastboot [ ]

commands:

update reflash device from

update.zip

flashall flash boot

+ recovery + system

flash [ ] write a file to a flash

partition

erase erase a flash

partition

format format a flash

partition

getvar display a

bootloader variable

boot [ ] download and boot kernel

flash:raw boot [ ] 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 specify device serial number or path to

device port

-l with "devices", lists device

paths

-p specify product name

-c override kernel commandline

-i specify a custom USB vendor id

-b specify a custom kernel base

address

-n specify the nand page size.

default: 2048

-S [K|M|G] automatically sparse files

greater than size. 0 to disable

fastboot 提供了扩展的命令符号

fastboot oem command args

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

(1).在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 个字

转载请注明出处:周木水的CSDN博客 https://blog.csdn.net/zhoumushui

我的GitHub:周木水的GitHub https://github.com/zhoumushui

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值