uboot 启动 linux ----2 ----set setevn saveenv 命令 保存介质

uboot 官方学习文档 http://www.denx.de/wiki/DULG/Manual

=> help setenv setenv - set environment variables Usage: setenv name value ... - set environment variable 'name' to 'value ...' setenv name - delete environment variable 'name' =>

To modify the U-Boot environment you have to use the setenv command. When called with exactly one argument, it will delete any variable of that name from U-Boot's environment, if such a variable exists. Any storage occupied for such a variable will be automatically reclaimed:

=> setenv foo This is an example value. => printenv foo foo=This is an example value. => setenv foo => printenv foo ## Error: "foo" not defined =>U_BOOT_CMD_COMPLETE(
 setenv, CONFIG_SYS_MAXARGS, 0, do_env_set,
 "set environment variables",
 "name value ...\n"
 "    - set environment variable 'name' to 'value ...'\n"
 "setenv name\n"
 "    - delete environment variable 'name'",
 var_complete
);do_env_set()       

 

如果uboot代码里面实现了saveenv,那么在setenv后,可以用saveenv去将所有的变量都存储起来。具体存到哪里,要根据是uboot中的定义决定。比如
     #define CONFIG_ENV_IS_IN_SPI_flash       就是定义成存储环境变量到SPI Flash里面。

#ifdef CONFIG_SPI_BOOT
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_CMD_SAVEENV 
  #define CONFIG_ENV_SECT_SIZE  0x10000
 #define CONFIG_ENV_OFFSET           0x1f0000


#elif defined CONFIG_NAND_BOOT
 #define CONFIG_ENV_IS_IN_AML_NAND
 #define CONFIG_CMD_SAVEENV
 #define CONFIG_ENV_OVERWRITE 
 #define CONFIG_ENV_OFFSET       0x400000
 #define CONFIG_ENV_BLOCK_NUM    2


#elif defined CONFIG_MMC_BOOT
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_CMD_SAVEENV
    #define CONFIG_SYS_MMC_ENV_DEV        0 
 #define CONFIG_ENV_OFFSET       0x1000000  
#else
 #define CONFIG_ENV_IS_NOWHERE    1
#endif

你可能感兴趣的:(飞思卡尔,I.MX6Q)