uboot: add support for bundling OpenSBI FW_DYNAMIC into U-Boot
PATCH 1/2 uboot: add support for bundling OpenSBI FW_DYNAMIC into U-Boot
Some RISC-V platforms (such as SiFive FU540) have a boot process where U-Boot encapsulates the FW_DYNAMIC part of the ARM trusted firmware. For such platforms, we need to build OpenSBI before U-Boot, and pass a OPENSBI variable pointing to OpenSBI bl31.bin to the U-Boot build process.
This commit introduces a BR2_TARGET_UBOOT_NEEDS_OPENSBI_FW_DYNAMIC variable to achieve this.
--- boot/uboot/Config.in | 15 +++++++++++++++ boot/uboot/uboot.mk | 5 +++++ 2 files changed, 20 insertions(+)
boot/uboot/Config.in +15 -0
@@ -202,6 +202,21 @@ config BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF endchoice +config BR2_TARGET_UBOOT_NEEDS_OPENSBI_FW_DYNAMIC + bool "U-Boot needs OpenSBI fw_dynamic" + depends on BR2_TARGET_OPENSBI + help + A fw_dynamic firmware is particularly useful when the + booting stage executed prior to OpenSBI firmware is + capable of loading both the OpenSBI firmware and the + booting stage binary to follow OpenSBI firmware. + + Some RISC-V platforms (such as SiFive FU540) encapsulate + the fw_dynamic part of OpenSBI inside U-Boot. This option + makes sure OpenSBI gets built prior to U-Boot, and that + the OPENSBI variable pointing to OpenSBI's fw_dynamic + binary, is passed during the Buildroot build. + menu "U-Boot binary format" config BR2_TARGET_UBOOT_FORMAT_AIS
boot/uboot/uboot.mk +5 -0
@@ -155,6 +155,11 @@ UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin endif endif +ifeq ($(BR2_TARGET_UBOOT_NEEDS_OPENSBI_FW_DYNAMIC),y) +UBOOT_DEPENDENCIES += opensbi +UBOOT_MAKE_OPTS += OPENSBI=$(BINARIES_DIR)/fw_dynamic.bin +endif + ifeq ($(BR2_TARGET_UBOOT_NEEDS_DTC),y) UBOOT_DEPENDENCIES += host-dtc endif
Signature · 1 line
2.17.1
PATCH 2/2 sifive/hifive-unleashed: Support Mainline U-Boot, Linux
Add Mainline U-Boot, Linux kernel version for
SiFive HiFive unleashed A00 board.
Now, board would
- Boot from MMC with U-Boot SPL
- Linux version v5.6
--- board/sifive/hifive-unleashed/extlinux.conf | 4 +++ board/sifive/hifive-unleashed/genimage.cfg | 15 ++++++--- .../hifive-unleashed/linux.config.fragment | 13 ++------ board/sifive/hifive-unleashed/post-build.sh | 5 +++ board/sifive/hifive-unleashed/readme.txt | 33 ++++++++++--------- configs/hifive_unleashed_defconfig | 33 ++++++++++++++----- 6 files changed, 66 insertions(+), 37 deletions(-) create mode 100644 board/sifive/hifive-unleashed/extlinux.conf create mode 100755 board/sifive/hifive-unleashed/post-build.sh
board/sifive/hifive-unleashed/extlinux.conf new file +4 -0
@@ -0,0 +1,4 @@ +label HiFive-Unleashed linux + kernel /boot/Image + devicetree /boot/hifive-unleashed-a00.dtb + append console=ttySIF0 root=/dev/mmcblk0p3 rootwait rw
board/sifive/hifive-unleashed/genimage.cfg +11 -4
@@ -3,15 +3,22 @@ image sdcard.img { gpt = true } - partition bootloader { - image = "fw_payload.bin" - offset = 1M - size = 32M + partition loader1 { + image = "u-boot-spl.bin" + offset = 17K + size = 1M + partition-type-uuid = 5B193300-FC78-40CD-8002-E86C45580B47 + } + + partition loader2 { + image = "u-boot.itb" + size = 4M partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985 } partition rootfs { image = "rootfs.ext4" + bootable = true partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 } }
board/sifive/hifive-unleashed/linux.config.fragment +3 -10
@@ -1,16 +1,9 @@ CONFIG_HZ_100=y -CONFIG_CMDLINE="earlycon=sbi root=/dev/mmcblk0p2 rootwait" -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_SERIAL_SIFIVE=y -CONFIG_SERIAL_SIFIVE_CONSOLE=y -CONFIG_SPI=y -CONFIG_SPI_SIFIVE=y CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y CONFIG_GPIO_SIFIVE=y -CONFIG_MMC=y -CONFIG_MMC_SPI=y -CONFIG_CLK_U54_PRCI=y -CONFIG_CLK_GEMGXL_MGMT=y +CONFIG_MTD=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_BLOCK=y CONFIG_PWM=y CONFIG_PWM_SIFIVE=y
board/sifive/hifive-unleashed/post-build.sh new file +5 -0
@@ -0,0 +1,5 @@ +#!/bin/sh + +BOARD_DIR="$(dirname $0)" + +install -m 0644 -D $BOARD_DIR/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.conf
board/sifive/hifive-unleashed/readme.txt +18 -15
@@ -30,35 +30,29 @@ Once the build has finished you will have the following files: output/images/ +-- fw_jump.bin +-- fw_jump.elf - +-- fw_payload.bin - +-- fw_payload.elf + +-- fw_dynamic.bin + +-- fw_dynamic.elf + +-- u-boot-spl.bin + +-- u-boot.itb +-- Image +-- rootfs.ext2 +-- rootfs.ext4 +-- rootfs.tar +-- sdcard.img - -Creating a bootable SD card with genimage -========================================= +Booting from MMC on the board +============================= Buildroot builds a SD card image for you. All you need to do is dd the image to your SD card, which can be done with the following command: - $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=4096 - -Booting the SD card on the board -================================ + $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 -Make sure that the all DIP switches are set to the off position for -default boot mode (MSEL mode = 1111), insert the SD card and power -up the board. +Make sure that the DIP switches MSEL[3:0] are set to 1011 for booting +from MMC. Insert the SD card and power up the board. Connect the USB cable and open minicom (/dev/ttyUSB1, 115200, 8N1). -See the 'SiFive HiFive Unleashed Getting Started Guide' for -more details (https://www.sifive.com/documentation). - You will get a warning reported by fdisk when you examine the SD card. This is because the genimage.cfg file doesn't specify the SD card size (as people will naturally have different sized cards), so the
@@ -73,3 +67,12 @@ You will see something like this at boot time: [ 2.334824] GPT:190496 != 122142719 [ 2.338302] GPT: Use GNU Parted to correct GPT errors. [ 2.343456] mmcblk0: p1 p2 + +Documentation +============= +See the 'SiFive HiFive Unleashed Getting Started Guide' for +more details (https://www.sifive.com/documentation). + +See the Amarula Solutions BSP sifive wiki for information of +usage and indetail steps. +https://wiki.amarulasolutions.com/bsp/riscv/sifive/hifive-unleashed.html
configs/hifive_unleashed_defconfig +25 -8
@@ -14,27 +14,44 @@ BR2_TARGET_GENERIC_GETTY=y BR2_TARGET_GENERIC_GETTY_PORT="ttySIF0" BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/sifive/hifive-unleashed/genimage.cfg" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/sifive/hifive-unleashed/post-build.sh" # Filesystem BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y -# Linux headers same as kernel, a 5.1 series -BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_1=y +# Linux headers same as kernel, a 5.6 series +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_6=y # Kernel BR2_LINUX_KERNEL=y -BR2_LINUX_KERNEL_CUSTOM_GIT=y -BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/alistair23/linux.git" -BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="hifive-unleashed-5.1" +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.6" BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/sifive/hifive-unleashed/linux.config.fragment" -BR2_LINUX_KERNEL_IMAGE=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="sifive/hifive-unleashed-a00" +BR2_LINUX_KERNEL_INSTALL_TARGET=y +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y -# Bootloader +# opensbi BR2_TARGET_OPENSBI=y BR2_TARGET_OPENSBI_PLAT="sifive/fu540" -BR2_TARGET_OPENSBI_LINUX_PAYLOAD=y +BR2_TARGET_OPENSBI_FW_DYNAMIC=y + +# Bootloader +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,amarula,u-boot-amarula)v3.0-hifive-unleashed.tar.gz" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="sifive_fu540" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS=y +BR2_TARGET_UBOOT_NEEDS_OPENSBI_FW_DYNAMIC=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin" # Host tools BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.17.1
PATCH 2/2 sifive/hifive-unleashed: Support Mainline U-Boot, Linux
Quoted 126 lines · Jagan Teki
Add Mainline U-Boot, Linux kernel version for
SiFive HiFive unleashed A00 board.Now, board would
- Boot from MMC with U-Boot SPL
- Linux version v5.6Signed-off-by Jagan Teki <[email protected]>--- board/sifive/hifive-unleashed/extlinux.conf | 4 +++ board/sifive/hifive-unleashed/genimage.cfg | 15 ++++++--- .../hifive-unleashed/linux.config.fragment | 13 ++------ board/sifive/hifive-unleashed/post-build.sh | 5 +++ board/sifive/hifive-unleashed/readme.txt | 33 ++++++++++--------- configs/hifive_unleashed_defconfig | 33 ++++++++++++++----- 6 files changed, 66 insertions(+), 37 deletions(-) create mode 100644 board/sifive/hifive-unleashed/extlinux.conf create mode 100755 board/sifive/hifive-unleashed/post-build.shboard/sifive/hifive-unleashed/extlinux.conf new file +4
-0@@ -0,0 +1,4 @@ +label HiFive-Unleashed linux + kernel /boot/Image + devicetree /boot/hifive-unleashed-a00.dtb + append console=ttySIF0 root=/dev/mmcblk0p3 rootwait rwboard/sifive/hifive-unleashed/genimage.cfg +11
-4@@ -3,15 +3,22 @@ image sdcard.img { gpt = true } - partition bootloader { - image = "fw_payload.bin" - offset = 1M - size = 32M + partition loader1 { + image = "u-boot-spl.bin" + offset = 17K + size = 1M + partition-type-uuid = 5B193300-FC78-40CD-8002-E86C45580B47 + } + + partition loader2 { + image = "u-boot.itb" + size = 4M partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985 } partition rootfs { image = "rootfs.ext4" + bootable = true partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 } }board/sifive/hifive-unleashed/linux.config.fragment +3
-10@@ -1,16 +1,9 @@ CONFIG_HZ_100=y -CONFIG_CMDLINE="earlycon=sbi root=/dev/mmcblk0p2 rootwait" -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_SERIAL_SIFIVE=y -CONFIG_SERIAL_SIFIVE_CONSOLE=y -CONFIG_SPI=y -CONFIG_SPI_SIFIVE=y CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y CONFIG_GPIO_SIFIVE=y -CONFIG_MMC=y -CONFIG_MMC_SPI=y -CONFIG_CLK_U54_PRCI=y -CONFIG_CLK_GEMGXL_MGMT=y +CONFIG_MTD=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_BLOCK=y CONFIG_PWM=y CONFIG_PWM_SIFIVE=yboard/sifive/hifive-unleashed/post-build.sh new file +5
-0@@ -0,0 +1,5 @@ +#!/bin/sh + +BOARD_DIR="$(dirname $0)" + +install -m 0644 -D $BOARD_DIR/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.confboard/sifive/hifive-unleashed/readme.txt +6
-6@@ -30,35 +30,29 @@ Once the build has finished you will have the following files: output/images/ +-- fw_jump.bin +-- fw_jump.elf - +-- fw_payload.bin - +-- fw_payload.elf + +-- fw_dynamic.bin + +-- fw_dynamic.elf + +-- u-boot-spl.bin + +-- u-boot.itb +-- Image +-- rootfs.ext2 +-- rootfs.ext4 +-- rootfs.tar +-- sdcard.img - -Creating a bootable SD card with genimage -========================================= +Booting from MMC on the board +============================= Buildroot builds a SD card image for you. All you need to do is dd the image to your SD card, which can be done with the following command: - $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=4096
board/sifive/hifive-unleashed/readme.txt Once the build has finished you will have the following files: · line 52
Quoted 10 lines
board/sifive/hifive-unleashed/readme.txt +3
-6- -Booting the SD card on the board -================================ + $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 -Make sure that the all DIP switches are set to the off position for -default boot mode (MSEL mode = 1111), insert the SD card and power -up the board. +Make sure that the DIP switches MSEL[3:0] are set to 1011 for booting +from MMC. Insert the SD card and power up the board.
So now it only supports MMC boot? I don't think that is a good idea.
Alistair
Quoted 86 lines
board/sifive/hifive-unleashed/readme.txt +9
-3Connect the USB cable and open minicom (/dev/ttyUSB1, 115200, 8N1). -See the 'SiFive HiFive Unleashed Getting Started Guide' for -more details (https://www.sifive.com/documentation). - You will get a warning reported by fdisk when you examine the SD card. This is because the genimage.cfg file doesn't specify the SD card size (as people will naturally have different sized cards), so the@@ -73,3 +67,12 @@ You will see something like this at boot time: [ 2.334824] GPT:190496 != 122142719 [ 2.338302] GPT: Use GNU Parted to correct GPT errors. [ 2.343456] mmcblk0: p1 p2 + +Documentation +============= +See the 'SiFive HiFive Unleashed Getting Started Guide' for +more details (https://www.sifive.com/documentation). + +See the Amarula Solutions BSP sifive wiki for information of +usage and indetail steps. +https://wiki.amarulasolutions.com/bsp/riscv/sifive/hifive-unleashed.htmlconfigs/hifive_unleashed_defconfig +25
-9@@ -14,27 +14,44 @@ BR2_TARGET_GENERIC_GETTY=y BR2_TARGET_GENERIC_GETTY_PORT="ttySIF0" BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/sifive/hifive-unleashed/genimage.cfg" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/sifive/hifive-unleashed/post-build.sh" # Filesystem BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y -# Linux headers same as kernel, a 5.1 series -BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_1=y +# Linux headers same as kernel, a 5.6 series +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_6=y # Kernel BR2_LINUX_KERNEL=y -BR2_LINUX_KERNEL_CUSTOM_GIT=y -BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/alistair23/linux.git" -BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="hifive-unleashed-5.1" +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.6" BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/sifive/hifive-unleashed/linux.config.fragment" -BR2_LINUX_KERNEL_IMAGE=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="sifive/hifive-unleashed-a00" +BR2_LINUX_KERNEL_INSTALL_TARGET=y +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y -# Bootloader +# opensbi BR2_TARGET_OPENSBI=y BR2_TARGET_OPENSBI_PLAT="sifive/fu540" -BR2_TARGET_OPENSBI_LINUX_PAYLOAD=y +BR2_TARGET_OPENSBI_FW_DYNAMIC=y + +# Bootloader +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,amarula,u-boot-amarula)v3.0-hifive-unleashed.tar.gz" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="sifive_fu540" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS=y +BR2_TARGET_UBOOT_NEEDS_OPENSBI_FW_DYNAMIC=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin" # Host tools BR2_PACKAGE_HOST_GENIMAGE=y --2.17.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 2/2 sifive/hifive-unleashed: Support Mainline U-Boot, Linux
Quoted 133 lines · Alistair Francis
Quoted 131 lines · Jagan Teki
Add Mainline U-Boot, Linux kernel version for
SiFive HiFive unleashed A00 board.Now, board would
- Boot from MMC with U-Boot SPL
- Linux version v5.6Signed-off-by Jagan Teki <[email protected]>--- board/sifive/hifive-unleashed/extlinux.conf | 4 +++ board/sifive/hifive-unleashed/genimage.cfg | 15 ++++++--- .../hifive-unleashed/linux.config.fragment | 13 ++------ board/sifive/hifive-unleashed/post-build.sh | 5 +++ board/sifive/hifive-unleashed/readme.txt | 33 ++++++++++--------- configs/hifive_unleashed_defconfig | 33 ++++++++++++++----- 6 files changed, 66 insertions(+), 37 deletions(-) create mode 100644 board/sifive/hifive-unleashed/extlinux.conf create mode 100755 board/sifive/hifive-unleashed/post-build.shboard/sifive/hifive-unleashed/extlinux.conf new file +4
-0@@ -0,0 +1,4 @@ +label HiFive-Unleashed linux + kernel /boot/Image + devicetree /boot/hifive-unleashed-a00.dtb + append console=ttySIF0 root=/dev/mmcblk0p3 rootwait rwboard/sifive/hifive-unleashed/genimage.cfg +11
-4@@ -3,15 +3,22 @@ image sdcard.img { gpt = true } - partition bootloader { - image = "fw_payload.bin" - offset = 1M - size = 32M + partition loader1 { + image = "u-boot-spl.bin" + offset = 17K + size = 1M + partition-type-uuid = 5B193300-FC78-40CD-8002-E86C45580B47 + } + + partition loader2 { + image = "u-boot.itb" + size = 4M partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985 } partition rootfs { image = "rootfs.ext4" + bootable = true partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 } }board/sifive/hifive-unleashed/linux.config.fragment +3
-10@@ -1,16 +1,9 @@ CONFIG_HZ_100=y -CONFIG_CMDLINE="earlycon=sbi root=/dev/mmcblk0p2 rootwait" -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_SERIAL_SIFIVE=y -CONFIG_SERIAL_SIFIVE_CONSOLE=y -CONFIG_SPI=y -CONFIG_SPI_SIFIVE=y CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y CONFIG_GPIO_SIFIVE=y -CONFIG_MMC=y -CONFIG_MMC_SPI=y -CONFIG_CLK_U54_PRCI=y -CONFIG_CLK_GEMGXL_MGMT=y +CONFIG_MTD=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_BLOCK=y CONFIG_PWM=y CONFIG_PWM_SIFIVE=yboard/sifive/hifive-unleashed/post-build.sh new file +5
-0@@ -0,0 +1,5 @@ +#!/bin/sh + +BOARD_DIR="$(dirname $0)" + +install -m 0644 -D $BOARD_DIR/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.confboard/sifive/hifive-unleashed/readme.txt +7
-9@@ -30,35 +30,29 @@ Once the build has finished you will have the following files: output/images/ +-- fw_jump.bin +-- fw_jump.elf - +-- fw_payload.bin - +-- fw_payload.elf + +-- fw_dynamic.bin + +-- fw_dynamic.elf + +-- u-boot-spl.bin + +-- u-boot.itb +-- Image +-- rootfs.ext2 +-- rootfs.ext4 +-- rootfs.tar +-- sdcard.img - -Creating a bootable SD card with genimage -========================================= +Booting from MMC on the board +============================= Buildroot builds a SD card image for you. All you need to do is dd the image to your SD card, which can be done with the following command: - $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=4096 - -Booting the SD card on the board -================================ + $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0
Quoted 7 lines
board/sifive/hifive-unleashed/readme.txt Once the build has finished you will have the following files: · line 52
Quoted 5 lines
board/sifive/hifive-unleashed/readme.txt +2
-3-Make sure that the all DIP switches are set to the off position for -default boot mode (MSEL mode = 1111), insert the SD card and power -up the board. +Make sure that the DIP switches MSEL[3:0] are set to 1011 for booting +from MMC. Insert the SD card and power up the board.So now it only supports MMC boot? I don't think that is a good idea.
The previous support still works, but SPL MMC boot is the standardized way and recognized by open source. I believe the priority of boot flow would be an open-source solution compared to other proprietary solutions.
Jagan.
PATCH 2/2 sifive/hifive-unleashed: Support Mainline U-Boot, Linux
In reply to Jagan TekiQuoted 75 lines · Jagan Teki
Add Mainline U-Boot, Linux kernel version for
SiFive HiFive unleashed A00 board.Now, board would
- Boot from MMC with U-Boot SPL
- Linux version v5.6Signed-off-by Jagan Teki <[email protected]>--- board/sifive/hifive-unleashed/extlinux.conf | 4 +++ board/sifive/hifive-unleashed/genimage.cfg | 15 ++++++--- .../hifive-unleashed/linux.config.fragment | 13 ++------ board/sifive/hifive-unleashed/post-build.sh | 5 +++ board/sifive/hifive-unleashed/readme.txt | 33 ++++++++++--------- configs/hifive_unleashed_defconfig | 33 ++++++++++++++----- 6 files changed, 66 insertions(+), 37 deletions(-) create mode 100644 board/sifive/hifive-unleashed/extlinux.conf create mode 100755 board/sifive/hifive-unleashed/post-build.shboard/sifive/hifive-unleashed/extlinux.conf new file +4
-0@@ -0,0 +1,4 @@ +label HiFive-Unleashed linux + kernel /boot/Image + devicetree /boot/hifive-unleashed-a00.dtb + append console=ttySIF0 root=/dev/mmcblk0p3 rootwait rwboard/sifive/hifive-unleashed/genimage.cfg +11
-4@@ -3,15 +3,22 @@ image sdcard.img { gpt = true } - partition bootloader { - image = "fw_payload.bin" - offset = 1M - size = 32M + partition loader1 { + image = "u-boot-spl.bin" + offset = 17K + size = 1M + partition-type-uuid = 5B193300-FC78-40CD-8002-E86C45580B47 + } + + partition loader2 { + image = "u-boot.itb" + size = 4M partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985 } partition rootfs { image = "rootfs.ext4" + bootable = true partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 } }board/sifive/hifive-unleashed/linux.config.fragment +0
-6@@ -1,16 +1,9 @@ CONFIG_HZ_100=y -CONFIG_CMDLINE="earlycon=sbi root=/dev/mmcblk0p2 rootwait" -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_SERIAL_SIFIVE=y -CONFIG_SERIAL_SIFIVE_CONSOLE=y -CONFIG_SPI=y -CONFIG_SPI_SIFIVE=y CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y
board/sifive/hifive-unleashed/linux.config.fragment line 9
Quoted 10 lines
board/sifive/hifive-unleashed/linux.config.fragment +3
-4CONFIG_GPIO_SIFIVE=y -CONFIG_MMC=y -CONFIG_MMC_SPI=y -CONFIG_CLK_U54_PRCI=y -CONFIG_CLK_GEMGXL_MGMT=y +CONFIG_MTD=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_BLOCK=y CONFIG_PWM=y CONFIG_PWM_SIFIVE=y
Looks good.
Quoted 61 lines
board/sifive/hifive-unleashed/post-build.sh new file +5
-0@@ -0,0 +1,5 @@ +#!/bin/sh + +BOARD_DIR="$(dirname $0)" + +install -m 0644 -D $BOARD_DIR/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.confboard/sifive/hifive-unleashed/readme.txt +9
-15@@ -30,35 +30,29 @@ Once the build has finished you will have the following files: output/images/ +-- fw_jump.bin +-- fw_jump.elf - +-- fw_payload.bin - +-- fw_payload.elf + +-- fw_dynamic.bin + +-- fw_dynamic.elf + +-- u-boot-spl.bin + +-- u-boot.itb +-- Image +-- rootfs.ext2 +-- rootfs.ext4 +-- rootfs.tar +-- sdcard.img - -Creating a bootable SD card with genimage -========================================= +Booting from MMC on the board +============================= Buildroot builds a SD card image for you. All you need to do is dd the image to your SD card, which can be done with the following command: - $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=4096 - -Booting the SD card on the board -================================ + $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 -Make sure that the all DIP switches are set to the off position for -default boot mode (MSEL mode = 1111), insert the SD card and power -up the board. +Make sure that the DIP switches MSEL[3:0] are set to 1011 for booting +from MMC. Insert the SD card and power up the board. Connect the USB cable and open minicom (/dev/ttyUSB1, 115200, 8N1). -See the 'SiFive HiFive Unleashed Getting Started Guide' for -more details (https://www.sifive.com/documentation). - You will get a warning reported by fdisk when you examine the SD card. This is because the genimage.cfg file doesn't specify the SD card size (as people will naturally have different sized cards), so the
board/sifive/hifive-unleashed/readme.txt You will see something like this at boot time: · line 70
Quoted 4 lines
board/sifive/hifive-unleashed/readme.txt +1
-0@@ -73,3 +67,12 @@ You will see something like this at boot time: [ 2.334824] GPT:190496 != 122142719 [ 2.338302] GPT: Use GNU Parted to correct GPT errors. [ 2.343456] mmcblk0: p1 p2 +
Looks good.
board/sifive/hifive-unleashed/readme.txt You will see something like this at boot time: · line 78
Quoted 8 lines
board/sifive/hifive-unleashed/readme.txt +8
-0+Documentation +============= +See the 'SiFive HiFive Unleashed Getting Started Guide' for +more details (https://www.sifive.com/documentation). + +See the Amarula Solutions BSP sifive wiki for information of +usage and indetail steps. +https://wiki.amarulasolutions.com/bsp/riscv/sifive/hifive-unleashed.html
I don't think we want to include this.
Quoted 14 lines
configs/hifive_unleashed_defconfig +1
-0@@ -14,27 +14,44 @@ BR2_TARGET_GENERIC_GETTY=y BR2_TARGET_GENERIC_GETTY_PORT="ttySIF0" BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/sifive/hifive-unleashed/genimage.cfg" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/sifive/hifive-unleashed/post-build.sh" # Filesystem BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y
configs/hifive_unleashed_defconfig BR2_TARGET_GENERIC_GETTY=y · line 29
Quoted 10 lines
configs/hifive_unleashed_defconfig +2
-5-# Linux headers same as kernel, a 5.1 series -BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_1=y +# Linux headers same as kernel, a 5.6 series +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_6=y # Kernel BR2_LINUX_KERNEL=y -BR2_LINUX_KERNEL_CUSTOM_GIT=y -BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/alistair23/linux.git" -BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="hifive-unleashed-5.1"
Woo, good job getting rid of a fork.
Quoted 12 lines
configs/hifive_unleashed_defconfig +7
-2+BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.6" BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/sifive/hifive-unleashed/linux.config.fragment" -BR2_LINUX_KERNEL_IMAGE=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="sifive/hifive-unleashed-a00" +BR2_LINUX_KERNEL_INSTALL_TARGET=y +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y -# Bootloader +# opensbi
configs/hifive_unleashed_defconfig BR2_TARGET_GENERIC_GETTY=y · line 46
Quoted 10 lines
configs/hifive_unleashed_defconfig +7
-1BR2_TARGET_OPENSBI=y BR2_TARGET_OPENSBI_PLAT="sifive/fu540" -BR2_TARGET_OPENSBI_LINUX_PAYLOAD=y +BR2_TARGET_OPENSBI_FW_DYNAMIC=y + +# Bootloader +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,amarula,u-boot-amarula)v3.0-hifive-unleashed.tar.gz"
We should just be able to use mainline u-boot.
Alistair
Quoted 18 lines
configs/hifive_unleashed_defconfig +8
-1+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="sifive_fu540" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS=y +BR2_TARGET_UBOOT_NEEDS_OPENSBI_FW_DYNAMIC=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin" # Host tools BR2_PACKAGE_HOST_GENIMAGE=y --2.17.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 1/2 uboot: add support for bundling OpenSBI FW_DYNAMIC into U-Boot
In reply to Jagan TekiQuoted 4 lines · Jagan Teki
Some RISC-V platforms (such as SiFive FU540) have a boot process where U-Boot encapsulates the
FW_DYNAMICpart of the ARM trusted firmware. For such platforms, we need to build OpenSBI before U-Boot,
This shouldn't be ARM trusted firmware.
Quoted 2 lines
and pass a OPENSBI variable pointing to OpenSBI bl31.bin to the U-Boot build process.
Also no bl31.bin for OpenSBI.
Alistair
Quoted 59 lines
This commit introduces a
BR2_TARGET_UBOOT_NEEDS_OPENSBI_FW_DYNAMICvariable to achieve this.Signed-off-by Jagan Teki <[email protected]>--- boot/uboot/Config.in | 15 +++++++++++++++ boot/uboot/uboot.mk | 5 +++++ 2 files changed, 20 insertions(+)boot/uboot/Config.in +15
-0@@ -202,6 +202,21 @@ config BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF endchoice +config BR2_TARGET_UBOOT_NEEDS_OPENSBI_FW_DYNAMIC + bool "U-Boot needs OpenSBI fw_dynamic" + depends on BR2_TARGET_OPENSBI + help + A fw_dynamic firmware is particularly useful when the + booting stage executed prior to OpenSBI firmware is + capable of loading both the OpenSBI firmware and the + booting stage binary to follow OpenSBI firmware. + + Some RISC-V platforms (such as SiFive FU540) encapsulate + the fw_dynamic part of OpenSBI inside U-Boot. This option + makes sure OpenSBI gets built prior to U-Boot, and that + the OPENSBI variable pointing to OpenSBI's fw_dynamic + binary, is passed during the Buildroot build. + menu "U-Boot binary format" config BR2_TARGET_UBOOT_FORMAT_AISboot/uboot/uboot.mk +5
-1@@ -155,6 +155,11 @@ UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin endif endif +ifeq ($(BR2_TARGET_UBOOT_NEEDS_OPENSBI_FW_DYNAMIC),y) +UBOOT_DEPENDENCIES += opensbi +UBOOT_MAKE_OPTS += OPENSBI=$(BINARIES_DIR)/fw_dynamic.bin +endif + ifeq ($(BR2_TARGET_UBOOT_NEEDS_DTC),y) UBOOT_DEPENDENCIES += host-dtc endif --2.17.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 1/2 uboot: add support for bundling OpenSBI FW_DYNAMIC into U-Boot
In reply to Jagan TekiHello Jagan,
Quoted 6 lines · On Wed, 6 May 2020 15:38:44 +0530 Jagan Teki <[email protected]>…
Some RISC-V platforms (such as SiFive FU540) have a boot process where U-Boot encapsulates the
FW_DYNAMICpart of the ARM trusted firmware. For such platforms, we need to build OpenSBI before U-Boot, and pass a OPENSBI variable pointing to OpenSBI bl31.bin to the U-Boot build process.
Quoted 8 lines
This commit introduces a
BR2_TARGET_UBOOT_NEEDS_OPENSBI_FW_DYNAMICvariable to achieve this.Signed-off-by Jagan Teki <[email protected]>--- boot/uboot/Config.in | 15 +++++++++++++++ boot/uboot/uboot.mk | 5 +++++ 2 files changed, 20 insertions(+)
Since you had comments from Alistair Francis on both patches, I mark these as Changes Requested in patchwork. Could you please take into account the feedback from Alistair, and send a new iteration?
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com