On 23.05.24 08:40, Kongyang Liu wrote:
Add detailed steps for compiling U-Boot and OpenSBI, generating the
firmware package with fiptool, and booting the board.

Signed-off-by: Kongyang Liu <seashell11234...@gmail.com>
---

  doc/board/sophgo/milkv_duo.rst | 41 +++++++++++++++++++++++++---------
  1 file changed, 30 insertions(+), 11 deletions(-)

diff --git a/doc/board/sophgo/milkv_duo.rst b/doc/board/sophgo/milkv_duo.rst
index cb2ed1ad98..a88db5b903 100644
--- a/doc/board/sophgo/milkv_duo.rst
+++ b/doc/board/sophgo/milkv_duo.rst
@@ -20,31 +20,50 @@ Building
  .. code-block:: console

There are is a 64 MiB version of the Milk-V Duo with the CF1800B, a 256 MiB version with the SG2002 and a Milk-V Duo S with the SG2000.

This may confuse U-Boot users. Should we mention explicitly that only the CF1800B based board is supported?

export CROSS_COMPILE=<riscv64 toolchain prefix>
+
+3. Compile U-Boot
+
+.. code-block:: console
+
     cd <U-Boot-dir>
     make milkv_duo_defconfig
     make
-This will generate u-boot-dtb.bin
+This will generate u-boot.bin and u-boot.dtb
-Booting
-~~~~~~~
-Currently, we rely on vendor FSBL(First Stage Boot Loader) to initialize the
-clock and load the u-boot image, then bootup from it.
+4. Compile OpenSBI
+
+.. code-block:: console
-Alternatively, to run u-boot-dtb.bin on top of FSBL, follow these steps:
+   cd <OpenSBI-dir>
+   make PLATFORM=generic FW_FDT_PATH=<Your U-Boot Path>/u-boot.dtb
-1. Use the vendor-provided tool to create a unified fip.bin file containing
-   FSBL, OpenSBI, and U-Boot.
+This will generate fw_dynamic.bin
-2. Place the generated fip.bin file into the FAT partition of the SD card.
+4. Generate firmware image package
-3. Insert the SD card into the board and power it on.
+Fiptool(https://github.com/sophgo/fiptool) is used to generate fip file.
+
+.. code-block:: console
+
+   git clone https://github.com/sophgo/fiptool
+   cd fiptool
+   ./fiptool \
+      --fsbl data/fsbl/cv180x.bin \

Where do we get this file from?

+      --opensbi <OpenSBI-dir>/fw_dynamic.bin \
+      --uboot <U-Boot-dir>/u-boot.bin \
+
+This will generate fip.bin

Should we let binman do this in future?

+
+Booting
+~~~~~~~
+1. Place the generated fip.bin file into the FAT partition of the SD card.

This information is insufficient to set up a new SD-card.

Should the SD card be MBR or GPT partitioned?

On an SD card there are typically are multiple partitions. All of these may be FAT partioned. Does the boot ROM use a fixed partition number, a partition type, or a start sector to identify the relevant partition?

It is left unclear if fip.bin is to be copied by dd to the partition or into a FAT file system on the partition.



I just downloaded the vendor milkv-duo-v1.1.1-2024-0528.img.zip file.

Here I found an MBR partition table with the following partitions:

Device                          Boot   Start     End Sectors  Size Id Type
milkv-duo-v1.1.1-2024-0528.img1 * 1 262144 262144 128M c W95 FAT32 (LBA)
milkv-duo-v1.1.1-2024-0528.img2       262145 1835008 1572864  768M 83 Linux
milkv-duo-v1.1.1-2024-0528.img3      1835009 2359296  524288  256M  0 Empty

Partition 1 was FAT16 partitioned and contained file fip.bin in the root directory. But I still don't know how the relevant partition is identified.

Best regards

Heinrich

+2. Insert the SD card into the board and power it on.
The board will automatically execute the FSBL from the fip.bin file.
  Subsequently, it will transition to OpenSBI, and finally, OpenSBI will invoke
  U-Boot.
-
  Sample boot log from Milk-V Duo board
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  .. code-block:: none

Reply via email to