3 * Andre Schwarz, Matrix Vision GmbH, andre.schwarz@matrix-vision.de
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <environment.h>
30 DECLARE_GLOBAL_DATA_PTR;
32 static char* entries_to_keep[] = {
33 "serial#", "ethaddr", "eth1addr", "model_info", "sensor_cnt",
34 "fpgadatasize", "ddr_size", "use_dhcp", "use_static_ipaddr",
35 "static_ipaddr", "static_netmask", "static_gateway",
36 "syslog", "watchdog", "netboot", "evo8serialnumber" };
38 #define MV_MAX_ENV_ENTRY_LENGTH 64
39 #define MV_KEEP_ENTRIES ARRAY_SIZE(entries_to_keep)
41 void mv_reset_environment(void)
44 char *s[MV_KEEP_ENTRIES];
45 char entries[MV_KEEP_ENTRIES][MV_MAX_ENV_ENTRY_LENGTH];
47 printf("\n*** RESET ENVIRONMENT ***\n");
49 memset(entries, 0, MV_KEEP_ENTRIES * MV_MAX_ENV_ENTRY_LENGTH);
50 for (i = 0; i < MV_KEEP_ENTRIES; i++) {
51 s[i] = getenv(entries_to_keep[i]);
53 printf("save '%s' : %s\n", entries_to_keep[i], s[i]);
54 strncpy(entries[i], s[i], MV_MAX_ENV_ENTRY_LENGTH);
61 for (i = 0; i < MV_KEEP_ENTRIES; i++) {
63 printf("restore '%s' : %s\n", entries_to_keep[i], s[i]);
64 setenv(entries_to_keep[i], s[i]);
71 int mv_load_fpga(void)
75 void *fpga_data = NULL;
76 char *datastr = getenv("fpgadata");
77 char *sizestr = getenv("fpgadatasize");
79 if (getenv("skip_fpga")) {
80 printf("found 'skip_fpga' -> FPGA _not_ loaded !\n");
83 printf("loading FPGA\n");
86 fpga_data = (void *)simple_strtoul(datastr, NULL, 16);
88 data_size = (size_t)simple_strtoul(sizestr, NULL, 16);
90 printf("fpgadatasize invalid -> FPGA _not_ loaded !\n");
94 result = fpga_load(0, fpga_data, data_size);
96 show_boot_progress(0);
101 u8 *dhcp_vendorex_prep(u8 *e)
105 /* DHCP vendor-class-identifier = 60 */
106 if ((ptr = getenv("dhcp_vendor-class-identifier"))) {
112 /* DHCP_CLIENT_IDENTIFIER = 61 */
113 if ((ptr = getenv("dhcp_client_id"))) {
123 u8 *dhcp_vendorex_proc(u8 *popt)