[PATCH v10 17/18] configs: fu540: Add config options for U-Boot SPL

Pragnesh Patel pragnesh.patel at sifive.com
Sun May 17 16:37:06 CEST 2020


Hi Bin,

>-----Original Message-----
>From: Bin Meng <bmeng.cn at gmail.com>
>Sent: 17 May 2020 18:28
>To: Pragnesh Patel <pragnesh.patel at sifive.com>
>Cc: U-Boot Mailing List <u-boot at lists.denx.de>; Atish Patra
><atish.patra at wdc.com>; Palmer Dabbelt <palmerdabbelt at google.com>; Paul
>Walmsley <paul.walmsley at sifive.com>; Jagan Teki
><jagan at amarulasolutions.com>; Anup Patel <anup.patel at wdc.com>; Sagar
>Kadam <sagar.kadam at sifive.com>; Rick Chen <rick at andestech.com>; Palmer
>Dabbelt <palmer at dabbelt.com>
>Subject: Re: [PATCH v10 17/18] configs: fu540: Add config options for U-Boot
>SPL
>
>[External Email] Do not click links or attachments unless you recognize the
>sender and know the content is safe
>
>Hi Pragnesh,
>
>On Thu, May 14, 2020 at 7:54 PM Pragnesh Patel
><pragnesh.patel at sifive.com> wrote:
>>
>> With sifive_fu540_defconfig:
>>
>> User can use FSBL or u-boot-spl.bin anyone at a time.
>>
>> For FSBL,
>> fsbl->fw_payload.bin (opensbi + U-Boot)
>>
>> For u-boot-spl.bin,
>> u-boot-spl.bin->FIT image (opensbi + U-Boot proper + dtb)
>>
>> U-Boot SPL will be loaded by ZSBL from SD card (replace fsbl.bin with
>> u-boot-spl.bin) and runs in L2 LIM in machine mode and then load FIT
>> image u-boot.itb from SD card into RAM.
>>
>> U-Boot SPL expects u-boot.itb FIT image at the starting of SD card
>> sector number (0x822) of GUID type "2E54B353-1271-4842-806F-
>E436D6AF6985"
>>
>> Signed-off-by: Pragnesh Patel <pragnesh.patel at sifive.com>
>> Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
>> Reviewed-by: Jagan Teki <jagan at amarulasolutions.com>
>> ---
>>  configs/sifive_fu540_defconfig |   8 ++
>>  doc/board/sifive/fu540.rst     | 134 +++++++++++++++++++++++++++++++++
>>  2 files changed, 142 insertions(+)
>>
>> diff --git a/configs/sifive_fu540_defconfig
>> b/configs/sifive_fu540_defconfig index f805aacc7a..8d412f8d6a 100644
>> --- a/configs/sifive_fu540_defconfig
>> +++ b/configs/sifive_fu540_defconfig
>> @@ -1,6 +1,11 @@
>>  CONFIG_RISCV=y
>> +CONFIG_SPL_GPIO_SUPPORT=y
>> +CONFIG_SYS_MALLOC_F_LEN=0x3000
>>  CONFIG_ENV_SIZE=0x20000
>> +CONFIG_SPL_MMC_SUPPORT=y
>>  CONFIG_NR_DRAM_BANKS=1
>> +CONFIG_SPL=y
>> +CONFIG_SPL_SPI_SUPPORT=y
>>  CONFIG_TARGET_SIFIVE_FU540=y
>>  CONFIG_ARCH_RV64I=y
>>  CONFIG_RISCV_SMODE=y
>> @@ -9,7 +14,10 @@ CONFIG_FIT=y
>>  CONFIG_MISC_INIT_R=y
>>  CONFIG_DISPLAY_CPUINFO=y
>>  CONFIG_DISPLAY_BOARDINFO=y
>> +CONFIG_SPL_SEPARATE_BSS=y
>> +CONFIG_SPL_YMODEM_SUPPORT=y
>>  CONFIG_OF_BOARD_FIXUP=y
>>  CONFIG_DEFAULT_DEVICE_TREE="hifive-unleashed-a00"
>>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>> +CONFIG_SPL_CLK=y
>>  CONFIG_DM_MTD=y
>> diff --git a/doc/board/sifive/fu540.rst b/doc/board/sifive/fu540.rst
>> index 610ba87074..89e8d66c56 100644
>> --- a/doc/board/sifive/fu540.rst
>> +++ b/doc/board/sifive/fu540.rst
>> @@ -31,6 +31,9 @@ TODO:
>>          stdout-path = "/soc/serial at 10010000:115200";
>>     };
>>
>> +Booting from MMC using FSBL
>> +---------------------------
>> +
>>  Building
>>  --------
>>
>> @@ -421,3 +424,134 @@ as well.
>>
>>     Please press Enter to activate this console.
>>     / #
>> +
>> +Booting from MMC using U-Boot SPL
>> +---------------------------------
>> +
>> +Building
>> +--------
>> +
>> +Before building U-Boot SPL, OpenSBI must be built first. OpenSBI can
>> +be cloned and built for FU540 as below:
>> +
>> +.. code-block:: console
>> +
>> +       git clone https://github.com/riscv/opensbi.git
>> +       cd opensbi
>> +       make PLATFORM=generic FW_DYNAMIC=y
>> +
>> +Copy OpenSBI FW_DYNAMIC image
>> +(build/platform/generic/firmware/fw_dynamic.bin) into U-Boot root
>> +directory
>> +
>> +.. code-block:: console
>> +
>> +       cp build/platform/generic/firmware/fw_dynamic.bin <u-boot-dir>
>> +
>> +Now build the U-Boot SPL and U-Boot proper
>> +
>> +.. code-block:: console
>> +
>> +       cd <U-Boot-dir>
>> +       make sifive_fu540_defconfig
>> +       make
>> +
>> +This will generate spl/u-boot-spl.bin and FIT image (u-boot.itb)
>> +
>> +
>> +Flashing
>> +--------
>> +
>> +ZSBL loads the U-Boot SPL (u-boot-spl.bin) from a partition with GUID
>> +type
>> +5B193300-FC78-40CD-8002-E86C45580B47
>> +
>> +U-Boot SPL expects a U-Boot FIT image (u-boot.itb) from a partition
>> +with GUID type 2E54B353-1271-4842-806F-E436D6AF6985
>> +
>> +FIT image (u-boot.itb) is a combination of fw_dynamic.bin,
>> +u-boot-nodtb.bin and device tree blob (hifive-unleashed-a00.dtb)
>> +
>> +Format the SD card (make sure the disk has GPT, otherwise use gdisk
>> +to switch)
>> +
>> +.. code-block:: none
>> +
>> +       # sudo sgdisk --clear \
>> +       > --set-alignment=2 \
>> +       > --new=1:34:2081 --change-name=1:loader1 --typecode=1:5B193300-
>FC78-40CD-8002-E86C45580B47 \
>> +       > --new=2:2082:10273 --change-name=2:loader2 --
>typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \
>> +       > --new=3:10274: --change-name=3:rootfs
>> + --typecode=3:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \
>
>The LBAs in this command do not match what is proposed in this patch:
>
>http://patchwork.ozlabs.org/project/uboot/patch/20200514115258.21042-
>16-pragnesh.patel at sifive.com/

I think the LBAs are in decimal here in this patch and hex in the proposed patch.

>
>> +       > /dev/sda
>> +
>> +Program the SD card
>> +
>> +.. code-block:: none
>> +
>> +       sudo dd if=spl/u-boot-spl.bin of=/dev/sda seek=34
>> +       sudo dd if=u-boot.itb of=/dev/sda seek=2082
>
>ditto

Same as above.

>
>Regards,
>Bin


More information about the U-Boot mailing list