]> Git Repo - J-u-boot.git/blob - common/main.c
common: Drop net.h from common header
[J-u-boot.git] / common / main.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2000
4  * Wolfgang Denk, DENX Software Engineering, [email protected].
5  */
6
7 /* #define      DEBUG   */
8
9 #include <common.h>
10 #include <autoboot.h>
11 #include <cli.h>
12 #include <command.h>
13 #include <console.h>
14 #include <env.h>
15 #include <init.h>
16 #include <net.h>
17 #include <version.h>
18
19 static void run_preboot_environment_command(void)
20 {
21         char *p;
22
23         p = env_get("preboot");
24         if (p != NULL) {
25                 int prev = 0;
26
27                 if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
28                         prev = disable_ctrlc(1); /* disable Ctrl-C checking */
29
30                 run_command_list(p, -1, 0);
31
32                 if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
33                         disable_ctrlc(prev);    /* restore Ctrl-C checking */
34         }
35 }
36
37 /* We come here after U-Boot is initialised and ready to process commands */
38 void main_loop(void)
39 {
40         const char *s;
41
42         bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
43
44         if (IS_ENABLED(CONFIG_VERSION_VARIABLE))
45                 env_set("ver", version_string);  /* set version variable */
46
47         cli_init();
48
49         if (IS_ENABLED(CONFIG_USE_PREBOOT))
50                 run_preboot_environment_command();
51
52         if (IS_ENABLED(CONFIG_UPDATE_TFTP))
53                 update_tftp(0UL, NULL, NULL);
54
55         s = bootdelay_process();
56         if (cli_process_fdt(&s))
57                 cli_secure_boot_cmd(s);
58
59         autoboot_command(s);
60
61         cli_loop();
62         panic("No CLI available");
63 }
This page took 0.029536 seconds and 4 git commands to generate.