]>
Commit | Line | Data |
---|---|---|
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> |
18d66533 | 11 | #include <cli.h> |
24b852a7 | 12 | #include <console.h> |
fbcdf32a | 13 | #include <version.h> |
bdccc4fe | 14 | |
fad63407 HS |
15 | /* |
16 | * Board-specific Platform code can reimplement show_boot_progress () if needed | |
17 | */ | |
3422299d | 18 | __weak void show_boot_progress(int val) {} |
fad63407 | 19 | |
1364a0e4 SG |
20 | static void run_preboot_environment_command(void) |
21 | { | |
1364a0e4 SG |
22 | char *p; |
23 | ||
00caae6d | 24 | p = env_get("preboot"); |
bc2b4c27 | 25 | if (p != NULL) { |
2cb132ad SG |
26 | int prev = 0; |
27 | ||
28 | if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED)) | |
29 | prev = disable_ctrlc(1); /* disable Ctrl-C checking */ | |
bc2b4c27 SG |
30 | |
31 | run_command_list(p, -1, 0); | |
32 | ||
2cb132ad SG |
33 | if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED)) |
34 | disable_ctrlc(prev); /* restore Ctrl-C checking */ | |
bc2b4c27 | 35 | } |
1364a0e4 SG |
36 | } |
37 | ||
affb2156 | 38 | /* We come here after U-Boot is initialised and ready to process commands */ |
1364a0e4 SG |
39 | void main_loop(void) |
40 | { | |
affb2156 SG |
41 | const char *s; |
42 | ||
1364a0e4 SG |
43 | bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop"); |
44 | ||
2cb132ad SG |
45 | if (IS_ENABLED(CONFIG_VERSION_VARIABLE)) |
46 | env_set("ver", version_string); /* set version variable */ | |
1364a0e4 | 47 | |
c1bb2cd0 | 48 | cli_init(); |
1364a0e4 | 49 | |
e9f6a374 SG |
50 | if (IS_ENABLED(CONFIG_USE_PREBOOT)) |
51 | run_preboot_environment_command(); | |
bc2b4c27 | 52 | |
2cb132ad SG |
53 | if (IS_ENABLED(CONFIG_UPDATE_TFTP)) |
54 | update_tftp(0UL, NULL, NULL); | |
bc2b4c27 | 55 | |
affb2156 SG |
56 | s = bootdelay_process(); |
57 | if (cli_process_fdt(&s)) | |
58 | cli_secure_boot_cmd(s); | |
59 | ||
60 | autoboot_command(s); | |
c1bb2cd0 | 61 | |
6493ccc7 | 62 | cli_loop(); |
045e6f0d | 63 | panic("No CLI available"); |
c609719b | 64 | } |