]> Git Repo - J-u-boot.git/blame - common/main.c
Kconfig: j721s2: Change K3_MCU_SCRATCHPAD_BASE to non firewalled region
[J-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>
4023dc9c 16#include <fdtdec.h>
6b8d3cea 17#include <init.h>
90526e9f 18#include <net.h>
bdfb6d70 19#include <version_string.h>
c74cd8bd 20#include <efi_loader.h>
bdccc4fe 21
1364a0e4
SG
22static void run_preboot_environment_command(void)
23{
1364a0e4
SG
24 char *p;
25
00caae6d 26 p = env_get("preboot");
bc2b4c27 27 if (p != NULL) {
2cb132ad
SG
28 int prev = 0;
29
30 if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
31 prev = disable_ctrlc(1); /* disable Ctrl-C checking */
bc2b4c27
SG
32
33 run_command_list(p, -1, 0);
34
2cb132ad
SG
35 if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
36 disable_ctrlc(prev); /* restore Ctrl-C checking */
bc2b4c27 37 }
1364a0e4
SG
38}
39
affb2156 40/* We come here after U-Boot is initialised and ready to process commands */
1364a0e4
SG
41void main_loop(void)
42{
affb2156
SG
43 const char *s;
44
1364a0e4
SG
45 bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
46
2cb132ad
SG
47 if (IS_ENABLED(CONFIG_VERSION_VARIABLE))
48 env_set("ver", version_string); /* set version variable */
1364a0e4 49
c1bb2cd0 50 cli_init();
1364a0e4 51
e9f6a374
SG
52 if (IS_ENABLED(CONFIG_USE_PREBOOT))
53 run_preboot_environment_command();
bc2b4c27 54
2cb132ad
SG
55 if (IS_ENABLED(CONFIG_UPDATE_TFTP))
56 update_tftp(0UL, NULL, NULL);
bc2b4c27 57
a57ad20d
AT
58 if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK_EARLY)) {
59 /* efi_init_early() already called */
60 if (efi_init_obj_list() == EFI_SUCCESS)
61 efi_launch_capsules();
62 }
c74cd8bd 63
affb2156
SG
64 s = bootdelay_process();
65 if (cli_process_fdt(&s))
66 cli_secure_boot_cmd(s);
67
68 autoboot_command(s);
c1bb2cd0 69
6493ccc7 70 cli_loop();
045e6f0d 71 panic("No CLI available");
c609719b 72}
This page took 0.606874 seconds and 4 git commands to generate.