blob: 401e84e3d51ff345d512b7574fccb1c429f6d006 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Joe Hershberger81321142012-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 Hershberger81321142012-10-12 08:48:51 +00008 */
9
Joe Hershberger60fd3ad2012-12-11 22:16:24 -060010#include <env_callback.h>
Simon Glassfb64e362020-05-10 11:40:09 -060011#include <linux/stringify.h>
Joe Hershberger60fd3ad2012-12-11 22:16:24 -060012
Simon Glass7327fe72021-10-21 21:08:46 -060013#ifndef USE_HOSTCC
14#include <generated/environment.h>
15#endif
16
Joe Hershberger81321142012-10-12 08:48:51 +000017#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
Simon Glass204eb222019-08-01 09:47:03 -060018env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = {
Joe Hershberger81321142012-10-12 08:48:51 +000019 ENV_CRC, /* CRC Sum */
20#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
21 1, /* Flags: valid */
22#endif
23 {
24#elif defined(DEFAULT_ENV_INSTANCE_STATIC)
25static char default_environment[] = {
Pali Rohár3c72b1b2020-12-23 12:21:28 +010026#elif defined(DEFAULT_ENV_IS_RW)
Marek Behún73d25342021-10-22 15:47:24 +020027char default_environment[] = {
Joe Hershberger81321142012-10-12 08:48:51 +000028#else
Marek Behún73d25342021-10-22 15:47:24 +020029const char default_environment[] = {
Joe Hershberger81321142012-10-12 08:48:51 +000030#endif
Rasmus Villemoes14c71142018-03-20 11:38:45 +010031#ifndef CONFIG_USE_DEFAULT_ENV_FILE
Joe Hershberger60fd3ad2012-12-11 22:16:24 -060032#ifdef CONFIG_ENV_CALLBACK_LIST_DEFAULT
33 ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0"
34#endif
Joe Hershberger71497d02012-12-11 22:16:31 -060035#ifdef CONFIG_ENV_FLAGS_LIST_DEFAULT
36 ENV_FLAGS_VAR "=" CONFIG_ENV_FLAGS_LIST_DEFAULT "\0"
37#endif
Sam Protsenkobd7bffe2017-08-14 20:22:17 +030038#ifdef CONFIG_USE_BOOTARGS
Joe Hershberger81321142012-10-12 08:48:51 +000039 "bootargs=" CONFIG_BOOTARGS "\0"
40#endif
41#ifdef CONFIG_BOOTCOMMAND
42 "bootcmd=" CONFIG_BOOTCOMMAND "\0"
43#endif
44#ifdef CONFIG_RAMBOOTCOMMAND
45 "ramboot=" CONFIG_RAMBOOTCOMMAND "\0"
46#endif
47#ifdef CONFIG_NFSBOOTCOMMAND
48 "nfsboot=" CONFIG_NFSBOOTCOMMAND "\0"
49#endif
Alex Kiernan685ead22018-07-05 12:38:15 +000050#if defined(CONFIG_BOOTDELAY)
Joe Hershberger81321142012-10-12 08:48:51 +000051 "bootdelay=" __stringify(CONFIG_BOOTDELAY) "\0"
52#endif
53#if defined(CONFIG_BAUDRATE) && (CONFIG_BAUDRATE >= 0)
54 "baudrate=" __stringify(CONFIG_BAUDRATE) "\0"
55#endif
56#ifdef CONFIG_LOADS_ECHO
57 "loads_echo=" __stringify(CONFIG_LOADS_ECHO) "\0"
58#endif
Joe Hershberger81321142012-10-12 08:48:51 +000059#ifdef CONFIG_ETHPRIME
60 "ethprime=" CONFIG_ETHPRIME "\0"
61#endif
62#ifdef CONFIG_IPADDR
63 "ipaddr=" __stringify(CONFIG_IPADDR) "\0"
64#endif
65#ifdef CONFIG_SERVERIP
66 "serverip=" __stringify(CONFIG_SERVERIP) "\0"
67#endif
68#ifdef CONFIG_SYS_AUTOLOAD
69 "autoload=" CONFIG_SYS_AUTOLOAD "\0"
70#endif
71#ifdef CONFIG_PREBOOT
72 "preboot=" CONFIG_PREBOOT "\0"
73#endif
74#ifdef CONFIG_ROOTPATH
75 "rootpath=" CONFIG_ROOTPATH "\0"
76#endif
77#ifdef CONFIG_GATEWAYIP
78 "gatewayip=" __stringify(CONFIG_GATEWAYIP) "\0"
79#endif
80#ifdef CONFIG_NETMASK
81 "netmask=" __stringify(CONFIG_NETMASK) "\0"
82#endif
83#ifdef CONFIG_HOSTNAME
Mario Six790d8442018-03-28 14:38:20 +020084 "hostname=" CONFIG_HOSTNAME "\0"
Joe Hershberger81321142012-10-12 08:48:51 +000085#endif
86#ifdef CONFIG_BOOTFILE
87 "bootfile=" CONFIG_BOOTFILE "\0"
88#endif
Tom Rini9004ee02021-08-23 10:25:30 -040089#ifdef CONFIG_SYS_LOAD_ADDR
90 "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR)"\0"
Joe Hershberger81321142012-10-12 08:48:51 +000091#endif
Joe Hershberger81321142012-10-12 08:48:51 +000092#if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0)
93 "pcidelay=" __stringify(CONFIG_PCI_BOOTDELAY)"\0"
94#endif
95#ifdef CONFIG_ENV_VARS_UBOOT_CONFIG
96 "arch=" CONFIG_SYS_ARCH "\0"
Masahiro Yamadadcc04732016-06-17 14:24:07 +090097#ifdef CONFIG_SYS_CPU
Joe Hershberger81321142012-10-12 08:48:51 +000098 "cpu=" CONFIG_SYS_CPU "\0"
Masahiro Yamadadcc04732016-06-17 14:24:07 +090099#endif
100#ifdef CONFIG_SYS_BOARD
Joe Hershberger81321142012-10-12 08:48:51 +0000101 "board=" CONFIG_SYS_BOARD "\0"
Stephen Warrenfc523052012-10-31 11:17:28 +0000102 "board_name=" CONFIG_SYS_BOARD "\0"
Masahiro Yamadadcc04732016-06-17 14:24:07 +0900103#endif
Joe Hershberger81321142012-10-12 08:48:51 +0000104#ifdef CONFIG_SYS_VENDOR
105 "vendor=" CONFIG_SYS_VENDOR "\0"
106#endif
107#ifdef CONFIG_SYS_SOC
108 "soc=" CONFIG_SYS_SOC "\0"
109#endif
Rasmus Villemoescf8e5432021-04-21 11:06:54 +0200110#ifdef CONFIG_ENV_IMPORT_FDT
111 "env_fdt_path=" CONFIG_ENV_FDT_PATH "\0"
112#endif
Joe Hershberger81321142012-10-12 08:48:51 +0000113#endif
Alex Kiernancf9888f2018-07-21 20:25:32 +0000114#if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0)
115 "bootlimit=" __stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0"
116#endif
Simon Glass7327fe72021-10-21 21:08:46 -0600117#ifdef CONFIG_EXTRA_ENV_TEXT
118# ifdef CONFIG_EXTRA_ENV_SETTINGS
119# error "Your board uses a text-file environment, so must not define CONFIG_EXTRA_ENV_SETTINGS"
120# endif
121 /* This is created in the Makefile */
122 CONFIG_EXTRA_ENV_TEXT
123#endif
Joe Hershberger81321142012-10-12 08:48:51 +0000124#ifdef CONFIG_EXTRA_ENV_SETTINGS
125 CONFIG_EXTRA_ENV_SETTINGS
126#endif
127 "\0"
Rasmus Villemoes14c71142018-03-20 11:38:45 +0100128#else /* CONFIG_USE_DEFAULT_ENV_FILE */
129#include "generated/defaultenv_autogenerated.h"
130#endif
Joe Hershberger81321142012-10-12 08:48:51 +0000131#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
132 }
133#endif
134};
Marek Behúnadb431e2021-10-22 15:47:25 +0200135
136#if !defined(USE_HOSTCC) && !defined(DEFAULT_ENV_INSTANCE_EMBEDDED)
137#include <env_internal.h>
138static_assert(sizeof(default_environment) <= ENV_SIZE,
139 "Default environment is too large");
140#endif