Uboot之命令行框架

一、参考例子:

  uboot-2010.06

二、uboot/include/configs/board_name.h

  增加#define CONFIG_CMD_USR

三、uboot/common/Makefile

  增加COBJS-$(CONFIG_CMD_USR) +=cmd_usr.o

四、uboot/common/

  增加cmd_usr.c

五、cmd_usr.c书写格式

  

 1 #include <common.h>
 2 #include <command.h>
 3 
 4 int do_cmdusr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 5 {
 6       //自己实现的功能:例如tftp等下载、数据校验  
 7 }
 8 
 9 U_BOOT_CMD(
10     cmdusr,    3,    0,    do_cmdusr,
11     "cmdusr- user cmd
",
12     " - this is cmd, Contains the following steps:
"
13     " - 1...
"
14     " - 2...
"
15     " - 3...
"
16     " - 4...
"
17 );
View Code
原文地址:https://www.cnblogs.com/pokerface/p/6770056.html