"Robert P. J. Day" <rpj...@crashcourse.ca> writes: > oh, wait, i think i just answered some of my questions based on this > snippet from common/env_nvram.c: > > /* > * Initialize Environment use > * > * We are still running from ROM, so data use is limited > */ > int env_init(void) > { > #if defined(CONFIG_SYS_NVRAM_ACCESS_ROUTINE) > ulong crc; > uchar data[ENV_SIZE]; > > nvram_read(&crc, CONFIG_ENV_ADDR, sizeof(ulong)); > nvram_read(data, CONFIG_ENV_ADDR + sizeof(ulong), ENV_SIZE); > > if (crc32(0, data, ENV_SIZE) == crc) { > gd->env_addr = (ulong)CONFIG_ENV_ADDR + sizeof(long); > #else > if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) { > gd->env_addr = (ulong)&env_ptr->data; > #endif > gd->env_valid = 1; > } else { > gd->env_addr = (ulong)&default_environment[0]; > gd->env_valid = 0; > } > > return 0; > } > > so if there is a valid environment at the address specified by the > board header file, it's used, otherwise fall back to > default_environment[]. i had suspected it was something like that, i > just hadn't found the code yet. > > is this written up somewhere?
Looks like you found your answer, at least in part. The environment is stored in one of many possible locations, see the various env_*.c files. Which one is used is determined by the board configuration. > p.s. how does the default environment get to the CONFIG_ENV_ADDR > defined in the board header file? is that done automatically when > u-boot starts to run and notices that there is no valid environment > info at that address, and therefore copies it for you? If the stored environment is invalid (e.g. uninitialised), the built-in default is used. Nothing is written until you issue a saveenv command. This saves a copy of the live environment to the configured location. -- Måns Rullgård _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot