<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/env, branch next</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>env: Make use of IF_ENABLED_INT in spi flash support</title>
<updated>2026-04-03T19:42:49+00:00</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2026-03-20T20:53:39+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=c1e17ac28466f9ba68cb65daa9d7f8b4b3ae0a25'/>
<id>c1e17ac28466f9ba68cb65daa9d7f8b4b3ae0a25</id>
<content type='text'>
In order to build the spi flash environment driver, but with
CONFIG_ENV_REDUNDANT disabled we must make use of IF_ENABLED_INT to
check for a value in CONFIG_ENV_OFFSET_REDUND otherwise we will fail to
build.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to build the spi flash environment driver, but with
CONFIG_ENV_REDUNDANT disabled we must make use of IF_ENABLED_INT to
check for a value in CONFIG_ENV_OFFSET_REDUND otherwise we will fail to
build.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>env: Correct dependency for ENV_IS_IN_NAND</title>
<updated>2026-04-03T19:42:32+00:00</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2026-03-20T20:53:37+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=0a0c3a400180a9d17d50bb9b29921b5c898104c2'/>
<id>0a0c3a400180a9d17d50bb9b29921b5c898104c2</id>
<content type='text'>
In order to have ENV_IS_IN_NAND be valid we must have MTD_RAW_NAND
enabled as a minimum, express this dependency in Kconfig.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to have ENV_IS_IN_NAND be valid we must have MTD_RAW_NAND
enabled as a minimum, express this dependency in Kconfig.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>env: flash: add catch-all for unrecognized flags in env_flash_init()</title>
<updated>2026-04-02T16:18:50+00:00</updated>
<author>
<name>Neil Berkman</name>
<email>neil@xuku.com</email>
</author>
<published>2026-03-18T21:15:15+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=ff7039032b7de3549b9b287b2c000c9e96c60380'/>
<id>ff7039032b7de3549b9b287b2c000c9e96c60380</id>
<content type='text'>
When both environment copies have valid CRCs but the flag bytes do not
match any recognized pair, env_flash_init() falls through without
setting gd-&gt;env_addr or gd-&gt;env_valid. This is a problem because:

1. env_init() then sets gd-&gt;env_addr = &amp;default_environment (in RAM).

2. In env_flash_load(), the pointer comparison
   gd-&gt;env_addr != &amp;flash_addr-&gt;data evaluates true (RAM != flash),
   triggering the pointer swap that selects the secondary copy.

3. The repair logic writes OBSOLETE (0x00) to the non-active flag but
   cannot promote the other flag from 0x00 to ACTIVE (0x01) because
   NOR flash requires a sector erase to set bits. Both copies end up
   with flag=0x00.

4. On every subsequent boot, flag1 == flag2 triggers the ENV_REDUND
   path, printing a spurious "recovered successfully" warning until
   an explicit saveenv erases and rewrites the sectors.

The recognized flag values are ACTIVE (0x01), OBSOLETE (0x00), and
erased (0xFF). Of the 256 possible flag values, the existing chain of
if/else-if handles only three: 253 of 256 values fall through without
setting gd-&gt;env_addr. Combined with 0x00 (already stuck on NOR),
254 of 256 values eventually reach the persistent-warning state.

Other env backends (SPI flash, NAND, MMC) handle this through
env_check_redund() in env/common.c, which uses a numeric comparison
of the flags as a serial counter and always reaches a decision. The
CFI flash backend is the only one that uses its own flag-matching
logic.

Add a catch-all else clause that defaults to the primary copy with
ENV_REDUND status, matching the existing behavior for the flag1==flag2
case. This ensures gd-&gt;env_addr is always set, preventing the
unintended pointer swap. The condition is recoverable via saveenv.

Signed-off-by: Neil Berkman &lt;neil@xuku.com&gt;

Reproducer: https://gist.github.com/neilberkman/4155612a7942d3f510f204eb85e61943

The SPI flash backend (env/sf.c) has a related but distinct issue:
it retained legacy boolean save semantics but its load path now uses
the common serial-number logic in env_check_redund(), creating an
inconsistency under interrupted updates. That has wider implications
for fw_env.c and would need separate discussion.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When both environment copies have valid CRCs but the flag bytes do not
match any recognized pair, env_flash_init() falls through without
setting gd-&gt;env_addr or gd-&gt;env_valid. This is a problem because:

1. env_init() then sets gd-&gt;env_addr = &amp;default_environment (in RAM).

2. In env_flash_load(), the pointer comparison
   gd-&gt;env_addr != &amp;flash_addr-&gt;data evaluates true (RAM != flash),
   triggering the pointer swap that selects the secondary copy.

3. The repair logic writes OBSOLETE (0x00) to the non-active flag but
   cannot promote the other flag from 0x00 to ACTIVE (0x01) because
   NOR flash requires a sector erase to set bits. Both copies end up
   with flag=0x00.

4. On every subsequent boot, flag1 == flag2 triggers the ENV_REDUND
   path, printing a spurious "recovered successfully" warning until
   an explicit saveenv erases and rewrites the sectors.

The recognized flag values are ACTIVE (0x01), OBSOLETE (0x00), and
erased (0xFF). Of the 256 possible flag values, the existing chain of
if/else-if handles only three: 253 of 256 values fall through without
setting gd-&gt;env_addr. Combined with 0x00 (already stuck on NOR),
254 of 256 values eventually reach the persistent-warning state.

Other env backends (SPI flash, NAND, MMC) handle this through
env_check_redund() in env/common.c, which uses a numeric comparison
of the flags as a serial counter and always reaches a decision. The
CFI flash backend is the only one that uses its own flag-matching
logic.

Add a catch-all else clause that defaults to the primary copy with
ENV_REDUND status, matching the existing behavior for the flag1==flag2
case. This ensures gd-&gt;env_addr is always set, preventing the
unintended pointer swap. The condition is recoverable via saveenv.

Signed-off-by: Neil Berkman &lt;neil@xuku.com&gt;

Reproducer: https://gist.github.com/neilberkman/4155612a7942d3f510f204eb85e61943

The SPI flash backend (env/sf.c) has a related but distinct issue:
it retained legacy boolean save semantics but its load path now uses
the common serial-number logic in env_check_redund(), creating an
inconsistency under interrupted updates. That has wider implications
for fw_env.c and would need separate discussion.
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace TARGET namespace and cleanup properly</title>
<updated>2026-02-14T17:06:46+00:00</updated>
<author>
<name>Tien Fong Chee</name>
<email>tien.fong.chee@altera.com</email>
</author>
<published>2026-02-13T12:27:23+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=62f7a94602094617ac384839ed695c2906893a88'/>
<id>62f7a94602094617ac384839ed695c2906893a88</id>
<content type='text'>
TARGET namespace is for machines / boards / what-have-you that
building U-Boot for. Simply replace from TARGET to ARCH
make things more clear and proper for ALL SoCFPGA.

Signed-off-by: Brian Sune &lt;briansune@gmail.com&gt;
Reviewed-by: Tien Fong Chee &lt;tien.fong.chee@altera.com&gt;

# Conflicts:
#	drivers/ddr/altera/Makefile
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
TARGET namespace is for machines / boards / what-have-you that
building U-Boot for. Simply replace from TARGET to ARCH
make things more clear and proper for ALL SoCFPGA.

Signed-off-by: Brian Sune &lt;briansune@gmail.com&gt;
Reviewed-by: Tien Fong Chee &lt;tien.fong.chee@altera.com&gt;

# Conflicts:
#	drivers/ddr/altera/Makefile
</pre>
</div>
</content>
</entry>
<entry>
<title>env: Add single to redundant environment upgrade path</title>
<updated>2026-01-07T18:31:26+00:00</updated>
<author>
<name>Marek Vasut</name>
<email>marek.vasut+renesas@mailbox.org</email>
</author>
<published>2025-12-23T14:31:11+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=1f131385810fddaeea23c5cf0269497d7e637534'/>
<id>1f131385810fddaeea23c5cf0269497d7e637534</id>
<content type='text'>
Add support for converting single-copy environment to redundant environment.
In case CRC checks on both redundant environment copies fail, try one more
CRC check on the primary environment copy and treat it as single environment.
If that check does pass, rewrite the single-copy environment into redundant
environment format, indicate the environment is valid, and import that as
usual primary copy of redundant environment. Follow up 'env save' will then
store two environment copies and the system will continue to operate as
regular redundant environment system.

Add test which validates this upgrade path. The test starts with spi.bin
which is pre-populated as single-copy environment and then upgrades that
environment to dual-copy environment.

Signed-off-by: Marek Vasut &lt;marek.vasut+renesas@mailbox.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add support for converting single-copy environment to redundant environment.
In case CRC checks on both redundant environment copies fail, try one more
CRC check on the primary environment copy and treat it as single environment.
If that check does pass, rewrite the single-copy environment into redundant
environment format, indicate the environment is valid, and import that as
usual primary copy of redundant environment. Follow up 'env save' will then
store two environment copies and the system will continue to operate as
regular redundant environment system.

Add test which validates this upgrade path. The test starts with spi.bin
which is pre-populated as single-copy environment and then upgrades that
environment to dual-copy environment.

Signed-off-by: Marek Vasut &lt;marek.vasut+renesas@mailbox.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>env: fat, ubi: Fix gd-&gt;env_valid for the first write</title>
<updated>2025-10-24T19:47:50+00:00</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2025-10-21T20:37:01+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=cf262e16080abcd587f47d0bbc8fa84558abcf89'/>
<id>cf262e16080abcd587f47d0bbc8fa84558abcf89</id>
<content type='text'>
As resolved and explained in detail in commit e589d5822cac ("env: spi:
Fix gd-&gt;env_valid for the first write") and archived discussion there is
a corner case where we don't do the right thing with redundant
environments. This same exact check was present in the mmc code and
resolved with commit 813a0df27a8a ("env: Invert gd-&gt;env_valid for
env_mmc_save") and in the discussion of that patch, I noted that both
fat and ubi (and at the time, sf) were doing the same thing. Take the
time now to correct fat and ubi environment.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As resolved and explained in detail in commit e589d5822cac ("env: spi:
Fix gd-&gt;env_valid for the first write") and archived discussion there is
a corner case where we don't do the right thing with redundant
environments. This same exact check was present in the mmc code and
resolved with commit 813a0df27a8a ("env: Invert gd-&gt;env_valid for
env_mmc_save") and in the discussion of that patch, I noted that both
fat and ubi (and at the time, sf) were doing the same thing. Take the
time now to correct fat and ubi environment.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>env: Invert gd-&gt;env_valid for env_mmc_save</title>
<updated>2025-10-21T19:18:46+00:00</updated>
<author>
<name>Jasper Orschulko</name>
<email>jasper@fancydomain.eu</email>
</author>
<published>2024-05-10T11:38:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=813a0df27a8af587bd25a6a4719f68066b370091'/>
<id>813a0df27a8af587bd25a6a4719f68066b370091</id>
<content type='text'>
The A/B update strategy of the env's has a gap in the first 2 calls of saveenv.
The env's are stored twice on the first memory area if:
gd-&gt;env_valid == ENV_INVALID.

u-boot=&gt; saveenv
Saving Environment to MMC... Writing to MMC(1)... OK
u-boot=&gt; saveenv
Saving Environment to MMC... Writing to MMC(1)... OK  &lt;-- !!!
u-boot=&gt; saveenv
Saving Environment to MMC... Writing to redundant MMC(1)... OK
u-boot=&gt; saveenv
Saving Environment to MMC... Writing to MMC(1)... OK

This is the same issue as resolved in commit e589d5822cac ("env: spi:
Fix gd-&gt;env_valid for the first write")

Signed-off-by: Michael Glembotzki &lt;Michael.Glembotzki@iris-sensing.com&gt;
Signed-off-by: Jasper Orschulko &lt;jasper@fancydomain.eu&gt;
Signed-off-by: Michael Heimpold &lt;mhei@heimpold.de&gt;
[trini: Amend the commit message]
---
Changes in v2:
- Rebase to current master
- Amend the commit message to reference the SPI version of this fix,
  which had significant follow-up discussion.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The A/B update strategy of the env's has a gap in the first 2 calls of saveenv.
The env's are stored twice on the first memory area if:
gd-&gt;env_valid == ENV_INVALID.

u-boot=&gt; saveenv
Saving Environment to MMC... Writing to MMC(1)... OK
u-boot=&gt; saveenv
Saving Environment to MMC... Writing to MMC(1)... OK  &lt;-- !!!
u-boot=&gt; saveenv
Saving Environment to MMC... Writing to redundant MMC(1)... OK
u-boot=&gt; saveenv
Saving Environment to MMC... Writing to MMC(1)... OK

This is the same issue as resolved in commit e589d5822cac ("env: spi:
Fix gd-&gt;env_valid for the first write")

Signed-off-by: Michael Glembotzki &lt;Michael.Glembotzki@iris-sensing.com&gt;
Signed-off-by: Jasper Orschulko &lt;jasper@fancydomain.eu&gt;
Signed-off-by: Michael Heimpold &lt;mhei@heimpold.de&gt;
[trini: Amend the commit message]
---
Changes in v2:
- Rebase to current master
- Amend the commit message to reference the SPI version of this fix,
  which had significant follow-up discussion.
</pre>
</div>
</content>
</entry>
<entry>
<title>env: Kconfig: disable external env in secure os boot</title>
<updated>2025-10-16T21:02:14+00:00</updated>
<author>
<name>Anshul Dalal</name>
<email>anshuld@ti.com</email>
</author>
<published>2025-10-09T12:34:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=1e470ddd0743bbd1f229421e11e9ad2093f7fd20'/>
<id>1e470ddd0743bbd1f229421e11e9ad2093f7fd20</id>
<content type='text'>
Falcon mode uses falcon_image_file from the env during mmc fs boot, but
external env can be compromised. Therefore disable access to external
env by setting SPL_ENV_IS_NOWHERE when SPL_OS_BOOT_SECURE is set.

Signed-off-by: Anshul Dalal &lt;anshuld@ti.com&gt;
Reviewed-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Falcon mode uses falcon_image_file from the env during mmc fs boot, but
external env can be compromised. Therefore disable access to external
env by setting SPL_ENV_IS_NOWHERE when SPL_OS_BOOT_SECURE is set.

Signed-off-by: Anshul Dalal &lt;anshuld@ti.com&gt;
Reviewed-by: Tom Rini &lt;trini@konsulko.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'next'</title>
<updated>2025-10-06T19:20:24+00:00</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2025-10-06T19:20:24+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=0eaa4b337336dbbe93395d1f2ccc18937eaafea2'/>
<id>0eaa4b337336dbbe93395d1f2ccc18937eaafea2</id>
<content type='text'>
Merge the outstanding changes from the 'next' branch to master.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Merge the outstanding changes from the 'next' branch to master.
</pre>
</div>
</content>
</entry>
<entry>
<title>env: fix typo in multiple Kconfig descriptions</title>
<updated>2025-10-04T18:15:57+00:00</updated>
<author>
<name>Thomas Bonnefille</name>
<email>thomas.bonnefille@bootlin.com</email>
</author>
<published>2025-09-24T19:21:51+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=3bbaa9dca65f7133ed54102126861ff4037d88cd'/>
<id>3bbaa9dca65f7133ed54102126861ff4037d88cd</id>
<content type='text'>
%s/environemt/environment

Signed-off-by: Thomas Bonnefille &lt;thomas.bonnefille@bootlin.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
%s/environemt/environment

Signed-off-by: Thomas Bonnefille &lt;thomas.bonnefille@bootlin.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
