From 6516e51970deea70b79ebff44ad704b2be08e3fb Mon Sep 17 00:00:00 2001
From: Josua Mayer <josua@solid-run.com>
Date: Sun, 20 Mar 2022 15:02:03 +0200
Subject: [PATCH] octeontx2_cn913x: support distro-boot

Signed-off-by: Josua Mayer <josua@solid-run.com>
---
 configs/sr_cn913x_cex7_defconfig   |  1 -
 include/configs/octeontx2_cn913x.h | 12 ++++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/configs/sr_cn913x_cex7_defconfig b/configs/sr_cn913x_cex7_defconfig
index f971d9d4d0..30e51c0026 100644
--- a/configs/sr_cn913x_cex7_defconfig
+++ b/configs/sr_cn913x_cex7_defconfig
@@ -11,7 +11,6 @@ CONFIG_DEBUG_UART=y
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
-CONFIG_BOOTCOMMAND="run get_images; run set_bootargs; booti $kernel_addr $ramfs_addr $fdt_addr"
 CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_CPUINFO is not set
diff --git a/include/configs/octeontx2_cn913x.h b/include/configs/octeontx2_cn913x.h
index 2ae70e5efe..aa966bd292 100644
--- a/include/configs/octeontx2_cn913x.h
+++ b/include/configs/octeontx2_cn913x.h
@@ -35,6 +35,18 @@
 	func(PXE, pxe, na) \
 	func(DHCP, dhcp, na)
 
+#include <config_distro_bootcmd.h>
+
+#undef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"console=" CONFIG_DEFAULT_CONSOLE "\0"\
+	"kernel_addr_r=0x7000000\0" \
+	"fdt_addr_r=0x6f00000\0" \
+	"ramdisk_addr_r=0x9000000\0" \
+	"scriptaddr=0x6e00000\0" \
+	"pxefile_addr_r=0x6000000\0" \
+	BOOTENV
+
 /* RTC configuration */
 #ifdef CONFIG_MARVELL_RTC
 #define ERRATA_FE_3124064
