[PATCH] doc: board: sophgo: milkv_duo: Update Milk-V Duo documentation

Kongyang Liu seashell11234455 at gmail.com
Tue Jun 11 09:12:09 CEST 2024


Heinrich Schuchardt <heinrich.schuchardt at canonical.com> 于2024年6月8日周六 00:31写道:
>
> 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 <seashell11234455 at 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?
>

I have tested the Milk-V Duo based on CV1800B and the Milk-V Duo256M based
on SG2002. The tool works properly on both of these boards. However, I have
not tested the Duo S because I currently don't have the board.

At present, U-Boot mainly supports the Milk-V Duo with 64M memory. For
users with 256M, we have provided a README in the GitHub repository for
building fip.bin.

> >
> >      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?
>

This is the precompiled FSBL provided by the vendor. Currently, the FSBL
needs to be placed into the vendor-provided SDK to be compiled. For
convenience, we provide the FSBL for different SoCs and uploaded them to
the GitHub repository.

> > +      --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?
>

The format of the FIP file is defined by the FSBL. This format may change
as the vendor updates the FSBL. At present, I don't think it's necessary
to adapt binman to this format. If there is a need in the future, we will
address this task.

> > +
> > +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.
>

Since I used a SD card that has been already formatted during my testing,
I forgot to mention this step in the documentation. I will add instructions
for this step in the next patch.

Best regards
Kongyang Liu

> 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
>


More information about the U-Boot mailing list