"Das U-Boot" Source Tree
at master 49 lines 1.1 kB view raw
1// SPDX-License-Identifier: GPL-2.0+ 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> 8 */ 9 10#include <command.h> 11#include <env.h> 12#include <env_internal.h> 13#include <asm/global_data.h> 14#include <linux/stddef.h> 15 16DECLARE_GLOBAL_DATA_PTR; 17 18/* 19 * Because we only ever have the default environment available we must mark 20 * it as invalid. 21 */ 22static int env_nowhere_init(void) 23{ 24 gd->env_valid = ENV_INVALID; 25 26 return 0; 27} 28 29static int env_nowhere_load(void) 30{ 31 /* 32 * For SPL, setting env_valid = ENV_INVALID is enough, as env_get() 33 * searches default_environment array in that case. 34 * For U-Boot proper, import the default environment to allow reload. 35 */ 36 if (!IS_ENABLED(CONFIG_XPL_BUILD)) 37 env_set_default(NULL, 0); 38 39 gd->env_valid = ENV_INVALID; 40 41 return 0; 42} 43 44U_BOOT_ENV_LOCATION(nowhere) = { 45 .location = ENVL_NOWHERE, 46 .init = env_nowhere_init, 47 .load = env_nowhere_load, 48 ENV_NAME("nowhere") 49};