@@ -3627,6 +3627,14 @@ but it can not erase, write this NOR flash by SRIO or PCIE interface.
These two #defines specify the offset and size of the environment
area within the specified MMC device.
+ If offset is positive (the usual case), it is treated as relative to
+ the start of the MMC partition. If offset is negative, it is treated
+ as relative to the end of the MMC partition. This can be useful if
+ your board may be fitted with different MMC devices, which have
+ different sizes for the MMC partitions, and you always want the
+ environment placed at the very end of the partition, to leave the
+ maximum possible space before it, to store other data.
These two values must be aligned to an MMC sector boundary.
- CONFIG_ENV_OFFSET_REDUND (optional):
@@ -3636,6 +3644,9 @@ but it can not erase, write this NOR flash by SRIO or PCIE interface.
valid backup copy in case the other copy is corrupted, e.g. due
to a power failure during a "saveenv" operation.
+ This value may also be positive or negative; this is handled in the
+ same way as CONFIG_ENV_OFFSET.
This value must also be aligned to an MMC sector boundary.
- CONFIG_ENV_SIZE_REDUND (optional):
@@ -53,11 +53,19 @@ DECLARE_GLOBAL_DATA_PTR;
__weak int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr)
- *env_addr = CONFIG_ENV_OFFSET;
+ s64 offset;
+ offset = CONFIG_ENV_OFFSET;
- *env_addr = CONFIG_ENV_OFFSET_REDUND;
+ offset = CONFIG_ENV_OFFSET_REDUND;
+ if (offset < 0)
+ offset += mmc->capacity;
+ *env_addr = offset;