04-S3C2440u-boot学习之u-boot分析(4)之u-boot命令实现
2017-02-09 21:25
381 查看
参考《韦东山1期视频》第09课第4节
u-boot分析之u-boot命令实现.WMV
1解析命令:如存在;
3增加一个hello命令
参考bootm,在common下创建hello_cmd.c
实现do_hello方法和U_BOOT_CMD
拷贝c文件到common目录下
修改common下的makefile文件:
增加cmd_hello.o
重新make。
执行hello。
u-boot分析之u-boot命令实现.WMV
1解析命令:如存在;
while (*str) { /* * Find separator, or string end * Allow simple escape of ';' by writing "\;" */ for (inquotes = 0, sep = str; *sep; sep++) { if ((*sep=='\'') && (*(sep-1) != '\\')) inquotes=!inquotes; if (!inquotes && (*sep == ';') && /* separator */ ( sep != str) && /* past string start */ (*(sep-1) != '\\')) /* and NOT escaped */ break; }2提取命令参数
/* Extract arguments */ if ((argc = parse_line (finaltoken, argv)) == 0) { rc = -1; /* no command at all */ continue; }
/* Look up command in command table */ if ((cmdtp = find_cmd(argv[0])) == NULL) { printf ("Unknown command '%s' - try 'help'\n", argv[0]); rc = -1; /* give up after bad command */ continue; }
struct cmd_tbl_s { char *name; /* Command Name */ int maxargs; /* maximum number of arguments */ int repeatable; /* autorepeat allowed? */ /* Implementation function */ int (*cmd)(struct cmd_tbl_s *, int, int, char *[]); char *usage; /* Usage message (short) */ #ifdef CFG_LONGHELP char *help; /* Help message (long) */ #endif #ifdef CONFIG_AUTO_COMPLETE /* do auto completion on the arguments */ int (*complete)(int argc, char *argv[], char last_char, int maxv, char *cmdv[]); #endif };
3增加一个hello命令
参考bootm,在common下创建hello_cmd.c
实现do_hello方法和U_BOOT_CMD
拷贝c文件到common目录下
修改common下的makefile文件:
增加cmd_hello.o
重新make。
执行hello。
相关文章推荐
- 04-S3C2440u-boot学习之u-boot分析(2)之Makefile结构分析
- 04-S3C2440u-boot学习之u-boot分析(1)编译体验
- 04-S3C2440u-boot学习之u-boot分析(5)_uboot启动内核
- 04-S3C2440u-boot学习之u-boot分析(3)之源码第1、2阶段
- u-boot分析 七 (添加u-boot命令,学习u-boot命令实现原理)
- u-boot分析 七 (添加u-boot命令,学习u-boot命令实现原理)
- u-boot命令分析&命令实现
- 伟东山视频自学笔记——uboot命令分析+实现_________精华————————
- u-boot分析(三)---boot命令实现以及内核的启动
- U_BOOT_CMD 命令实现分析
- u-boot分析之u-boot命令实现
- u-boot分析(三)---boot命令实现以及内核的启动
- WPF学习笔记二 依赖属性实现原理及性能分析
- U_BOOT_CMD命令的实现
- Andrid学习一----recovery.img与boot.img简单对比分析
- gcc编程环境基础4--ld命令和u-boot中的lds文件实例和简单实例分析
- gcc编程环境基础4--ld命令和u-boot中的lds文件实例和简单实例分析
- U_BOOT_CMD命令的实现
- ld命令和u-boot中的lds文件实例和简单实例分析
- s3c uboot-的start.S详细注解及分析