97 struct partition_block
98 {
99 u32 id;
100 u32 summed_longs;
101 s32 chk_sum;
102 u32 host_id;
103 u32 next;
104 u32 flags;
105 u32 reserved_1[2];
106 u32 dev_flags;
107 char drive_name[32];
108 u32 reserved_2[15];
109 u32 environment[17];
110 u32 reserved_3[15];
111 };
environment 是在上上面的函数定义的
如果初始化成功则 gd->env_valid = 1;
则后面不会出现 *** Warning - bad CRC, using default environment 可是我到现在还没找到初始化他的程序。
env_relocate (); 设置环境变量
194 void env_relocate (void)
195 {
196 DEBUGF ("%s[%d] offset = 0x%lx\n", __FUNCTION__,__LINE__,
197 gd->reloc_off);
198
199 #ifdef CONFIG_AMIGAONEG3SE
200 enable_nvram();
201 #endif
202
203 #ifdef ENV_IS_EMBEDDED
204 /*
205 * The environment buffer is embedded with the text segment,
206 * just relocate the environment pointer
207 */
208 env_ptr = (env_t *)((ulong)env_ptr + gd->reloc_off);
209 DEBUGF ("%s[%d] embedded ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
210 #else
211 /*
212 * We must allocate a buffer for the environment
213 */
214 env_ptr = (env_t *)malloc (CFG_ENV_SIZE);
215 DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
216 #endif
217
218 /*
219 * After relocation to RAM, we can always use the "memory" functions
220 */
221 env_get_char = env_get_char_memory;
222
223 if (gd->env_valid == 0) {
224 #if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */
225 puts ("Using default environment\n\n");
226 #else
227 puts ("*** Warning - bad CRC, using default environment\n\n");
228 show_boot_progress (-60);
229 #endif
230
231 if (sizeof(default_environment) > ENV_SIZE)
232 {
233 puts ("*** Error - default environment is too large\n\n");
234 return;
235 }
236
237 memset (env_ptr, 0, sizeof(env_t));
238 memcpy (env_ptr->data,
239 default_environment,
240 sizeof(default_environment));
241 #ifdef CFG_REDUNDAND_ENVIRONMENT
242 env_ptr->flags = 0xFF;
243 #endif
244 env_crc_update ();
245 gd->env_valid = 1;
246 }
247 else {
248 env_relocate_spec ();
249 }
250 gd->env_addr = (ulong)&(env_ptr->data);
251
252 #ifdef CONFIG_AMIGAONEG3SE
2 #ifdef CONFIG_AMIGAONEG3SE
253 disable_nvram();
254 #endif
255 } |