Skip to contentSkip to conversation

aspeed: Use FIT-provided ramdisk if available

PATCH In review Rick Altherr 3 participants 7 messages Jan 12, 2017 – Jan 19, 2017

lore
Share & tools
lore
#0 lore raw

cover aspeed: Use FIT-provided ramdisk if available

Changes the default boot command on Aspeed SoCs to use a ramdisk from the kernel's FIT image, if available, and fallback to loading a separate ramdisk image from a fixed flash location if not. Supporting both allows for an upgrade path while the ramdisk location is changed.

Rick Altherr (2):
aspeed: Use HUSH shell
aspeed: use FIT-provided ramdisk if available

 configs/ast_g4_ncsi_defconfig | 1 +
 configs/ast_g4_phy_defconfig  | 1 +
 configs/ast_g5_ncsi_defconfig | 1 +
 configs/ast_g5_phy_defconfig  | 1 +
 include/configs/ast-common.h  | 6 +++++-
 5 files changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.11.0.390.gc69c2f50cf-goog
#1 lore raw

PATCH 1/2 aspeed: Use HUSH shell

HUSH is the newer command-line interface that provides scripting capabilities. Those are needed for an boot command that can boot either a FIT image that includes a ramdisk or a separate kernel and ramdisk.

---

 configs/ast_g4_ncsi_defconfig | 1 +
 configs/ast_g4_phy_defconfig  | 1 +
 configs/ast_g5_ncsi_defconfig | 1 +
 configs/ast_g5_phy_defconfig  | 1 +
 4 files changed, 4 insertions(+)
configs/ast_g4_ncsi_defconfig +1 -0
index ab4907cfe2..54686bee5c 100644
@@ -7,6 +7,7 @@ CONFIG_CMD_PING=y
 CONFIG_EFI_LOADER=n
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_HUSH_PARSER=y
 CONFIG_OF_LIBFDT=y
 CONFIG_SPI_FLASH=y
 CONFIG_SYS_NS16550=y
configs/ast_g4_phy_defconfig +1 -0
index 21a56c4b96..f8db39ef13 100644
@@ -8,6 +8,7 @@ CONFIG_CMD_PING=y
 CONFIG_EFI_LOADER=n
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_HUSH_PARSER=y
 CONFIG_OF_LIBFDT=y
 CONFIG_SPI_FLASH=y
 CONFIG_SYS_NS16550=y
configs/ast_g5_ncsi_defconfig +1 -0
index 7cd4fd116d..74029ed514 100644
@@ -7,6 +7,7 @@ CONFIG_CMD_PING=y
 CONFIG_EFI_LOADER=n
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_HUSH_PARSER=y
 CONFIG_OF_LIBFDT=y
 CONFIG_SPI_FLASH=y
 CONFIG_SYS_NS16550=y
configs/ast_g5_phy_defconfig +1 -0
index c686dd2297..767f3af605 100644
@@ -8,6 +8,7 @@ CONFIG_CMD_PING=y
 CONFIG_EFI_LOADER=n
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_HUSH_PARSER=y
 CONFIG_OF_LIBFDT=y
 CONFIG_SPI_FLASH=y
 CONFIG_SYS_NS16550=y
Signature · 1 line
2.11.0.390.gc69c2f50cf-goog
#2 lore raw

Re: [U-Boot,1/2] aspeed: Use HUSH shell

Hi Rick,

Quoted 3 lines · Rick Altherr

HUSH is the newer command-line interface that provides scripting capabilities. Those are needed for an boot command that can boot either a FIT image that includes a ramdisk or a separate kernel and ramdisk.

For some reason this patch didn't arrive in my mailbox. I found it on patchwork.

I took at look at the code size change with enabling this:

$ size u-boot && ls -la u-boot.bin
   text    data     bss     dec     hex filename
 215567    7152   71048  293767   47b87 u-boot
-rw-r--r-- 1 joel joel 222536 Dec  8 12:03 u-boot.bin
$ size u-boot && ls -la u-boot.bin
   text    data     bss     dec     hex filename
 227643    7448   71448  306539   4ad6b u-boot
-rw-r--r-- 1 joel joel 234908 Jan 16 08:30 u-boot.bin

We go up by 5.6%, or 12KB. We're still well within the 384KB partition size, so there is no issue there.

I've merged it into our u-boot tree.

Cheers,

Joel

Quoted 59 lines

---

 configs/ast_g4_ncsi_defconfig | 1 +
 configs/ast_g4_phy_defconfig  | 1 +
 configs/ast_g5_ncsi_defconfig | 1 +
 configs/ast_g5_phy_defconfig  | 1 +
 4 files changed, 4 insertions(+)
configs/ast_g4_ncsi_defconfig +1 -0
index ab4907cfe2..54686bee5c 100644
@@ -7,6 +7,7 @@ CONFIG_CMD_PING=y
 CONFIG_EFI_LOADER=n
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_HUSH_PARSER=y
 CONFIG_OF_LIBFDT=y
 CONFIG_SPI_FLASH=y
 CONFIG_SYS_NS16550=y
configs/ast_g4_phy_defconfig +1 -0
index 21a56c4b96..f8db39ef13 100644
@@ -8,6 +8,7 @@ CONFIG_CMD_PING=y
 CONFIG_EFI_LOADER=n
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_HUSH_PARSER=y
 CONFIG_OF_LIBFDT=y
 CONFIG_SPI_FLASH=y
 CONFIG_SYS_NS16550=y
configs/ast_g5_ncsi_defconfig +1 -0
index 7cd4fd116d..74029ed514 100644
@@ -7,6 +7,7 @@ CONFIG_CMD_PING=y
 CONFIG_EFI_LOADER=n
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_HUSH_PARSER=y
 CONFIG_OF_LIBFDT=y
 CONFIG_SPI_FLASH=y
 CONFIG_SYS_NS16550=y
configs/ast_g5_phy_defconfig +1 -0
index c686dd2297..767f3af605 100644
@@ -8,6 +8,7 @@ CONFIG_CMD_PING=y
 CONFIG_EFI_LOADER=n
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_HUSH_PARSER=y
 CONFIG_OF_LIBFDT=y
 CONFIG_SPI_FLASH=y
 CONFIG_SYS_NS16550=y
#3 lore raw

PATCH 2/2 aspeed: use FIT-provided ramdisk if available

In reply to Rick Altherr

If the kernel FIT specifies a ramdisk, use it. Otherwise, expect a ramdisk at 0x20300000.

---

 include/configs/ast-common.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/configs/ast-common.h +5 -1
index b39ea33ce7..110c780070 100644
@@ -96,7 +96,11 @@
 #define CONFIG_ENV_OFFSET		0x60000	/* environment starts here  */
 #define CONFIG_ENV_SIZE			0x20000	/* Total Size of Environment Sector */
 
-#define CONFIG_BOOTCOMMAND	"bootm 20080000 20300000"
+#define CONFIG_BOOTCOMMAND	\
+	"fdt addr 20080000; " \
+	"if fdt get value ramdisk_conf /configurations/conf@1 ramdisk; then " \
+	"    bootm 20080000; else bootm 20080000 20300000; " \
+	"fi"
 #define CONFIG_ENV_OVERWRITE
 
 #define ASPEED_ENV_SETTINGS \
Signature · 1 line
2.11.0.390.gc69c2f50cf-goog
#4 lore raw

Re: [U-Boot,2/2] aspeed: use FIT-provided ramdisk if available

Quoted 14 lines · Rick Altherr

If the kernel FIT specifies a ramdisk, use it. Otherwise, expect a ramdisk at 0x20300000.

---

 include/configs/ast-common.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/configs/ast-common.h +0 -0
index b39ea33ce7..110c780070 100644

include/configs/ast-common.h line 103

Quoted 9 lines
include/configs/ast-common.h +5 -1
@@ -96,7 +96,11 @@
 #define CONFIG_ENV_OFFSET              0x60000 /* environment starts here  */
 #define CONFIG_ENV_SIZE                        0x20000 /* Total Size of Environment Sector */
 
-#define CONFIG_BOOTCOMMAND     "bootm 20080000 20300000"
+#define CONFIG_BOOTCOMMAND     \
+       "fdt addr 20080000; " \
+       "if fdt get value ramdisk_conf /configurations/conf@1 ramdisk; then " \
+       "    bootm 20080000; else bootm 20080000 20300000; " \
+       "fi"

This feels a little clunky. Is this the method upstream suggests to solve this problem?

Cheers,

Joel

#5 lore raw

Re: [U-Boot,2/2] aspeed: use FIT-provided ramdisk if available

I couldn't find any prior examples. I'll ask upstream what they think.

Quoted 35 lines · Joel Stanley
Quoted 14 lines · Rick Altherr

If the kernel FIT specifies a ramdisk, use it. Otherwise, expect a ramdisk at 0x20300000.

---

 include/configs/ast-common.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/configs/ast-common.h +0 -0
index b39ea33ce7..110c780070 100644

include/configs/ast-common.h line 96

Quoted 1 line
include/configs/ast-common.h +0 -0
@@ -96,7 +96,11 @@
 #define CONFIG_ENV_OFFSET              0x60000 /* environment starts

here */

include/configs/ast-common.h line 97

Quoted 1 line
include/configs/ast-common.h +0 -0
 #define CONFIG_ENV_SIZE                        0x20000 /* Total Size of

Environment Sector */

include/configs/ast-common.h

Quoted 5 lines
include/configs/ast-common.h +3 -1
-#define CONFIG_BOOTCOMMAND     "bootm 20080000 20300000"
+#define CONFIG_BOOTCOMMAND     \
+       "fdt addr 20080000; " \
+       "if fdt get value ramdisk_conf /configurations/conf@1 ramdisk;

then " \

include/configs/ast-common.h line 103

Quoted 2 lines
include/configs/ast-common.h +2 -0
+       "    bootm 20080000; else bootm 20080000 20300000; " \
+       "fi"

This feels a little clunky. Is this the method upstream suggests to solve this problem?

Cheers,

Joel

Reviewed-by
#6 lore raw

Re: [U-Boot,2/2] aspeed: use FIT-provided ramdisk if available

Quoted 35 lines · Rick Altherr

I couldn't find any prior examples. I'll ask upstream what they think.

Quoted 32 lines · Joel Stanley
Quoted 24 lines · Rick Altherr

If the kernel FIT specifies a ramdisk, use it. Otherwise, expect a ramdisk at 0x20300000.

---

 include/configs/ast-common.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/configs/ast-common.h +0 -0
index b39ea33ce7..110c780070 100644
@@ -96,7 +96,11 @@
 #define CONFIG_ENV_OFFSET              0x60000 /* environment starts

here */
#define CONFIG_ENV_SIZE 0x20000 /* Total Size of
Environment Sector */

include/configs/ast-common.h +3 -1
-#define CONFIG_BOOTCOMMAND     "bootm 20080000 20300000"
+#define CONFIG_BOOTCOMMAND     \
+       "fdt addr 20080000; " \
+       "if fdt get value ramdisk_conf /configurations/conf@1 ramdisk;

then " \

include/configs/ast-common.h line 103

Quoted 2 lines
include/configs/ast-common.h +2 -0
+       "    bootm 20080000; else bootm 20080000 20300000; " \
+       "fi"

This feels a little clunky. Is this the method upstream suggests to solve this problem?

Clunky, but it works. In general people don't mind too much what you put in your own board scripts.

Regards,
Simon