03-S3C2440u-boot学习之u-boot分析之u-boot命令实现
来源:互联网 发布:linux hadoop 下载 编辑:程序博客网 时间:2024/06/06 04:22
参考《韦东山1期视频》第09课第4节 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*/intmaxargs;/* maximum number of arguments*/intrepeatable;/* autorepeat allowed?*//* Implementation function*/int(*cmd)(struct cmd_tbl_s *, int, int, char *[]);char*usage;/* Usage message(short)*/#ifdefCFG_LONGHELPchar*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。
0 0
- 03-S3C2440u-boot学习之u-boot分析之u-boot命令实现
- 03-S3C2440u-boot学习之u-boot分析编译体验
- 03-S3C2440u-boot学习之u-boot分析之Makefile结构分析
- 03-S3C2440u-boot学习之u-boot分析之源码第1、2阶段
- 03-S3C2440u-boot学习之u-boot分析_uboot启动内核
- u-boot分析 七 (添加u-boot命令,学习u-boot命令实现原理)
- u-boot之命令分析(6)
- u-boot之mkconfig分析
- u-boot之Makefile分析
- u-boot之SPL分析
- u-boot分析之Makefile
- u-boot 学习之综述
- u-boot 学习之常用命令
- BootLoader 之U-Boot学习.
- u-boot命令实现
- U-BOOT之四:u-boot.lds分析
- U-Boot之四:u-boot.lds分析
- U-Boot之四:u-boot.lds分析
- ADS仿真目标参数调谐与目标优化 ----tuner和goal控件使用
- 关于Integer大小比较的问题
- palette调色板初级使用
- 链表的学习 day1
- 继承、封装、多态
- 03-S3C2440u-boot学习之u-boot分析之u-boot命令实现
- 关于localtime()函数在多线程中的core问题
- C实例---文件操作(打开文件)
- JAVA jsoup 架包安装
- 后缀数组模板
- 对象继承训练(2):继承后可以调用父类方法
- .Net程序员学用Oracle系列(11):系统函数(下)
- POJ1182【种类并查集】
- 《程序员自我修养》--动态链接