]> git.ipfire.org Git - thirdparty/u-boot.git/blame - common/main.c
common: Drop net.h from common header
[thirdparty/u-boot.git] / common / main.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
c609719b
WD
2/*
3 * (C) Copyright 2000
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
c609719b
WD
5 */
6
a6c7ad2f
WD
7/* #define DEBUG */
8
c609719b 9#include <common.h>
66ded17d 10#include <autoboot.h>
18d66533 11#include <cli.h>
288b29e4 12#include <command.h>
24b852a7 13#include <console.h>
9fb625ce 14#include <env.h>
6b8d3cea 15#include <init.h>
90526e9f 16#include <net.h>
fbcdf32a 17#include <version.h>
bdccc4fe 18
1364a0e4
SG
19static void run_preboot_environment_command(void)
20{
1364a0e4
SG
21 char *p;
22
00caae6d 23 p = env_get("preboot");
bc2b4c27 24 if (p != NULL) {
2cb132ad
SG
25 int prev = 0;
26
27 if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
28 prev = disable_ctrlc(1); /* disable Ctrl-C checking */
bc2b4c27
SG
29
30 run_command_list(p, -1, 0);
31
2cb132ad
SG
32 if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
33 disable_ctrlc(prev); /* restore Ctrl-C checking */
bc2b4c27 34 }
1364a0e4
SG
35}
36
affb2156 37/* We come here after U-Boot is initialised and ready to process commands */
1364a0e4
SG
38void main_loop(void)
39{
affb2156
SG
40 const char *s;
41
1364a0e4
SG
42 bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
43
2cb132ad
SG
44 if (IS_ENABLED(CONFIG_VERSION_VARIABLE))
45 env_set("ver", version_string); /* set version variable */
1364a0e4 46
c1bb2cd0 47 cli_init();
1364a0e4 48
e9f6a374
SG
49 if (IS_ENABLED(CONFIG_USE_PREBOOT))
50 run_preboot_environment_command();
bc2b4c27 51
2cb132ad
SG
52 if (IS_ENABLED(CONFIG_UPDATE_TFTP))
53 update_tftp(0UL, NULL, NULL);
bc2b4c27 54
affb2156
SG
55 s = bootdelay_process();
56 if (cli_process_fdt(&s))
57 cli_secure_boot_cmd(s);
58
59 autoboot_command(s);
c1bb2cd0 60
6493ccc7 61 cli_loop();
045e6f0d 62 panic("No CLI available");
c609719b 63}