mirror of
https://github.com/thead-yocto-mirror/meta-riscv
synced 2026-09-07 01:04:40 +02:00
u-boot: Update the boot script to fall back to MMC load
Update the u-boot boot script to try a TFTP load first and if that fails fall back to an MMC load. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
committed by
Khem Raj
parent
4a6f008cec
commit
7f90dea34e
@@ -14,11 +14,11 @@ PREFERRED_PROVIDER_virtual/kernel ?= "linux-mainline"
|
||||
EXTRA_IMAGEDEPENDS += "opensbi"
|
||||
RISCV_SBI_PLAT = "sifive/fu540"
|
||||
|
||||
## When we have u-boot SD/MMC load support we can swap to
|
||||
## u-boot being the defual. Until then it's an option for TFTP boot
|
||||
# RISCV_SBI_PAYLOAD ?= "u-boot.bin"
|
||||
## This will set the kernel as the OpenSBI payload
|
||||
RISCV_SBI_PAYLOAD ?= "${KERNEL_IMAGETYPE}-${MACHINE}.bin"
|
||||
## This sets u-boot as the default OpenSBI payload
|
||||
RISCV_SBI_PAYLOAD ?= "u-boot.bin"
|
||||
## This will set the kernel as the OpenSBI payload. This is not recommended,
|
||||
## you can use U-Boot's MMC loading instead.
|
||||
# RISCV_SBI_PAYLOAD ?= "${KERNEL_IMAGETYPE}-${MACHINE}.bin"
|
||||
|
||||
RISCV_SBI_FDT ?= "hifive-unleashed-a00.dtb"
|
||||
## Use this to add Microsemi Expansion board support
|
||||
@@ -40,10 +40,10 @@ UBOOT_MACHINE = "sifive_fu540_defconfig"
|
||||
|
||||
UBOOT_ENTRYPOINT = "0x80200000"
|
||||
|
||||
## Set this to "tftp-boot" to generate a boot.scr file which should
|
||||
## be included in the TFTP directory. It will contain the commands to
|
||||
## autoboot Linux from u-boot.
|
||||
UBOOT_ENV ?= "tftp-boot"
|
||||
## Set this to "mmc-boot" to generate a boot.scr file which should be included
|
||||
## in the boot partition. It will try to load a kernel image by TFTP and if that
|
||||
## fails it will fall back to local images in the boot partition.
|
||||
UBOOT_ENV ?= "mmc-boot"
|
||||
|
||||
## wic default support
|
||||
WKS_FILE_DEPENDS ?= " \
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
From 90c37e55fceae6e8fabf5da75ce37ed1c89c6631 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Francis <alistair.francis@wdc.com>
|
||||
Date: Wed, 17 Apr 2019 15:27:11 -0700
|
||||
Subject: [PATCH] sifive-fu540: Set default arguments to help booting
|
||||
|
||||
Set some default args that will help us to autoboot. As the sifive-u540
|
||||
currently does not support SD/MMC accesses we can't use the standard
|
||||
uEnv.txt file to set extra variables.
|
||||
|
||||
This patch should be removed and replaced with a standard uEnv.txt flow
|
||||
when u-boot can load defaults from the SD card.
|
||||
|
||||
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
|
||||
Upstream-Status: Inappropriate [configuration]
|
||||
---
|
||||
include/configs/sifive-fu540.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
|
||||
index 7007b5f6af..07c6bfa178 100644
|
||||
--- a/include/configs/sifive-fu540.h
|
||||
+++ b/include/configs/sifive-fu540.h
|
||||
@@ -38,6 +38,7 @@
|
||||
"scriptaddr=0x82300000\0" \
|
||||
"pxefile_addr_r=0x82400000\0" \
|
||||
"ramdisk_addr_r=0x82500000\0" \
|
||||
+ "serverip=@SERVERIP@\0" \
|
||||
BOOTENV
|
||||
|
||||
#endif /* __CONFIG_H */
|
||||
--
|
||||
2.21.0
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From 9197591db555e852f816614a8bd92af81044396c Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Francis <alistair.francis@wdc.com>
|
||||
Date: Wed, 3 Jul 2019 09:39:48 -0700
|
||||
Subject: [PATCH] sifive-fu540: config: Add mmc0 as a boot target device
|
||||
|
||||
Add the mmc0 device as a BOOT_TARGET_DEVICES.
|
||||
|
||||
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
|
||||
Upstream-Status: Pending
|
||||
---
|
||||
include/configs/sifive-fu540.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
|
||||
index 7007b5f6af..f28f0d7da1 100644
|
||||
--- a/include/configs/sifive-fu540.h
|
||||
+++ b/include/configs/sifive-fu540.h
|
||||
@@ -26,6 +26,7 @@
|
||||
#define CONFIG_ENV_SIZE SZ_4K
|
||||
|
||||
#define BOOT_TARGET_DEVICES(func) \
|
||||
+ func(MMC, mmc, 0) \
|
||||
func(DHCP, dhcp, na)
|
||||
|
||||
#include <config_distro_bootcmd.h>
|
||||
--
|
||||
2.22.0
|
||||
|
||||
11
recipes-bsp/u-boot/files/mmc-boot.txt
Normal file
11
recipes-bsp/u-boot/files/mmc-boot.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
# Try a TFTP boot
|
||||
setenv serverip @SERVERIP@
|
||||
dhcp
|
||||
if tftpboot ${kernel_addr_r} uImage; then
|
||||
bootm ${kernel_addr_r} - $fdt_addr_r
|
||||
fi;
|
||||
|
||||
# If the TFTP boot didn't work, try a SD card boot
|
||||
if load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} uImage; then
|
||||
bootm ${kernel_addr_r} - $fdt_addr_r
|
||||
fi;
|
||||
@@ -1,2 +0,0 @@
|
||||
tftpboot $kernel_addr_r uImage
|
||||
bootm $kernel_addr_r - $fdt_addr_r
|
||||
@@ -1,6 +1,6 @@
|
||||
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
|
||||
|
||||
SRC_URI += "file://0001-sifive-fu540-Set-default-arguments-to-help-booting.patch \
|
||||
SRC_URI += "file://0001-sifive-fu540-config-Add-mmc0-as-a-boot-target-device.patch \
|
||||
file://0002-net-macb-sync-header-definitions-as-taken-from-Linux.patch \
|
||||
file://0003-net-macb-add-support-for-faster-clk-rates.patch \
|
||||
file://0004-net-macb-use-bit-access-macro-from-header-file.patch \
|
||||
@@ -21,7 +21,7 @@ SRC_URI += "file://0001-sifive-fu540-Set-default-arguments-to-help-booting.patch
|
||||
file://0019-mmc-mmc_spi-Re-write-driver-using-DM-framework.patch \
|
||||
file://0020-riscv-sifive-fu540-Enable-SiFive-SPI-and-MMC-SPI-dri.patch \
|
||||
file://0021-doc-sifive-fu540-Update-README-for-SiFive-SPI-and-MM.patch \
|
||||
file://tftp-boot.txt \
|
||||
file://mmc-boot.txt \
|
||||
"
|
||||
|
||||
DEPENDS += "u-boot-tools-native"
|
||||
@@ -30,7 +30,7 @@ DEPENDS += "u-boot-tools-native"
|
||||
TFTP_SERVER_IP ?= "127.0.0.1"
|
||||
|
||||
do_configure_prepend() {
|
||||
sed -i -e 's,@SERVERIP@,${TFTP_SERVER_IP},g' ${S}/include/configs/sifive-fu540.h
|
||||
sed -i -e 's,@SERVERIP@,${TFTP_SERVER_IP},g' ${WORKDIR}/mmc-boot.txt
|
||||
|
||||
if [ -f "${WORKDIR}/${UBOOT_ENV}.txt" ]; then
|
||||
mkimage -O linux -T script -C none -n "U-Boot boot script" \
|
||||
|
||||
Reference in New Issue
Block a user