Skip to contentSkip to conversation

board: ae350: Support autoboot from RAM

PATCH In review Leo Yu-Chi Liang 2 participants 2 messages Nov 4, 2021 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: ae350: Support autoboot from RAM

Add boot command "bootcmd_ram" to support autoboot from RAM.

This feature could be useful at the very initial state of chip design when there is only a minimal set of peripheral. (e.g. without mmc and mac ..etc)

The kernel image is default to be loaded at 0x2000000 via debug port, and the following script serves as an example:

spl()

{
	cmd="riscv64-linux-gdb -q \
	-ex \"target remote $host:$port\" \
	-ex \"load\" \
	-ex \"thread apply all set \\\$pc=&_start\" \
	-ex \"thread apply all set \\\$a0=\\\$mhartid\" \
	-ex \"thread apply all set \\\$a1=<dtb address>\" \
	-ex \"restore u-boot.itb binary 0x200000\" \
	-ex \"restore Image binary 0x2000000\" \
	-ex \"c\" \
	spl/u-boot-spl
	"

	echo $cmd
	eval $cmd
}

The address where the kernel is loaded can be altered by changing the value of KERNEL_IMAGE_ADDR.

---
 include/configs/ax25-ae350.h | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
include/configs/ax25-ae350.h +12 -1
index bf3f34e428..1c3f957d32 100644
@@ -119,12 +119,23 @@
 /* Increase max gunzip size */
 #define CONFIG_SYS_BOOTM_LEN	(64 << 20)
 
+/* Support autoboot from RAM (kernel image is loaded via debug port) */
+#define KERNEL_IMAGE_ADDR	"0x2000000 "
+#define BOOTENV_DEV_NAME_RAM(devtypeu, devtypel, instance) \
+	"ram "
+#define BOOTENV_DEV_RAM(devtypeu, devtypel, instance) \
+	"bootcmd_ram=" \
+	"booti " \
+	KERNEL_IMAGE_ADDR \
+	"- $fdtcontroladdr\0"
+
 /* When we use RAM as ENV */
 
 /* Enable distro boot */
 #define BOOT_TARGET_DEVICES(func) \
 	func(MMC, mmc, 0) \
-	func(DHCP, dhcp, na)
+	func(DHCP, dhcp, na) \
+	func(RAM, ram, na)
 #include <config_distro_bootcmd.h>
 
 #define CONFIG_EXTRA_ENV_SETTINGS	\
Signature · 1 line
2.17.0

A message that is not in the archive (sent off-list or not yet received): HK0PR03MB299443FC26A12E8DD511C88AC18D9@HK0PR03MB2994.apcprd03.prod.outlook.com

Reviewed-by
#2 lore raw
Quoted 30 lines

From: Leo Yu-Chi Liang(梁育齊) <[email protected]>
Sent: Thursday, November 04, 2021 9:53 AM
To: [email protected]
Cc: Rick Jian-Zhi Chen(陳建志) <[email protected]>; Leo Yu-Chi Liang(梁育齊) <[email protected]>
Subject: [PATCH 1/1] board: ae350: Support autoboot from RAM

Add boot command "bootcmd_ram" to support autoboot from RAM.

This feature could be useful at the very initial state of chip design when there is only a minimal set of peripheral. (e.g. without mmc and mac ..etc)

The kernel image is default to be loaded at 0x2000000 via debug port, and the following script serves as an example:

spl()

{
        cmd="riscv64-linux-gdb -q \
        -ex \"target remote $host:$port\" \
        -ex \"load\" \
        -ex \"thread apply all set \\\$pc=&_start\" \
        -ex \"thread apply all set \\\$a0=\\\$mhartid\" \
        -ex \"thread apply all set \\\$a1=<dtb address>\" \
        -ex \"restore u-boot.itb binary 0x200000\" \
        -ex \"restore Image binary 0x2000000\" \
        -ex \"c\" \
        spl/u-boot-spl
        "

        echo $cmd
        eval $cmd
}
Quoted 6 lines

The address where the kernel is loaded can be altered by changing the value of KERNEL_IMAGE_ADDR.

---
 include/configs/ax25-ae350.h | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)