如何u-boot的引导程序读取/保存它的环境变量? [英] How u-boot bootloader reads/saves its environment Variables?

查看:384
本文介绍了如何u-boot的引导程序读取/保存它的环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • 的U-Boot引导程序如何读取/保存其环境变量?

  • 我们如何在Flash申报U-Boot的环境变截面的地址?

  • How u-boot bootloader reads/saves its environment Variables ?
  • How we declare address of u-boot environment Variable section in Flash ?

说明这里 U-Boot的环境是一个内存块这是保存在永久存储和复制的U-Boot启动时到RAM中。

什么是意义复制到RAM 的?

的U-boot将复制的环境变量的内存块RAM?

U-boot will copy block of memory of environment variables to RAM ?

感谢

推荐答案

是,U-boot的将环境变量的内存块复制到RAM中。

Yes, U-boot will copy block of memory of environment variables to RAM.

永久存储,其中块的来源,是特定于平台。一些常见的存储选项(和源文件处理的存储选件):

The persistent storage, where the block comes from, is platform-specific. Some common storage options (and source file handling that storage option):

NOR flash   common/env_flash.c
SPI flash   common/env_sf.c
MMC         common/env_mmc.c

CONFIG_定义包括/ CONFIGS / yourboard.h将决定细节。例如,对于SPI闪存映射存储器顶部,也许:

CONFIG_ definitions in include/configs/yourboard.h will determine the details. For example, for SPI flash mapped at top of memory, maybe:

#define CONFIG_ENV_IS_IN_SPI_FLASH
#define CONFIG_ENV_SIZE    0x00001000
#define CONFIG_ENV_ADDR    0xFFFFF000

CONFIG_ENV_ADDR是Flash U-Boot的环境变截面的地址。

CONFIG_ENV_ADDR is address of u-boot environment Variable section in Flash.

需要注意的是u-boot的写作环境,持久性存储,当本节,将自动创建一个CRC32。当在启动时读取环境CRC检查。如果CRC校验不通过,存储的环境不使用;而不是一个新的缺省环境硬coded到程序code时,这是一个特例。

Note that u-boot automatically creates a CRC32 over this section when writing the environment to persistent storage. That CRC is checked when environment is read on startup. If CRC check does not pass, the stored environment is not used; instead a new default environment hardcoded into the program code is used, that is a special case.

在U-Boot的初始化,环境变量导入到一个哈希表。在操作中,所有的读/写操作,而所有的printenv」(显示环境变量)和SETENV(设置环境变量)命令使用这些表条目。任何更改都得救,直到命令saveenv完成后,其写入到永久存储。

During U-Boot initialization, the environment variables are imported into a hash table. In operation, all read/write operations, and all "printenv" (display environment variable) and "setenv" (set environment variable) commands use those table entries. Any changes are unsaved until command "saveenv" is done, which writes to the persistent storage.

有关更多信息,请参阅的的u-boot /普通/ cmd_nvedit.c 14-24行和的的u-boot / README 线3474-3881(行号是v2013.10)。

For more info, see u-boot/common/cmd_nvedit.c lines 14-24 and u-boot/README lines 3474-3881 (line numbers are for v2013.10).

这篇关于如何u-boot的引导程序读取/保存它的环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆