首页 > 代码库 > Uboot之命令行框架

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\n",
12     " - this is cmd, Contains the following steps:\n"
13     " - 1...\n"
14     " - 2...\n"
15     " - 3...\n"
16     " - 4...\n"
17 );
View Code

 

Uboot之命令行框架