uboot添加命令,最快最简山寨法

687阅读 0评论2012-09-27 xlzxlz2
分类:

最近移动硬盘的表现越来越不给力,拷部电影都要N久。
关键的是里面还有整理的资料,本着未雨绸缪的精神,今天开始写博客。

进入正题。

首先在 uboot/common/cmd_mem.c 中(本目录下别的文件也行)
文件末尾添加(这样是为了强制编译,不加条件编译什么的,费时间)


  1. int do_my_test (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  2. {
  3.      // do what you wanna do
  4.      printf("leon here\n");
  5.      return 0;
  6. }

  7. U_BOOT_CMD(
  8.     my_test,         //命令名
  9.     4,               //参数个数上限
  10.     1,               //autorepeat allowed?
  11.     do_my_test,      //执行命令函数
  12.     "my_test - leon test\n",  //Usage
  13.     "no help info\n"          //Help Message
  14. );

完了,编译,烧u-boot.bin,敲命令 my_test 即可
上一篇:制作rootfs文件 ramdisk
下一篇:linux vlan代码部分