blob: dc05f68bfeb27b1efdfc6b832dacbcb0f1b763ed [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>
wdenk7ac16102004-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 Loeligerd76b5c12007-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 Denk6405a152006-03-31 18:32:53 +020053DECLARE_GLOBAL_DATA_PTR;
54
wdenk86765902003-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) && \
wdenk79b59372004-06-09 14:58:14 +000059 !defined(CFG_ENV_IS_IN_NAND) && \
Kyungmin Parkaf3d11c2007-09-10 17:15:14 +090060 !defined(CFG_ENV_IS_IN_ONENAND) && \
wdenk86765902003-12-06 23:55:10 +000061 !defined(CFG_ENV_IS_NOWHERE)
Kyungmin Parkaf3d11c2007-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
wdenka68d3ed2002-10-11 08:38:32 +000071/* Function that returns a pointer to a value from the environment */
72/* (Only memory version supported / needed). */
73extern uchar *env_get_addr(int);
74
75/* Function that updates CRC of the enironment */
76extern void env_crc_update (void);
77
78/************************************************************************
79************************************************************************/
80
wdenka68d3ed2002-10-11 08:38:32 +000081/*
82 * Table with supported baudrates (defined in config_xyz.h)
83 */
84static const unsigned long baudrate_table[] = CFG_BAUDRATE_TABLE;
85#define N_BAUDRATES (sizeof(baudrate_table) / sizeof(baudrate_table[0]))
86
87
88/************************************************************************
89 * Command interface: print one or all environment variables
90 */
91
92int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
93{
94 int i, j, k, nxt;
95 int rcode = 0;
96
97 if (argc == 1) { /* Print all env variables */
98 for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
99 for (nxt=i; env_get_char(nxt) != '\0'; ++nxt)
100 ;
101 for (k=i; k<nxt; ++k)
102 putc(env_get_char(k));
103 putc ('\n');
104
105 if (ctrlc()) {
106 puts ("\n ** Abort\n");
107 return 1;
108 }
109 }
110
111 printf("\nEnvironment size: %d/%d bytes\n", i, ENV_SIZE);
112
113 return 0;
114 }
115
116 for (i=1; i<argc; ++i) { /* print single env variables */
117 char *name = argv[i];
118
119 k = -1;
120
121 for (j=0; env_get_char(j) != '\0'; j=nxt+1) {
122
123 for (nxt=j; env_get_char(nxt) != '\0'; ++nxt)
124 ;
Wolfgang Denk7fb52662005-10-13 16:45:02 +0200125 k = envmatch((uchar *)name, j);
wdenka68d3ed2002-10-11 08:38:32 +0000126 if (k < 0) {
127 continue;
128 }
129 puts (name);
130 putc ('=');
131 while (k < nxt)
132 putc(env_get_char(k++));
133 putc ('\n');
134 break;
135 }
136 if (k < 0) {
137 printf ("## Error: \"%s\" not defined\n", name);
138 rcode ++;
139 }
140 }
141 return rcode;
142}
143
144/************************************************************************
145 * Set a new environment variable,
146 * or replace or delete an existing one.
147 *
148 * This function will ONLY work with a in-RAM copy of the environment
149 */
150
151int _do_setenv (int flag, int argc, char *argv[])
152{
wdenka68d3ed2002-10-11 08:38:32 +0000153 int i, len, oldval;
154 int console = -1;
155 uchar *env, *nxt = NULL;
Wolfgang Denk7fb52662005-10-13 16:45:02 +0200156 char *name;
wdenka68d3ed2002-10-11 08:38:32 +0000157 bd_t *bd = gd->bd;
158
159 uchar *env_data = env_get_addr(0);
160
161 if (!env_data) /* need copy in RAM */
162 return 1;
163
164 name = argv[1];
165
Wolfgang Denkbc50f8c2006-10-28 01:14:32 +0200166 if (strchr(name, '=')) {
167 printf ("## Error: illegal character '=' in variable name \"%s\"\n", name);
168 return 1;
169 }
170
wdenka68d3ed2002-10-11 08:38:32 +0000171 /*
172 * search if variable with this name already exists
173 */
174 oldval = -1;
175 for (env=env_data; *env; env=nxt+1) {
176 for (nxt=env; *nxt; ++nxt)
177 ;
Wolfgang Denk7fb52662005-10-13 16:45:02 +0200178 if ((oldval = envmatch((uchar *)name, env-env_data)) >= 0)
wdenka68d3ed2002-10-11 08:38:32 +0000179 break;
180 }
181
182 /*
183 * Delete any existing definition
184 */
185 if (oldval >= 0) {
186#ifndef CONFIG_ENV_OVERWRITE
187
188 /*
stroesef8105cf2003-04-04 15:44:49 +0000189 * Ethernet Address and serial# can be set only once,
190 * ver is readonly.
wdenka68d3ed2002-10-11 08:38:32 +0000191 */
Sergey Kubushyne8f39122007-08-10 20:26:18 +0200192#ifdef CONFIG_HAS_UID
193 /* Allow serial# forced overwrite with 0xdeaf4add flag */
194 if ( ((strcmp (name, "serial#") == 0) && (flag != 0xdeaf4add)) ||
195#else
wdenka68d3ed2002-10-11 08:38:32 +0000196 if ( (strcmp (name, "serial#") == 0) ||
Sergey Kubushyne8f39122007-08-10 20:26:18 +0200197#endif
wdenka68d3ed2002-10-11 08:38:32 +0000198 ((strcmp (name, "ethaddr") == 0)
199#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR)
Wolfgang Denk7fb52662005-10-13 16:45:02 +0200200 && (strcmp ((char *)env_get_addr(oldval),MK_STR(CONFIG_ETHADDR)) != 0)
wdenka68d3ed2002-10-11 08:38:32 +0000201#endif /* CONFIG_OVERWRITE_ETHADDR_ONCE && CONFIG_ETHADDR */
202 ) ) {
203 printf ("Can't overwrite \"%s\"\n", name);
204 return 1;
205 }
206#endif
207
208 /* Check for console redirection */
209 if (strcmp(name,"stdin") == 0) {
210 console = stdin;
211 } else if (strcmp(name,"stdout") == 0) {
212 console = stdout;
213 } else if (strcmp(name,"stderr") == 0) {
214 console = stderr;
215 }
216
217 if (console != -1) {
218 if (argc < 3) { /* Cannot delete it! */
219 printf("Can't delete \"%s\"\n", name);
220 return 1;
221 }
222
223 /* Try assigning specified device */
224 if (console_assign (console, argv[2]) < 0)
225 return 1;
wdenk7ac16102004-08-01 22:48:16 +0000226
227#ifdef CONFIG_SERIAL_MULTI
228 if (serial_assign (argv[2]) < 0)
229 return 1;
230#endif
wdenka68d3ed2002-10-11 08:38:32 +0000231 }
232
233 /*
234 * Switch to new baudrate if new baudrate is supported
235 */
236 if (strcmp(argv[1],"baudrate") == 0) {
237 int baudrate = simple_strtoul(argv[2], NULL, 10);
238 int i;
239 for (i=0; i<N_BAUDRATES; ++i) {
240 if (baudrate == baudrate_table[i])
241 break;
242 }
243 if (i == N_BAUDRATES) {
244 printf ("## Baudrate %d bps not supported\n",
245 baudrate);
246 return 1;
247 }
248 printf ("## Switch baudrate to %d bps and press ENTER ...\n",
249 baudrate);
250 udelay(50000);
251 gd->baudrate = baudrate;
Bartlomiej Sieka23d43282006-12-20 00:29:43 +0100252#if defined(CONFIG_PPC) || defined(CONFIG_MCF52x2)
wdenke7f34c62003-01-11 09:48:40 +0000253 gd->bd->bi_baudrate = baudrate;
254#endif
255
wdenka68d3ed2002-10-11 08:38:32 +0000256 serial_setbrg ();
257 udelay(50000);
258 for (;;) {
259 if (getc() == '\r')
260 break;
261 }
262 }
263
264 if (*++nxt == '\0') {
265 if (env > env_data) {
266 env--;
267 } else {
268 *env = '\0';
269 }
270 } else {
271 for (;;) {
272 *env = *nxt++;
273 if ((*env == '\0') && (*nxt == '\0'))
274 break;
275 ++env;
276 }
277 }
278 *++env = '\0';
279 }
280
281#ifdef CONFIG_NET_MULTI
282 if (strncmp(name, "eth", 3) == 0) {
283 char *end;
284 int num = simple_strtoul(name+3, &end, 10);
285
286 if (strcmp(end, "addr") == 0) {
287 eth_set_enetaddr(num, argv[2]);
288 }
289 }
290#endif
291
292
293 /* Delete only ? */
294 if ((argc < 3) || argv[2] == NULL) {
295 env_crc_update ();
296 return 0;
297 }
298
299 /*
300 * Append new definition at the end
301 */
302 for (env=env_data; *env || *(env+1); ++env)
303 ;
304 if (env > env_data)
305 ++env;
306 /*
307 * Overflow when:
308 * "name" + "=" + "val" +"\0\0" > ENV_SIZE - (env-env_data)
309 */
310 len = strlen(name) + 2;
311 /* add '=' for first arg, ' ' for all others */
312 for (i=2; i<argc; ++i) {
313 len += strlen(argv[i]) + 1;
314 }
315 if (len > (&env_data[ENV_SIZE]-env)) {
316 printf ("## Error: environment overflow, \"%s\" deleted\n", name);
317 return 1;
318 }
319 while ((*env = *name++) != '\0')
320 env++;
321 for (i=2; i<argc; ++i) {
322 char *val = argv[i];
323
324 *env = (i==2) ? '=' : ' ';
325 while ((*++env = *val++) != '\0')
326 ;
327 }
328
329 /* end is marked with double '\0' */
330 *++env = '\0';
331
332 /* Update CRC */
333 env_crc_update ();
334
335 /*
336 * Some variables should be updated when the corresponding
337 * entry in the enviornment is changed
338 */
339
340 if (strcmp(argv[1],"ethaddr") == 0) {
341 char *s = argv[2]; /* always use only one arg */
342 char *e;
343 for (i=0; i<6; ++i) {
344 bd->bi_enetaddr[i] = s ? simple_strtoul(s, &e, 16) : 0;
345 if (s) s = (*e) ? e+1 : e;
346 }
347#ifdef CONFIG_NET_MULTI
348 eth_set_enetaddr(0, argv[2]);
349#endif
350 return 0;
351 }
352
353 if (strcmp(argv[1],"ipaddr") == 0) {
354 char *s = argv[2]; /* always use only one arg */
355 char *e;
356 unsigned long addr;
357 bd->bi_ip_addr = 0;
358 for (addr=0, i=0; i<4; ++i) {
359 ulong val = s ? simple_strtoul(s, &e, 10) : 0;
360 addr <<= 8;
361 addr |= (val & 0xFF);
362 if (s) s = (*e) ? e+1 : e;
363 }
364 bd->bi_ip_addr = htonl(addr);
365 return 0;
366 }
367 if (strcmp(argv[1],"loadaddr") == 0) {
368 load_addr = simple_strtoul(argv[2], NULL, 16);
369 return 0;
370 }
Jon Loeligerd76b5c12007-07-08 18:02:23 -0500371#if defined(CONFIG_CMD_NET)
wdenka68d3ed2002-10-11 08:38:32 +0000372 if (strcmp(argv[1],"bootfile") == 0) {
373 copy_filename (BootFile, argv[2], sizeof(BootFile));
374 return 0;
375 }
Jon Loeligerd704d912007-07-10 11:02:44 -0500376#endif
wdenk452cfd62002-11-19 11:04:11 +0000377
stroesef8105cf2003-04-04 15:44:49 +0000378#ifdef CONFIG_AMIGAONEG3SE
wdenk452cfd62002-11-19 11:04:11 +0000379 if (strcmp(argv[1], "vga_fg_color") == 0 ||
380 strcmp(argv[1], "vga_bg_color") == 0 ) {
381 extern void video_set_color(unsigned char attr);
382 extern unsigned char video_get_attr(void);
383
384 video_set_color(video_get_attr());
385 return 0;
386 }
387#endif /* CONFIG_AMIGAONEG3SE */
388
wdenka68d3ed2002-10-11 08:38:32 +0000389 return 0;
390}
391
392void setenv (char *varname, char *varvalue)
393{
394 char *argv[4] = { "setenv", varname, varvalue, NULL };
Jeffrey Mann62b896f2007-04-23 14:00:11 +0200395 if (varvalue == NULL)
396 _do_setenv (0, 2, argv);
397 else
398 _do_setenv (0, 3, argv);
wdenka68d3ed2002-10-11 08:38:32 +0000399}
400
Sergey Kubushyne8f39122007-08-10 20:26:18 +0200401#ifdef CONFIG_HAS_UID
402void forceenv (char *varname, char *varvalue)
403{
404 char *argv[4] = { "forceenv", varname, varvalue, NULL };
405 _do_setenv (0xdeaf4add, 3, argv);
406}
407#endif
408
409int do_setenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
wdenka68d3ed2002-10-11 08:38:32 +0000410{
411 if (argc < 2) {
412 printf ("Usage:\n%s\n", cmdtp->usage);
413 return 1;
414 }
415
416 return _do_setenv (flag, argc, argv);
417}
418
419/************************************************************************
420 * Prompt for environment variable
421 */
422
Jon Loeligerd76b5c12007-07-08 18:02:23 -0500423#if defined(CONFIG_CMD_ASKENV)
wdenka68d3ed2002-10-11 08:38:32 +0000424int do_askenv ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
425{
426 extern char console_buffer[CFG_CBSIZE];
427 char message[CFG_CBSIZE];
428 int size = CFG_CBSIZE - 1;
429 int len;
430 char *local_args[4];
431
432 local_args[0] = argv[0];
433 local_args[1] = argv[1];
434 local_args[2] = NULL;
435 local_args[3] = NULL;
436
437 if (argc < 2) {
438 printf ("Usage:\n%s\n", cmdtp->usage);
439 return 1;
440 }
441 /* Check the syntax */
442 switch (argc) {
443 case 1:
444 printf ("Usage:\n%s\n", cmdtp->usage);
445 return 1;
446
447 case 2: /* askenv envname */
448 sprintf (message, "Please enter '%s':", argv[1]);
449 break;
450
451 case 3: /* askenv envname size */
452 sprintf (message, "Please enter '%s':", argv[1]);
453 size = simple_strtoul (argv[2], NULL, 10);
454 break;
455
456 default: /* askenv envname message1 ... messagen size */
457 {
458 int i;
459 int pos = 0;
460
461 for (i = 2; i < argc - 1; i++) {
462 if (pos) {
463 message[pos++] = ' ';
464 }
465 strcpy (message+pos, argv[i]);
466 pos += strlen(argv[i]);
467 }
468 message[pos] = '\0';
469 size = simple_strtoul (argv[argc - 1], NULL, 10);
470 }
471 break;
472 }
473
474 if (size >= CFG_CBSIZE)
475 size = CFG_CBSIZE - 1;
476
477 if (size <= 0)
478 return 1;
479
480 /* prompt for input */
481 len = readline (message);
482
483 if (size < len)
484 console_buffer[size] = '\0';
485
486 len = 2;
487 if (console_buffer[0] != '\0') {
488 local_args[2] = console_buffer;
489 len = 3;
490 }
491
492 /* Continue calling setenv code */
493 return _do_setenv (flag, len, local_args);
494}
Jon Loeligerd704d912007-07-10 11:02:44 -0500495#endif
wdenka68d3ed2002-10-11 08:38:32 +0000496
497/************************************************************************
498 * Look up variable from environment,
499 * return address of storage for that variable,
500 * or NULL if not found
501 */
502
Wolfgang Denk7fb52662005-10-13 16:45:02 +0200503char *getenv (char *name)
wdenka68d3ed2002-10-11 08:38:32 +0000504{
505 int i, nxt;
506
wdenk2a3cb022002-11-05 21:01:48 +0000507 WATCHDOG_RESET();
508
wdenka68d3ed2002-10-11 08:38:32 +0000509 for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
510 int val;
511
512 for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
513 if (nxt >= CFG_ENV_SIZE) {
514 return (NULL);
515 }
516 }
Wolfgang Denk7fb52662005-10-13 16:45:02 +0200517 if ((val=envmatch((uchar *)name, i)) < 0)
wdenka68d3ed2002-10-11 08:38:32 +0000518 continue;
Wolfgang Denk7fb52662005-10-13 16:45:02 +0200519 return ((char *)env_get_addr(val));
wdenka68d3ed2002-10-11 08:38:32 +0000520 }
521
522 return (NULL);
523}
524
Wolfgang Denk7fb52662005-10-13 16:45:02 +0200525int getenv_r (char *name, char *buf, unsigned len)
wdenka68d3ed2002-10-11 08:38:32 +0000526{
527 int i, nxt;
528
529 for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
530 int val, n;
531
532 for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
533 if (nxt >= CFG_ENV_SIZE) {
534 return (-1);
535 }
536 }
Wolfgang Denk7fb52662005-10-13 16:45:02 +0200537 if ((val=envmatch((uchar *)name, i)) < 0)
wdenka68d3ed2002-10-11 08:38:32 +0000538 continue;
539 /* found; copy out */
540 n = 0;
541 while ((len > n++) && (*buf++ = env_get_char(val++)) != '\0')
542 ;
543 if (len == n)
544 *buf = '\0';
545 return (n);
546 }
547 return (-1);
548}
549
Jean-Christophe PLAGNIOL-VILLARD43ad6232008-02-23 12:15:56 +0100550#if ((defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
Jon Loeliger3de8b242007-06-11 19:01:54 -0500551 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
Kyungmin Parkaf3d11c2007-09-10 17:15:14 +0900552 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \
Jean-Christophe PLAGNIOL-VILLARD43ad6232008-02-23 12:15:56 +0100553 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND))) \
554 && !defined(CFG_ENV_IS_NOWHERE))
wdenka68d3ed2002-10-11 08:38:32 +0000555int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
556{
557 extern char * env_name_spec;
558
559 printf ("Saving Environment to %s...\n", env_name_spec);
560
561 return (saveenv() ? 1 : 0);
562}
wdenk57b2d802003-06-27 21:31:46 +0000563
wdenka68d3ed2002-10-11 08:38:32 +0000564#endif
565
566
567/************************************************************************
568 * Match a name / name=value pair
569 *
570 * s1 is either a simple 'name', or a 'name=value' pair.
571 * i2 is the environment index for a 'name2=value2' pair.
572 * If the names match, return the index for the value2, else NULL.
573 */
574
Rafal Jaworowski75b54422008-01-09 18:05:27 +0100575int envmatch (uchar *s1, int i2)
wdenka68d3ed2002-10-11 08:38:32 +0000576{
577
578 while (*s1 == env_get_char(i2++))
579 if (*s1++ == '=')
580 return(i2);
581 if (*s1 == '\0' && env_get_char(i2-1) == '=')
582 return(i2);
583 return(-1);
584}
wdenk57b2d802003-06-27 21:31:46 +0000585
586
587/**************************************************/
588
wdenkf287a242003-07-01 21:06:45 +0000589U_BOOT_CMD(
590 printenv, CFG_MAXARGS, 1, do_printenv,
wdenk57b2d802003-06-27 21:31:46 +0000591 "printenv- print environment variables\n",
592 "\n - print values of all environment variables\n"
593 "printenv name ...\n"
594 " - print value of environment variable 'name'\n"
595);
596
wdenkf287a242003-07-01 21:06:45 +0000597U_BOOT_CMD(
598 setenv, CFG_MAXARGS, 0, do_setenv,
wdenk57b2d802003-06-27 21:31:46 +0000599 "setenv - set environment variables\n",
600 "name value ...\n"
601 " - set environment variable 'name' to 'value ...'\n"
602 "setenv name\n"
603 " - delete environment variable 'name'\n"
604);
605
Jean-Christophe PLAGNIOL-VILLARD43ad6232008-02-23 12:15:56 +0100606#if ((defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
Jon Loeliger3de8b242007-06-11 19:01:54 -0500607 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
Kyungmin Parkaf3d11c2007-09-10 17:15:14 +0900608 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \
Jean-Christophe PLAGNIOL-VILLARD43ad6232008-02-23 12:15:56 +0100609 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND))) \
610 && !defined(CFG_ENV_IS_NOWHERE))
wdenkf287a242003-07-01 21:06:45 +0000611U_BOOT_CMD(
612 saveenv, 1, 0, do_saveenv,
wdenk57b2d802003-06-27 21:31:46 +0000613 "saveenv - save environment variables to persistent storage\n",
614 NULL
615);
616
Jon Loeligerd704d912007-07-10 11:02:44 -0500617#endif
wdenk57b2d802003-06-27 21:31:46 +0000618
Jon Loeligerd76b5c12007-07-08 18:02:23 -0500619#if defined(CONFIG_CMD_ASKENV)
wdenk57b2d802003-06-27 21:31:46 +0000620
wdenkf287a242003-07-01 21:06:45 +0000621U_BOOT_CMD(
622 askenv, CFG_MAXARGS, 1, do_askenv,
wdenk57b2d802003-06-27 21:31:46 +0000623 "askenv - get environment variables from stdin\n",
624 "name [message] [size]\n"
625 " - get environment variable 'name' from stdin (max 'size' chars)\n"
626 "askenv name\n"
627 " - get environment variable 'name' from stdin\n"
628 "askenv name size\n"
629 " - get environment variable 'name' from stdin (max 'size' chars)\n"
630 "askenv name [message] size\n"
631 " - display 'message' string and get environment variable 'name'"
632 "from stdin (max 'size' chars)\n"
633);
Jon Loeligerd704d912007-07-10 11:02:44 -0500634#endif
wdenk57b2d802003-06-27 21:31:46 +0000635
Jon Loeligerd76b5c12007-07-08 18:02:23 -0500636#if defined(CONFIG_CMD_RUN)
wdenk57b2d802003-06-27 21:31:46 +0000637int do_run (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
wdenkf287a242003-07-01 21:06:45 +0000638U_BOOT_CMD(
639 run, CFG_MAXARGS, 1, do_run,
wdenk57b2d802003-06-27 21:31:46 +0000640 "run - run commands in an environment variable\n",
641 "var [...]\n"
642 " - run the commands in the environment variable(s) 'var'\n"
643);
Jon Loeligerd704d912007-07-10 11:02:44 -0500644#endif