u-boot/board/Marvell
Derek LaHousse 3a68fda33f arm: mvebu: Espressobin: Fix default env variables
Default env variables on Espressobin boards are broken since commit c4df0f6f31
("arm: mvebu: Espressobin: Set default value for $fdtfile env variable") as well
as the 'env default -a' command.

The algorithm to find free space in the default_environment[] array returns
after the first env variable instead of the correct position of the last
variable, where there is allocated free space.

This causes that U-Boot board_late_init() function to overwrite a portion of the
default environment with $ethXaddr and $fdtfile variables immediately after the
first env variable and so it is overwriting other variables.

This patch also adds an additional null byte to terminate the environment array.

But U-Boot board_late_init() function do not fill this nul byte explicitly. And
because of that, U-Boot is later trying to interpret remaining buffer as a
continuation of variable list. Normally buffer should be empty but due to the
above issue, it contains garbage from remaining env variables.

For example 'env default -a' command results in damaging variable names. It was
observed that scritaddr variable name was changed to criptaddr (without leading
's').

This bug was reported and discussed on the Armbian forum:
https://forum.armbian.com/topic/19564-making-espressobin-v7-work-in-2022/?do=findComment&comment=138136

Fix these issues in two steps:

1) Change code which finds free space for dynamic env variables in
default_environment[] array by jumping to the end of the variable list instead
of jumping after the first defined variable. [By Derek]

2) Add code which appends terminating nul byte as indication of the end of the
env list, after the last nul term env string. [By Pali]

Fixes: c4df0f6f31 ("arm: mvebu: Espressobin: Set default value for $fdtfile env variable")
Signed-off-by: Derek LaHousse <derek@seaofdirac.org>
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Stefan Roese <sr@denx.de>
2022-12-12 07:36:04 +01:00
..
db-88f6720 common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
db-88f6820-amc ddr: marvell: a38x: add support for twin-die combined memory device 2021-02-26 10:22:29 +01:00
db-88f6820-gp Makefile: Rename u-boot-spl.kwb to u-boot-with-spl.kwb 2022-11-07 07:17:55 +01:00
db-mv784mp-gp common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
db-xc3-24g4xg common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
dreamplug arm: kirkwood: Dreamplug : Use Marvell uclass mvgbe and PHY driver for Ethernet 2022-02-10 07:12:16 +01:00
guruplug WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
mvebu_alleycat-5 arm: mvebu: Add RD-AC5X board 2022-11-07 07:46:28 +01:00
mvebu_armada-8k arm: mvebu: mvebu_armada-8k: drop Puzzle M801 early init code 2021-10-08 08:37:55 +02:00
mvebu_armada-37xx arm: mvebu: Espressobin: Fix default env variables 2022-12-12 07:36:04 +01:00
octeon_ebb7304 fdt_support: Add fdt_for_each_node_by_compatible() helper macro 2022-01-20 11:35:29 +01:00
octeon_nic23 mips: octeon_nic23: Add PCIe FLR fixup via cyclic infrastructure 2022-09-13 16:01:44 -04:00
octeontx doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
octeontx2 doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
octeontx2_cn913x arm: octeontx2: Add Octeon TX2 CN913x DB support 2021-05-16 06:48:45 +02:00
openrd Convert CONFIG_88F5182 et al to Kconfig 2021-12-27 16:20:19 -05:00
sheevaplug arm: kirkwood: Sheevaplug : Use Marvell uclass mvgbe and PHY driver for Ethernet 2022-04-21 13:14:52 +02:00