summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJianlong Huang <jianlong.huang@starfivetech.com>2022-09-23 03:46:47 +0300
committerJianlong Huang <jianlong.huang@starfivetech.com>2022-11-03 11:29:26 +0300
commitd4566c2f24b4df5702bb1ddf22f7d4b122f31280 (patch)
tree7fc62ef09d10bd8ee4ce606ee364fe0fa34bd487
parent62abf7817bc66ed679534d75d904b029713cade3 (diff)
downloadu-boot-d4566c2f24b4df5702bb1ddf22f7d4b122f31280.tar.xz
Support boot from grub
Signed-off-by: Jianlong Huang <jianlong.huang@starfivetech.com>
-rw-r--r--configs/starfive_visionfive2_defconfig6
-rw-r--r--include/configs/starfive-visionfive2.h43
2 files changed, 36 insertions, 13 deletions
diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
index 0616c38582..f8ef1ae507 100644
--- a/configs/starfive_visionfive2_defconfig
+++ b/configs/starfive_visionfive2_defconfig
@@ -26,7 +26,10 @@ CONFIG_SPI_BOOT=y
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="console=ttyS0,115200 debug rootwait earlycon=sbi"
CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="run load_vf2_env; env import -t $kernel_addr_r $filesize;run boot2"
+CONFIG_BOOTCOMMAND="run load_vf2_env;run importbootenv;run boot2;run distro_bootcmd"
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="run mmcbootenv"
+CONFIG_DEFAULT_FDT_FILE="starfive/starfive_visionfive2.dtb"
CONFIG_LOG_MAX_LEVEL=4
CONFIG_SPL_LOG=y
CONFIG_DISPLAY_CPUINFO=y
@@ -53,7 +56,6 @@ CONFIG_CMD_GPT_RENAME=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MISC=y
CONFIG_CMD_PART=y
-CONFIG_CMD_USB=y
CONFIG_CMD_TFTPPUT=y
CONFIG_CMD_SYSBOOT=y
CONFIG_CMD_EXT4_WRITE=y
diff --git a/include/configs/starfive-visionfive2.h b/include/configs/starfive-visionfive2.h
index 6ffedda85e..3eaf214fd5 100644
--- a/include/configs/starfive-visionfive2.h
+++ b/include/configs/starfive-visionfive2.h
@@ -85,7 +85,7 @@
#endif
/* HACK these should have '#if defined (stuff) around them like zynqp*/
-#define BOOT_TARGET_DEVICES(func) func(DHCP, dhcp, na) func(MMC, mmc, 0)
+#define BOOT_TARGET_DEVICES(func) func(MMC, mmc, 0) func(DHCP, dhcp, na)
#include <config_distro_bootcmd.h>
@@ -101,19 +101,40 @@
"name=loader2,size=4MB,type=${type_guid_gpt_loader2};" \
"name=system,size=-,bootable,type=${type_guid_gpt_system};"
-#define VISIONFIVE2_BOOTENV \
- "testenv=vf2_uEnv.txt\0" \
- "load_vf2_env=" \
- "if test ${bootmode} = flash; then " \
- "if mmc dev ${devnum}; then " \
- "echo found device ${devnum};" \
+#define VISIONFIVE2_BOOTENV \
+ "bootenv=uEnv.txt\0" \
+ "testenv=vf2_uEnv.txt\0" \
+ "bootdir=/boot\0" \
+ "mmcpart=3\0" \
+ "loadaddr=0xa0000000\0" \
+ "load_vf2_env=fatload mmc ${bootpart} ${loadaddr} ${testenv}\0" \
+ "loadbootenv=fatload mmc ${bootpart} ${loadaddr} ${bootenv}\0" \
+ "ext4bootenv=" \
+ "ext4load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootenv}\0"\
+ "importbootenv=" \
+ "echo Importing environment from mmc${devnum} ...; " \
+ "env import -t ${loadaddr} ${filesize}\0" \
+ "scan_mmc_dev=" \
+ "if test ${bootmode} = flash; then " \
+ "if mmc dev ${devnum}; then " \
+ "echo found device ${devnum};" \
"else " \
- "setenv devnum 0;" \
- "mmc dev 0;" \
+ "setenv devnum 0;" \
+ "mmc dev 0;" \
"fi; " \
"fi; " \
- "echo bootmode ${bootmode} device ${devnum};" \
- "fatload mmc ${devnum}:3 ${kernel_addr_r} ${testenv};\0" \
+ "echo bootmode ${bootmode} device ${devnum};\0" \
+ "mmcbootenv=run scan_mmc_dev; " \
+ "setenv bootpart ${devnum}:${mmcpart}; " \
+ "if mmc rescan; then " \
+ "run loadbootenv && run importbootenv; " \
+ "run ext4bootenv && run importbootenv; " \
+ "if test -n $uenvcmd; then " \
+ "echo Running uenvcmd ...; " \
+ "run uenvcmd; " \
+ "fi; " \
+ "fi\0" \
+ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0"
#define CONFIG_EXTRA_ENV_SETTINGS \
"fdt_high=0xffffffffffffffff\0" \