]> Git Repo - J-u-boot.git/blame - common/main.c
usb: onboard-hub: Fix the return values of regulator APIs
[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
66ded17d 9#include <autoboot.h>
e761035b 10#include <button.h>
52f24238 11#include <bootstage.h>
1047b534 12#include <bootstd.h>
18d66533 13#include <cli.h>
288b29e4 14#include <command.h>
24b852a7 15#include <console.h>
9fb625ce 16#include <env.h>
4023dc9c 17#include <fdtdec.h>
6b8d3cea 18#include <init.h>
90526e9f 19#include <net.h>
bdfb6d70 20#include <version_string.h>
c74cd8bd 21#include <efi_loader.h>
bdccc4fe 22
1364a0e4
SG
23static void run_preboot_environment_command(void)
24{
1364a0e4
SG
25 char *p;
26
00caae6d 27 p = env_get("preboot");
bc2b4c27 28 if (p != NULL) {
2cb132ad
SG
29 int prev = 0;
30
31 if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
32 prev = disable_ctrlc(1); /* disable Ctrl-C checking */
bc2b4c27
SG
33
34 run_command_list(p, -1, 0);
35
2cb132ad
SG
36 if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
37 disable_ctrlc(prev); /* restore Ctrl-C checking */
bc2b4c27 38 }
1364a0e4
SG
39}
40
affb2156 41/* We come here after U-Boot is initialised and ready to process commands */
1364a0e4
SG
42void main_loop(void)
43{
affb2156
SG
44 const char *s;
45
1364a0e4
SG
46 bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
47
2cb132ad
SG
48 if (IS_ENABLED(CONFIG_VERSION_VARIABLE))
49 env_set("ver", version_string); /* set version variable */
1364a0e4 50
c1bb2cd0 51 cli_init();
1364a0e4 52
e9f6a374
SG
53 if (IS_ENABLED(CONFIG_USE_PREBOOT))
54 run_preboot_environment_command();
bc2b4c27 55
2cb132ad
SG
56 if (IS_ENABLED(CONFIG_UPDATE_TFTP))
57 update_tftp(0UL, NULL, NULL);
bc2b4c27 58
a57ad20d
AT
59 if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK_EARLY)) {
60 /* efi_init_early() already called */
61 if (efi_init_obj_list() == EFI_SUCCESS)
62 efi_launch_capsules();
63 }
c74cd8bd 64
e761035b
CC
65 process_button_cmds();
66
affb2156
SG
67 s = bootdelay_process();
68 if (cli_process_fdt(&s))
69 cli_secure_boot_cmd(s);
70
71 autoboot_command(s);
c1bb2cd0 72
1047b534
SG
73 /* if standard boot if enabled, assume that it will be able to boot */
74 if (IS_ENABLED(CONFIG_BOOTSTD_PROG)) {
75 int ret;
76
77 ret = bootstd_prog_boot();
78 printf("Standard boot failed (err=%dE)\n", ret);
79 panic("Failed to boot");
80 }
81
6493ccc7 82 cli_loop();
1047b534 83
045e6f0d 84 panic("No CLI available");
c609719b 85}
This page took 0.619166 seconds and 4 git commands to generate.