Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2000-2010 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 5 | * |
| 6 | * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 7 | * Andreas Heppel <aheppel@sysgo.de> |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 10 | #include <config.h> |
Joe Hershberger | 60fd3ad | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 11 | #include <env_callback.h> |
Simon Glass | fb64e36 | 2020-05-10 11:40:09 -0600 | [diff] [blame] | 12 | #include <linux/stringify.h> |
Joe Hershberger | 60fd3ad | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 13 | |
Simon Glass | 7327fe7 | 2021-10-21 21:08:46 -0600 | [diff] [blame] | 14 | #include <generated/environment.h> |
Simon Glass | 7327fe7 | 2021-10-21 21:08:46 -0600 | [diff] [blame] | 15 | |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 16 | #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED |
Simon Glass | 204eb22 | 2019-08-01 09:47:03 -0600 | [diff] [blame] | 17 | env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = { |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 18 | ENV_CRC, /* CRC Sum */ |
| 19 | #ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT |
| 20 | 1, /* Flags: valid */ |
| 21 | #endif |
| 22 | { |
| 23 | #elif defined(DEFAULT_ENV_INSTANCE_STATIC) |
| 24 | static char default_environment[] = { |
Algapally Santosh Sagar | 0ed240e | 2023-09-21 16:50:42 +0530 | [diff] [blame] | 25 | #elif defined(CONFIG_DEFAULT_ENV_IS_RW) |
Marek Behún | 73d2534 | 2021-10-22 15:47:24 +0200 | [diff] [blame] | 26 | char default_environment[] = { |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 27 | #else |
Marek Behún | 73d2534 | 2021-10-22 15:47:24 +0200 | [diff] [blame] | 28 | const char default_environment[] = { |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 29 | #endif |
Rasmus Villemoes | 14c7114 | 2018-03-20 11:38:45 +0100 | [diff] [blame] | 30 | #ifndef CONFIG_USE_DEFAULT_ENV_FILE |
Joe Hershberger | 60fd3ad | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 31 | #ifdef CONFIG_ENV_CALLBACK_LIST_DEFAULT |
| 32 | ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0" |
| 33 | #endif |
Joe Hershberger | 71497d0 | 2012-12-11 22:16:31 -0600 | [diff] [blame] | 34 | #ifdef CONFIG_ENV_FLAGS_LIST_DEFAULT |
| 35 | ENV_FLAGS_VAR "=" CONFIG_ENV_FLAGS_LIST_DEFAULT "\0" |
| 36 | #endif |
Sam Protsenko | bd7bffe | 2017-08-14 20:22:17 +0300 | [diff] [blame] | 37 | #ifdef CONFIG_USE_BOOTARGS |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 38 | "bootargs=" CONFIG_BOOTARGS "\0" |
| 39 | #endif |
| 40 | #ifdef CONFIG_BOOTCOMMAND |
| 41 | "bootcmd=" CONFIG_BOOTCOMMAND "\0" |
| 42 | #endif |
Alex Kiernan | 685ead2 | 2018-07-05 12:38:15 +0000 | [diff] [blame] | 43 | #if defined(CONFIG_BOOTDELAY) |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 44 | "bootdelay=" __stringify(CONFIG_BOOTDELAY) "\0" |
| 45 | #endif |
Algapally Santosh Sagar | df17899 | 2023-09-21 16:50:43 +0530 | [diff] [blame] | 46 | #if !defined(CONFIG_OF_SERIAL_BAUD) && defined(CONFIG_BAUDRATE) && (CONFIG_BAUDRATE >= 0) |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 47 | "baudrate=" __stringify(CONFIG_BAUDRATE) "\0" |
| 48 | #endif |
| 49 | #ifdef CONFIG_LOADS_ECHO |
| 50 | "loads_echo=" __stringify(CONFIG_LOADS_ECHO) "\0" |
| 51 | #endif |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 52 | #ifdef CONFIG_ETHPRIME |
| 53 | "ethprime=" CONFIG_ETHPRIME "\0" |
| 54 | #endif |
Tom Rini | 1479a83 | 2022-12-02 16:42:27 -0500 | [diff] [blame] | 55 | #ifdef CONFIG_USE_IPADDR |
| 56 | "ipaddr=" CONFIG_IPADDR "\0" |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 57 | #endif |
Tom Rini | 1479a83 | 2022-12-02 16:42:27 -0500 | [diff] [blame] | 58 | #ifdef CONFIG_USE_SERVERIP |
| 59 | "serverip=" CONFIG_SERVERIP "\0" |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 60 | #endif |
Tom Rini | 065d661 | 2022-06-13 22:57:35 -0400 | [diff] [blame] | 61 | #ifdef CONFIG_SYS_DISABLE_AUTOLOAD |
| 62 | "autoload=0\0" |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 63 | #endif |
Pali Rohár | 39c43c3 | 2022-07-10 13:42:55 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_PREBOOT_DEFINED |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 65 | "preboot=" CONFIG_PREBOOT "\0" |
| 66 | #endif |
Tom Rini | 1479a83 | 2022-12-02 16:42:27 -0500 | [diff] [blame] | 67 | #ifdef CONFIG_USE_ROOTPATH |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 68 | "rootpath=" CONFIG_ROOTPATH "\0" |
| 69 | #endif |
Tom Rini | 1479a83 | 2022-12-02 16:42:27 -0500 | [diff] [blame] | 70 | #ifdef CONFIG_USE_GATEWAYIP |
| 71 | "gatewayip=" CONFIG_GATEWAYIP "\0" |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 72 | #endif |
Tom Rini | 1479a83 | 2022-12-02 16:42:27 -0500 | [diff] [blame] | 73 | #ifdef CONFIG_USE_NETMASK |
| 74 | "netmask=" CONFIG_NETMASK "\0" |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 75 | #endif |
Tom Rini | 1479a83 | 2022-12-02 16:42:27 -0500 | [diff] [blame] | 76 | #ifdef CONFIG_USE_HOSTNAME |
| 77 | "hostname=" CONFIG_HOSTNAME "\0" |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 78 | #endif |
Tom Rini | 5fb860c | 2022-02-25 11:19:48 -0500 | [diff] [blame] | 79 | #ifdef CONFIG_USE_BOOTFILE |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 80 | "bootfile=" CONFIG_BOOTFILE "\0" |
| 81 | #endif |
Tom Rini | 9004ee0 | 2021-08-23 10:25:30 -0400 | [diff] [blame] | 82 | #ifdef CONFIG_SYS_LOAD_ADDR |
| 83 | "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR)"\0" |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 84 | #endif |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 85 | #if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0) |
| 86 | "pcidelay=" __stringify(CONFIG_PCI_BOOTDELAY)"\0" |
| 87 | #endif |
| 88 | #ifdef CONFIG_ENV_VARS_UBOOT_CONFIG |
| 89 | "arch=" CONFIG_SYS_ARCH "\0" |
Masahiro Yamada | dcc0473 | 2016-06-17 14:24:07 +0900 | [diff] [blame] | 90 | #ifdef CONFIG_SYS_CPU |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 91 | "cpu=" CONFIG_SYS_CPU "\0" |
Masahiro Yamada | dcc0473 | 2016-06-17 14:24:07 +0900 | [diff] [blame] | 92 | #endif |
| 93 | #ifdef CONFIG_SYS_BOARD |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 94 | "board=" CONFIG_SYS_BOARD "\0" |
Stephen Warren | fc52305 | 2012-10-31 11:17:28 +0000 | [diff] [blame] | 95 | "board_name=" CONFIG_SYS_BOARD "\0" |
Masahiro Yamada | dcc0473 | 2016-06-17 14:24:07 +0900 | [diff] [blame] | 96 | #endif |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 97 | #ifdef CONFIG_SYS_VENDOR |
| 98 | "vendor=" CONFIG_SYS_VENDOR "\0" |
| 99 | #endif |
| 100 | #ifdef CONFIG_SYS_SOC |
| 101 | "soc=" CONFIG_SYS_SOC "\0" |
| 102 | #endif |
Janne Grunau | 176e8f0 | 2024-04-04 08:25:52 +0200 | [diff] [blame] | 103 | #ifdef CONFIG_USB_HOST |
| 104 | "usb_ignorelist=" |
| 105 | #ifdef CONFIG_USB_KEYBOARD |
| 106 | /* Ignore Yubico devices. Currently only a single USB keyboard device is |
| 107 | * supported and the emulated HID keyboard Yubikeys present is useless |
| 108 | * as keyboard. |
| 109 | */ |
| 110 | "0x1050:*," |
| 111 | #endif |
| 112 | "\0" |
| 113 | #endif |
Rasmus Villemoes | cf8e543 | 2021-04-21 11:06:54 +0200 | [diff] [blame] | 114 | #ifdef CONFIG_ENV_IMPORT_FDT |
| 115 | "env_fdt_path=" CONFIG_ENV_FDT_PATH "\0" |
| 116 | #endif |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 117 | #endif |
Alex Kiernan | cf9888f | 2018-07-21 20:25:32 +0000 | [diff] [blame] | 118 | #if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0) |
| 119 | "bootlimit=" __stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0" |
| 120 | #endif |
Tom Rini | c997d52 | 2022-06-13 22:57:36 -0400 | [diff] [blame] | 121 | #ifdef CONFIG_MTDIDS_DEFAULT |
| 122 | "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" |
| 123 | #endif |
| 124 | #ifdef CONFIG_MTDPARTS_DEFAULT |
| 125 | "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" |
| 126 | #endif |
Simon Glass | 7327fe7 | 2021-10-21 21:08:46 -0600 | [diff] [blame] | 127 | #ifdef CONFIG_EXTRA_ENV_TEXT |
Simon Glass | 7327fe7 | 2021-10-21 21:08:46 -0600 | [diff] [blame] | 128 | /* This is created in the Makefile */ |
| 129 | CONFIG_EXTRA_ENV_TEXT |
| 130 | #endif |
Tom Rini | c9edebe | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 131 | #ifdef CFG_EXTRA_ENV_SETTINGS |
| 132 | CFG_EXTRA_ENV_SETTINGS |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 133 | #endif |
Algapally Santosh Sagar | df17899 | 2023-09-21 16:50:43 +0530 | [diff] [blame] | 134 | #ifdef CONFIG_OF_SERIAL_BAUD |
| 135 | /* Padding for baudrate at the end when environment is writable */ |
| 136 | "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
| 137 | #endif |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 138 | "\0" |
Rasmus Villemoes | 14c7114 | 2018-03-20 11:38:45 +0100 | [diff] [blame] | 139 | #else /* CONFIG_USE_DEFAULT_ENV_FILE */ |
| 140 | #include "generated/defaultenv_autogenerated.h" |
| 141 | #endif |
Joe Hershberger | 8132114 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 142 | #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED |
| 143 | } |
| 144 | #endif |
| 145 | }; |
Marek Behún | adb431e | 2021-10-22 15:47:25 +0200 | [diff] [blame] | 146 | |
| 147 | #if !defined(USE_HOSTCC) && !defined(DEFAULT_ENV_INSTANCE_EMBEDDED) |
| 148 | #include <env_internal.h> |
| 149 | static_assert(sizeof(default_environment) <= ENV_SIZE, |
| 150 | "Default environment is too large"); |
| 151 | #endif |