uboot命令的实现
1->输入字符串(name)
2->这些字符串就会产生动作,根据不同的名字,产生不同的动作(函数)
最简单的办法是做一个结构体,有名字和对应的处理函数:
cmd_tabl_t 结构体
typedef struct cmd_tbl_s cmd_tbl_t;

韦东山移植学习----03uboot-增加命令、描述
在uboot上增加命令实践
1)eg:增加命令 ,新建文件cmd_hello.c仿照cmd_boom.c,头文件照用 ==》 在uboot的common目录里面
int do_hello(cmd_tbl_t *cmdtp ,int flag,int argc,char *argv[])
{
int i;
print(“hello,word!,%d\n”,argc);
for(i=0;i<argc;i++)
{
printf("argv[%d]; %s\n ",i,argv[i]);
}
return 0;
}
U_BOOT_CMD(
hello,CFG_MAXARGS, 1, do_hello,
“hello -jus for test \n”,
“helloo,long help …\n”
)

2)在 COMMON里面的Makefile 上增加cmd_hello.o,
韦东山移植学习----03uboot-增加命令、描述
3)make ,增加新文件不需要make disclean也可以
韦东山移植学习----03uboot-增加命令、描述
韦东山移植学习----03uboot-增加命令、描述
韦东山移植学习----03uboot-增加命令、描述

韦东山移植学习----03uboot-增加命令、描述韦东山移植学习----03uboot-增加命令、描述

相关文章:

  • 2022-12-23
  • 2021-07-04
  • 2021-09-30
  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
猜你喜欢
  • 2021-07-23
  • 2022-12-23
  • 2021-04-06
  • 2021-08-26
  • 2022-12-23
  • 2021-12-30
相关资源
相似解决方案