怎样在fastboot 里面加入新的命令
2024-10-19 01:33:04
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
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
-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 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);
的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");
}
}
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 个字符
您能够使用以下已经定义好的三个函数与PC 端交互
fastboot_okey(const char* result);
fastboot_fail(const char* reason);
fastboot_info(const char* reason);
注意这三个打印字符串的长度都不能超过64-1-4 = 59 个字符
最新文章
- c++作业:Circle
- Deep Learning 5_深度学习UFLDL教程:PCA and Whitening_Exercise(斯坦福大学深度学习教程)
- Ipad Safari iframe cookie 当浏览器默认禁用第三方COOKIE
- guava学习--Ordering
- ajax 调用 JSON.parse();
- javascript宿主对象之window.screen、window.close()/open()、window.moveTo、window.resizeTo
- C语言--- 字符串数组 、 预处理器和预处理指令 、 多文件编程 、 结构体
- DEBUG模式下屏蔽某些烦人的动态日志信息
- POJ 1847 Tram【Floyd】
- Objective-C 编程艺术 (Zen and the Art of the Objective-C Craftsmanship 中文翻译)
- [转载]SharePoint 网站管理-PowerShell
- js日期格式,日期对象
- 使用javax.script包实现Java设置JS脚本中的变量
- bzoj 2750: [HAOI2012]Road
- Java过滤器Filter
- 小白的python之路Linux部分10/27&;28
- ADO.NET之SqlConnection、sqlcommand的应用(学习笔记)
- 5月17 AJAX返回类型-------JSON和XML
- 《算法》第四章部分程序 part 15
- 解决:Determining IP Information for eth0...问题
热门文章
- SQL Server 预编译执行SQLs
- J.U.C并发框架源码阅读(十一)DelayQueue
- Codeforces 908 D New Year and Arbitrary Arrangement
- 【bzoj1566】【管道取珠】竟然是dp题(浅尝ACM-E)
- Struts2笔记--Action访问Servlet API
- service mysqld start 报错:service mysqld start 报错 090517 13:34:15 [ERROR] Can&#39;t open the mysql.plugin table. Please run mysql_upgrade to create it. 090Can&#39;t open the mysql.plugin table. Please run mysql
- Oracle ORA-01033: 错误解决办法
- ubuntu 下安装nodejs以及pm2
- 命令行下的“蒙面歌王”rundll32.exe
- 什么是滤波器,滤波器是干嘛用的,IIR和FIR滤波器又是什么?(回答请简洁,别浪费大家时间)