Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Feb 2024 15:17:27 GMT
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 3fb8f1272b50 - main - riscv: add firmware partitions to GENERICSD.conf
Message-ID:  <202402141517.41EFHRxX015284@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=3fb8f1272b50cb87cb624b321f7b81e76627c437

commit 3fb8f1272b50cb87cb624b321f7b81e76627c437
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-02-14 15:12:57 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-02-14 15:16:54 +0000

    riscv: add firmware partitions to GENERICSD.conf
    
    Create two partitions in the existing space at the beginning of the
    image (8MB). These are intended to hold u-boot SPL and u-boot proper.
    
    The partition types selected are compatible with SiFive boards, e.g. the
    HiFive Unmatched. They can easily be overridden for a platform that uses
    the same scheme but different partition types, e.g. the StarFive
    VisionFive v2. Firmware is not actually installed, this too is left for
    the user.
    
    It is not as simple to create the firmware partitions after the fact,
    e.g. with partition indices 3 and 4. It is a shortcoming of current day
    u-boot that the SPL loader looks for a specific partition index, rather
    than the partition type, meaning that we will fail to boot if partition
    2 doesn't contain u-boot.
    
    Thus, our GENERICSD images become more generically usable with current
    RISC-V hardware/firmware platforms.
    
    Reviewed by:    manu, karels, imp
    MFC after:      1 month
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D43849
---
 release/riscv/GENERICSD.conf | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/release/riscv/GENERICSD.conf b/release/riscv/GENERICSD.conf
index 7bd58bc9f97b..d4abbc7965b8 100644
--- a/release/riscv/GENERICSD.conf
+++ b/release/riscv/GENERICSD.conf
@@ -1,6 +1,4 @@
 #!/bin/sh
-#
-#
 
 EMBEDDED_TARGET_ARCH="riscv64"
 EMBEDDED_TARGET="riscv"
@@ -11,4 +9,18 @@ IMAGE_SIZE="6144M"
 KERNEL="GENERIC"
 MD_ARGS="-x 63 -y 255"
 PART_SCHEME="GPT"
+EFIPART_SUFFIX=p3
+ROOTFSPART_SUFFIX=p4
 export BOARDNAME="GENERICSD"
+
+arm_create_partitions() {
+    # Create two partitions for firmware, preceding EFI and ROOTFS:
+    #  1. u-boot SPL
+    #  2. u-boot loader
+    #
+    #  The exact partition types can be rewritten by the user, but they should
+    #  be reserved now.
+
+    chroot ${CHROOTDIR} gpart add -t hifive-fsbl -l spl -a 512k -b 2m -s 2m ${mddev}
+    chroot ${CHROOTDIR} gpart add -t hifive-bbl -l uboot -a 512k -b 4m -s 4m ${mddev}
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402141517.41EFHRxX015284>