uboot的两种command执行方式

来源:互联网 发布:python界面开发 实例 编辑:程序博客网 时间:2024/05/16 17:03

主要是uboot进入了

void cli_loop(void){#ifdef CONFIG_SYS_HUSH_PARSERparse_file_outer();/* This point is never reached */for (;;);#elsecli_simple_loop();#endif /*CONFIG_SYS_HUSH_PARSER*/}

这里进入了循环执行命令的代码。

第一种形式是采用HUSH解析的方式

第二种形式是采用cli_simple_loop的方式


第二种调用比较简单。主要是直接从串口读取一行命令

len = cli_readline(CONFIG_SYS_PROMPT);

然后调用

rc = run_command_repeatable(lastcommand, flag);->cli_simple_run_command

开始执行


第一种形式

parse_file_outer->parse_stream_outer


在parse_stream_outer里面 调用

rcode = parse_stream(&temp, &ctx, inp, '\n');解析字符串

然后调用

code = run_list(ctx.list_head); 执行命令流程如下

run_list->run_list_real->run_pipe_real->cmd_process



更详细可以参考

https://my.oschina.net/u/1982421/blog/303213


0 1