2 * (C) Copyright 2009 mGine co.
3 * unsik Kim <donari75@gmail.com>
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>
27 #include <linux/stddef.h>
30 /* references to names in env_common.c */
31 extern uchar default_environment
[];
32 extern int default_environment_size
;
34 char * env_name_spec
= "MG_DISK";
38 DECLARE_GLOBAL_DATA_PTR
;
40 uchar
env_get_char_spec(int index
)
42 return (*((uchar
*) (gd
->env_addr
+ index
)));
45 void env_relocate_spec(void)
51 puts ("*** Warning - mg_disk_init error");
54 err
= mg_disk_read(CONFIG_ENV_ADDR
, (u_char
*)env_ptr
, CONFIG_ENV_SIZE
);
56 puts ("*** Warning - mg_disk_read error");
60 if (crc32(0, env_ptr
->data
, ENV_SIZE
) != env_ptr
->crc
) {
61 puts ("*** Warning - CRC error");
68 printf (", using default environment\n\n");
76 env_ptr
->crc
= crc32(0, env_ptr
->data
, ENV_SIZE
);
77 err
= mg_disk_write(CONFIG_ENV_ADDR
, (u_char
*)env_ptr
,
80 puts ("*** Warning - mg_disk_write error\n\n");
88 gd
->env_addr
= (ulong
) & default_environment
[0];