]> Git Repo - u-boot.git/blame - common/main.c
bootm: Update fixup_silent_linux() to return an error
[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, [email protected].
c609719b
WD
5 */
6
a6c7ad2f
WD
7/* #define DEBUG */
8
c609719b 9#include <common.h>
66ded17d 10#include <autoboot.h>
52f24238 11#include <bootstage.h>
18d66533 12#include <cli.h>
288b29e4 13#include <command.h>
24b852a7 14#include <console.h>
9fb625ce 15#include <env.h>
6b8d3cea 16#include <init.h>
90526e9f 17#include <net.h>
fbcdf32a 18#include <version.h>
c74cd8bd 19#include <efi_loader.h>
bdccc4fe 20
1364a0e4
SG
21static void run_preboot_environment_command(void)
22{
1364a0e4
SG
23 char *p;
24
00caae6d 25 p = env_get("preboot");
bc2b4c27 26 if (p != NULL) {
2cb132ad
SG
27 int prev = 0;
28
29 if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
30 prev = disable_ctrlc(1); /* disable Ctrl-C checking */
bc2b4c27
SG
31
32 run_command_list(p, -1, 0);
33
2cb132ad
SG
34 if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
35 disable_ctrlc(prev); /* restore Ctrl-C checking */
bc2b4c27 36 }
1364a0e4
SG
37}
38
affb2156 39/* We come here after U-Boot is initialised and ready to process commands */
1364a0e4
SG
40void main_loop(void)
41{
affb2156
SG
42 const char *s;
43
1364a0e4
SG
44 bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
45
2cb132ad
SG
46 if (IS_ENABLED(CONFIG_VERSION_VARIABLE))
47 env_set("ver", version_string); /* set version variable */
1364a0e4 48
c1bb2cd0 49 cli_init();
1364a0e4 50
e9f6a374
SG
51 if (IS_ENABLED(CONFIG_USE_PREBOOT))
52 run_preboot_environment_command();
bc2b4c27 53
2cb132ad
SG
54 if (IS_ENABLED(CONFIG_UPDATE_TFTP))
55 update_tftp(0UL, NULL, NULL);
bc2b4c27 56
c74cd8bd
AT
57 if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK_EARLY))
58 efi_launch_capsules();
59
affb2156
SG
60 s = bootdelay_process();
61 if (cli_process_fdt(&s))
62 cli_secure_boot_cmd(s);
63
64 autoboot_command(s);
c1bb2cd0 65
6493ccc7 66 cli_loop();
045e6f0d 67 panic("No CLI available");
c609719b 68}
This page took 0.321624 seconds and 4 git commands to generate.