]> Git Repo - u-boot.git/blame - common/main.c
Move command line API into cli.c
[u-boot.git] / common / main.c
CommitLineData
c609719b
WD
1/*
2 * (C) Copyright 2000
3 * Wolfgang Denk, DENX Software Engineering, [email protected].
4 *
1a459660 5 * SPDX-License-Identifier: GPL-2.0+
c609719b
WD
6 */
7
a6c7ad2f
WD
8/* #define DEBUG */
9
c609719b 10#include <common.h>
66ded17d 11#include <autoboot.h>
18d66533 12#include <cli.h>
eca86fad 13#include <cli_hush.h>
fbcdf32a 14#include <malloc.h>
fbcdf32a 15#include <version.h>
bdccc4fe 16
fad63407
HS
17/*
18 * Board-specific Platform code can reimplement show_boot_progress () if needed
19 */
20void inline __show_boot_progress (int val) {}
5e2c08c3 21void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress")));
fad63407 22
c609719b
WD
23#ifdef CONFIG_MODEM_SUPPORT
24int do_mdm_init = 0;
25extern void mdm_init(void); /* defined in board.c */
26#endif
27
bc2b4c27
SG
28void main_loop(void)
29{
bc2b4c27
SG
30#ifdef CONFIG_PREBOOT
31 char *p;
32#endif
33
34 bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
35
0f605c15
SG
36#ifndef CONFIG_SYS_GENERIC_BOARD
37 puts("Warning: Your board does not use generic board. Please read\n");
38 puts("doc/README.generic-board and take action. Boards not\n");
39 puts("upgraded by the late 2014 may break or be removed.\n");
40#endif
41
bc2b4c27
SG
42#ifdef CONFIG_MODEM_SUPPORT
43 debug("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init);
44 if (do_mdm_init) {
45 char *str = strdup(getenv("mdm_cmd"));
46 setenv("preboot", str); /* set or delete definition */
47 if (str != NULL)
48 free(str);
49 mdm_init(); /* wait for modem connection */
50 }
51#endif /* CONFIG_MODEM_SUPPORT */
52
53#ifdef CONFIG_VERSION_VARIABLE
54 {
55 setenv("ver", version_string); /* set version variable */
56 }
57#endif /* CONFIG_VERSION_VARIABLE */
58
59#ifdef CONFIG_SYS_HUSH_PARSER
60 u_boot_hush_start();
61#endif
62
63#if defined(CONFIG_HUSH_INIT_VAR)
64 hush_init_var();
65#endif
66
67#ifdef CONFIG_PREBOOT
68 p = getenv("preboot");
69 if (p != NULL) {
70# ifdef CONFIG_AUTOBOOT_KEYED
71 int prev = disable_ctrlc(1); /* disable Control C checking */
72# endif
73
74 run_command_list(p, -1, 0);
75
76# ifdef CONFIG_AUTOBOOT_KEYED
77 disable_ctrlc(prev); /* restore Control C checking */
78# endif
79 }
80#endif /* CONFIG_PREBOOT */
81
82#if defined(CONFIG_UPDATE_TFTP)
83 update_tftp(0UL);
84#endif /* CONFIG_UPDATE_TFTP */
85
66ded17d 86 bootdelay_process();
c609719b
WD
87 /*
88 * Main Loop for Monitor Command Processing
89 */
6d0f6bcf 90#ifdef CONFIG_SYS_HUSH_PARSER
c609719b
WD
91 parse_file_outer();
92 /* This point is never reached */
93 for (;;);
94#else
6493ccc7 95 cli_loop();
6d0f6bcf 96#endif /*CONFIG_SYS_HUSH_PARSER*/
c609719b 97}
This page took 0.207441 seconds and 4 git commands to generate.