diff mbox series

keymile: common: fix hexadecimal env variable format

Message ID AM9PR06MB8100BB08B04905C9F2827A40D23B9@AM9PR06MB8100.eurprd06.prod.outlook.com
State Accepted
Commit 0753603e25dff5189ff4ba397b0625cc2d9a16c3
Delegated to: Priyanka Jain
Headers show
Series keymile: common: fix hexadecimal env variable format | expand

Commit Message

Aleksandar Gerasimovski June 4, 2021, 9:25 a.m. UTC
Commit df86d32 breaks linux kernel and product application boot.

Linux kernel and our product application scripts are expecting 0x prefix
for hexadecimal values, while env_set_hex writes them without a prefix.

This patch partially revert env_set_hex usage for affected env variables.

Signed-off-by: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachi-powergrids.com>
---
 board/keymile/common/common.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 2ce7462..016806a 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -46,12 +46,14 @@  int set_km_env(void)
 	unsigned int pram;
 	unsigned int varaddr;
 	unsigned int kernelmem;
-	char *p;
 	unsigned long rootfssize = 0;
+	char envval[16];
+	char *p;
 
 	pnvramaddr = CONFIG_SYS_SDRAM_BASE + gd->ram_size -
 		CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM - CONFIG_KM_PNVRAM;
-	env_set_hex("pnvramaddr", pnvramaddr);
+	sprintf(envval, "0x%x", pnvramaddr);
+	env_set("pnvramaddr", envval);
 
 	/* try to read rootfssize (ram image) from environment */
 	p = env_get("rootfssize");
@@ -64,9 +66,12 @@  int set_km_env(void)
 	varaddr = CONFIG_SYS_SDRAM_BASE + gd->ram_size -
 		CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM;
 	env_set_hex("varaddr", varaddr);
+	sprintf(envval, "0x%x", varaddr);
+	env_set("varaddr", envval);
 
 	kernelmem = gd->ram_size - 0x400 * pram;
-	env_set_hex("kernelmem", kernelmem);
+	sprintf(envval, "0x%x", kernelmem);
+	env_set("kernelmem", envval);
 
 	return 0;
 }