diff mbox series

[v11,15/18] sifive: fu540: Add sample SD gpt partition layout

Message ID 20200519070346.24479-16-pragnesh.patel@sifive.com
State Superseded
Delegated to: Andes
Headers show
Series RISC-V SiFive FU540 support SPL | expand

Commit Message

Pragnesh Patel May 19, 2020, 7:03 a.m. UTC
From: Jagan Teki <jagan@amarulasolutions.com>

This is a sample GPT partition layout for SD card,
right now three important partitions are added to
make the system bootable.

partition layout:

Part    Start LBA       End LBA         Name
        Attributes
        Type GUID
        Partition GUID
  1     0x00000022      0x00000821      "loader1"
        attrs:  0x0000000000000000
        type:   5b193300-fc78-40cd-8002-e86c45580b47
        guid:   cbcbef44-e627-42bc-b134-93b6f3784b8c
  2     0x00000822      0x00002821      "loader2"
        attrs:  0x0000000000000000
        type:   2e54b353-1271-4842-806f-e436d6af6985
        guid:   f54eba28-d8de-4852-978d-1a673777e2ae
  3     0x00002822      0x00020821      "rootfs"
        attrs:  0x0000000000000004
        type:   0fc63daf-8483-4772-8e79-3d69d8477de4
        type:   linux
        guid:   9561df46-8d55-4799-a83b-cfee9ef6ff93

Note:
- loader1 would be fsbl or spl
- loader2 would be U-Boot or U-Boot proper

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
---
 board/sifive/fu540/Kconfig     |  2 ++
 include/configs/sifive-fu540.h | 13 +++++++++++++
 2 files changed, 15 insertions(+)

Comments

Bin Meng May 20, 2020, 1:59 p.m. UTC | #1
Hi Pragnesh,

On Tue, May 19, 2020 at 3:05 PM Pragnesh Patel
<pragnesh.patel@sifive.com> wrote:
>
> From: Jagan Teki <jagan@amarulasolutions.com>
>
> This is a sample GPT partition layout for SD card,
> right now three important partitions are added to
> make the system bootable.
>
> partition layout:
>
> Part    Start LBA       End LBA         Name
>         Attributes
>         Type GUID
>         Partition GUID
>   1     0x00000022      0x00000821      "loader1"
>         attrs:  0x0000000000000000
>         type:   5b193300-fc78-40cd-8002-e86c45580b47
>         guid:   cbcbef44-e627-42bc-b134-93b6f3784b8c
>   2     0x00000822      0x00002821      "loader2"
>         attrs:  0x0000000000000000
>         type:   2e54b353-1271-4842-806f-e436d6af6985
>         guid:   f54eba28-d8de-4852-978d-1a673777e2ae
>   3     0x00002822      0x00020821      "rootfs"
>         attrs:  0x0000000000000004
>         type:   0fc63daf-8483-4772-8e79-3d69d8477de4
>         type:   linux
>         guid:   9561df46-8d55-4799-a83b-cfee9ef6ff93
>
> Note:
> - loader1 would be fsbl or spl
> - loader2 would be U-Boot or U-Boot proper
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
> ---
>  board/sifive/fu540/Kconfig     |  2 ++
>  include/configs/sifive-fu540.h | 13 +++++++++++++
>  2 files changed, 15 insertions(+)
>

I see Jagan posted patches for SPI flash booting, and the layout is
different from MMC.

Can we use the same layout here, ie: by reserving spaces for the
U-Boot environment on MMC?

See http://patchwork.ozlabs.org/project/uboot/patch/20200519192340.16624-7-jagan@amarulasolutions.com/

    0 - 34 : reserved for GPT header
   35 - 39 : unused
   40 - 2087 : loader1 (SPL, FSBL)
 2088 - 10279 : loader2 (U-Boot proper, U-Boot)
10280 - 10535 : environment
10536 - 65494 : rootfs
65528 - 65536 : distro script


REgards,
Bin
Pragnesh Patel May 20, 2020, 2:20 p.m. UTC | #2
Hi Bin/Jagan,

>-----Original Message-----
>From: Bin Meng <bmeng.cn@gmail.com>
>Sent: 20 May 2020 19:30
>To: Pragnesh Patel <pragnesh.patel@sifive.com>
>Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Atish Patra
><atish.patra@wdc.com>; Palmer Dabbelt <palmerdabbelt@google.com>; Paul
>Walmsley <paul.walmsley@sifive.com>; Jagan Teki
><jagan@amarulasolutions.com>; Anup Patel <anup.patel@wdc.com>; Sagar
>Kadam <sagar.kadam@sifive.com>; Rick Chen <rick@andestech.com>; Palmer
>Dabbelt <palmer@dabbelt.com>
>Subject: Re: [PATCH v11 15/18] sifive: fu540: Add sample SD gpt partition
>layout
>
>[External Email] Do not click links or attachments unless you recognize the
>sender and know the content is safe
>
>Hi Pragnesh,
>
>On Tue, May 19, 2020 at 3:05 PM Pragnesh Patel
><pragnesh.patel@sifive.com> wrote:
>>
>> From: Jagan Teki <jagan@amarulasolutions.com>
>>
>> This is a sample GPT partition layout for SD card, right now three
>> important partitions are added to make the system bootable.
>>
>> partition layout:
>>
>> Part    Start LBA       End LBA         Name
>>         Attributes
>>         Type GUID
>>         Partition GUID
>>   1     0x00000022      0x00000821      "loader1"
>>         attrs:  0x0000000000000000
>>         type:   5b193300-fc78-40cd-8002-e86c45580b47
>>         guid:   cbcbef44-e627-42bc-b134-93b6f3784b8c
>>   2     0x00000822      0x00002821      "loader2"
>>         attrs:  0x0000000000000000
>>         type:   2e54b353-1271-4842-806f-e436d6af6985
>>         guid:   f54eba28-d8de-4852-978d-1a673777e2ae
>>   3     0x00002822      0x00020821      "rootfs"
>>         attrs:  0x0000000000000004
>>         type:   0fc63daf-8483-4772-8e79-3d69d8477de4
>>         type:   linux
>>         guid:   9561df46-8d55-4799-a83b-cfee9ef6ff93
>>
>> Note:
>> - loader1 would be fsbl or spl
>> - loader2 would be U-Boot or U-Boot proper
>>
>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
>> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
>> Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
>> ---
>>  board/sifive/fu540/Kconfig     |  2 ++
>>  include/configs/sifive-fu540.h | 13 +++++++++++++
>>  2 files changed, 15 insertions(+)
>>
>
>I see Jagan posted patches for SPI flash booting, and the layout is different
>from MMC.
>
>Can we use the same layout here, ie: by reserving spaces for the U-Boot
>environment on MMC?
>
>See
>http://patchwork.ozlabs.org/project/uboot/patch/20200519192340.16624-7-
>jagan@amarulasolutions.com/
>
>    0 - 34 : reserved for GPT header
>   35 - 39 : unused
>   40 - 2087 : loader1 (SPL, FSBL)
> 2088 - 10279 : loader2 (U-Boot proper, U-Boot)
>10280 - 10535 : environment
>10536 - 65494 : rootfs
>65528 - 65536 : distro script

I am okay with this. @Jagan Teki do you have any comment on this ?

>
>
>REgards,
>Bin
diff mbox series

Patch

diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig
index 4a77a2a37b..86193d7668 100644
--- a/board/sifive/fu540/Kconfig
+++ b/board/sifive/fu540/Kconfig
@@ -34,6 +34,8 @@  config BOARD_SPECIFIC_OPTIONS # dummy
 	imply CMD_EXT4
 	imply CMD_FAT
 	imply CMD_FS_GENERIC
+	imply CMD_GPT
+	imply PARTITION_TYPE_GUID
 	imply CMD_NET
 	imply CMD_PING
 	imply CMD_SF
diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
index ef3ae9b650..72c841eb9b 100644
--- a/include/configs/sifive-fu540.h
+++ b/include/configs/sifive-fu540.h
@@ -47,6 +47,15 @@ 
 
 #include <config_distro_bootcmd.h>
 
+#define TYPE_GUID_LOADER1	"5B193300-FC78-40CD-8002-E86C45580B47"
+#define TYPE_GUID_LOADER2	"2E54B353-1271-4842-806F-E436D6AF6985"
+#define TYPE_GUID_SYSTEM	"0FC63DAF-8483-4772-8E79-3D69D8477DE4"
+
+#define PARTS_DEFAULT \
+	"name=loader1,start=17K,size=1M,type=${type_guid_gpt_loader1};" \
+	"name=loader2,size=4MB,type=${type_guid_gpt_loader2};" \
+	"name=system,size=-,bootable,type=${type_guid_gpt_system};"
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"fdt_high=0xffffffffffffffff\0" \
 	"initrd_high=0xffffffffffffffff\0" \
@@ -55,6 +64,10 @@ 
 	"scriptaddr=0x88100000\0" \
 	"pxefile_addr_r=0x88200000\0" \
 	"ramdisk_addr_r=0x88300000\0" \
+	"type_guid_gpt_loader1=" TYPE_GUID_LOADER1 "\0" \
+	"type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \
+	"type_guid_gpt_system=" TYPE_GUID_SYSTEM "\0" \
+	"partitions=" PARTS_DEFAULT "\0" \
 	BOOTENV
 
 #define CONFIG_PREBOOT \