Преглед на файлове

freedom-u540: Setup u-boot autoboot for TFTP

This patch does two things:
 - Patches u-boot to set the server ip by default
   - When u-boot has SD/MMC support we should remove this patch and
     instead set enviroment variables from uEnv.txt

 - Adds a tftp-boot.txt file
   - This file is built into a boot.src.uimg file which should then be
     copied to the TFTP directory. This file should be used by those who
     are intereted in u-boot autobooting from TFTP.
   - In the future a seperate boot file can be added allowing autoboot
     from the SD card

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Alistair Francis преди 5 години
родител
ревизия
9e781551e5

+ 5 - 0
conf/machine/freedom-u540.conf

@@ -40,6 +40,11 @@ WIC_CREATE_EXTRA_ARGS ?= "--no-fstab-update"
 EXTRA_IMAGEDEPENDS += "u-boot"
 UBOOT_MACHINE = "sifive_fu540_defconfig"
 
+# 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"
+
 ### wic default support
 WKS_FILE_DEPENDS ?= " \
     opensbi \

+ 33 - 0
recipes-bsp/u-boot/files/0001-sifive-fu540-Set-default-arguments-to-help-booting.patch

@@ -0,0 +1,33 @@
+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
+

+ 2 - 0
recipes-bsp/u-boot/files/tftp-boot.txt

@@ -0,0 +1,2 @@
+tftpboot $kernel_addr_r uImage
+bootm $kernel_addr_r - $fdt_addr_r

+ 25 - 0
recipes-bsp/u-boot/u-boot_2019.04.bbappend

@@ -18,4 +18,29 @@ SRC_URI += "file://0001-riscv-add-infrastructure-for-calling-functions-on-ot.pat
             file://0016-riscv-dts-ae350-support-SMP.patch \
             file://0017-riscv-ae350-enable-SMP.patch \
             file://0018-riscv-dts-fix-CONFIG_DEFAULT_DEVICE_TREE-failure.patch \
+            file://0001-sifive-fu540-Set-default-arguments-to-help-booting.patch \
+            file://tftp-boot.txt \
            "
+
+DEPENDS += "u-boot-tools-native"
+
+UBOOT_ENTRYPOINT = "0x80200000"
+
+# Overwrite this for your server
+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
+
+    mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" \
+        -d ${WORKDIR}/${UBOOT_ENV}.txt ${WORKDIR}/boot.scr.uimg
+}
+
+do_deploy_append () {
+      install -d ${DEPLOY_DIR_IMAGE}
+      install -m 755 ${WORKDIR}/boot.scr.uimg ${DEPLOY_DIR_IMAGE}/
+}
+
+addtask deploy after do_install
+
+FILES_${PN} += "/boot/boot.scr.uimg"