Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:techref:bootloader:uboot.config [2018/02/20 20:52] – ↷ Links adapted because of a move operation docs:techref:bootloader:uboot.config [2024/01/01 13:03] (current) – Added content of archive.org web page yemtex
Line 2: Line 2:
 Das U-Boot uses a small amount of space on the flash storage usually on the same partition it is stored on to store some important configuration parameters. This can hardly be compared to NVRAM/TFFS-approach of other bootloaders. It is called the //u-boot environment//. It stores some values like the IP address of the TFTP server (on your PC) to which the the TFTP client (part of U-Boot) will try to connect, etc. Das U-Boot uses a small amount of space on the flash storage usually on the same partition it is stored on to store some important configuration parameters. This can hardly be compared to NVRAM/TFFS-approach of other bootloaders. It is called the //u-boot environment//. It stores some values like the IP address of the TFTP server (on your PC) to which the the TFTP client (part of U-Boot) will try to connect, etc.
  
-You can read and write these values when you are connected to the //U-Boot console// via [[docs:hardware:port.serial|Serial Port]] and also from the CLI once you booted OpenWrt.+You can read and write these values when you are connected to the //U-Boot console// via [[docs:techref:hardware:port.serial|Serial Port]] and also from the CLI once you booted OpenWrt.
  
  
-One of the huge advantages of [[docs:techref:bootloader:uboot|Das U-Boot]] is it'ability for run time configuration. This flexibility is based on being able to easily change environment variables. The environment is usually at the end of the uboot [[docs:techref:flash.layout|partition]]. The //environment variables// are set up in a board specific file, e.g. ''[[https://dev.openwrt.org/browser/trunk/package/uboot-ar71xx/files/include/configs/nbg460n.h|package/uboot-ar71xx/files/include/configs/nbg460n.h]]'' for the [[toh/zyxel/nbg460n|Zyxel NBG 460N/550N/550NH]].+One of the huge advantages of [[docs:techref:bootloader:uboot|Das U-Boot]] is its ability for run time configuration. This flexibility is based on being able to easily change environment variables. The environment is usually at the end of the uboot [[docs:techref:flash.layout|partition]]. The //environment variables// are set up in a board specific file, e.g. ''[[https://dev.openwrt.org/browser/trunk/package/uboot-ar71xx/files/include/configs/nbg460n.h|package/uboot-ar71xx/files/include/configs/nbg460n.h]]'' for the [[toh/zyxel/nbg460n|Zyxel NBG 460N/550N/550NH]].
  
 The location on the flash partition is predefined: The location on the flash partition is predefined:
Line 16: Line 16:
 and copied to RAM when U-Boot starts. and copied to RAM when U-Boot starts.
  
-| {{:meta:icons:tango:dialog-information.png?nolink}} | The U-Boot Environment is protected by a [[wp>Cyclic redundancy check|CRC32]] checksum. \\ See [[http://www.denx.de/wiki/view/DULG/WarningBadCRCUsingDefaultEnvironment|** Warning - bad CRC, using default environment]]  |+| {{:meta:icons:tango:dialog-information.png?nolink}} | The U-Boot Environment is protected by a [[wp>Cyclic redundancy check|CRC32]] checksum. \\ See [[https://web.archive.org/web/20211024121026/http://www.denx.de/wiki/view/DULG/WarningBadCRCUsingDefaultEnvironment|Warning - bad CRC, using default environment]] \\ |
  
 +++++Content of linked page 'Warning - bad CRC, using default environment'| **Question:** \\
 +\\
 +I have ported U-Boot to a custom board. It seems to boot OK, but it prints: \\
 +''Warning - bad CRC, using default environment'' \\
 +Why? \\
 +\\
 +**Answer:** \\
 +\\
 +Most probably everything is OK. The message is printed because the flash sector or ERPROM containing the environment variables has never been initialized yet. The message will go away as soon as you save the envrionment variables using the ''saveenv'' command. ++++
  
 ===== Common variables ===== ===== Common variables =====
Line 40: Line 49:
  
 ===== Accessing U-Boot environment variables in Serial Console ===== ===== Accessing U-Boot environment variables in Serial Console =====
-  * [[docs:hardware:port.serial|Serial Console]]+  * [[docs:techref:hardware:port.serial|Serial Console]]
   * -> [[http://www.denx.de/wiki/view/DULG/UBoot]]\\   * -> [[http://www.denx.de/wiki/view/DULG/UBoot]]\\
     * -> [[http://www.denx.de/wiki/view/DULG/UBootCommandLineInterface|5.9. U-Boot Command Line Interface]]     * -> [[http://www.denx.de/wiki/view/DULG/UBootCommandLineInterface|5.9. U-Boot Command Line Interface]]
Line 104: Line 113:
  
 ===== Accessing U-Boot environment variables in OpenWrt ===== ===== Accessing U-Boot environment variables in OpenWrt =====
-The relevant tools to manipulate the U-Boot environment are contained in the ''[[docs:user-guide:additional-software:opkg]]''-package ''uboot-envtools''+The relevant tools to manipulate the U-Boot environment are contained in the ''[[docs:guide-user:additional-software:opkg]]''-package ''[[packages:pkgdata_lede17_1:uboot-envtools|uboot-envtools]]''
 ^ Package ^ Version ^ Depends ^ Size ^ Description  ^ ^ Package ^ Version ^ Depends ^ Size ^ Description  ^
 | uboot-envtools  |  20081215-2  | zlib  |   7843 | This package includes tools to read (''fw_printenv'') and modify (''fw_setenv'') U-Boot bootloader environment.  | | uboot-envtools  |  20081215-2  | zlib  |   7843 | This package includes tools to read (''fw_printenv'') and modify (''fw_setenv'') U-Boot bootloader environment.  |
Line 196: Line 205:
  
 In above example the boot partition is 2x64KiB ins size, but the booloader console only reports 131068 Bytes which is 4 Bytes short. How can this be? This could be CRC32 value. Furthermore we see, the environment occupies 778Bytes! Now we guess, the environment is located at the end of the partition and the CRC32 is again behind it. So it's offset should be, hmm, hmm, 131.068-778=130.290 and minus 1 because we count the zeros = 130.289 in hex 0x0001FCF1. In above example the boot partition is 2x64KiB ins size, but the booloader console only reports 131068 Bytes which is 4 Bytes short. How can this be? This could be CRC32 value. Furthermore we see, the environment occupies 778Bytes! Now we guess, the environment is located at the end of the partition and the CRC32 is again behind it. So it's offset should be, hmm, hmm, 131.068-778=130.290 and minus 1 because we count the zeros = 130.289 in hex 0x0001FCF1.
-Let's do a [[docs:user-guide:installation:generic.backup|backup]] and look at the content of the whole partition with help of a [[wp>hex editor]]. The assumption was obviously wrong. At the end, there is only FF data at the end.+Let's do a [[docs:guide-user:installation:generic.backup|backup]] and look at the content of the whole partition with help of a [[wp>hex editor]]. The assumption was obviously wrong. At the end, there is only FF data at the end.
  
   * ''[[http://git.denx.de/?p=u-boot.git;a=blob_plain;f=tools/env/README;hb=HEAD|/uboot.source.code/tools/env/README]]''   * ''[[http://git.denx.de/?p=u-boot.git;a=blob_plain;f=tools/env/README;hb=HEAD|/uboot.source.code/tools/env/README]]''
  • Last modified: 2018/02/20 20:52
  • by