X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fenv_common.c;h=c0bfc2f5db3b3efebb7c039747b54abc186c1acc;hb=9c2c8a3129ff357b0bd052e1bc248c4c3368c49c;hp=bb18070c54af55dd847a1b239ac98ffb2f76dabf;hpb=2598090b7e17f8bdca95b22e7f27217054730e02;p=u-boot diff --git a/common/env_common.c b/common/env_common.c index bb18070c54..c0bfc2f5db 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -5,23 +5,7 @@ * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH * Andreas Heppel * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -95,6 +79,24 @@ int getenv_yesno(const char *var) 1 : 0; } +/* + * Look up the variable from the default environment + */ +char *getenv_default(const char *name) +{ + char *ret_val; + unsigned long really_valid = gd->env_valid; + unsigned long real_gd_flags = gd->flags; + + /* Pretend that the image is bad. */ + gd->flags &= ~GD_FLG_ENV_READY; + gd->env_valid = 0; + ret_val = getenv(name); + gd->env_valid = really_valid; + gd->flags = real_gd_flags; + return ret_val; +} + void set_default_env(const char *s) { int flags = 0; @@ -138,7 +140,6 @@ int set_default_vars(int nvars, char * const vars[]) H_NOCLEAR | H_INTERACTIVE, nvars, vars); } -#ifndef CONFIG_SPL_BUILD /* * Check if CRC is valid and (if yes) import the environment. * Note that "buf" may or may not be aligned. @@ -170,7 +171,6 @@ int env_import(const char *buf, int check) return 0; } -#endif void env_relocate(void) {