blob: aa3dd40f3fa5e8c89625a97e39be7cf918e93a80 [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
Tom Rinidec7ea02024-05-20 13:35:03 -060010#include <config.h>
Joe Hershberger60fd3ad2012-12-11 22:16:24 -060011#include <env_callback.h>
Simon Glassfb64e362020-05-10 11:40:09 -060012#include <linux/stringify.h>
Joe Hershberger60fd3ad2012-12-11 22:16:24 -060013
Simon Glass7327fe72021-10-21 21:08:46 -060014#include <generated/environment.h>
Simon Glass7327fe72021-10-21 21:08:46 -060015
Joe Hershberger81321142012-10-12 08:48:51 +000016#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
Simon Glass204eb222019-08-01 09:47:03 -060017env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = {
Joe Hershberger81321142012-10-12 08:48:51 +000018 ENV_CRC, /* CRC Sum */
19#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
20 1, /* Flags: valid */
21#endif
22 {
23#elif defined(DEFAULT_ENV_INSTANCE_STATIC)
24static char default_environment[] = {
Algapally Santosh Sagar0ed240e2023-09-21 16:50:42 +053025#elif defined(CONFIG_DEFAULT_ENV_IS_RW)
Marek Behún73d25342021-10-22 15:47:24 +020026char default_environment[] = {
Joe Hershberger81321142012-10-12 08:48:51 +000027#else
Marek Behún73d25342021-10-22 15:47:24 +020028const char default_environment[] = {
Joe Hershberger81321142012-10-12 08:48:51 +000029#endif
Rasmus Villemoes14c71142018-03-20 11:38:45 +010030#ifndef CONFIG_USE_DEFAULT_ENV_FILE
Joe Hershberger60fd3ad2012-12-11 22:16:24 -060031#ifdef CONFIG_ENV_CALLBACK_LIST_DEFAULT
32 ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0"
33#endif
Joe Hershberger71497d02012-12-11 22:16:31 -060034#ifdef CONFIG_ENV_FLAGS_LIST_DEFAULT
35 ENV_FLAGS_VAR "=" CONFIG_ENV_FLAGS_LIST_DEFAULT "\0"
36#endif
Sam Protsenkobd7bffe2017-08-14 20:22:17 +030037#ifdef CONFIG_USE_BOOTARGS
Joe Hershberger81321142012-10-12 08:48:51 +000038 "bootargs=" CONFIG_BOOTARGS "\0"
39#endif
40#ifdef CONFIG_BOOTCOMMAND
41 "bootcmd=" CONFIG_BOOTCOMMAND "\0"
42#endif
Alex Kiernan685ead22018-07-05 12:38:15 +000043#if defined(CONFIG_BOOTDELAY)
Joe Hershberger81321142012-10-12 08:48:51 +000044 "bootdelay=" __stringify(CONFIG_BOOTDELAY) "\0"
45#endif
Algapally Santosh Sagardf178992023-09-21 16:50:43 +053046#if !defined(CONFIG_OF_SERIAL_BAUD) && defined(CONFIG_BAUDRATE) && (CONFIG_BAUDRATE >= 0)
Joe Hershberger81321142012-10-12 08:48:51 +000047 "baudrate=" __stringify(CONFIG_BAUDRATE) "\0"
48#endif
49#ifdef CONFIG_LOADS_ECHO
50 "loads_echo=" __stringify(CONFIG_LOADS_ECHO) "\0"
51#endif
Joe Hershberger81321142012-10-12 08:48:51 +000052#ifdef CONFIG_ETHPRIME
53 "ethprime=" CONFIG_ETHPRIME "\0"
54#endif
Tom Rini1479a832022-12-02 16:42:27 -050055#ifdef CONFIG_USE_IPADDR
56 "ipaddr=" CONFIG_IPADDR "\0"
Joe Hershberger81321142012-10-12 08:48:51 +000057#endif
Tom Rini1479a832022-12-02 16:42:27 -050058#ifdef CONFIG_USE_SERVERIP
59 "serverip=" CONFIG_SERVERIP "\0"
Joe Hershberger81321142012-10-12 08:48:51 +000060#endif
Tom Rini065d6612022-06-13 22:57:35 -040061#ifdef CONFIG_SYS_DISABLE_AUTOLOAD
62 "autoload=0\0"
Joe Hershberger81321142012-10-12 08:48:51 +000063#endif
Pali Rohár39c43c32022-07-10 13:42:55 +020064#ifdef CONFIG_PREBOOT_DEFINED
Joe Hershberger81321142012-10-12 08:48:51 +000065 "preboot=" CONFIG_PREBOOT "\0"
66#endif
Tom Rini1479a832022-12-02 16:42:27 -050067#ifdef CONFIG_USE_ROOTPATH
Joe Hershberger81321142012-10-12 08:48:51 +000068 "rootpath=" CONFIG_ROOTPATH "\0"
69#endif
Tom Rini1479a832022-12-02 16:42:27 -050070#ifdef CONFIG_USE_GATEWAYIP
71 "gatewayip=" CONFIG_GATEWAYIP "\0"
Joe Hershberger81321142012-10-12 08:48:51 +000072#endif
Tom Rini1479a832022-12-02 16:42:27 -050073#ifdef CONFIG_USE_NETMASK
74 "netmask=" CONFIG_NETMASK "\0"
Joe Hershberger81321142012-10-12 08:48:51 +000075#endif
Tom Rini1479a832022-12-02 16:42:27 -050076#ifdef CONFIG_USE_HOSTNAME
77 "hostname=" CONFIG_HOSTNAME "\0"
Joe Hershberger81321142012-10-12 08:48:51 +000078#endif
Tom Rini5fb860c2022-02-25 11:19:48 -050079#ifdef CONFIG_USE_BOOTFILE
Joe Hershberger81321142012-10-12 08:48:51 +000080 "bootfile=" CONFIG_BOOTFILE "\0"
81#endif
Tom Rini9004ee02021-08-23 10:25:30 -040082#ifdef CONFIG_SYS_LOAD_ADDR
83 "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR)"\0"
Joe Hershberger81321142012-10-12 08:48:51 +000084#endif
Joe Hershberger81321142012-10-12 08:48:51 +000085#ifdef CONFIG_ENV_VARS_UBOOT_CONFIG
86 "arch=" CONFIG_SYS_ARCH "\0"
Masahiro Yamadadcc04732016-06-17 14:24:07 +090087#ifdef CONFIG_SYS_CPU
Joe Hershberger81321142012-10-12 08:48:51 +000088 "cpu=" CONFIG_SYS_CPU "\0"
Masahiro Yamadadcc04732016-06-17 14:24:07 +090089#endif
90#ifdef CONFIG_SYS_BOARD
Joe Hershberger81321142012-10-12 08:48:51 +000091 "board=" CONFIG_SYS_BOARD "\0"
Stephen Warrenfc523052012-10-31 11:17:28 +000092 "board_name=" CONFIG_SYS_BOARD "\0"
Masahiro Yamadadcc04732016-06-17 14:24:07 +090093#endif
Joe Hershberger81321142012-10-12 08:48:51 +000094#ifdef CONFIG_SYS_VENDOR
95 "vendor=" CONFIG_SYS_VENDOR "\0"
96#endif
97#ifdef CONFIG_SYS_SOC
98 "soc=" CONFIG_SYS_SOC "\0"
99#endif
Janne Grunau176e8f02024-04-04 08:25:52 +0200100#ifdef CONFIG_USB_HOST
101 "usb_ignorelist="
102#ifdef CONFIG_USB_KEYBOARD
103 /* Ignore Yubico devices. Currently only a single USB keyboard device is
104 * supported and the emulated HID keyboard Yubikeys present is useless
105 * as keyboard.
106 */
107 "0x1050:*,"
108#endif
109 "\0"
110#endif
Rasmus Villemoescf8e5432021-04-21 11:06:54 +0200111#ifdef CONFIG_ENV_IMPORT_FDT
112 "env_fdt_path=" CONFIG_ENV_FDT_PATH "\0"
113#endif
Joe Hershberger81321142012-10-12 08:48:51 +0000114#endif
Alex Kiernancf9888f2018-07-21 20:25:32 +0000115#if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0)
116 "bootlimit=" __stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0"
117#endif
Tom Rinic997d522022-06-13 22:57:36 -0400118#ifdef CONFIG_MTDIDS_DEFAULT
119 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0"
120#endif
121#ifdef CONFIG_MTDPARTS_DEFAULT
122 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0"
123#endif
Simon Glass7327fe72021-10-21 21:08:46 -0600124#ifdef CONFIG_EXTRA_ENV_TEXT
Simon Glass7327fe72021-10-21 21:08:46 -0600125 /* This is created in the Makefile */
126 CONFIG_EXTRA_ENV_TEXT
127#endif
Tom Rinic9edebe2022-12-04 10:03:50 -0500128#ifdef CFG_EXTRA_ENV_SETTINGS
129 CFG_EXTRA_ENV_SETTINGS
Joe Hershberger81321142012-10-12 08:48:51 +0000130#endif
Algapally Santosh Sagardf178992023-09-21 16:50:43 +0530131#ifdef CONFIG_OF_SERIAL_BAUD
132 /* Padding for baudrate at the end when environment is writable */
133 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
134#endif
Joe Hershberger81321142012-10-12 08:48:51 +0000135 "\0"
Rasmus Villemoes14c71142018-03-20 11:38:45 +0100136#else /* CONFIG_USE_DEFAULT_ENV_FILE */
137#include "generated/defaultenv_autogenerated.h"
138#endif
Joe Hershberger81321142012-10-12 08:48:51 +0000139#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
140 }
141#endif
142};
Marek Behúnadb431e2021-10-22 15:47:25 +0200143
144#if !defined(USE_HOSTCC) && !defined(DEFAULT_ENV_INSTANCE_EMBEDDED)
145#include <env_internal.h>
146static_assert(sizeof(default_environment) <= ENV_SIZE,
147 "Default environment is too large");
148#endif