Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Joe Hershberger | ddd8418 | 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 | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
Joe Hershberger | 170ab11 | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 10 | #include <env_callback.h> |
Simon Glass | 1af3c7f | 2020-05-10 11:40:09 -0600 | [diff] [blame] | 11 | #include <linux/stringify.h> |
Joe Hershberger | 170ab11 | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 12 | |
Simon Glass | 86b9c3e | 2021-10-21 21:08:46 -0600 | [diff] [blame] | 13 | #ifndef USE_HOSTCC |
| 14 | #include <generated/environment.h> |
| 15 | #endif |
| 16 | |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 17 | #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED |
Simon Glass | be54ec1 | 2019-08-01 09:47:03 -0600 | [diff] [blame] | 18 | env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = { |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 19 | ENV_CRC, /* CRC Sum */ |
| 20 | #ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT |
| 21 | 1, /* Flags: valid */ |
| 22 | #endif |
| 23 | { |
| 24 | #elif defined(DEFAULT_ENV_INSTANCE_STATIC) |
| 25 | static char default_environment[] = { |
Pali Rohár | 93f4048 | 2020-12-23 12:21:28 +0100 | [diff] [blame] | 26 | #elif defined(DEFAULT_ENV_IS_RW) |
Marek Behún | c5cbbe3 | 2021-10-22 15:47:24 +0200 | [diff] [blame] | 27 | char default_environment[] = { |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 28 | #else |
Marek Behún | c5cbbe3 | 2021-10-22 15:47:24 +0200 | [diff] [blame] | 29 | const char default_environment[] = { |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 30 | #endif |
Rasmus Villemoes | f3d8f7d | 2018-03-20 11:38:45 +0100 | [diff] [blame] | 31 | #ifndef CONFIG_USE_DEFAULT_ENV_FILE |
Joe Hershberger | 170ab11 | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 32 | #ifdef CONFIG_ENV_CALLBACK_LIST_DEFAULT |
| 33 | ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0" |
| 34 | #endif |
Joe Hershberger | 2598090 | 2012-12-11 22:16:31 -0600 | [diff] [blame] | 35 | #ifdef CONFIG_ENV_FLAGS_LIST_DEFAULT |
| 36 | ENV_FLAGS_VAR "=" CONFIG_ENV_FLAGS_LIST_DEFAULT "\0" |
| 37 | #endif |
Sam Protsenko | 5abc1a4 | 2017-08-14 20:22:17 +0300 | [diff] [blame] | 38 | #ifdef CONFIG_USE_BOOTARGS |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 39 | "bootargs=" CONFIG_BOOTARGS "\0" |
| 40 | #endif |
| 41 | #ifdef CONFIG_BOOTCOMMAND |
| 42 | "bootcmd=" CONFIG_BOOTCOMMAND "\0" |
| 43 | #endif |
Alex Kiernan | 57aa4d2 | 2018-07-05 12:38:15 +0000 | [diff] [blame] | 44 | #if defined(CONFIG_BOOTDELAY) |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 45 | "bootdelay=" __stringify(CONFIG_BOOTDELAY) "\0" |
| 46 | #endif |
| 47 | #if defined(CONFIG_BAUDRATE) && (CONFIG_BAUDRATE >= 0) |
| 48 | "baudrate=" __stringify(CONFIG_BAUDRATE) "\0" |
| 49 | #endif |
| 50 | #ifdef CONFIG_LOADS_ECHO |
| 51 | "loads_echo=" __stringify(CONFIG_LOADS_ECHO) "\0" |
| 52 | #endif |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 53 | #ifdef CONFIG_ETHPRIME |
| 54 | "ethprime=" CONFIG_ETHPRIME "\0" |
| 55 | #endif |
| 56 | #ifdef CONFIG_IPADDR |
| 57 | "ipaddr=" __stringify(CONFIG_IPADDR) "\0" |
| 58 | #endif |
| 59 | #ifdef CONFIG_SERVERIP |
| 60 | "serverip=" __stringify(CONFIG_SERVERIP) "\0" |
| 61 | #endif |
Tom Rini | bf904ea | 2022-06-13 22:57:35 -0400 | [diff] [blame] | 62 | #ifdef CONFIG_SYS_DISABLE_AUTOLOAD |
| 63 | "autoload=0\0" |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 64 | #endif |
| 65 | #ifdef CONFIG_PREBOOT |
| 66 | "preboot=" CONFIG_PREBOOT "\0" |
| 67 | #endif |
| 68 | #ifdef CONFIG_ROOTPATH |
| 69 | "rootpath=" CONFIG_ROOTPATH "\0" |
| 70 | #endif |
| 71 | #ifdef CONFIG_GATEWAYIP |
| 72 | "gatewayip=" __stringify(CONFIG_GATEWAYIP) "\0" |
| 73 | #endif |
| 74 | #ifdef CONFIG_NETMASK |
| 75 | "netmask=" __stringify(CONFIG_NETMASK) "\0" |
| 76 | #endif |
| 77 | #ifdef CONFIG_HOSTNAME |
Mario Six | 5bc0543 | 2018-03-28 14:38:20 +0200 | [diff] [blame] | 78 | "hostname=" CONFIG_HOSTNAME "\0" |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 79 | #endif |
Tom Rini | fdfb17b | 2022-02-25 11:19:48 -0500 | [diff] [blame] | 80 | #ifdef CONFIG_USE_BOOTFILE |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 81 | "bootfile=" CONFIG_BOOTFILE "\0" |
| 82 | #endif |
Tom Rini | 72d8136 | 2021-08-23 10:25:30 -0400 | [diff] [blame] | 83 | #ifdef CONFIG_SYS_LOAD_ADDR |
| 84 | "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR)"\0" |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 85 | #endif |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 86 | #if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0) |
| 87 | "pcidelay=" __stringify(CONFIG_PCI_BOOTDELAY)"\0" |
| 88 | #endif |
| 89 | #ifdef CONFIG_ENV_VARS_UBOOT_CONFIG |
| 90 | "arch=" CONFIG_SYS_ARCH "\0" |
Masahiro Yamada | 9604474 | 2016-06-17 14:24:07 +0900 | [diff] [blame] | 91 | #ifdef CONFIG_SYS_CPU |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 92 | "cpu=" CONFIG_SYS_CPU "\0" |
Masahiro Yamada | 9604474 | 2016-06-17 14:24:07 +0900 | [diff] [blame] | 93 | #endif |
| 94 | #ifdef CONFIG_SYS_BOARD |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 95 | "board=" CONFIG_SYS_BOARD "\0" |
Stephen Warren | 418b7f3 | 2012-10-31 11:17:28 +0000 | [diff] [blame] | 96 | "board_name=" CONFIG_SYS_BOARD "\0" |
Masahiro Yamada | 9604474 | 2016-06-17 14:24:07 +0900 | [diff] [blame] | 97 | #endif |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 98 | #ifdef CONFIG_SYS_VENDOR |
| 99 | "vendor=" CONFIG_SYS_VENDOR "\0" |
| 100 | #endif |
| 101 | #ifdef CONFIG_SYS_SOC |
| 102 | "soc=" CONFIG_SYS_SOC "\0" |
| 103 | #endif |
Rasmus Villemoes | 95fd977 | 2021-04-21 11:06:54 +0200 | [diff] [blame] | 104 | #ifdef CONFIG_ENV_IMPORT_FDT |
| 105 | "env_fdt_path=" CONFIG_ENV_FDT_PATH "\0" |
| 106 | #endif |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 107 | #endif |
Alex Kiernan | c9ad6bc | 2018-07-21 20:25:32 +0000 | [diff] [blame] | 108 | #if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0) |
| 109 | "bootlimit=" __stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0" |
| 110 | #endif |
Tom Rini | a331017 | 2022-06-13 22:57:36 -0400 | [diff] [blame] | 111 | #ifdef CONFIG_MTDIDS_DEFAULT |
| 112 | "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" |
| 113 | #endif |
| 114 | #ifdef CONFIG_MTDPARTS_DEFAULT |
| 115 | "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" |
| 116 | #endif |
Simon Glass | 86b9c3e | 2021-10-21 21:08:46 -0600 | [diff] [blame] | 117 | #ifdef CONFIG_EXTRA_ENV_TEXT |
Simon Glass | 86b9c3e | 2021-10-21 21:08:46 -0600 | [diff] [blame] | 118 | /* This is created in the Makefile */ |
| 119 | CONFIG_EXTRA_ENV_TEXT |
| 120 | #endif |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 121 | #ifdef CONFIG_EXTRA_ENV_SETTINGS |
| 122 | CONFIG_EXTRA_ENV_SETTINGS |
| 123 | #endif |
| 124 | "\0" |
Rasmus Villemoes | f3d8f7d | 2018-03-20 11:38:45 +0100 | [diff] [blame] | 125 | #else /* CONFIG_USE_DEFAULT_ENV_FILE */ |
| 126 | #include "generated/defaultenv_autogenerated.h" |
| 127 | #endif |
Joe Hershberger | ddd8418 | 2012-10-12 08:48:51 +0000 | [diff] [blame] | 128 | #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED |
| 129 | } |
| 130 | #endif |
| 131 | }; |
Marek Behún | 37f3758 | 2021-10-22 15:47:25 +0200 | [diff] [blame] | 132 | |
| 133 | #if !defined(USE_HOSTCC) && !defined(DEFAULT_ENV_INSTANCE_EMBEDDED) |
| 134 | #include <env_internal.h> |
| 135 | static_assert(sizeof(default_environment) <= ENV_SIZE, |
| 136 | "Default environment is too large"); |
| 137 | #endif |