[U-Boot] [PATCH v5 10/19] cmd: converted with new env interfaces
AKASHI Takahiro
takahiro.akashi at linaro.org
Thu Sep 5 08:21:24 UTC 2019
env_xxx(...) -> env_xxx(ctx_uboot, ...)
Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
---
cmd/ab_select.c | 2 +-
cmd/avb.c | 2 +-
cmd/bdinfo.c | 6 +++---
cmd/binop.c | 4 ++--
cmd/bootefi.c | 8 ++++----
cmd/bootm.c | 4 ++--
cmd/bootmenu.c | 6 +++---
cmd/cbfs.c | 2 +-
cmd/cramfs.c | 8 ++++----
cmd/dtimg.c | 2 +-
cmd/elf.c | 29 ++++++++++++++++-------------
cmd/fdt.c | 22 +++++++++++-----------
cmd/fpga.c | 4 ++--
cmd/gpt.c | 8 ++++----
cmd/ini.c | 6 +++---
cmd/itest.c | 2 +-
cmd/jffs2.c | 4 ++--
cmd/load.c | 10 +++++-----
cmd/lzmadec.c | 2 +-
cmd/md5sum.c | 4 ++--
cmd/mtdparts.c | 41 +++++++++++++++++++++--------------------
cmd/mvebu/bubt.c | 2 +-
cmd/nand.c | 12 ++++++------
cmd/net.c | 46 ++++++++++++++++++++++++----------------------
cmd/part.c | 6 +++---
cmd/pxe.c | 33 ++++++++++++++++++---------------
cmd/qfw.c | 6 +++---
cmd/reiser.c | 8 ++++----
cmd/setexpr.c | 8 ++++----
cmd/spl.c | 5 +++--
cmd/ti/ddr3.c | 2 +-
cmd/tpm-common.c | 2 +-
cmd/tpm-v1.c | 2 +-
cmd/trace.c | 18 +++++++++---------
cmd/ubi.c | 2 +-
cmd/unzip.c | 2 +-
cmd/ximg.c | 4 ++--
cmd/zfs.c | 6 +++---
cmd/zip.c | 2 +-
39 files changed, 176 insertions(+), 166 deletions(-)
diff --git a/cmd/ab_select.c b/cmd/ab_select.c
index 7c8f2ee8eb3a..ff7408d7640e 100644
--- a/cmd/ab_select.c
+++ b/cmd/ab_select.c
@@ -32,7 +32,7 @@ static int do_ab_select(cmd_tbl_t *cmdtp, int flag, int argc,
/* Android standard slot names are 'a', 'b', ... */
slot[0] = BOOT_SLOT_NAME(ret);
slot[1] = '\0';
- env_set(argv[1], slot);
+ env_set(ctx_uboot, argv[1], slot);
printf("ANDROID: Booting slot: %s\n", slot);
return CMD_RET_SUCCESS;
}
diff --git a/cmd/avb.c b/cmd/avb.c
index 5bc158252b30..3cb49edbeca0 100644
--- a/cmd/avb.c
+++ b/cmd/avb.c
@@ -283,7 +283,7 @@ int do_avb_verify_part(cmd_tbl_t *cmdtp, int flag,
else
cmdline = out_data->cmdline;
- env_set(AVB_BOOTARGS, cmdline);
+ env_set(ctx_uboot, AVB_BOOTARGS, cmdline);
res = CMD_RET_SUCCESS;
break;
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index ae6006f85ffa..2a4e5546a29a 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -28,7 +28,7 @@ static void print_eth(int idx)
sprintf(name, "eth%iaddr", idx);
else
strcpy(name, "ethaddr");
- val = env_get(name);
+ val = env_get(ctx_uboot, name);
if (!val)
val = "(not set)";
printf("%-12s= %s\n", name, val);
@@ -51,7 +51,7 @@ static void print_eths(void)
} while (dev);
printf("current eth = %s\n", eth_get_name());
- printf("ip_addr = %s\n", env_get("ipaddr"));
+ printf("ip_addr = %s\n", env_get(ctx_uboot, "ipaddr"));
}
#endif
@@ -141,7 +141,7 @@ static inline void print_eth_ip_addr(void)
#if defined(CONFIG_HAS_ETH5)
print_eth(5);
#endif
- printf("IP addr = %s\n", env_get("ipaddr"));
+ printf("IP addr = %s\n", env_get(ctx_uboot, "ipaddr"));
#endif
}
diff --git a/cmd/binop.c b/cmd/binop.c
index 6d2df5f3dd4f..16dbb3f50649 100644
--- a/cmd/binop.c
+++ b/cmd/binop.c
@@ -28,7 +28,7 @@ void write_to_env_var(char *varname, u8 *result, ulong len)
str_ptr += 2;
}
*str_ptr = '\0';
- env_set(varname, str_output);
+ env_set(ctx_uboot, varname, str_output);
free(str_output);
}
@@ -37,7 +37,7 @@ void read_from_env_var(char *varname, u8 *result)
{
char *str_value;
- str_value = env_get(varname);
+ str_value = env_get(ctx_uboot, varname);
if (str_value)
hex2bin(result, str_value, strlen(str_value) / 2);
else
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index f613cce7e262..f014c234b380 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -36,7 +36,7 @@ static efi_status_t set_load_options(efi_handle_t handle, const char *env_var)
{
struct efi_loaded_image *loaded_image_info;
size_t size;
- const char *env = env_get(env_var);
+ const char *env = env_get(ctx_uboot, env_var);
u16 *pos;
efi_status_t ret;
@@ -234,7 +234,7 @@ static efi_status_t efi_install_fdt(const char *fdt_opt)
if (get_config_table(&efi_guid_fdt))
return EFI_SUCCESS;
/* Use our own device tree as default */
- fdt_opt = env_get("fdtcontroladdr");
+ fdt_opt = env_get(ctx_uboot, "fdtcontroladdr");
if (!fdt_opt) {
printf("ERROR: need device tree\n");
return EFI_NOT_FOUND;
@@ -366,7 +366,7 @@ static int do_bootefi_image(const char *image_opt)
if (!strcmp(image_opt, "hello")) {
char *saddr;
- saddr = env_get("loadaddr");
+ saddr = env_get(ctx_uboot, "loadaddr");
size = __efi_helloworld_end - __efi_helloworld_begin;
if (saddr)
@@ -382,7 +382,7 @@ static int do_bootefi_image(const char *image_opt)
} else
#endif
{
- size_str = env_get("filesize");
+ size_str = env_get(ctx_uboot, "filesize");
if (size_str)
size = simple_strtoul(size_str, NULL, 16);
else
diff --git a/cmd/bootm.c b/cmd/bootm.c
index 8279f2b7cc63..46ee8ddbcb95 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -137,7 +137,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
{
- const char *ep = env_get("autostart");
+ const char *ep = env_get(ctx_uboot, "autostart");
if (ep && !strcmp(ep, "yes")) {
char *local_args[2];
@@ -201,7 +201,7 @@ U_BOOT_CMD(
#if defined(CONFIG_CMD_BOOTD)
int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- return run_command(env_get("bootcmd"), flag);
+ return run_command(env_get(ctx_uboot, "bootcmd"), flag);
}
U_BOOT_CMD(
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index 3dc2c854aca5..cc5368f090f0 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -53,7 +53,7 @@ static char *bootmenu_getoption(unsigned short int n)
return NULL;
sprintf(name, "bootmenu_%d", n);
- return env_get(name);
+ return env_get(ctx_uboot, name);
}
static void bootmenu_print_entry(void *data)
@@ -265,7 +265,7 @@ static struct bootmenu_data *bootmenu_create(int delay)
menu->active = 0;
menu->first = NULL;
- default_str = env_get("bootmenu_default");
+ default_str = env_get(ctx_uboot, "bootmenu_default");
if (default_str)
menu->active = (int)simple_strtol(default_str, NULL, 10);
@@ -494,7 +494,7 @@ int do_bootmenu(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
delay_str = argv[1];
if (!delay_str)
- delay_str = env_get("bootmenu_delay");
+ delay_str = env_get(ctx_uboot, "bootmenu_delay");
if (delay_str)
delay = (int)simple_strtol(delay_str, NULL, 10);
diff --git a/cmd/cbfs.c b/cmd/cbfs.c
index 98e652a4e7bf..9969284ee95f 100644
--- a/cmd/cbfs.c
+++ b/cmd/cbfs.c
@@ -80,7 +80,7 @@ static int do_cbfs_fsload(cmd_tbl_t *cmdtp, int flag, int argc,
printf("\n%ld bytes read\n", size);
- env_set_hex("filesize", size);
+ env_set_hex(ctx_uboot, "filesize", size);
return 0;
}
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index 2188910b2a77..b7cb1d72ee8a 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -105,7 +105,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
struct mtdids id;
ulong addr;
- addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
+ addr = simple_strtoul(env_get(ctx_uboot, "cramfsaddr"), NULL, 16);
/* hack! */
/* cramfs_* only supports NOR flash chips */
@@ -118,7 +118,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
part.offset = (u64)(uintptr_t) map_sysmem(addr - OFFSET_ADJUSTMENT, 0);
/* pre-set Boot file name */
- filename = env_get("bootfile");
+ filename = env_get(ctx_uboot, "bootfile");
if (!filename)
filename = "uImage";
@@ -139,7 +139,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (size > 0) {
printf("### CRAMFS load complete: %d bytes loaded to 0x%lx\n",
size, offset);
- env_set_hex("filesize", size);
+ env_set_hex(ctx_uboot, "filesize", size);
} else {
printf("### CRAMFS LOAD ERROR<%x> for %s!\n", size, filename);
}
@@ -170,7 +170,7 @@ int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
struct mtdids id;
ulong addr;
- addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
+ addr = simple_strtoul(env_get(ctx_uboot, "cramfsaddr"), NULL, 16);
/* hack! */
/* cramfs_* only supports NOR flash chips */
diff --git a/cmd/dtimg.c b/cmd/dtimg.c
index 6c5d53cc6808..7f990368608e 100644
--- a/cmd/dtimg.c
+++ b/cmd/dtimg.c
@@ -82,7 +82,7 @@ static int dtimg_get_fdt(int argc, char * const argv[], enum cmd_dtimg_info cmd)
return CMD_RET_FAILURE;
}
- env_set(argv[3], buf);
+ env_set(ctx_uboot, argv[3], buf);
return CMD_RET_SUCCESS;
}
diff --git a/cmd/elf.c b/cmd/elf.c
index 538562fda581..aa3ca401fa21 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -275,7 +275,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
unsigned long addr; /* Address of the ELF image */
unsigned long rc; /* Return value from user code */
char *sload = NULL;
- const char *ep = env_get("autostart");
+ const char *ep = env_get(ctx_uboot, "autostart");
int rcode = 0;
/* Consume 'bootelf' */
@@ -383,7 +383,8 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* Get VxWorks's physical memory base address from environment,
* if we don't specify it in the environment, use a default one.
*/
- base = env_get_hex("vx_phys_mem_base", VXWORKS_PHYS_MEM_BASE);
+ base = env_get_hex(ctx_uboot, "vx_phys_mem_base",
+ VXWORKS_PHYS_MEM_BASE);
data = (struct e820_entry *)(base + E820_DATA_OFFSET);
info = (struct e820_info *)(base + E820_INFO_OFFSET);
@@ -423,7 +424,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* (LOCAL_MEM_LOCAL_ADRS + BOOT_LINE_OFFSET) as defined by
* VxWorks BSP. For example, on PowerPC it defaults to 0x4200.
*/
- tmp = env_get("bootaddr");
+ tmp = env_get(ctx_uboot, "bootaddr");
if (!tmp) {
#ifdef CONFIG_X86
bootaddr = base + X86_BOOT_LINE_OFFSET;
@@ -440,9 +441,9 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* Check to see if the bootline is defined in the 'bootargs' parameter.
* If it is not defined, we may be able to construct the info.
*/
- bootline = env_get("bootargs");
+ bootline = env_get(ctx_uboot, "bootargs");
if (!bootline) {
- tmp = env_get("bootdev");
+ tmp = env_get(ctx_uboot, "bootdev");
if (tmp) {
strcpy(build_buf, tmp);
ptr = strlen(tmp);
@@ -450,7 +451,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("## VxWorks boot device not specified\n");
}
- tmp = env_get("bootfile");
+ tmp = env_get(ctx_uboot, "bootfile");
if (tmp)
ptr += sprintf(build_buf + ptr, "host:%s ", tmp);
else
@@ -460,12 +461,14 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* The following parameters are only needed if 'bootdev'
* is an ethernet device, otherwise they are optional.
*/
- tmp = env_get("ipaddr");
+ tmp = env_get(ctx_uboot, "ipaddr");
if (tmp) {
ptr += sprintf(build_buf + ptr, "e=%s", tmp);
- tmp = env_get("netmask");
+ tmp = env_get(ctx_uboot, "netmask");
if (tmp) {
- u32 mask = env_get_ip("netmask").s_addr;
+ u32 mask;
+
+ mask = env_get_ip(ctx_uboot, "netmask").s_addr;
ptr += sprintf(build_buf + ptr,
":%08x ", ntohl(mask));
} else {
@@ -473,19 +476,19 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
}
- tmp = env_get("serverip");
+ tmp = env_get(ctx_uboot, "serverip");
if (tmp)
ptr += sprintf(build_buf + ptr, "h=%s ", tmp);
- tmp = env_get("gatewayip");
+ tmp = env_get(ctx_uboot, "gatewayip");
if (tmp)
ptr += sprintf(build_buf + ptr, "g=%s ", tmp);
- tmp = env_get("hostname");
+ tmp = env_get(ctx_uboot, "hostname");
if (tmp)
ptr += sprintf(build_buf + ptr, "tn=%s ", tmp);
- tmp = env_get("othbootargs");
+ tmp = env_get(ctx_uboot, "othbootargs");
if (tmp) {
strcpy(build_buf + ptr, tmp);
ptr += strlen(tmp);
diff --git a/cmd/fdt.c b/cmd/fdt.c
index 25a6ed40d203..6a4dd6d664a0 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -43,7 +43,7 @@ void set_working_fdt_addr(ulong addr)
buf = map_sysmem(addr, 0);
working_fdt = buf;
- env_set_hex("fdtaddr", addr);
+ env_set_hex(ctx_uboot, "fdtaddr", addr);
}
/*
@@ -52,12 +52,12 @@ void set_working_fdt_addr(ulong addr)
static int fdt_value_env_set(const void *nodep, int len, const char *var)
{
if (is_printable_string(nodep, len))
- env_set(var, (void *)nodep);
+ env_set(ctx_uboot, var, (void *)nodep);
else if (len == 4) {
char buf[11];
sprintf(buf, "0x%08X", fdt32_to_cpu(*(fdt32_t *)nodep));
- env_set(var, buf);
+ env_set(ctx_uboot, var, buf);
} else if (len%4 == 0 && len <= 20) {
/* Needed to print things like sha1 hashes. */
char buf[41];
@@ -66,7 +66,7 @@ static int fdt_value_env_set(const void *nodep, int len, const char *var)
for (i = 0; i < len; i += sizeof(unsigned int))
sprintf(buf + (i * 2), "%08x",
*(unsigned int *)(nodep + i));
- env_set(var, buf);
+ env_set(ctx_uboot, var, buf);
} else {
printf("error: unprintable value\n");
return 1;
@@ -101,7 +101,7 @@ static int fdt_get_header_value(int argc, char * const argv[])
continue;
val = fdt32_to_cpu(fdtp[i]);
- env_set_hex(argv[3], val);
+ env_set_hex(ctx_uboot, argv[3], val);
return CMD_RET_SUCCESS;
}
@@ -145,7 +145,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
printf("The address of the fdt is %#08lx\n",
control ? (ulong)map_to_sysmem(blob) :
- env_get_hex("fdtaddr", 0));
+ env_get_hex(ctx_uboot, "fdtaddr", 0));
return 0;
}
@@ -395,7 +395,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
node_name = fdt_get_name(working_fdt,
nextNodeOffset,
NULL);
- env_set(var, node_name);
+ env_set(ctx_uboot, var, node_name);
return 0;
}
nextNodeOffset = fdt_next_node(
@@ -405,7 +405,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
if (subcmd[0] == 's') {
/* get the num nodes at this level */
- env_set_ulong(var, curIndex + 1);
+ env_set_ulong(ctx_uboot, var, curIndex + 1);
} else {
/* node index not found */
printf("libfdt node not found\n");
@@ -416,7 +416,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
working_fdt, nodeoffset, prop, &len);
if (len == 0) {
/* no property value */
- env_set(var, "");
+ env_set(ctx_uboot, var, "");
return 0;
} else if (nodep && len > 0) {
if (subcmd[0] == 'v') {
@@ -431,13 +431,13 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char buf[11];
sprintf(buf, "0x%p", nodep);
- env_set(var, buf);
+ env_set(ctx_uboot, var, buf);
} else if (subcmd[0] == 's') {
/* Get size */
char buf[11];
sprintf(buf, "0x%08X", len);
- env_set(var, buf);
+ env_set(ctx_uboot, var, buf);
} else
return CMD_RET_USAGE;
return 0;
diff --git a/cmd/fpga.c b/cmd/fpga.c
index b1c7b5453b3b..caa86dfdb298 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -18,7 +18,7 @@
static long do_fpga_get_device(char *arg)
{
long dev = FPGA_INVALID_DEVICE;
- char *devstr = env_get("fpga");
+ char *devstr = env_get(ctx_uboot, "fpga");
if (devstr)
/* Should be strtol to handle -1 cases */
@@ -239,7 +239,7 @@ static int do_fpga_loadmk(cmd_tbl_t *cmdtp, int flag, int argc,
ulong fit_addr;
#endif
ulong dev = do_fpga_get_device(argv[0]);
- char *datastr = env_get("fpgadata");
+ char *datastr = env_get(ctx_uboot, "fpgadata");
debug("fpga: argc %x, dev %lx, datastr %s\n", argc, dev, datastr);
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 0c4349f4b249..c8c5a32e87a5 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -55,14 +55,14 @@ static int extract_env(const char *str, char **env)
memset(s + strlen(s) - 1, '\0', 1);
memmove(s, s + 2, strlen(s) - 1);
- e = env_get(s);
+ e = env_get(ctx_uboot, s);
if (e == NULL) {
#ifdef CONFIG_RANDOM_UUID
debug("%s unset. ", str);
gen_rand_uuid_str(uuid_str, UUID_STR_FORMAT_GUID);
- env_set(s, uuid_str);
+ env_set(ctx_uboot, s, uuid_str);
- e = env_get(s);
+ e = env_get(ctx_uboot, s);
if (e) {
debug("Set to random.\n");
ret = 0;
@@ -625,7 +625,7 @@ static int do_disk_guid(struct blk_desc *dev_desc, char * const namestr)
return CMD_RET_FAILURE;
if (namestr)
- env_set(namestr, disk_guid);
+ env_set(ctx_uboot, namestr, disk_guid);
else
printf("%s\n", disk_guid);
diff --git a/cmd/ini.c b/cmd/ini.c
index 0c425262d0e7..4cecaca09560 100644
--- a/cmd/ini.c
+++ b/cmd/ini.c
@@ -218,7 +218,7 @@ static int ini_handler(void *user, char *section, char *name, char *value)
for (i = 0; i < strlen(value); i++)
value[i] = tolower(value[i]);
#endif
- env_set(name, value);
+ env_set(ctx_uboot, name, value);
printf("ini: Imported %s as %s\n", name, value);
}
@@ -237,9 +237,9 @@ static int do_ini(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
section = argv[1];
file_address = (char *)simple_strtoul(
- argc < 3 ? env_get("loadaddr") : argv[2], NULL, 16);
+ argc < 3 ? env_get(ctx_uboot, "loadaddr") : argv[2], NULL, 16);
file_size = (size_t)simple_strtoul(
- argc < 4 ? env_get("filesize") : argv[3], NULL, 16);
+ argc < 4 ? env_get(ctx_uboot, "filesize") : argv[3], NULL, 16);
return ini_parse(file_address, file_size, ini_handler, (void *)section);
}
diff --git a/cmd/itest.c b/cmd/itest.c
index 8b630d71e62d..7ffeea01ba79 100644
--- a/cmd/itest.c
+++ b/cmd/itest.c
@@ -101,7 +101,7 @@ static char * evalstr(char *s)
i++;
}
s[i] = 0;
- return env_get((const char *)&s[2]);
+ return env_get(ctx_uboot, (const char *)&s[2]);
} else {
return s;
}
diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index b47cd3d98930..af9af57d4c12 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -479,7 +479,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ulong offset = load_addr;
/* pre-set Boot file name */
- filename = env_get("bootfile");
+ filename = env_get(ctx_uboot, "bootfile");
if (!filename)
filename = "uImage";
@@ -512,7 +512,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (size > 0) {
printf("### %s load complete: %d bytes loaded to 0x%lx\n",
fsname, size, offset);
- env_set_hex("filesize", size);
+ env_set_hex(ctx_uboot, "filesize", size);
} else {
printf("### %s LOAD ERROR<%x> for %s!\n", fsname, size, filename);
}
diff --git a/cmd/load.c b/cmd/load.c
index 713fe56b5557..7770311d314f 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -50,7 +50,7 @@ static int do_load_serial(cmd_tbl_t *cmdtp, int flag, int argc,
load_baudrate = current_baudrate = gd->baudrate;
#endif
- env_echo = env_get("loads_echo");
+ env_echo = env_get(ctx_uboot, "loads_echo");
if (env_echo && *env_echo == '1')
do_echo = 1;
else
@@ -182,7 +182,7 @@ static ulong load_serial(long offset)
start_addr, end_addr, size, size
);
flush_cache(start_addr, size);
- env_set_hex("filesize", size);
+ env_set_hex(ctx_uboot, "filesize", size);
return (addr);
case SREC_START:
break;
@@ -427,7 +427,7 @@ static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc,
offset = CONFIG_SYS_LOAD_ADDR;
/* pre-set offset from $loadaddr */
- s = env_get("loadaddr");
+ s = env_get(ctx_uboot, "loadaddr");
if (s)
offset = simple_strtoul(s, NULL, 16);
@@ -529,7 +529,7 @@ static ulong load_serial_bin(ulong offset)
flush_cache(offset, size);
printf("## Total Size = 0x%08x = %d Bytes\n", size, size);
- env_set_hex("filesize", size);
+ env_set_hex(ctx_uboot, "filesize", size);
return offset;
}
@@ -1000,7 +1000,7 @@ static ulong load_serial_ymodem(ulong offset, int mode)
flush_cache(offset, ALIGN(size, ARCH_DMA_MINALIGN));
printf("## Total Size = 0x%08x = %d Bytes\n", size, size);
- env_set_hex("filesize", size);
+ env_set_hex(ctx_uboot, "filesize", size);
return offset;
}
diff --git a/cmd/lzmadec.c b/cmd/lzmadec.c
index e3b9cc75ac2b..2c9c2fe52d33 100644
--- a/cmd/lzmadec.c
+++ b/cmd/lzmadec.c
@@ -42,7 +42,7 @@ static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
return 1;
printf("Uncompressed size: %ld = %#lX\n", (ulong)src_len,
(ulong)src_len);
- env_set_hex("filesize", src_len);
+ env_set_hex(ctx_uboot, "filesize", src_len);
return 0;
}
diff --git a/cmd/md5sum.c b/cmd/md5sum.c
index 63cbae0364c1..b1ffb298de55 100644
--- a/cmd/md5sum.c
+++ b/cmd/md5sum.c
@@ -35,7 +35,7 @@ static void store_result(const u8 *sum, const char *dest)
sprintf(str_ptr, "%02x", sum[i]);
str_ptr += 2;
}
- env_set(dest, str_output);
+ env_set(ctx_uboot, dest, str_output);
}
}
@@ -54,7 +54,7 @@ static int parse_verify_sum(char *verify_str, u8 *vsum)
if (strlen(verify_str) == 32)
vsum_str = verify_str;
else {
- vsum_str = env_get(verify_str);
+ vsum_str = env_get(ctx_uboot, verify_str);
if (vsum_str == NULL || strlen(vsum_str) != 32)
return 1;
}
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index 46155cabf66c..9f5f9f09f6f7 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -242,7 +242,8 @@ static void index_partitions(void)
dev = list_entry(dentry, struct mtd_device, link);
if (dev == current_mtd_dev) {
mtddevnum += current_mtd_partnum;
- env_set_ulong("mtddevnum", mtddevnum);
+ env_set_ulong(ctx_uboot, "mtddevnum",
+ mtddevnum);
debug("=> mtddevnum %d,\n", mtddevnum);
break;
}
@@ -251,17 +252,17 @@ static void index_partitions(void)
part = mtd_part_info(current_mtd_dev, current_mtd_partnum);
if (part) {
- env_set("mtddevname", part->name);
+ env_set(ctx_uboot, "mtddevname", part->name);
debug("=> mtddevname %s\n", part->name);
} else {
- env_set("mtddevname", NULL);
+ env_set(ctx_uboot, "mtddevname", NULL);
debug("=> mtddevname NULL\n");
}
} else {
- env_set("mtddevnum", NULL);
- env_set("mtddevname", NULL);
+ env_set(ctx_uboot, "mtddevnum", NULL);
+ env_set(ctx_uboot, "mtddevname", NULL);
debug("=> mtddevnum NULL\n=> mtddevname NULL\n");
}
@@ -280,12 +281,12 @@ static void current_save(void)
sprintf(buf, "%s%d,%d", MTD_DEV_TYPE(current_mtd_dev->id->type),
current_mtd_dev->id->num, current_mtd_partnum);
- env_set("partition", buf);
+ env_set(ctx_uboot, "partition", buf);
strncpy(last_partition, buf, 16);
debug("=> partition %s\n", buf);
} else {
- env_set("partition", NULL);
+ env_set(ctx_uboot, "partition", NULL);
last_partition[0] = '\0';
debug("=> partition NULL\n");
@@ -1214,9 +1215,9 @@ static int generate_mtdparts_save(char *buf, u32 buflen)
ret = generate_mtdparts(buf, buflen);
if ((buf[0] != '\0') && (ret == 0))
- env_set("mtdparts", buf);
+ env_set(ctx_uboot, "mtdparts", buf);
else
- env_set("mtdparts", NULL);
+ env_set(ctx_uboot, "mtdparts", NULL);
return ret;
}
@@ -1537,8 +1538,8 @@ static int spread_partitions(void)
static const char *env_get_mtdparts(char *buf)
{
if (gd->flags & GD_FLG_ENV_READY)
- return env_get("mtdparts");
- if (env_get_f("mtdparts", buf, MTDPARTS_MAXLEN) != -1)
+ return env_get(ctx_uboot, "mtdparts");
+ if (env_get_f(ctx_uboot, "mtdparts", buf, MTDPARTS_MAXLEN) != -1)
return buf;
return NULL;
}
@@ -1742,9 +1743,9 @@ int mtdparts_init(void)
}
/* get variables */
- ids = env_get("mtdids");
+ ids = env_get(ctx_uboot, "mtdids");
parts = env_get_mtdparts(tmp_parts);
- current_partition = env_get("partition");
+ current_partition = env_get(ctx_uboot, "partition");
/* save it for later parsing, cannot rely on current partition pointer
* as 'partition' variable may be updated during init */
@@ -1766,7 +1767,7 @@ int mtdparts_init(void)
if (mtdids_default) {
debug("mtdids variable not defined, using default\n");
ids = mtdids_default;
- env_set("mtdids", (char *)ids);
+ env_set(ctx_uboot, "mtdids", (char *)ids);
} else {
printf("mtdids not defined, no default present\n");
return 1;
@@ -1782,7 +1783,7 @@ int mtdparts_init(void)
if (!parts) {
if (mtdparts_default && use_defaults) {
parts = mtdparts_default;
- if (env_set("mtdparts", (char *)parts) == 0)
+ if (env_set(ctx_uboot, "mtdparts", (char *)parts) == 0)
use_defaults = 0;
} else
printf("mtdparts variable not set, see 'help mtdparts'\n");
@@ -1852,7 +1853,7 @@ int mtdparts_init(void)
current_mtd_partnum = pnum;
current_save();
}
- } else if (env_get("partition") == NULL) {
+ } else if (!env_get(ctx_uboot, "partition")) {
debug("no partition variable set, setting...\n");
current_save();
}
@@ -1958,9 +1959,9 @@ static int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc,
{
if (argc == 2) {
if (strcmp(argv[1], "default") == 0) {
- env_set("mtdids", NULL);
- env_set("mtdparts", NULL);
- env_set("partition", NULL);
+ env_set(ctx_uboot, "mtdids", NULL);
+ env_set(ctx_uboot, "mtdparts", NULL);
+ env_set(ctx_uboot, "partition", NULL);
use_defaults = 1;
mtdparts_init();
@@ -1969,7 +1970,7 @@ static int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc,
/* this may be the first run, initialize lists if needed */
mtdparts_init();
- env_set("mtdparts", NULL);
+ env_set(ctx_uboot, "mtdparts", NULL);
/* mtd_devices_init() calls current_save() */
return mtd_devices_init();
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index 84d2d531f0d4..c7fc3a7ef4e4 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -98,7 +98,7 @@ static ulong get_load_addr(void)
const char *addr_str;
unsigned long addr;
- addr_str = env_get("loadaddr");
+ addr_str = env_get(ctx_uboot, "loadaddr");
if (addr_str)
addr = simple_strtoul(addr_str, NULL, 16);
else
diff --git a/cmd/nand.c b/cmd/nand.c
index 27efef20bc95..ba9c1071f5b5 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -306,9 +306,9 @@ static void nand_print_and_set_info(int idx)
printf(" bbt options 0x%08x\n", chip->bbt_options);
/* Set geometry info */
- env_set_hex("nand_writesize", mtd->writesize);
- env_set_hex("nand_oobsize", mtd->oobsize);
- env_set_hex("nand_erasesize", mtd->erasesize);
+ env_set_hex(ctx_uboot, "nand_writesize", mtd->writesize);
+ env_set_hex(ctx_uboot, "nand_oobsize", mtd->oobsize);
+ env_set_hex(ctx_uboot, "nand_erasesize", mtd->erasesize);
}
static int raw_access(struct mtd_info *mtd, ulong addr, loff_t off,
@@ -384,7 +384,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#else
int quiet = 0;
#endif
- const char *quiet_str = env_get("quiet");
+ const char *quiet_str = env_get(ctx_uboot, "quiet");
int dev = nand_curr_device;
int repeat = flag & CMD_FLAG_REPEAT;
@@ -967,11 +967,11 @@ static int do_nandboot(cmd_tbl_t *cmdtp, int flag, int argc,
switch (argc) {
case 1:
addr = CONFIG_SYS_LOAD_ADDR;
- boot_device = env_get("bootdevice");
+ boot_device = env_get(ctx_uboot, "bootdevice");
break;
case 2:
addr = simple_strtoul(argv[1], NULL, 16);
- boot_device = env_get("bootdevice");
+ boot_device = env_get(ctx_uboot, "bootdevice");
break;
case 3:
addr = simple_strtoul(argv[1], NULL, 16);
diff --git a/cmd/net.c b/cmd/net.c
index 237403977e80..25b347077d7c 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -120,23 +120,23 @@ static void netboot_update_env(void)
if (net_gateway.s_addr) {
ip_to_string(net_gateway, tmp);
- env_set("gatewayip", tmp);
+ env_set(ctx_uboot, "gatewayip", tmp);
}
if (net_netmask.s_addr) {
ip_to_string(net_netmask, tmp);
- env_set("netmask", tmp);
+ env_set(ctx_uboot, "netmask", tmp);
}
if (net_hostname[0])
- env_set("hostname", net_hostname);
+ env_set(ctx_uboot, "hostname", net_hostname);
if (net_root_path[0])
- env_set("rootpath", net_root_path);
+ env_set(ctx_uboot, "rootpath", net_root_path);
if (net_ip.s_addr) {
ip_to_string(net_ip, tmp);
- env_set("ipaddr", tmp);
+ env_set(ctx_uboot, "ipaddr", tmp);
}
#if !defined(CONFIG_BOOTP_SERVERIP)
/*
@@ -145,32 +145,32 @@ static void netboot_update_env(void)
*/
if (net_server_ip.s_addr) {
ip_to_string(net_server_ip, tmp);
- env_set("serverip", tmp);
+ env_set(ctx_uboot, "serverip", tmp);
}
#endif
if (net_dns_server.s_addr) {
ip_to_string(net_dns_server, tmp);
- env_set("dnsip", tmp);
+ env_set(ctx_uboot, "dnsip", tmp);
}
#if defined(CONFIG_BOOTP_DNS2)
if (net_dns_server2.s_addr) {
ip_to_string(net_dns_server2, tmp);
- env_set("dnsip2", tmp);
+ env_set(ctx_uboot, "dnsip2", tmp);
}
#endif
if (net_nis_domain[0])
- env_set("domain", net_nis_domain);
+ env_set(ctx_uboot, "domain", net_nis_domain);
#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
if (net_ntp_time_offset) {
sprintf(tmp, "%d", net_ntp_time_offset);
- env_set("timeoffset", tmp);
+ env_set(ctx_uboot, "timeoffset", tmp);
}
#endif
#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
if (net_ntp_server.s_addr) {
ip_to_string(net_ntp_server, tmp);
- env_set("ntpserverip", tmp);
+ env_set(ctx_uboot, "ntpserverip", tmp);
}
#endif
}
@@ -187,14 +187,15 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
net_boot_file_name_explicit = false;
/* pre-set load_addr */
- s = env_get("loadaddr");
+ s = env_get(ctx_uboot, "loadaddr");
if (s != NULL)
load_addr = simple_strtoul(s, NULL, 16);
switch (argc) {
case 1:
/* refresh bootfile name from env */
- copy_filename(net_boot_file_name, env_get("bootfile"),
+ copy_filename(net_boot_file_name, env_get(ctx_uboot,
+ "bootfile"),
sizeof(net_boot_file_name));
break;
@@ -208,7 +209,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
if (end == (argv[1] + strlen(argv[1]))) {
load_addr = addr;
/* refresh bootfile name from env */
- copy_filename(net_boot_file_name, env_get("bootfile"),
+ copy_filename(net_boot_file_name,
+ env_get(ctx_uboot, "bootfile"),
sizeof(net_boot_file_name));
} else {
net_boot_file_name_explicit = true;
@@ -307,14 +309,14 @@ static void cdp_update_env(void)
printf("CDP offered appliance VLAN %d\n",
ntohs(cdp_appliance_vlan));
vlan_to_string(cdp_appliance_vlan, tmp);
- env_set("vlan", tmp);
+ env_set(ctx_uboot, "vlan", tmp);
net_our_vlan = cdp_appliance_vlan;
}
if (cdp_native_vlan != htons(-1)) {
printf("CDP offered native VLAN %d\n", ntohs(cdp_native_vlan));
vlan_to_string(cdp_native_vlan, tmp);
- env_set("nvlan", tmp);
+ env_set(ctx_uboot, "nvlan", tmp);
net_native_vlan = cdp_native_vlan;
}
}
@@ -347,7 +349,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char *toff;
if (argc < 2) {
- net_ntp_server = env_get_ip("ntpserverip");
+ net_ntp_server = env_get_ip(ctx_uboot, "ntpserverip");
if (net_ntp_server.s_addr == 0) {
printf("ntpserverip not set\n");
return CMD_RET_FAILURE;
@@ -360,7 +362,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
}
- toff = env_get("timeoffset");
+ toff = env_get(ctx_uboot, "timeoffset");
if (toff == NULL)
net_ntp_time_offset = 0;
else
@@ -439,14 +441,14 @@ static int do_link_local(cmd_tbl_t *cmdtp, int flag, int argc,
net_gateway.s_addr = 0;
ip_to_string(net_gateway, tmp);
- env_set("gatewayip", tmp);
+ env_set(ctx_uboot, "gatewayip", tmp);
ip_to_string(net_netmask, tmp);
- env_set("netmask", tmp);
+ env_set(ctx_uboot, "netmask", tmp);
ip_to_string(net_ip, tmp);
- env_set("ipaddr", tmp);
- env_set("llipaddr", tmp); /* store this for next time */
+ env_set(ctx_uboot, "ipaddr", tmp);
+ env_set(ctx_uboot, "llipaddr", tmp); /* store this for next time */
return CMD_RET_SUCCESS;
}
diff --git a/cmd/part.c b/cmd/part.c
index 6cfb67b27959..eb1b782901bf 100644
--- a/cmd/part.c
+++ b/cmd/part.c
@@ -44,7 +44,7 @@ static int do_part_uuid(int argc, char * const argv[])
return 1;
if (argc > 2)
- env_set(argv[2], info.uuid);
+ env_set(ctx_uboot, argv[2], info.uuid);
else
printf("%s\n", info.uuid);
@@ -105,7 +105,7 @@ static int do_part_list(int argc, char * const argv[])
sprintf(t, "%s%x", str[0] ? " " : "", p);
strcat(str, t);
}
- env_set(var, str);
+ env_set(ctx_uboot, var, str);
return 0;
}
@@ -160,7 +160,7 @@ static int do_part_info(int argc, char * const argv[], enum cmd_part_info param)
}
if (argc > 3)
- env_set(argv[3], buf);
+ env_set(ctx_uboot, argv[3], buf);
else
printf("%s\n", buf);
diff --git a/cmd/pxe.c b/cmd/pxe.c
index 205997544623..e26162d01dc8 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -46,7 +46,7 @@ static char *from_env(const char *envvar)
{
char *ret;
- ret = env_get(envvar);
+ ret = env_get(ctx_uboot, envvar);
if (!ret)
printf("missing environment variable: %s\n", envvar);
@@ -601,7 +601,7 @@ static int label_localboot(struct pxe_label *label)
char bootargs[CONFIG_SYS_CBSIZE];
cli_simple_process_macros(label->append, bootargs);
- env_set("bootargs", bootargs);
+ env_set(ctx_uboot, "bootargs", bootargs);
}
debug("running: %s\n", localcmd);
@@ -660,9 +660,10 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
}
bootm_argv[2] = initrd_str;
- strncpy(bootm_argv[2], env_get("ramdisk_addr_r"), 18);
+ strncpy(bootm_argv[2], env_get(ctx_uboot, "ramdisk_addr_r"),
+ 18);
strcat(bootm_argv[2], ":");
- strncat(bootm_argv[2], env_get("filesize"), 9);
+ strncat(bootm_argv[2], env_get(ctx_uboot, "filesize"), 9);
}
if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) {
@@ -673,8 +674,10 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
if (label->ipappend & 0x1) {
sprintf(ip_str, " ip=%s:%s:%s:%s",
- env_get("ipaddr"), env_get("serverip"),
- env_get("gatewayip"), env_get("netmask"));
+ env_get(ctx_uboot, "ipaddr"),
+ env_get(ctx_uboot, "serverip"),
+ env_get(ctx_uboot, "gatewayip"),
+ env_get(ctx_uboot, "netmask"));
}
#ifdef CONFIG_CMD_NET
@@ -706,12 +709,12 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
strcat(bootargs, mac_str);
cli_simple_process_macros(bootargs, finalbootargs);
- env_set("bootargs", finalbootargs);
+ env_set(ctx_uboot, "bootargs", finalbootargs);
printf("append: %s\n", finalbootargs);
}
}
- bootm_argv[1] = env_get("kernel_addr_r");
+ bootm_argv[1] = env_get(ctx_uboot, "kernel_addr_r");
/* for FIT, append the configuration identifier */
if (label->config) {
int len = strlen(bootm_argv[1]) + strlen(label->config) + 1;
@@ -738,7 +741,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
*
* Scenario 3: fdt blob is not available.
*/
- bootm_argv[3] = env_get("fdt_addr_r");
+ bootm_argv[3] = env_get(ctx_uboot, "fdt_addr_r");
/* if fdt label is defined then get fdt from server */
if (bootm_argv[3]) {
@@ -750,7 +753,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
} else if (label->fdtdir) {
char *f1, *f2, *f3, *f4, *slash;
- f1 = env_get("fdtfile");
+ f1 = env_get(ctx_uboot, "fdtfile");
if (f1) {
f2 = "";
f3 = "";
@@ -763,9 +766,9 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
* or the boot scripts should set $fdtfile
* before invoking "pxe" or "sysboot".
*/
- f1 = env_get("soc");
+ f1 = env_get(ctx_uboot, "soc");
f2 = "-";
- f3 = env_get("board");
+ f3 = env_get(ctx_uboot, "board");
f4 = ".dtb";
}
@@ -805,7 +808,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
}
if (!bootm_argv[3])
- bootm_argv[3] = env_get("fdt_addr");
+ bootm_argv[3] = env_get(ctx_uboot, "fdt_addr");
if (bootm_argv[3]) {
if (!bootm_argv[2])
@@ -1746,10 +1749,10 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
if (argc < 6)
- filename = env_get("bootfile");
+ filename = env_get(ctx_uboot, "bootfile");
else {
filename = argv[5];
- env_set("bootfile", filename);
+ env_set(ctx_uboot, "bootfile", filename);
}
if (strstr(argv[3], "ext2"))
diff --git a/cmd/qfw.c b/cmd/qfw.c
index af826627a217..0063590fe496 100644
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -55,7 +55,7 @@ static int qemu_fwcfg_setup_kernel(void *load_addr, void *initrd_addr)
* when invoking qemu), do not update bootargs
*/
if (*data_addr != '\0') {
- if (env_set("bootargs", data_addr) < 0)
+ if (env_set(ctx_uboot, "bootargs", data_addr) < 0)
printf("warning: unable to change bootargs\n");
}
}
@@ -123,7 +123,7 @@ static int qemu_fwcfg_do_load(cmd_tbl_t *cmdtp, int flag,
void *load_addr;
void *initrd_addr;
- env = env_get("loadaddr");
+ env = env_get(ctx_uboot, "loadaddr");
load_addr = env ?
(void *)simple_strtoul(env, NULL, 16) :
#ifdef CONFIG_LOADADDR
@@ -132,7 +132,7 @@ static int qemu_fwcfg_do_load(cmd_tbl_t *cmdtp, int flag,
NULL;
#endif
- env = env_get("ramdiskaddr");
+ env = env_get(ctx_uboot, "ramdiskaddr");
initrd_addr = env ?
(void *)simple_strtoul(env, NULL, 16) :
#ifdef CONFIG_RAMDISK_ADDR
diff --git a/cmd/reiser.c b/cmd/reiser.c
index 7f51b927a475..af2100558982 100644
--- a/cmd/reiser.c
+++ b/cmd/reiser.c
@@ -88,18 +88,18 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
switch (argc) {
case 3:
- addr_str = env_get("loadaddr");
+ addr_str = env_get(ctx_uboot, "loadaddr");
if (addr_str != NULL) {
addr = simple_strtoul (addr_str, NULL, 16);
} else {
addr = CONFIG_SYS_LOAD_ADDR;
}
- filename = env_get("bootfile");
+ filename = env_get(ctx_uboot, "bootfile");
count = 0;
break;
case 4:
addr = simple_strtoul (argv[3], NULL, 16);
- filename = env_get("bootfile");
+ filename = env_get(ctx_uboot, "bootfile");
count = 0;
break;
case 5:
@@ -157,7 +157,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
load_addr = addr;
printf ("\n%ld bytes read\n", filelen);
- env_set_hex("filesize", filelen);
+ env_set_hex(ctx_uboot, "filesize", filelen);
return filelen;
}
diff --git a/cmd/setexpr.c b/cmd/setexpr.c
index 0182f1993846..206de37b6f96 100644
--- a/cmd/setexpr.c
+++ b/cmd/setexpr.c
@@ -145,7 +145,7 @@ static int regex_sub(const char *name,
}
if (t == NULL) {
- value = env_get(name);
+ value = env_get(ctx_uboot, name);
if (value == NULL) {
printf("## Error: variable \"%s\" not defined\n", name);
@@ -286,7 +286,7 @@ static int regex_sub(const char *name,
printf("%s=%s\n", name, data);
- return env_set(name, data);
+ return env_set(ctx_uboot, name, data);
}
#endif
@@ -314,7 +314,7 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* plain assignment: "setexpr name value" */
if (argc == 3) {
- env_set_hex(argv[1], a);
+ env_set_hex(ctx_uboot, argv[1], a);
return 0;
}
@@ -370,7 +370,7 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
}
- env_set_hex(argv[1], value);
+ env_set_hex(ctx_uboot, argv[1], value);
return 0;
}
diff --git a/cmd/spl.c b/cmd/spl.c
index 56051b8a4be9..a2008b3d0f37 100644
--- a/cmd/spl.c
+++ b/cmd/spl.c
@@ -119,8 +119,9 @@ static int spl_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
case SPL_EXPORT_FDT:
printf("Argument image is now in RAM: 0x%p\n",
(void *)images.ft_addr);
- env_set_addr("fdtargsaddr", images.ft_addr);
- env_set_hex("fdtargslen", fdt_totalsize(images.ft_addr));
+ env_set_addr(ctx_uboot, "fdtargsaddr", images.ft_addr);
+ env_set_hex(ctx_uboot, "fdtargslen",
+ fdt_totalsize(images.ft_addr));
#ifdef CONFIG_CMD_SPL_WRITE_SIZE
if (fdt_totalsize(images.ft_addr) >
CONFIG_CMD_SPL_WRITE_SIZE)
diff --git a/cmd/ti/ddr3.c b/cmd/ti/ddr3.c
index b82cbe152dc9..6124e4dc8c53 100644
--- a/cmd/ti/ddr3.c
+++ b/cmd/ti/ddr3.c
@@ -164,7 +164,7 @@ static void ddr_check_ecc_status(void)
int ecc_test = 0;
char *env;
- env = env_get("ecc_test");
+ env = env_get(ctx_uboot, "ecc_test");
if (env)
ecc_test = simple_strtol(env, NULL, 0);
diff --git a/cmd/tpm-common.c b/cmd/tpm-common.c
index 38900fb1590b..1ddf77a6a07b 100644
--- a/cmd/tpm-common.c
+++ b/cmd/tpm-common.c
@@ -224,7 +224,7 @@ int type_string_write_vars(const char *type_str, u8 *data,
default:
return -1;
}
- if (env_set_ulong(*vars, value))
+ if (env_set_ulong(ctx_uboot, *vars, value))
return -1;
}
diff --git a/cmd/tpm-v1.c b/cmd/tpm-v1.c
index 2807331524aa..5cb50c58f8c9 100644
--- a/cmd/tpm-v1.c
+++ b/cmd/tpm-v1.c
@@ -430,7 +430,7 @@ static int do_tpm_load_key_by_sha1(cmd_tbl_t *cmdtp, int flag, int argc, char *
&key_handle);
if (!err) {
printf("Key handle is 0x%x\n", key_handle);
- env_set_hex("key_handle", key_handle);
+ env_set_hex(ctx_uboot, "key_handle", key_handle);
}
return report_return_code(err);
diff --git a/cmd/trace.c b/cmd/trace.c
index 392b12953617..e7b982a370ef 100644
--- a/cmd/trace.c
+++ b/cmd/trace.c
@@ -16,10 +16,10 @@ static int get_args(int argc, char * const argv[], char **buff,
if (argc < 2)
return -1;
if (argc < 4) {
- *buff_size = env_get_ulong("profsize", 16, 0);
- *buff = map_sysmem(env_get_ulong("profbase", 16, 0),
+ *buff_size = env_get_ulong(ctx_uboot, "profsize", 16, 0);
+ *buff = map_sysmem(env_get_ulong(ctx_uboot, "profbase", 16, 0),
*buff_size);
- *buff_ptr = env_get_ulong("profoffset", 16, 0);
+ *buff_ptr = env_get_ulong(ctx_uboot, "profoffset", 16, 0);
} else {
*buff_size = simple_strtoul(argv[3], NULL, 16);
*buff = map_sysmem(simple_strtoul(argv[2], NULL, 16),
@@ -45,9 +45,9 @@ static int create_func_list(int argc, char * const argv[])
used = min(avail, (size_t)needed);
printf("Function trace dumped to %08lx, size %#zx\n",
(ulong)map_to_sysmem(buff + buff_ptr), used);
- env_set_hex("profbase", map_to_sysmem(buff));
- env_set_hex("profsize", buff_size);
- env_set_hex("profoffset", buff_ptr + used);
+ env_set_hex(ctx_uboot, "profbase", map_to_sysmem(buff));
+ env_set_hex(ctx_uboot, "profsize", buff_size);
+ env_set_hex(ctx_uboot, "profoffset", buff_ptr + used);
return 0;
}
@@ -69,9 +69,9 @@ static int create_call_list(int argc, char * const argv[])
printf("Call list dumped to %08lx, size %#zx\n",
(ulong)map_to_sysmem(buff + buff_ptr), used);
- env_set_hex("profbase", map_to_sysmem(buff));
- env_set_hex("profsize", buff_size);
- env_set_hex("profoffset", buff_ptr + used);
+ env_set_hex(ctx_uboot, "profbase", map_to_sysmem(buff));
+ env_set_hex(ctx_uboot, "profsize", buff_size);
+ env_set_hex(ctx_uboot, "profoffset", buff_ptr + used);
return 0;
}
diff --git a/cmd/ubi.c b/cmd/ubi.c
index ca5dc9021b12..28d2c6b93af0 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -387,7 +387,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
} while (size);
if (!size)
- env_set_hex("filesize", len_read);
+ env_set_hex(ctx_uboot, "filesize", len_read);
free(tbuf);
return err;
diff --git a/cmd/unzip.c b/cmd/unzip.c
index afd58e7cdb12..34347f111dc1 100644
--- a/cmd/unzip.c
+++ b/cmd/unzip.c
@@ -30,7 +30,7 @@ static int do_unzip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
printf("Uncompressed size: %lu = 0x%lX\n", src_len, src_len);
- env_set_hex("filesize", src_len);
+ env_set_hex(ctx_uboot, "filesize", src_len);
return 0;
}
diff --git a/cmd/ximg.c b/cmd/ximg.c
index a9481004f036..1726a3978e4d 100644
--- a/cmd/ximg.c
+++ b/cmd/ximg.c
@@ -252,8 +252,8 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
flush_cache(dest, ALIGN(len, ARCH_DMA_MINALIGN));
- env_set_hex("fileaddr", data);
- env_set_hex("filesize", len);
+ env_set_hex(ctx_uboot, "fileaddr", data);
+ env_set_hex(ctx_uboot, "filesize", len);
return 0;
}
diff --git a/cmd/zfs.c b/cmd/zfs.c
index ed5402bb139e..2dc71bb93b44 100644
--- a/cmd/zfs.c
+++ b/cmd/zfs.c
@@ -51,10 +51,10 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
count = 0;
addr = simple_strtoul(argv[3], NULL, 16);
- filename = env_get("bootfile");
+ filename = env_get(ctx_uboot, "bootfile");
switch (argc) {
case 3:
- addr_str = env_get("loadaddr");
+ addr_str = env_get(ctx_uboot, "loadaddr");
if (addr_str != NULL)
addr = simple_strtoul(addr_str, NULL, 16);
else
@@ -115,7 +115,7 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
load_addr = addr;
printf("%llu bytes read\n", zfile.size);
- env_set_hex("filesize", zfile.size);
+ env_set_hex(ctx_uboot, "filesize", zfile.size);
return 0;
}
diff --git a/cmd/zip.c b/cmd/zip.c
index 8ef46e9815f7..73fed730703c 100644
--- a/cmd/zip.c
+++ b/cmd/zip.c
@@ -30,7 +30,7 @@ static int do_zip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
printf("Compressed size: %lu = 0x%lX\n", dst_len, dst_len);
- env_set_hex("filesize", dst_len);
+ env_set_hex(ctx_uboot, "filesize", dst_len);
return 0;
}
--
2.21.0
More information about the U-Boot
mailing list