mirror of
https://github.com/openhwgroup/cvw
synced 2025-01-23 21:14:37 +00:00
b3aaa87cba
Since writing an SD card image generation script, the bootloader needed to be altered to access individual binaries from specific partitions. A new file, gpt.c with it's header gpt.h, have been added to the bootloader to facilitate this. The SDC has been added to the device tree for the VCU108 board. Additionally the SDC interrupt signal was added to the PLIC node in the device tree. The PLIC itself was modified to accept the SDC interrupt signal.
41 lines
1023 B
C
41 lines
1023 B
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include "boot.h"
|
|
|
|
// LBA 0: Protective MBR
|
|
// ignored here
|
|
|
|
// Partition Table Header (LBA 1)
|
|
typedef struct gpt_pth
|
|
{
|
|
uint64_t signature;
|
|
uint32_t revision;
|
|
uint32_t header_size; //! little endian, usually 0x5c = 92
|
|
uint32_t crc_header;
|
|
uint32_t reserved; //! must be 0
|
|
uint64_t current_lba;
|
|
uint64_t backup_lba;
|
|
uint64_t first_usable_lba;
|
|
uint64_t last_usable_lba;
|
|
uint8_t disk_guid[16];
|
|
uint64_t partition_entries_lba;
|
|
uint32_t nr_partition_entries;
|
|
uint32_t size_partition_entry; //! usually 0x80 = 128
|
|
uint32_t crc_partition_entry;
|
|
} gpt_pth_t;
|
|
|
|
// Partition Entries (LBA 2-33)
|
|
typedef struct partition_entries
|
|
{
|
|
uint8_t partition_type_guid[16];
|
|
uint8_t partition_guid[16];
|
|
uint64_t first_lba;
|
|
uint64_t last_lba; //! inclusive
|
|
uint64_t attributes;
|
|
uint8_t name[72]; //! utf16 encoded
|
|
} partition_entries_t;
|
|
|
|
// Find boot partition and load it to the destination
|
|
int gpt_load_partitions(BYTE card_type);
|