blob: 1db0fc3c03b14c4a3fb0761b2cc77bc4b562e7ed [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) && \
wdenk5779d8d2003-12-06 23:55:10 +000060 !defined(CFG_ENV_IS_NOWHERE)
61# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|NOWHERE}
wdenka68d3ed2002-10-11 08:38:32 +000062#endif
63
64#define XMK_STR(x) #x
65#define MK_STR(x) XMK_STR(x)
66
67/************************************************************************
68************************************************************************/
69
70/* Function that returns a character from the environment */
71extern uchar (*env_get_char)(int);
72
73/* Function that returns a pointer to a value from the environment */
74/* (Only memory version supported / needed). */
75extern uchar *env_get_addr(int);
76
77/* Function that updates CRC of the enironment */
78extern void env_crc_update (void);
79
80/************************************************************************
81************************************************************************/
82
83static int envmatch (uchar *, int);
84
85/*
86 * Table with supported baudrates (defined in config_xyz.h)
87 */
88static const unsigned long baudrate_table[] = CFG_BAUDRATE_TABLE;
89#define N_BAUDRATES (sizeof(baudrate_table) / sizeof(baudrate_table[0]))
90
91
92/************************************************************************
93 * Command interface: print one or all environment variables
94 */
95
96int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
97{
98 int i, j, k, nxt;
99 int rcode = 0;
100
101 if (argc == 1) { /* Print all env variables */
102 for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
103 for (nxt=i; env_get_char(nxt) != '\0'; ++nxt)
104 ;
105 for (k=i; k<nxt; ++k)
106 putc(env_get_char(k));
107 putc ('\n');
108
109 if (ctrlc()) {
110 puts ("\n ** Abort\n");
111 return 1;
112 }
113 }
114
115 printf("\nEnvironment size: %d/%d bytes\n", i, ENV_SIZE);
116
117 return 0;
118 }
119
120 for (i=1; i<argc; ++i) { /* print single env variables */
121 char *name = argv[i];
122
123 k = -1;
124
125 for (j=0; env_get_char(j) != '\0'; j=nxt+1) {
126
127 for (nxt=j; env_get_char(nxt) != '\0'; ++nxt)
128 ;
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200129 k = envmatch((uchar *)name, j);
wdenka68d3ed2002-10-11 08:38:32 +0000130 if (k < 0) {
131 continue;
132 }
133 puts (name);
134 putc ('=');
135 while (k < nxt)
136 putc(env_get_char(k++));
137 putc ('\n');
138 break;
139 }
140 if (k < 0) {
141 printf ("## Error: \"%s\" not defined\n", name);
142 rcode ++;
143 }
144 }
145 return rcode;
146}
147
148/************************************************************************
149 * Set a new environment variable,
150 * or replace or delete an existing one.
151 *
152 * This function will ONLY work with a in-RAM copy of the environment
153 */
154
155int _do_setenv (int flag, int argc, char *argv[])
156{
wdenka68d3ed2002-10-11 08:38:32 +0000157 int i, len, oldval;
158 int console = -1;
159 uchar *env, *nxt = NULL;
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200160 char *name;
wdenka68d3ed2002-10-11 08:38:32 +0000161 bd_t *bd = gd->bd;
162
163 uchar *env_data = env_get_addr(0);
164
165 if (!env_data) /* need copy in RAM */
166 return 1;
167
168 name = argv[1];
169
Wolfgang Denk471a7be2006-10-28 01:14:32 +0200170 if (strchr(name, '=')) {
171 printf ("## Error: illegal character '=' in variable name \"%s\"\n", name);
172 return 1;
173 }
174
wdenka68d3ed2002-10-11 08:38:32 +0000175 /*
176 * search if variable with this name already exists
177 */
178 oldval = -1;
179 for (env=env_data; *env; env=nxt+1) {
180 for (nxt=env; *nxt; ++nxt)
181 ;
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200182 if ((oldval = envmatch((uchar *)name, env-env_data)) >= 0)
wdenka68d3ed2002-10-11 08:38:32 +0000183 break;
184 }
185
186 /*
187 * Delete any existing definition
188 */
189 if (oldval >= 0) {
190#ifndef CONFIG_ENV_OVERWRITE
191
192 /*
stroese05875972003-04-04 15:44:49 +0000193 * Ethernet Address and serial# can be set only once,
194 * ver is readonly.
wdenka68d3ed2002-10-11 08:38:32 +0000195 */
Sergey Kubushync74b2102007-08-10 20:26:18 +0200196#ifdef CONFIG_HAS_UID
197 /* Allow serial# forced overwrite with 0xdeaf4add flag */
198 if ( ((strcmp (name, "serial#") == 0) && (flag != 0xdeaf4add)) ||
199#else
wdenka68d3ed2002-10-11 08:38:32 +0000200 if ( (strcmp (name, "serial#") == 0) ||
Sergey Kubushync74b2102007-08-10 20:26:18 +0200201#endif
wdenka68d3ed2002-10-11 08:38:32 +0000202 ((strcmp (name, "ethaddr") == 0)
203#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR)
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200204 && (strcmp ((char *)env_get_addr(oldval),MK_STR(CONFIG_ETHADDR)) != 0)
wdenka68d3ed2002-10-11 08:38:32 +0000205#endif /* CONFIG_OVERWRITE_ETHADDR_ONCE && CONFIG_ETHADDR */
206 ) ) {
207 printf ("Can't overwrite \"%s\"\n", name);
208 return 1;
209 }
210#endif
211
212 /* Check for console redirection */
213 if (strcmp(name,"stdin") == 0) {
214 console = stdin;
215 } else if (strcmp(name,"stdout") == 0) {
216 console = stdout;
217 } else if (strcmp(name,"stderr") == 0) {
218 console = stderr;
219 }
220
221 if (console != -1) {
222 if (argc < 3) { /* Cannot delete it! */
223 printf("Can't delete \"%s\"\n", name);
224 return 1;
225 }
226
227 /* Try assigning specified device */
228 if (console_assign (console, argv[2]) < 0)
229 return 1;
wdenk281e00a2004-08-01 22:48:16 +0000230
231#ifdef CONFIG_SERIAL_MULTI
232 if (serial_assign (argv[2]) < 0)
233 return 1;
234#endif
wdenka68d3ed2002-10-11 08:38:32 +0000235 }
236
237 /*
238 * Switch to new baudrate if new baudrate is supported
239 */
240 if (strcmp(argv[1],"baudrate") == 0) {
241 int baudrate = simple_strtoul(argv[2], NULL, 10);
242 int i;
243 for (i=0; i<N_BAUDRATES; ++i) {
244 if (baudrate == baudrate_table[i])
245 break;
246 }
247 if (i == N_BAUDRATES) {
248 printf ("## Baudrate %d bps not supported\n",
249 baudrate);
250 return 1;
251 }
252 printf ("## Switch baudrate to %d bps and press ENTER ...\n",
253 baudrate);
254 udelay(50000);
255 gd->baudrate = baudrate;
Bartlomiej Siekac84bad02006-12-20 00:29:43 +0100256#if defined(CONFIG_PPC) || defined(CONFIG_MCF52x2)
wdenkd0fb80c2003-01-11 09:48:40 +0000257 gd->bd->bi_baudrate = baudrate;
258#endif
259
wdenka68d3ed2002-10-11 08:38:32 +0000260 serial_setbrg ();
261 udelay(50000);
262 for (;;) {
263 if (getc() == '\r')
264 break;
265 }
266 }
267
268 if (*++nxt == '\0') {
269 if (env > env_data) {
270 env--;
271 } else {
272 *env = '\0';
273 }
274 } else {
275 for (;;) {
276 *env = *nxt++;
277 if ((*env == '\0') && (*nxt == '\0'))
278 break;
279 ++env;
280 }
281 }
282 *++env = '\0';
283 }
284
285#ifdef CONFIG_NET_MULTI
286 if (strncmp(name, "eth", 3) == 0) {
287 char *end;
288 int num = simple_strtoul(name+3, &end, 10);
289
290 if (strcmp(end, "addr") == 0) {
291 eth_set_enetaddr(num, argv[2]);
292 }
293 }
294#endif
295
296
297 /* Delete only ? */
298 if ((argc < 3) || argv[2] == NULL) {
299 env_crc_update ();
300 return 0;
301 }
302
303 /*
304 * Append new definition at the end
305 */
306 for (env=env_data; *env || *(env+1); ++env)
307 ;
308 if (env > env_data)
309 ++env;
310 /*
311 * Overflow when:
312 * "name" + "=" + "val" +"\0\0" > ENV_SIZE - (env-env_data)
313 */
314 len = strlen(name) + 2;
315 /* add '=' for first arg, ' ' for all others */
316 for (i=2; i<argc; ++i) {
317 len += strlen(argv[i]) + 1;
318 }
319 if (len > (&env_data[ENV_SIZE]-env)) {
320 printf ("## Error: environment overflow, \"%s\" deleted\n", name);
321 return 1;
322 }
323 while ((*env = *name++) != '\0')
324 env++;
325 for (i=2; i<argc; ++i) {
326 char *val = argv[i];
327
328 *env = (i==2) ? '=' : ' ';
329 while ((*++env = *val++) != '\0')
330 ;
331 }
332
333 /* end is marked with double '\0' */
334 *++env = '\0';
335
336 /* Update CRC */
337 env_crc_update ();
338
339 /*
340 * Some variables should be updated when the corresponding
341 * entry in the enviornment is changed
342 */
343
344 if (strcmp(argv[1],"ethaddr") == 0) {
345 char *s = argv[2]; /* always use only one arg */
346 char *e;
347 for (i=0; i<6; ++i) {
348 bd->bi_enetaddr[i] = s ? simple_strtoul(s, &e, 16) : 0;
349 if (s) s = (*e) ? e+1 : e;
350 }
351#ifdef CONFIG_NET_MULTI
352 eth_set_enetaddr(0, argv[2]);
353#endif
354 return 0;
355 }
356
357 if (strcmp(argv[1],"ipaddr") == 0) {
358 char *s = argv[2]; /* always use only one arg */
359 char *e;
360 unsigned long addr;
361 bd->bi_ip_addr = 0;
362 for (addr=0, i=0; i<4; ++i) {
363 ulong val = s ? simple_strtoul(s, &e, 10) : 0;
364 addr <<= 8;
365 addr |= (val & 0xFF);
366 if (s) s = (*e) ? e+1 : e;
367 }
368 bd->bi_ip_addr = htonl(addr);
369 return 0;
370 }
371 if (strcmp(argv[1],"loadaddr") == 0) {
372 load_addr = simple_strtoul(argv[2], NULL, 16);
373 return 0;
374 }
Jon Loeligerc76fe472007-07-08 18:02:23 -0500375#if defined(CONFIG_CMD_NET)
wdenka68d3ed2002-10-11 08:38:32 +0000376 if (strcmp(argv[1],"bootfile") == 0) {
377 copy_filename (BootFile, argv[2], sizeof(BootFile));
378 return 0;
379 }
Jon Loeliger90253172007-07-10 11:02:44 -0500380#endif
wdenkc7de8292002-11-19 11:04:11 +0000381
stroese05875972003-04-04 15:44:49 +0000382#ifdef CONFIG_AMIGAONEG3SE
wdenkc7de8292002-11-19 11:04:11 +0000383 if (strcmp(argv[1], "vga_fg_color") == 0 ||
384 strcmp(argv[1], "vga_bg_color") == 0 ) {
385 extern void video_set_color(unsigned char attr);
386 extern unsigned char video_get_attr(void);
387
388 video_set_color(video_get_attr());
389 return 0;
390 }
391#endif /* CONFIG_AMIGAONEG3SE */
392
wdenka68d3ed2002-10-11 08:38:32 +0000393 return 0;
394}
395
396void setenv (char *varname, char *varvalue)
397{
398 char *argv[4] = { "setenv", varname, varvalue, NULL };
Jeffrey Mann9ffd4512007-04-23 14:00:11 +0200399 if (varvalue == NULL)
400 _do_setenv (0, 2, argv);
401 else
402 _do_setenv (0, 3, argv);
wdenka68d3ed2002-10-11 08:38:32 +0000403}
404
Sergey Kubushync74b2102007-08-10 20:26:18 +0200405#ifdef CONFIG_HAS_UID
406void forceenv (char *varname, char *varvalue)
407{
408 char *argv[4] = { "forceenv", varname, varvalue, NULL };
409 _do_setenv (0xdeaf4add, 3, argv);
410}
411#endif
412
413int do_setenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
wdenka68d3ed2002-10-11 08:38:32 +0000414{
415 if (argc < 2) {
416 printf ("Usage:\n%s\n", cmdtp->usage);
417 return 1;
418 }
419
420 return _do_setenv (flag, argc, argv);
421}
422
423/************************************************************************
424 * Prompt for environment variable
425 */
426
Jon Loeligerc76fe472007-07-08 18:02:23 -0500427#if defined(CONFIG_CMD_ASKENV)
wdenka68d3ed2002-10-11 08:38:32 +0000428int do_askenv ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
429{
430 extern char console_buffer[CFG_CBSIZE];
431 char message[CFG_CBSIZE];
432 int size = CFG_CBSIZE - 1;
433 int len;
434 char *local_args[4];
435
436 local_args[0] = argv[0];
437 local_args[1] = argv[1];
438 local_args[2] = NULL;
439 local_args[3] = NULL;
440
441 if (argc < 2) {
442 printf ("Usage:\n%s\n", cmdtp->usage);
443 return 1;
444 }
445 /* Check the syntax */
446 switch (argc) {
447 case 1:
448 printf ("Usage:\n%s\n", cmdtp->usage);
449 return 1;
450
451 case 2: /* askenv envname */
452 sprintf (message, "Please enter '%s':", argv[1]);
453 break;
454
455 case 3: /* askenv envname size */
456 sprintf (message, "Please enter '%s':", argv[1]);
457 size = simple_strtoul (argv[2], NULL, 10);
458 break;
459
460 default: /* askenv envname message1 ... messagen size */
461 {
462 int i;
463 int pos = 0;
464
465 for (i = 2; i < argc - 1; i++) {
466 if (pos) {
467 message[pos++] = ' ';
468 }
469 strcpy (message+pos, argv[i]);
470 pos += strlen(argv[i]);
471 }
472 message[pos] = '\0';
473 size = simple_strtoul (argv[argc - 1], NULL, 10);
474 }
475 break;
476 }
477
478 if (size >= CFG_CBSIZE)
479 size = CFG_CBSIZE - 1;
480
481 if (size <= 0)
482 return 1;
483
484 /* prompt for input */
485 len = readline (message);
486
487 if (size < len)
488 console_buffer[size] = '\0';
489
490 len = 2;
491 if (console_buffer[0] != '\0') {
492 local_args[2] = console_buffer;
493 len = 3;
494 }
495
496 /* Continue calling setenv code */
497 return _do_setenv (flag, len, local_args);
498}
Jon Loeliger90253172007-07-10 11:02:44 -0500499#endif
wdenka68d3ed2002-10-11 08:38:32 +0000500
501/************************************************************************
502 * Look up variable from environment,
503 * return address of storage for that variable,
504 * or NULL if not found
505 */
506
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200507char *getenv (char *name)
wdenka68d3ed2002-10-11 08:38:32 +0000508{
509 int i, nxt;
510
wdenk2a3cb022002-11-05 21:01:48 +0000511 WATCHDOG_RESET();
512
wdenka68d3ed2002-10-11 08:38:32 +0000513 for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
514 int val;
515
516 for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
517 if (nxt >= CFG_ENV_SIZE) {
518 return (NULL);
519 }
520 }
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200521 if ((val=envmatch((uchar *)name, i)) < 0)
wdenka68d3ed2002-10-11 08:38:32 +0000522 continue;
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200523 return ((char *)env_get_addr(val));
wdenka68d3ed2002-10-11 08:38:32 +0000524 }
525
526 return (NULL);
527}
528
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200529int getenv_r (char *name, char *buf, unsigned len)
wdenka68d3ed2002-10-11 08:38:32 +0000530{
531 int i, nxt;
532
533 for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
534 int val, n;
535
536 for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
537 if (nxt >= CFG_ENV_SIZE) {
538 return (-1);
539 }
540 }
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200541 if ((val=envmatch((uchar *)name, i)) < 0)
wdenka68d3ed2002-10-11 08:38:32 +0000542 continue;
543 /* found; copy out */
544 n = 0;
545 while ((len > n++) && (*buf++ = env_get_char(val++)) != '\0')
546 ;
547 if (len == n)
548 *buf = '\0';
549 return (n);
550 }
551 return (-1);
552}
553
Stefan Roese3865b1f2007-07-11 12:13:53 +0200554#if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
Jon Loeliger65c450b2007-06-11 19:01:54 -0500555 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
556 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND))
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
577static int
578envmatch (uchar *s1, int i2)
579{
580
581 while (*s1 == env_get_char(i2++))
582 if (*s1++ == '=')
583 return(i2);
584 if (*s1 == '\0' && env_get_char(i2-1) == '=')
585 return(i2);
586 return(-1);
587}
wdenk8bde7f72003-06-27 21:31:46 +0000588
589
590/**************************************************/
591
wdenk0d498392003-07-01 21:06:45 +0000592U_BOOT_CMD(
593 printenv, CFG_MAXARGS, 1, do_printenv,
wdenk8bde7f72003-06-27 21:31:46 +0000594 "printenv- print environment variables\n",
595 "\n - print values of all environment variables\n"
596 "printenv name ...\n"
597 " - print value of environment variable 'name'\n"
598);
599
wdenk0d498392003-07-01 21:06:45 +0000600U_BOOT_CMD(
601 setenv, CFG_MAXARGS, 0, do_setenv,
wdenk8bde7f72003-06-27 21:31:46 +0000602 "setenv - set environment variables\n",
603 "name value ...\n"
604 " - set environment variable 'name' to 'value ...'\n"
605 "setenv name\n"
606 " - delete environment variable 'name'\n"
607);
608
Stefan Roese3865b1f2007-07-11 12:13:53 +0200609#if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
Jon Loeliger65c450b2007-06-11 19:01:54 -0500610 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
611 || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND))
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