diff options
| author | Zoltan HERPAI | 2022-06-02 10:29:57 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2023-10-29 17:45:13 +0000 |
| commit | 635466123429ba8682b575245bbf52e3b33b7163 (patch) | |
| tree | 17550da29fa033f9a2d902ca2e45ba8d370b83fa | |
| parent | 0fa1cc51013ff3a8e7f5fd3b6aeeafbbb7abc365 (diff) | |
| download | firmware-utils-635466123429ba8682b575245bbf52e3b33b7163.tar.gz | |
firmware-utils: ptgen: add SiFive GPT partition support
The SiFive RISC-V SoCs use two special partition types in the boot process.
As a first step, the ZSBL (zero-stage bootloader) in the CPU looks for a
partition with a GUID of 5B193300-FC78-40CD-8002-E86C45580B47 to load the
first-stage bootloader - which in OpenWrt's case is an SPL image. The FSBL
(SPL) then looks for a partition with a GUID of
2E54B353-1271-4842-806F-E436D6AF6985 to load the SSBL which is usually an
u-boot.
With ptgen already supporting GPT partition creation, add the required GUID
types and name them accordingly to be invoked with the '-T <GPT partition
type>' parameter.
Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
| -rw-r--r-- | src/ptgen.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ptgen.c b/src/ptgen.c index 58066fe..b231c28 100644 --- a/src/ptgen.c +++ b/src/ptgen.c @@ -82,6 +82,14 @@ typedef struct { GUID_INIT( 0x0fc63daf, 0x8483, 0x4772, \ 0x8e, 0x79, 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4) +#define GUID_PARTITION_SIFIVE_SPL \ + GUID_INIT( 0x5b193300, 0xfc78, 0x40cd, \ + 0x80, 0x02, 0xe8, 0x6c, 0x45, 0x58, 0x0b, 0x47) + +#define GUID_PARTITION_SIFIVE_UBOOT \ + GUID_INIT( 0x2e54b353, 0x1271, 0x4842, \ + 0x80, 0x6f, 0xe4, 0x36, 0xd6, 0xaf, 0x69, 0x85) + #define GPT_HEADER_SIZE 92 #define GPT_ENTRY_SIZE 128 #define GPT_ENTRY_MAX 128 @@ -276,6 +284,19 @@ static inline bool parse_gpt_parttype(const char *type, struct partinfo *part) (1ULL << 56); /* success=1 */ return true; } + + if (!strcmp(type, "sifiveu_spl")) { + part->has_guid = true; + part->guid = GUID_PARTITION_SIFIVE_SPL; + return true; + } + + if (!strcmp(type, "sifiveu_uboot")) { + part->has_guid = true; + part->guid = GUID_PARTITION_SIFIVE_UBOOT; + return true; + } + return false; } |