Commit fc7c870b authored by davidcunado-arm's avatar davidcunado-arm Committed by GitHub
Browse files

Merge pull request #797 from dp-arm/dp/fiptool-improvements

fiptool: Add support for operating on binary blobs using the UUID
parents 9eb4d4dd d02fcebe
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
/* Length of a node address (an IEEE 802 address). */ /* Length of a node address (an IEEE 802 address). */
#define _UUID_NODE_LEN 6 #define _UUID_NODE_LEN 6
/* Length of UUID string including dashes. */
#define _UUID_STR_LEN 36
/* /*
* See also: * See also:
* http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt * http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt
......
This diff is collapsed.
...@@ -38,10 +38,8 @@ ...@@ -38,10 +38,8 @@
#define NELEM(x) (sizeof (x) / sizeof *(x)) #define NELEM(x) (sizeof (x) / sizeof *(x))
/* TODO: Do not hardcode, use realloc() */
#define MAX_IMAGES 32
enum { enum {
DO_UNSPEC = 0,
DO_PACK = 1, DO_PACK = 1,
DO_UNPACK = 2, DO_UNPACK = 2,
DO_REMOVE = 3 DO_REMOVE = 3
...@@ -53,10 +51,20 @@ enum { ...@@ -53,10 +51,20 @@ enum {
LOG_ERR LOG_ERR
}; };
typedef struct image_desc {
uuid_t uuid;
char *name;
char *cmdline_name;
int action;
char *action_arg;
struct image_desc *next;
} image_desc_t;
typedef struct image { typedef struct image {
uuid_t uuid; uuid_t uuid;
size_t size; size_t size;
void *buffer; void *buffer;
struct image *next;
} image_t; } image_t;
typedef struct cmd { typedef struct cmd {
......
...@@ -38,152 +38,110 @@ toc_entry_t toc_entries[] = { ...@@ -38,152 +38,110 @@ toc_entry_t toc_entries[] = {
{ {
.name = "SCP Firmware Updater Configuration FWU SCP_BL2U", .name = "SCP Firmware Updater Configuration FWU SCP_BL2U",
.uuid = UUID_TRUSTED_UPDATE_FIRMWARE_SCP_BL2U, .uuid = UUID_TRUSTED_UPDATE_FIRMWARE_SCP_BL2U,
.cmdline_name = "scp-fwu-cfg", .cmdline_name = "scp-fwu-cfg"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "AP Firmware Updater Configuration BL2U", .name = "AP Firmware Updater Configuration BL2U",
.uuid = UUID_TRUSTED_UPDATE_FIRMWARE_BL2U, .uuid = UUID_TRUSTED_UPDATE_FIRMWARE_BL2U,
.cmdline_name = "ap-fwu-cfg", .cmdline_name = "ap-fwu-cfg"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "Firmware Updater NS_BL2U", .name = "Firmware Updater NS_BL2U",
.uuid = UUID_TRUSTED_UPDATE_FIRMWARE_NS_BL2U, .uuid = UUID_TRUSTED_UPDATE_FIRMWARE_NS_BL2U,
.cmdline_name = "fwu", .cmdline_name = "fwu"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "Non-Trusted Firmware Updater certificate", .name = "Non-Trusted Firmware Updater certificate",
.uuid = UUID_TRUSTED_FWU_CERT, .uuid = UUID_TRUSTED_FWU_CERT,
.cmdline_name = "fwu-cert", .cmdline_name = "fwu-cert"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "Trusted Boot Firmware BL2", .name = "Trusted Boot Firmware BL2",
.uuid = UUID_TRUSTED_BOOT_FIRMWARE_BL2, .uuid = UUID_TRUSTED_BOOT_FIRMWARE_BL2,
.cmdline_name = "tb-fw", .cmdline_name = "tb-fw"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "SCP Firmware SCP_BL2", .name = "SCP Firmware SCP_BL2",
.uuid = UUID_SCP_FIRMWARE_SCP_BL2, .uuid = UUID_SCP_FIRMWARE_SCP_BL2,
.cmdline_name = "scp-fw", .cmdline_name = "scp-fw"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "EL3 Runtime Firmware BL31", .name = "EL3 Runtime Firmware BL31",
.uuid = UUID_EL3_RUNTIME_FIRMWARE_BL31, .uuid = UUID_EL3_RUNTIME_FIRMWARE_BL31,
.cmdline_name = "soc-fw", .cmdline_name = "soc-fw"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "Secure Payload BL32 (Trusted OS)", .name = "Secure Payload BL32 (Trusted OS)",
.uuid = UUID_SECURE_PAYLOAD_BL32, .uuid = UUID_SECURE_PAYLOAD_BL32,
.cmdline_name = "tos-fw", .cmdline_name = "tos-fw"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "Non-Trusted Firmware BL33", .name = "Non-Trusted Firmware BL33",
.uuid = UUID_NON_TRUSTED_FIRMWARE_BL33, .uuid = UUID_NON_TRUSTED_FIRMWARE_BL33,
.cmdline_name = "nt-fw", .cmdline_name = "nt-fw"
.action = 0,
.action_arg = NULL
}, },
/* Key Certificates */ /* Key Certificates */
{ {
.name = "Root Of Trust key certificate", .name = "Root Of Trust key certificate",
.uuid = UUID_ROT_KEY_CERT, .uuid = UUID_ROT_KEY_CERT,
.cmdline_name = "rot-cert", .cmdline_name = "rot-cert"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "Trusted key certificate", .name = "Trusted key certificate",
.uuid = UUID_TRUSTED_KEY_CERT, .uuid = UUID_TRUSTED_KEY_CERT,
.cmdline_name = "trusted-key-cert", .cmdline_name = "trusted-key-cert"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "SCP Firmware key certificate", .name = "SCP Firmware key certificate",
.uuid = UUID_SCP_FW_KEY_CERT, .uuid = UUID_SCP_FW_KEY_CERT,
.cmdline_name = "scp-fw-key-cert", .cmdline_name = "scp-fw-key-cert"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "SoC Firmware key certificate", .name = "SoC Firmware key certificate",
.uuid = UUID_SOC_FW_KEY_CERT, .uuid = UUID_SOC_FW_KEY_CERT,
.cmdline_name = "soc-fw-key-cert", .cmdline_name = "soc-fw-key-cert"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "Trusted OS Firmware key certificate", .name = "Trusted OS Firmware key certificate",
.uuid = UUID_TRUSTED_OS_FW_KEY_CERT, .uuid = UUID_TRUSTED_OS_FW_KEY_CERT,
.cmdline_name = "tos-fw-key-cert", .cmdline_name = "tos-fw-key-cert"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "Non-Trusted Firmware key certificate", .name = "Non-Trusted Firmware key certificate",
.uuid = UUID_NON_TRUSTED_FW_KEY_CERT, .uuid = UUID_NON_TRUSTED_FW_KEY_CERT,
.cmdline_name = "nt-fw-key-cert", .cmdline_name = "nt-fw-key-cert"
.action = 0,
.action_arg = NULL
}, },
/* Content certificates */ /* Content certificates */
{ {
.name = "Trusted Boot Firmware BL2 certificate", .name = "Trusted Boot Firmware BL2 certificate",
.uuid = UUID_TRUSTED_BOOT_FW_CERT, .uuid = UUID_TRUSTED_BOOT_FW_CERT,
.cmdline_name = "tb-fw-cert", .cmdline_name = "tb-fw-cert"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "SCP Firmware content certificate", .name = "SCP Firmware content certificate",
.uuid = UUID_SCP_FW_CONTENT_CERT, .uuid = UUID_SCP_FW_CONTENT_CERT,
.cmdline_name = "scp-fw-cert", .cmdline_name = "scp-fw-cert"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "SoC Firmware content certificate", .name = "SoC Firmware content certificate",
.uuid = UUID_SOC_FW_CONTENT_CERT, .uuid = UUID_SOC_FW_CONTENT_CERT,
.cmdline_name = "soc-fw-cert", .cmdline_name = "soc-fw-cert"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "Trusted OS Firmware content certificate", .name = "Trusted OS Firmware content certificate",
.uuid = UUID_TRUSTED_OS_FW_CONTENT_CERT, .uuid = UUID_TRUSTED_OS_FW_CONTENT_CERT,
.cmdline_name = "tos-fw-cert", .cmdline_name = "tos-fw-cert"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = "Non-Trusted Firmware content certificate", .name = "Non-Trusted Firmware content certificate",
.uuid = UUID_NON_TRUSTED_FW_CONTENT_CERT, .uuid = UUID_NON_TRUSTED_FW_CONTENT_CERT,
.cmdline_name = "nt-fw-cert", .cmdline_name = "nt-fw-cert"
.action = 0,
.action_arg = NULL
}, },
{ {
.name = NULL, .name = NULL,
.uuid = { 0 }, .uuid = { 0 },
.cmdline_name = NULL, .cmdline_name = NULL,
.action = 0,
.action_arg = NULL
} }
}; };
size_t toc_entries_len = sizeof(toc_entries) / sizeof(toc_entries[0]);
...@@ -39,14 +39,11 @@ ...@@ -39,14 +39,11 @@
#define TOC_HEADER_SERIAL_NUMBER 0x12345678 #define TOC_HEADER_SERIAL_NUMBER 0x12345678
typedef struct toc_entry { typedef struct toc_entry {
const char *name; char *name;
uuid_t uuid; uuid_t uuid;
const char *cmdline_name; char *cmdline_name;
int action;
char *action_arg;
} toc_entry_t; } toc_entry_t;
extern toc_entry_t toc_entries[]; extern toc_entry_t toc_entries[];
extern size_t toc_entries_len;
#endif /* __TBBR_CONFIG_H__ */ #endif /* __TBBR_CONFIG_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment