P.S. mis-spoke should have written "Having 'env load' allows to skip that reboot step in-between
On Wed, Apr 17, 2024 at 12:28 PM E Shattow <luc...@gmail.com> wrote: > > On Wed, Apr 17, 2024 at 1:22 AM Heinrich Schuchardt > <heinrich.schucha...@canonical.com> wrote: > > > > On 17.04.24 03:41, E Shattow wrote: > > > Successful in use w/ 'tio' serial tool and Adafruit CP2102N Friend > > > adapter on Mars CM Lite board in DFRobot mini router carrier. > > > > > > While SPL and u-boot.itb payload are sourced via UART the environment > > > variables are from the environment variable storage as-is. This makes > > > sense in the use case for development but may have side-effects in the > > > case of U-Boot as a JH7110 recovery tool. There is now 'env default -f > > > -a' which does not purge non-default variables and retains the > > > non-default variables when migrating from vendor firmware. Consider to > > > also build for U-Boot the commands that can aid in cleaning the stored > > > environment variable state CONFIG_CMD_ERASEENV=y and in-memory state > > > CONFIG_CMD_NVEDIT_LOAD=y. With these it can be done easily with: 'env > > > erase; env load; env save'. > > > > Thank you for testing. > > > > After erasing there is no need to save the environment. If there is no > > environment on flash, the default will be loaded anyway: > > > > *** Warning - bad CRC, using default environment > > > > Instead of 'env erase' you could use 'sf erase 0xf0000 0x1000' which is > > already available. As adding CONFIG_CMD_ERASEENV=y is not necessary in > > the scope of this patch series I would prefer leaving it to future > > discussion. > > > > Best regards > > > > Heinrich > > > > The 'env erase; env load; env save' can be done at the same session > just before recovery write to provide a sanitized environment with the > defaults of the present U-Boot payload loaded via UART, so is not the > same as 'sf erase ...' waiting for a reboot (5 minutes more to > transfer via UART at 115200 baud) and needing to interrupt the boot to > further 'env save'. Having 'env load' allows to allow that reboot step > in-between. Point taken though, it's helpful for recovery but not > required. -E