3 * Murray Jensen, CSIRO Manufacturing Science and Technology,
4 * <Murray.Jensen@cmst.csiro.au>
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 /* imports from common/main.c */
29 extern char console_buffer[CFG_CBSIZE];
32 fetch_and_parse(bd_t *bd, char *fn, ulong addr, int (*cback)(uchar *, uchar *))
37 while ((ethaddr = getenv("ethaddr")) == NULL || *ethaddr == '\0') {
39 puts("*** Ethernet address is not set\n");
44 n = readline("Enter board ethernet address: ");
59 /* see if it looks like an ethernet address */
63 for (i = 0; i < 6; i++) {
64 char term = (i == 5 ? '\0' : ':');
66 ea[i] = simple_strtol(p, &q, 16);
68 if ((q - p) != 2 || *q++ != term)
75 /* it looks ok - set it */
76 printf("Setting ethernet address to %s\n", console_buffer);
77 setenv("ethaddr", console_buffer);
79 puts("Remember to do a 'saveenv' to make it permanent\n");
84 printf("Invalid ethernet address (%s) - please re-enter\n",
89 copy_filename(BootFile, fn, sizeof (BootFile));
92 if (NetLoop(TFTP) == 0) {
93 printf("tftp transfer of file '%s' failed\n", fn);
97 if (NetBootFileXferSize == 0) {
98 printf("can't determine size of file '%s'\n", fn);
102 fp = (uchar *)load_addr;
103 efp = fp + NetBootFileXferSize;
108 if (*fp == '#' || *fp == '\n') {
109 while (fp < efp && *fp++ != '\n')
116 while (fp < efp && *fp != '=')
127 while (fp < efp && *fp != '\n')
130 /* ok if we go off the end here */
136 if ((*cback)(name, value) == 0)