blob: dd263b6666318b60db83de3de767e0ec8f0501fa [file] [log] [blame]
wdenka68d3ed2002-10-11 08:38:32 +00001/*
2 * (C) Copyright 2000-2002
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
6 * Andreas Heppel <aheppel@sysgo.de>
7
8 * See file CREDITS for list of people who contributed to this
9 * project.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 * MA 02111-1307 USA
25 */
26
27/**************************************************************************
28 *
29 * Support for persistent environment data
30 *
31 * The "environment" is stored as a list of '\0' terminated
32 * "name=value" strings. The end of the list is marked by a double
33 * '\0'. New entries are always added at the end. Deleting an entry
34 * shifts the remaining entries to the front. Replacing an entry is a
35 * combination of deleting the old value and adding the new one.
36 *
37 * The environment is preceeded by a 32 bit CRC over the data part.
38 *
39 **************************************************************************
40 */
41
42#include <common.h>
43#include <command.h>
44#include <environment.h>
wdenk2a3cb022002-11-05 21:01:48 +000045#include <watchdog.h>
wdenk281e00a2004-08-01 22:48:16 +000046#include <serial.h>
wdenka68d3ed2002-10-11 08:38:32 +000047#include <linux/stddef.h>
48#include <asm/byteorder.h>
Jon Loeligerc76fe472007-07-08 18:02:23 -050049#if defined(CONFIG_CMD_NET)
wdenka68d3ed2002-10-11 08:38:32 +000050#include <net.h>
51#endif
52
Wolfgang Denkd87080b2006-03-31 18:32:53 +020053DECLARE_GLOBAL_DATA_PTR;
54
wdenk5779d8d2003-12-06 23:55:10 +000055#if !defined(CFG_ENV_IS_IN_NVRAM) && \
56 !defined(CFG_ENV_IS_IN_EEPROM) && \
57 !defined(CFG_ENV_IS_IN_FLASH) && \
58 !defined(CFG_ENV_IS_IN_DATAFLASH) && \
wdenk13a56952004-06-09 14:58:14 +000059 !defined(CFG_ENV_IS_IN_NAND) && \
Kyungmin Parkd7e8ce12007-09-10 17:15:14 +090060 !defined(CFG_ENV_IS_IN_ONENAND) && \
wdenk5779d8d2003-12-06 23:55:10 +000061 !defined(CFG_ENV_IS_NOWHERE)
Kyungmin Parkd7e8ce12007-09-10 17:15:14 +090062# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|ONENAND|NOWHERE}
wdenka68d3ed2002-10-11 08:38:32 +000063#endif
64
65#define XMK_STR(x) #x
66#define MK_STR(x) XMK_STR(x)
67
68/************************************************************************
69************************************************************************/
70
71/* Function that returns a character from the environment */
72extern uchar (*env_get_char)(int);
73
74/* Function that returns a pointer to a value from the environment */
75/* (Only memory version supported / needed). */
76extern uchar *env_get_addr(int);
77
78/* Function that updates CRC of the enironment */
79extern void env_crc_update (void);
80
81/************************************************************************
82************************************************************************/
83
wdenka68d3ed2002-10-11 08:38:32 +000084/*
85 * Table with supported baudrates (defined in config_xyz.h)
86 */
87static const unsigned long baudrate_table[] = CFG_BAUDRATE_TABLE;
88#define N_BAUDRATES (sizeof(baudrate_table) / sizeof(baudrate_table[0]))
89
90
91/************************************************************************
92 * Command interface: print one or all environment variables
93 */
94
95int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
96{
97 int i, j, k, nxt;
98 int rcode = 0;
99
100 if (argc == 1) { /* Print all env variables */
101 for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
102 for (nxt=i; env_get_char(nxt) != '\0'; ++nxt)
103 ;
104 for (k=i; k<nxt; ++k)
105 putc(env_get_char(k));
106 putc ('\n');
107
108 if (ctrlc()) {
109 puts ("\n ** Abort\n");
110 return 1;
111 }
112 }
113
114 printf("\nEnvironment size: %d/%d bytes\n", i, ENV_SIZE);
115
116 return 0;
117 }
118
119 for (i=1; i<argc; ++i) { /* print single env variables */
120 char *name = argv[i];
121
122 k = -1;
123
124 for (j=0; env_get_char(j) != '\0'; j=nxt+1) {
125
126 for (nxt=j; env_get_char(nxt) != '\0'; ++nxt)
127 ;
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200128 k = envmatch((uchar *)name, j);
wdenka68d3ed2002-10-11 08:38:32 +0000129 if (k < 0) {
130 continue;
131 }
132 puts (name);
133 putc ('=');
134 while (k < nxt)
135 putc(env_get_char(k++));
136 putc ('\n');
137 break;
138 }
139 if (k < 0) {
140 printf ("## Error: \"%s\" not defined\n", name);
141 rcode ++;
142 }
143 }
144 return rcode;
145}
146
147/************************************************************************
148 * Set a new environment variable,
149 * or replace or delete an existing one.
150 *
151 * This function will ONLY work with a in-RAM copy of the environment
152 */
153
154int _do_setenv (int flag, int argc, char *argv[])
155{
wdenka68d3ed2002-10-11 08:38:32 +0000156 int i, len, oldval;
157 int console = -1;
158 uchar *env, *nxt = NULL;
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200159 char *name;
wdenka68d3ed2002-10-11 08:38:32 +0000160 bd_t *bd = gd->bd;
161
162 uchar *env_data = env_get_addr(0);
163
164 if (!env_data) /* need copy in RAM */
165 return 1;
166
167 name = argv[1];
168
Wolfgang Denk471a7be2006-10-28 01:14:32 +0200169 if (strchr(name, '=')) {
170 printf ("## Error: illegal character '=' in variable name \"%s\"\n", name);
171 return 1;
172 }
173
wdenka68d3ed2002-10-11 08:38:32 +0000174 /*
175 * search if variable with this name already exists
176 */
177 oldval = -1;
178 for (env=env_data; *env; env=nxt+1) {
179 for (nxt=env; *nxt; ++nxt)
180 ;
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200181 if ((oldval = envmatch((uchar *)name, env-env_data)) >= 0)
wdenka68d3ed2002-10-11 08:38:32 +0000182 break;
183 }
184
185 /*
186 * Delete any existing definition
187 */
188 if (oldval >= 0) {
189#ifndef CONFIG_ENV_OVERWRITE
190
191 /*
stroese05875972003-04-04 15:44:49 +0000192 * Ethernet Address and serial# can be set only once,
193 * ver is readonly.
wdenka68d3ed2002-10-11 08:38:32 +0000194 */
Sergey Kubushync74b2102007-08-10 20:26:18 +0200195#ifdef CONFIG_HAS_UID
196 /* Allow serial# forced overwrite with 0xdeaf4add flag */
197 if ( ((strcmp (name, "serial#") == 0) && (flag != 0xdeaf4add)) ||
198#else
wdenka68d3ed2002-10-11 08:38:32 +0000199 if ( (strcmp (name, "serial#") == 0) ||
Sergey Kubushync74b2102007-08-10 20:26:18 +0200200#endif
wdenka68d3ed2002-10-11 08:38:32 +0000201 ((strcmp (name, "ethaddr") == 0)
202#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR)
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200203 && (strcmp ((char *)env_get_addr(oldval),MK_STR(CONFIG_ETHADDR)) != 0)
wdenka68d3ed2002-10-11 08:38:32 +0000204#endif /* CONFIG_OVERWRITE_ETHADDR_ONCE && CONFIG_ETHADDR */
205 ) ) {
206 printf ("Can't overwrite \"%s\"\n", name);
207 return 1;
208 }
209#endif
210
211 /* Check for console redirection */
212 if (strcmp(name,"stdin") == 0) {
213 console = stdin;
214 } else if (strcmp(name,"stdout") == 0) {
215 console = stdout;
216 } else if (strcmp(name,"stderr") == 0) {
217 console = stderr;
218 }
219
220 if (console != -1) {
221 if (argc < 3) { /* Cannot delete it! */
222 printf("Can't delete \"%s\"\n", name);
223 return 1;
224 }
225
226 /* Try assigning specified device */
227 if (console_assign (console, argv[2]) < 0)
228 return 1;
wdenk281e00a2004-08-01 22:48:16 +0000229
230#ifdef CONFIG_SERIAL_MULTI
231 if (serial_assign (argv[2]) < 0)
232 return 1;
233#endif
wdenka68d3ed2002-10-11 08:38:32 +0000234 }
235
236 /*
237 * Switch to new baudrate if new baudrate is supported
238 */
239 if (strcmp(argv[1],"baudrate") == 0) {
240 int baudrate = simple_strtoul(argv[2], NULL, 10);
241 int i;
242 for (i=0; i<N_BAUDRATES; ++i) {
243 if (baudrate == baudrate_table[i])
244 break;
245 }
246 if (i == N_BAUDRATES) {
247 printf ("## Baudrate %d bps not supported\n",
248 baudrate);
249 return 1;
250 }
251 printf ("## Switch baudrate to %d bps and press ENTER ...\n",
252 baudrate);
253 udelay(50000);
254 gd->baudrate = baudrate;
Bartlomiej Siekac84bad02006-12-20 00:29:43 +0100255#if defined(CONFIG_PPC) || defined(CONFIG_MCF52x2)
wdenkd0fb80c2003-01-11 09:48:40 +0000256 gd->bd->bi_baudrate = baudrate;
257#endif
258
wdenka68d3ed2002-10-11 08:38:32 +0000259 serial_setbrg ();
260 udelay(50000);
261 for (;;) {
262 if (getc() == '\r')
263 break;
264 }
265 }
266
267 if (*++nxt == '\0') {
268 if (env > env_data) {
269 env--;
270 } else {
271 *env = '\0';
272 }
273 } else {
274 for (;;) {
275 *env = *nxt++;
276 if ((*env == '\0') && (*nxt == '\0'))
277 break;
278 ++env;
279 }
280 }
281 *++env = '\0';
282 }
283
284#ifdef CONFIG_NET_MULTI
285 if (strncmp(name, "eth", 3) == 0) {
286 char *end;
287 int num = simple_strtoul(name+3, &end, 10);
288
289 if (strcmp(end, "addr") == 0) {
290 eth_set_enetaddr(num, argv[2]);
291 }
292 }
293#endif
294
295
296 /* Delete only ? */
297 if ((argc < 3) || argv[2] == NULL) {
298 env_crc_update ();
299 return 0;
300 }
301
302 /*
303 * Append new definition at the end
304 */
305 for (env=env_data; *env || *(env+1); ++env)
306 ;
307 if (env > env_data)
308 ++env;
309 /*
310 * Overflow when:
311 * "name" + "=" + "val" +"\0\0" > ENV_SIZE - (env-env_data)
312 */
313 len = strlen(name) + 2;
314 /* add '=' for first arg, ' ' for all others */
315 for (i=2; i<argc; ++i) {
316 len += strlen(argv[i]) + 1;
317 }
318 if (len > (&env_data[ENV_SIZE]-env)) {
319 printf ("## Error: environment overflow, \"%s\" deleted\n", name);
320 return 1;
321 }
322 while ((*env = *name++) != '\0')
323 env++;
324 for (i=2; i<argc; ++i) {
325 char *val = argv[i];
326
327 *env = (i==2) ? '=' : ' ';
328 while ((*++env = *val++) != '\0')
329 ;
330 }
331
332 /* end is marked with double '\0' */
333 *++env = '\0';
334
335 /* Update CRC */
336 env_crc_update ();
337
338 /*
339 * Some variables should be updated when the corresponding
340 * entry in the enviornment is changed
341 */
342
343 if (strcmp(argv[1],"ethaddr") == 0) {
344 char *s = argv[2]; /* always use only one arg */
345 char *e;
346 for (i=0; i<6; ++i) {
347 bd->bi_enetaddr[i] = s ? simple_strtoul(s, &e, 16) : 0;
348 if (s) s = (*e) ? e+1 : e;
349 }
350#ifdef CONFIG_NET_MULTI
351 eth_set_enetaddr(0, argv[2]);
352#endif
353 return 0;
354 }
355
356 if (strcmp(argv[1],"ipaddr") == 0) {
357 char *s = argv[2]; /* always use only one arg */
358 char *e;
359 unsigned long addr;
360 bd->bi_ip_addr = 0;
361 for (addr=0, i=0; i<4; ++i) {
362 ulong val = s ? simple_strtoul(s, &e, 10) : 0;
363 addr <<= 8;
364 addr |= (val & 0xFF);
365 if (s) s = (*e) ? e+1 : e;
366 }
367 bd->bi_ip_addr = htonl(addr);
368 return 0;
369 }
370 if (strcmp(argv[1],"loadaddr") == 0) {
371 load_addr = simple_strtoul(argv[2], NULL, 16);
372 return 0;
373 }
Jon Loeligerc76fe472007-07-08 18:02:23 -0500374#if defined(CONFIG_CMD_NET)
wdenka68d3ed2002-10-11 08:38:32 +0000375 if (strcmp(argv[1],"bootfile") == 0) {
376 copy_filename (BootFile, argv[2], sizeof(BootFile));
377 return 0;
378 }
Jon Loeliger90253172007-07-10 11:02:44 -0500379#endif
wdenkc7de8292002-11-19 11:04:11 +0000380
stroese05875972003-04-04 15:44:49 +0000381#ifdef CONFIG_AMIGAONEG3SE
wdenkc7de8292002-11-19 11:04:11 +0000382 if (strcmp(argv[1], "vga_fg_color") == 0 ||
383 strcmp(argv[1], "vga_bg_color") == 0 ) {
384 extern void video_set_color(unsigned char attr);
385 extern unsigned char video_get_attr(void);
386
387 video_set_color(video_get_attr());
388 return 0;
389 }
390#endif /* CONFIG_AMIGAONEG3SE */
391
wdenka68d3ed2002-10-11 08:38:32 +0000392 return 0;
393}
394
395void setenv (char *varname, char *varvalue)
396{
397 char *argv[4] = { "setenv", varname, varvalue, NULL };
Jeffrey Mann9ffd4512007-04-23 14:00:11 +0200398 if (varvalue == NULL)
399 _do_setenv (0, 2, argv);
400 else
401 _do_setenv (0, 3, argv);
wdenka68d3ed2002-10-11 08:38:32 +0000402}
403
Sergey Kubushync74b2102007-08-10 20:26:18 +0200404#ifdef CONFIG_HAS_UID
405void forceenv (char *varname, char *varvalue)
406{
407 char *argv[4] = { "forceenv", varname, varvalue, NULL };
408 _do_setenv (0xdeaf4add, 3, argv);
409}
410#endif
411
412int do_setenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
wdenka68d3ed2002-10-11 08:38:32 +0000413{
414 if (argc < 2) {
415 printf ("Usage:\n%s\n", cmdtp->usage);
416 return 1;
417 }
418
419 return _do_setenv (flag, argc, argv);
420}
421
422/************************************************************************
423 * Prompt for environment variable
424 */
425
Jon Loeligerc76fe472007-07-08 18:02:23 -0500426#if defined(CONFIG_CMD_ASKENV)
wdenka68d3ed2002-10-11 08:38:32 +0000427int do_askenv ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
428{
429 extern char console_buffer[CFG_CBSIZE];
430 char message[CFG_CBSIZE];
431 int size = CFG_CBSIZE - 1;
432 int len;
433 char *local_args[4];
434
435 local_args[0] = argv[0];
436 local_args[1] = argv[1];
437 local_args[2] = NULL;
438 local_args[3] = NULL;
439
440 if (argc < 2) {
441 printf ("Usage:\n%s\n", cmdtp->usage);
442 return 1;
443 }
444 /* Check the syntax */
445 switch (argc) {
446 case 1:
447 printf ("Usage:\n%s\n", cmdtp->usage);
448 return 1;
449
450 case 2: /* askenv envname */
451 sprintf (message, "Please enter '%s':", argv[1]);
452 break;
453
454 case 3: /* askenv envname size */
455 sprintf (message, "Please enter '%s':", argv[1]);
456 size = simple_strtoul (argv[2], NULL, 10);
457 break;
458
459 default: /* askenv envname message1 ... messagen size */
460 {
461 int i;
462 int pos = 0;
463
464 for (i = 2; i < argc - 1; i++) {
465 if (pos) {
466 message[pos++] = ' ';
467 }
468 strcpy (message+pos, argv[i]);
469 pos += strlen(argv[i]);
470 }
471 message[pos] = '\0';
472 size = simple_strtoul (argv[argc - 1], NULL, 10);
473 }
474 break;
475 }
476
477 if (size >= CFG_CBSIZE)
478 size = CFG_CBSIZE - 1;
479
480 if (size <= 0)
481 return 1;
482
483 /* prompt for input */
484 len = readline (message);
485
486 if (size < len)
487 console_buffer[size] = '\0';
488
489 len = 2;
490 if (console_buffer[0] != '\0') {
491 local_args[2] = console_buffer;
492 len = 3;
493 }
494
495 /* Continue calling setenv code */
496 return _do_setenv (flag, len, local_args);
497}
Jon Loeliger90253172007-07-10 11:02:44 -0500498#endif
wdenka68d3ed2002-10-11 08:38:32 +0000499
500/************************************************************************
501 * Look up variable from environment,
502 * return address of storage for that variable,
503 * or NULL if not found
504 */
505
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200506char *getenv (char *name)
wdenka68d3ed2002-10-11 08:38:32 +0000507{
508 int i, nxt;
509
wdenk2a3cb022002-11-05 21:01:48 +0000510 WATCHDOG_RESET();
511
wdenka68d3ed2002-10-11 08:38:32 +0000512 for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
513 int val;
514
515 for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
516 if (nxt >= CFG_ENV_SIZE) {
517 return (NULL);
518 }
519 }
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200520 if ((val=envmatch((uchar *)name, i)) < 0)
wdenka68d3ed2002-10-11 08:38:32 +0000521 continue;
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200522 return ((char *)env_get_addr(val));
wdenka68d3ed2002-10-11 08:38:32 +0000523 }
524
525 return (NULL);
526}
527
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200528int getenv_r (char *name, char *buf, unsigned len)
wdenka68d3ed2002-10-11 08:38:32 +0000529{
530 int i, nxt;
531
532 for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
533 int val, n;
534
535 for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
536 if (nxt >= CFG_ENV_SIZE) {
537 return (-1);
538 }
539 }
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200540 if ((val=envmatch((uchar *)name, i)) < 0)
wdenka68d3ed2002-10-11 08:38:32 +0000541 continue;
542 /* found; copy out */
543 n = 0;
544 while ((len > n++) && (*buf++ = env_get_char(val++)) != '\0')
545 ;
546 if (len == n)
547 *buf = '\0';
548 return (n);
549 }
550 return (-1);
551}
552
Stefan Roese3865b1f2007-07-11 12:13:53 +0200553#if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
Jon Loeliger65c450b2007-06-11 19:01:54 -0500554 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
Kyungmin Parkd7e8ce12007-09-10 17:15:14 +0900555 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \
556 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND))
wdenka68d3ed2002-10-11 08:38:32 +0000557int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
558{
559 extern char * env_name_spec;
560
561 printf ("Saving Environment to %s...\n", env_name_spec);
562
563 return (saveenv() ? 1 : 0);
564}
wdenk8bde7f72003-06-27 21:31:46 +0000565
wdenka68d3ed2002-10-11 08:38:32 +0000566#endif
567
568
569/************************************************************************
570 * Match a name / name=value pair
571 *
572 * s1 is either a simple 'name', or a 'name=value' pair.
573 * i2 is the environment index for a 'name2=value2' pair.
574 * If the names match, return the index for the value2, else NULL.
575 */
576
Rafal Jaworowski26a41792008-01-09 18:05:27 +0100577int envmatch (uchar *s1, int i2)
wdenka68d3ed2002-10-11 08:38:32 +0000578{
579
580 while (*s1 == env_get_char(i2++))
581 if (*s1++ == '=')
582 return(i2);
583 if (*s1 == '\0' && env_get_char(i2-1) == '=')
584 return(i2);
585 return(-1);
586}
wdenk8bde7f72003-06-27 21:31:46 +0000587
588
589/**************************************************/
590
wdenk0d498392003-07-01 21:06:45 +0000591U_BOOT_CMD(
592 printenv, CFG_MAXARGS, 1, do_printenv,
wdenk8bde7f72003-06-27 21:31:46 +0000593 "printenv- print environment variables\n",
594 "\n - print values of all environment variables\n"
595 "printenv name ...\n"
596 " - print value of environment variable 'name'\n"
597);
598
wdenk0d498392003-07-01 21:06:45 +0000599U_BOOT_CMD(
600 setenv, CFG_MAXARGS, 0, do_setenv,
wdenk8bde7f72003-06-27 21:31:46 +0000601 "setenv - set environment variables\n",
602 "name value ...\n"
603 " - set environment variable 'name' to 'value ...'\n"
604 "setenv name\n"
605 " - delete environment variable 'name'\n"
606);
607
Stefan Roese3865b1f2007-07-11 12:13:53 +0200608#if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
Jon Loeliger65c450b2007-06-11 19:01:54 -0500609 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
Kyungmin Parkd7e8ce12007-09-10 17:15:14 +0900610 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \
611 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND))
wdenk0d498392003-07-01 21:06:45 +0000612U_BOOT_CMD(
613 saveenv, 1, 0, do_saveenv,
wdenk8bde7f72003-06-27 21:31:46 +0000614 "saveenv - save environment variables to persistent storage\n",
615 NULL
616);
617
Jon Loeliger90253172007-07-10 11:02:44 -0500618#endif
wdenk8bde7f72003-06-27 21:31:46 +0000619
Jon Loeligerc76fe472007-07-08 18:02:23 -0500620#if defined(CONFIG_CMD_ASKENV)
wdenk8bde7f72003-06-27 21:31:46 +0000621
wdenk0d498392003-07-01 21:06:45 +0000622U_BOOT_CMD(
623 askenv, CFG_MAXARGS, 1, do_askenv,
wdenk8bde7f72003-06-27 21:31:46 +0000624 "askenv - get environment variables from stdin\n",
625 "name [message] [size]\n"
626 " - get environment variable 'name' from stdin (max 'size' chars)\n"
627 "askenv name\n"
628 " - get environment variable 'name' from stdin\n"
629 "askenv name size\n"
630 " - get environment variable 'name' from stdin (max 'size' chars)\n"
631 "askenv name [message] size\n"
632 " - display 'message' string and get environment variable 'name'"
633 "from stdin (max 'size' chars)\n"
634);
Jon Loeliger90253172007-07-10 11:02:44 -0500635#endif
wdenk8bde7f72003-06-27 21:31:46 +0000636
Jon Loeligerc76fe472007-07-08 18:02:23 -0500637#if defined(CONFIG_CMD_RUN)
wdenk8bde7f72003-06-27 21:31:46 +0000638int do_run (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
wdenk0d498392003-07-01 21:06:45 +0000639U_BOOT_CMD(
640 run, CFG_MAXARGS, 1, do_run,
wdenk8bde7f72003-06-27 21:31:46 +0000641 "run - run commands in an environment variable\n",
642 "var [...]\n"
643 " - run the commands in the environment variable(s) 'var'\n"
644);
Jon Loeliger90253172007-07-10 11:02:44 -0500645#endif