blob: 21afd7f7dcff90ce02f9bbbf26fc559090177a06 [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#ifndef USE_HOSTCC
14#include <generated/environment.h>
15#endif
16
Joe Hershbergerddd84182012-10-12 08:48:51 +000017#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
Simon Glassbe54ec12019-08-01 09:47:03 -060018env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = {
Joe Hershbergerddd84182012-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ár93f40482020-12-23 12:21:28 +010026#elif defined(DEFAULT_ENV_IS_RW)
Marek Behúnc5cbbe32021-10-22 15:47:24 +020027char default_environment[] = {
Joe Hershbergerddd84182012-10-12 08:48:51 +000028#else
Marek Behúnc5cbbe32021-10-22 15:47:24 +020029const char default_environment[] = {
Joe Hershbergerddd84182012-10-12 08:48:51 +000030#endif
Rasmus Villemoesf3d8f7d2018-03-20 11:38:45 +010031#ifndef CONFIG_USE_DEFAULT_ENV_FILE
Joe Hershberger170ab112012-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 Hershberger25980902012-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 Protsenko5abc1a42017-08-14 20:22:17 +030038#ifdef CONFIG_USE_BOOTARGS
Joe Hershbergerddd84182012-10-12 08:48:51 +000039 "bootargs=" CONFIG_BOOTARGS "\0"
40#endif
41#ifdef CONFIG_BOOTCOMMAND
42 "bootcmd=" CONFIG_BOOTCOMMAND "\0"
43#endif
Alex Kiernan57aa4d22018-07-05 12:38:15 +000044#if defined(CONFIG_BOOTDELAY)
Joe Hershbergerddd84182012-10-12 08:48:51 +000045 "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 Hershbergerddd84182012-10-12 08:48:51 +000053#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
62#ifdef CONFIG_SYS_AUTOLOAD
63 "autoload=" CONFIG_SYS_AUTOLOAD "\0"
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 Six5bc05432018-03-28 14:38:20 +020078 "hostname=" CONFIG_HOSTNAME "\0"
Joe Hershbergerddd84182012-10-12 08:48:51 +000079#endif
80#ifdef CONFIG_BOOTFILE
81 "bootfile=" CONFIG_BOOTFILE "\0"
82#endif
Tom Rini72d81362021-08-23 10:25:30 -040083#ifdef CONFIG_SYS_LOAD_ADDR
84 "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR)"\0"
Joe Hershbergerddd84182012-10-12 08:48:51 +000085#endif
Joe Hershbergerddd84182012-10-12 08:48:51 +000086#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 Yamada96044742016-06-17 14:24:07 +090091#ifdef CONFIG_SYS_CPU
Joe Hershbergerddd84182012-10-12 08:48:51 +000092 "cpu=" CONFIG_SYS_CPU "\0"
Masahiro Yamada96044742016-06-17 14:24:07 +090093#endif
94#ifdef CONFIG_SYS_BOARD
Joe Hershbergerddd84182012-10-12 08:48:51 +000095 "board=" CONFIG_SYS_BOARD "\0"
Stephen Warren418b7f32012-10-31 11:17:28 +000096 "board_name=" CONFIG_SYS_BOARD "\0"
Masahiro Yamada96044742016-06-17 14:24:07 +090097#endif
Joe Hershbergerddd84182012-10-12 08:48:51 +000098#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 Villemoes95fd9772021-04-21 11:06:54 +0200104#ifdef CONFIG_ENV_IMPORT_FDT
105 "env_fdt_path=" CONFIG_ENV_FDT_PATH "\0"
106#endif
Joe Hershbergerddd84182012-10-12 08:48:51 +0000107#endif
Alex Kiernanc9ad6bc2018-07-21 20:25:32 +0000108#if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0)
109 "bootlimit=" __stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0"
110#endif
Simon Glass86b9c3e2021-10-21 21:08:46 -0600111#ifdef CONFIG_EXTRA_ENV_TEXT
112# ifdef CONFIG_EXTRA_ENV_SETTINGS
113# error "Your board uses a text-file environment, so must not define CONFIG_EXTRA_ENV_SETTINGS"
114# endif
115 /* This is created in the Makefile */
116 CONFIG_EXTRA_ENV_TEXT
117#endif
Joe Hershbergerddd84182012-10-12 08:48:51 +0000118#ifdef CONFIG_EXTRA_ENV_SETTINGS
119 CONFIG_EXTRA_ENV_SETTINGS
120#endif
121 "\0"
Rasmus Villemoesf3d8f7d2018-03-20 11:38:45 +0100122#else /* CONFIG_USE_DEFAULT_ENV_FILE */
123#include "generated/defaultenv_autogenerated.h"
124#endif
Joe Hershbergerddd84182012-10-12 08:48:51 +0000125#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
126 }
127#endif
128};
Marek Behún37f37582021-10-22 15:47:25 +0200129
130#if !defined(USE_HOSTCC) && !defined(DEFAULT_ENV_INSTANCE_EMBEDDED)
131#include <env_internal.h>
132static_assert(sizeof(default_environment) <= ENV_SIZE,
133 "Default environment is too large");
134#endif