Blame view
common/main.c
1.34 KB
83d290c56
|
1 |
// SPDX-License-Identifier: GPL-2.0+ |
c609719b8
|
2 3 4 |
/* * (C) Copyright 2000 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
c609719b8
|
5 |
*/ |
a6c7ad2f6
|
6 |
/* #define DEBUG */ |
c609719b8
|
7 |
#include <common.h> |
66ded17df
|
8 |
#include <autoboot.h> |
18d66533a
|
9 |
#include <cli.h> |
288b29e44
|
10 |
#include <command.h> |
24b852a7a
|
11 |
#include <console.h> |
9fb625ce0
|
12 |
#include <env.h> |
6b8d3ceaf
|
13 |
#include <init.h> |
fbcdf32af
|
14 |
#include <version.h> |
bdccc4fed
|
15 |
|
fad634071
|
16 17 18 |
/* * Board-specific Platform code can reimplement show_boot_progress () if needed */ |
3422299dc
|
19 |
__weak void show_boot_progress(int val) {} |
fad634071
|
20 |
|
1364a0e48
|
21 22 |
static void run_preboot_environment_command(void) { |
1364a0e48
|
23 |
char *p; |
00caae6d4
|
24 |
p = env_get("preboot"); |
bc2b4c27d
|
25 |
if (p != NULL) { |
2cb132ad2
|
26 27 28 29 |
int prev = 0; if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED)) prev = disable_ctrlc(1); /* disable Ctrl-C checking */ |
bc2b4c27d
|
30 31 |
run_command_list(p, -1, 0); |
2cb132ad2
|
32 33 |
if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED)) disable_ctrlc(prev); /* restore Ctrl-C checking */ |
bc2b4c27d
|
34 |
} |
1364a0e48
|
35 |
} |
affb21562
|
36 |
/* We come here after U-Boot is initialised and ready to process commands */ |
1364a0e48
|
37 38 |
void main_loop(void) { |
affb21562
|
39 |
const char *s; |
1364a0e48
|
40 |
bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop"); |
2cb132ad2
|
41 42 |
if (IS_ENABLED(CONFIG_VERSION_VARIABLE)) env_set("ver", version_string); /* set version variable */ |
1364a0e48
|
43 |
|
c1bb2cd0b
|
44 |
cli_init(); |
1364a0e48
|
45 |
|
e9f6a3746
|
46 47 |
if (IS_ENABLED(CONFIG_USE_PREBOOT)) run_preboot_environment_command(); |
bc2b4c27d
|
48 |
|
2cb132ad2
|
49 50 |
if (IS_ENABLED(CONFIG_UPDATE_TFTP)) update_tftp(0UL, NULL, NULL); |
bc2b4c27d
|
51 |
|
affb21562
|
52 53 54 55 56 |
s = bootdelay_process(); if (cli_process_fdt(&s)) cli_secure_boot_cmd(s); autoboot_command(s); |
c1bb2cd0b
|
57 |
|
6493ccc7c
|
58 |
cli_loop(); |
045e6f0d4
|
59 |
panic("No CLI available"); |
c609719b8
|
60 |
} |