blob: 2ca4a087d3b63d4ab1905943967c24de3095cf45 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Joe Hershbergerddd84182012-10-12 08:48:51 +00002/*
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 Hershbergerddd84182012-10-12 08:48:51 +00008 */
9
Joe Hershberger170ab112012-12-11 22:16:24 -060010#include <env_callback.h>
Simon Glass1af3c7f2020-05-10 11:40:09 -060011#include <linux/stringify.h>
Joe Hershberger170ab112012-12-11 22:16:24 -060012
Simon Glass86b9c3e2021-10-21 21:08:46 -060013#include <generated/environment.h>
Simon Glass86b9c3e2021-10-21 21:08:46 -060014
Joe Hershbergerddd84182012-10-12 08:48:51 +000015#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
Simon Glassbe54ec12019-08-01 09:47:03 -060016env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = {
Joe Hershbergerddd84182012-10-12 08:48:51 +000017 ENV_CRC, /* CRC Sum */
18#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
19 1, /* Flags: valid */
20#endif
21 {
22#elif defined(DEFAULT_ENV_INSTANCE_STATIC)
23static char default_environment[] = {
Algapally Santosh Sagar88198922023-09-21 16:50:42 +053024#elif defined(CONFIG_DEFAULT_ENV_IS_RW)
Marek Behúnc5cbbe32021-10-22 15:47:24 +020025char default_environment[] = {
Joe Hershbergerddd84182012-10-12 08:48:51 +000026#else
Marek Behúnc5cbbe32021-10-22 15:47:24 +020027const char default_environment[] = {
Joe Hershbergerddd84182012-10-12 08:48:51 +000028#endif
Rasmus Villemoesf3d8f7d2018-03-20 11:38:45 +010029#ifndef CONFIG_USE_DEFAULT_ENV_FILE
Joe Hershberger170ab112012-12-11 22:16:24 -060030#ifdef CONFIG_ENV_CALLBACK_LIST_DEFAULT
31 ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0"
32#endif
Joe Hershberger25980902012-12-11 22:16:31 -060033#ifdef CONFIG_ENV_FLAGS_LIST_DEFAULT
34 ENV_FLAGS_VAR "=" CONFIG_ENV_FLAGS_LIST_DEFAULT "\0"
35#endif
Sam Protsenko5abc1a42017-08-14 20:22:17 +030036#ifdef CONFIG_USE_BOOTARGS
Joe Hershbergerddd84182012-10-12 08:48:51 +000037 "bootargs=" CONFIG_BOOTARGS "\0"
38#endif
39#ifdef CONFIG_BOOTCOMMAND
40 "bootcmd=" CONFIG_BOOTCOMMAND "\0"
41#endif
Alex Kiernan57aa4d22018-07-05 12:38:15 +000042#if defined(CONFIG_BOOTDELAY)
Joe Hershbergerddd84182012-10-12 08:48:51 +000043 "bootdelay=" __stringify(CONFIG_BOOTDELAY) "\0"
44#endif
Algapally Santosh Sagarbd9ff682023-09-21 16:50:43 +053045#if !defined(CONFIG_OF_SERIAL_BAUD) && defined(CONFIG_BAUDRATE) && (CONFIG_BAUDRATE >= 0)
Joe Hershbergerddd84182012-10-12 08:48:51 +000046 "baudrate=" __stringify(CONFIG_BAUDRATE) "\0"
47#endif
48#ifdef CONFIG_LOADS_ECHO
49 "loads_echo=" __stringify(CONFIG_LOADS_ECHO) "\0"
50#endif
Joe Hershbergerddd84182012-10-12 08:48:51 +000051#ifdef CONFIG_ETHPRIME
52 "ethprime=" CONFIG_ETHPRIME "\0"
53#endif
Tom Rini54f80dd2022-12-02 16:42:27 -050054#ifdef CONFIG_USE_IPADDR
55 "ipaddr=" CONFIG_IPADDR "\0"
Joe Hershbergerddd84182012-10-12 08:48:51 +000056#endif
Tom Rini54f80dd2022-12-02 16:42:27 -050057#ifdef CONFIG_USE_SERVERIP
58 "serverip=" CONFIG_SERVERIP "\0"
Joe Hershbergerddd84182012-10-12 08:48:51 +000059#endif
Tom Rinibf904ea2022-06-13 22:57:35 -040060#ifdef CONFIG_SYS_DISABLE_AUTOLOAD
61 "autoload=0\0"
Joe Hershbergerddd84182012-10-12 08:48:51 +000062#endif
Pali Rohár2827c2f2022-07-10 13:42:55 +020063#ifdef CONFIG_PREBOOT_DEFINED
Joe Hershbergerddd84182012-10-12 08:48:51 +000064 "preboot=" CONFIG_PREBOOT "\0"
65#endif
Tom Rini54f80dd2022-12-02 16:42:27 -050066#ifdef CONFIG_USE_ROOTPATH
Joe Hershbergerddd84182012-10-12 08:48:51 +000067 "rootpath=" CONFIG_ROOTPATH "\0"
68#endif
Tom Rini54f80dd2022-12-02 16:42:27 -050069#ifdef CONFIG_USE_GATEWAYIP
70 "gatewayip=" CONFIG_GATEWAYIP "\0"
Joe Hershbergerddd84182012-10-12 08:48:51 +000071#endif
Tom Rini54f80dd2022-12-02 16:42:27 -050072#ifdef CONFIG_USE_NETMASK
73 "netmask=" CONFIG_NETMASK "\0"
Joe Hershbergerddd84182012-10-12 08:48:51 +000074#endif
Tom Rini54f80dd2022-12-02 16:42:27 -050075#ifdef CONFIG_USE_HOSTNAME
76 "hostname=" CONFIG_HOSTNAME "\0"
Joe Hershbergerddd84182012-10-12 08:48:51 +000077#endif
Tom Rinifdfb17b2022-02-25 11:19:48 -050078#ifdef CONFIG_USE_BOOTFILE
Joe Hershbergerddd84182012-10-12 08:48:51 +000079 "bootfile=" CONFIG_BOOTFILE "\0"
80#endif
Tom Rini72d81362021-08-23 10:25:30 -040081#ifdef CONFIG_SYS_LOAD_ADDR
82 "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR)"\0"
Joe Hershbergerddd84182012-10-12 08:48:51 +000083#endif
Joe Hershbergerddd84182012-10-12 08:48:51 +000084#if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0)
85 "pcidelay=" __stringify(CONFIG_PCI_BOOTDELAY)"\0"
86#endif
87#ifdef CONFIG_ENV_VARS_UBOOT_CONFIG
88 "arch=" CONFIG_SYS_ARCH "\0"
Masahiro Yamada96044742016-06-17 14:24:07 +090089#ifdef CONFIG_SYS_CPU
Joe Hershbergerddd84182012-10-12 08:48:51 +000090 "cpu=" CONFIG_SYS_CPU "\0"
Masahiro Yamada96044742016-06-17 14:24:07 +090091#endif
92#ifdef CONFIG_SYS_BOARD
Joe Hershbergerddd84182012-10-12 08:48:51 +000093 "board=" CONFIG_SYS_BOARD "\0"
Stephen Warren418b7f32012-10-31 11:17:28 +000094 "board_name=" CONFIG_SYS_BOARD "\0"
Masahiro Yamada96044742016-06-17 14:24:07 +090095#endif
Joe Hershbergerddd84182012-10-12 08:48:51 +000096#ifdef CONFIG_SYS_VENDOR
97 "vendor=" CONFIG_SYS_VENDOR "\0"
98#endif
99#ifdef CONFIG_SYS_SOC
100 "soc=" CONFIG_SYS_SOC "\0"
101#endif
Rasmus Villemoes95fd9772021-04-21 11:06:54 +0200102#ifdef CONFIG_ENV_IMPORT_FDT
103 "env_fdt_path=" CONFIG_ENV_FDT_PATH "\0"
104#endif
Joe Hershbergerddd84182012-10-12 08:48:51 +0000105#endif
Alex Kiernanc9ad6bc2018-07-21 20:25:32 +0000106#if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0)
107 "bootlimit=" __stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0"
108#endif
Tom Rinia3310172022-06-13 22:57:36 -0400109#ifdef CONFIG_MTDIDS_DEFAULT
110 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0"
111#endif
112#ifdef CONFIG_MTDPARTS_DEFAULT
113 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0"
114#endif
Simon Glass86b9c3e2021-10-21 21:08:46 -0600115#ifdef CONFIG_EXTRA_ENV_TEXT
Simon Glass86b9c3e2021-10-21 21:08:46 -0600116 /* This is created in the Makefile */
117 CONFIG_EXTRA_ENV_TEXT
118#endif
Tom Rini0613c362022-12-04 10:03:50 -0500119#ifdef CFG_EXTRA_ENV_SETTINGS
120 CFG_EXTRA_ENV_SETTINGS
Joe Hershbergerddd84182012-10-12 08:48:51 +0000121#endif
Algapally Santosh Sagarbd9ff682023-09-21 16:50:43 +0530122#ifdef CONFIG_OF_SERIAL_BAUD
123 /* Padding for baudrate at the end when environment is writable */
124 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
125#endif
Joe Hershbergerddd84182012-10-12 08:48:51 +0000126 "\0"
Rasmus Villemoesf3d8f7d2018-03-20 11:38:45 +0100127#else /* CONFIG_USE_DEFAULT_ENV_FILE */
128#include "generated/defaultenv_autogenerated.h"
129#endif
Joe Hershbergerddd84182012-10-12 08:48:51 +0000130#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
131 }
132#endif
133};
Marek Behún37f37582021-10-22 15:47:25 +0200134
135#if !defined(USE_HOSTCC) && !defined(DEFAULT_ENV_INSTANCE_EMBEDDED)
136#include <env_internal.h>
137static_assert(sizeof(default_environment) <= ENV_SIZE,
138 "Default environment is too large");
139#endif