浏览代码

sandbox: init cli for -c

sandbox crashes if a variable is set in the -c command, because
hush's top_vars is not allocated.  Call cli_init() from sandbox
to ensure this is done before we execute the -c command.

 $ ./u-boot -c 'a=1'
 ...
 Segmentation fault (core dumped)

Signed-off-by: Rabin Vincent <rabin@rab.in>
Acked-by: Simon Glass <sjg@chromium.org)
Tested-by: Simon Glass <sjg@chromium.org)
Rabin Vincent 10 年之前
父节点
当前提交
7dbcb76e77
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      arch/sandbox/cpu/start.c

+ 3 - 0
arch/sandbox/cpu/start.c

@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <os.h>
+#include <cli.h>
 #include <asm/getopt.h>
 #include <asm/io.h>
 #include <asm/sections.h>
@@ -76,6 +77,8 @@ int sandbox_main_loop_init(void)
 
 	/* Execute command if required */
 	if (state->cmd) {
+		cli_init();
+
 		run_command_list(state->cmd, -1, 0);
 		if (!state->interactive)
 			os_exit(state->exit_type);