Skip to contentSkip to conversation

sifive: fu540: Add sample SD gpt partition layout

PATCH Superseded Jagan Teki 1 participant 2 messages Apr 7, 2020 SiFive drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

PATCH 1/2 sifive: fu540: Add sample SD gpt partition layout

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

Right now the board doesn't support the environment, so the U-Boot environment and ESP partitions will add in future.

partition layout:

Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000800 0x00000fff "loader1"

        attrs:  0x0000000000000000
        type:   5b193300-fc78-40cd-8002-e86c45580b47
        guid:   3b86e786-4b78-4bb2-92ac-7c7b45e73d33
  2     0x00001000      0x00002fff      "loader2"
        attrs:  0x0000000000000000
        type:   2e54b353-1271-4842-806f-e436d6af6985
        guid:   c09e2067-3c33-4ceb-993a-fbdc29a6a8cf
  3     0x00003000      0x03b9ffde      "system"
        attrs:  0x0000000000000004
        type:   0fc63daf-8483-4772-8e79-3d69d8477de4
        type:   linux
        guid:   99f4fd58-6e52-4a2b-b5f0-035f5756ad01

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

---
Note: On top of https://patchwork.ozlabs.org/cover/1263480/

 board/sifive/fu540/Kconfig     |  2 ++
 include/configs/sifive-fu540.h | 13 +++++++++++++
 2 files changed, 15 insertions(+)
board/sifive/fu540/Kconfig +2 -0
index 5c67aab96a..43d01bab8d 100644
@@ -32,6 +32,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 CLK_SIFIVE
include/configs/sifive-fu540.h +13 -0
index ef3ae9b650..189e70d7be 100644
@@ -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=1M,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 \
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/2 sifive: fu540: Add U-Boot proper sector start

Add U-Boot proper sector start offset for SiFive FU540. This value is based on the partition layout supported by SiFive FU540.

u-boot.itb need to write on this specific offset so-that the SPL will retrieve it from here and load.

---
Note: On top of https://patchwork.ozlabs.org/cover/1263480/

 common/spl/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
common/spl/Kconfig +2 -1
index 07eee56219..4c36864602 100644
@@ -308,7 +308,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
 		     ARCH_MX6 || ARCH_MX7 || \
 		     ARCH_ROCKCHIP || ARCH_MVEBU ||  ARCH_SOCFPGA || \
 		     ARCH_AT91 || ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || \
-		     OMAP44XX || OMAP54XX || AM33XX || AM43XX
+		     OMAP44XX || OMAP54XX || AM33XX || AM43XX || TARGET_SIFIVE_FU540
 	help
 	  Use sector number for specifying U-Boot location on MMC/SD in
 	  raw mode.
@@ -325,6 +325,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
 	default 0x300 if ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || OMAP44XX || \
 		         OMAP54XX || AM33XX || AM43XX || ARCH_K3
 	default 0x4000 if ARCH_ROCKCHIP
+	default 0x1000 if TARGET_SIFIVE_FU540
 	help
 	  Address on the MMC to load U-Boot from, when the MMC is being used
 	  in raw mode. Units: MMC sectors (1 sector = 512 bytes).
Signature · 1 line
2.17.1