]>
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 | { | |
bc2b4c27 | 22 | #ifdef CONFIG_PREBOOT |
1364a0e4 SG |
23 | char *p; |
24 | ||
00caae6d | 25 | p = env_get("preboot"); |
bc2b4c27 SG |
26 | if (p != NULL) { |
27 | # ifdef CONFIG_AUTOBOOT_KEYED | |
28 | int prev = disable_ctrlc(1); /* disable Control C checking */ | |
29 | # endif | |
30 | ||
31 | run_command_list(p, -1, 0); | |
32 | ||
33 | # ifdef CONFIG_AUTOBOOT_KEYED | |
34 | disable_ctrlc(prev); /* restore Control C checking */ | |
35 | # endif | |
36 | } | |
37 | #endif /* CONFIG_PREBOOT */ | |
1364a0e4 SG |
38 | } |
39 | ||
affb2156 | 40 | /* We come here after U-Boot is initialised and ready to process commands */ |
1364a0e4 SG |
41 | void main_loop(void) |
42 | { | |
affb2156 SG |
43 | const char *s; |
44 | ||
1364a0e4 SG |
45 | bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop"); |
46 | ||
1364a0e4 | 47 | #ifdef CONFIG_VERSION_VARIABLE |
382bee57 | 48 | env_set("ver", version_string); /* set version variable */ |
1364a0e4 SG |
49 | #endif /* CONFIG_VERSION_VARIABLE */ |
50 | ||
c1bb2cd0 | 51 | cli_init(); |
1364a0e4 SG |
52 | |
53 | run_preboot_environment_command(); | |
bc2b4c27 SG |
54 | |
55 | #if defined(CONFIG_UPDATE_TFTP) | |
c7ff5528 | 56 | update_tftp(0UL, NULL, NULL); |
bc2b4c27 SG |
57 | #endif /* CONFIG_UPDATE_TFTP */ |
58 | ||
affb2156 SG |
59 | s = bootdelay_process(); |
60 | if (cli_process_fdt(&s)) | |
61 | cli_secure_boot_cmd(s); | |
62 | ||
63 | autoboot_command(s); | |
c1bb2cd0 | 64 | |
6493ccc7 | 65 | cli_loop(); |
045e6f0d | 66 | panic("No CLI available"); |
c609719b | 67 | } |