summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2019-05-04 07:04:47 +0000
committerGitHub <noreply@github.com>2019-05-04 07:04:47 +0000
commit28152c298beb5796625bc5f1cceec7eda18e1d17 (patch)
tree7f95a9ade16e401e804a06e8b9ee71aa094c4b7e
parentabc1c32378debaccdfb63c711de56f3a1becb84b (diff)
parentf23a09b177d9a55679fd3a57951313b8a34dc4d9 (diff)
downloadgenimage-28152c298beb5796625bc5f1cceec7eda18e1d17.tar.gz
genimage-28152c298beb5796625bc5f1cceec7eda18e1d17.tar.xz
Merge pull request #58 from tpetazzoni/gpt-bootable
image-hd: add support for bootable flags on GPT
-rw-r--r--image-hd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/image-hd.c b/image-hd.c
index 2c2860c..1f80ae7 100644
--- a/image-hd.c
+++ b/image-hd.c
@@ -78,6 +78,8 @@ struct gpt_partition_entry {
#define GPT_SECTORS (1 + GPT_ENTRIES * sizeof(struct gpt_partition_entry) / 512)
#define GPT_REVISION_1_0 0x00010000
+#define GPT_PE_FLAG_BOOTABLE (1 << 2)
+
static void hdimage_setup_chs(unsigned int lba, unsigned char *chs)
{
const unsigned int hpc = 255;
@@ -275,6 +277,7 @@ static int hdimage_insert_gpt(struct image *image, struct list_head *partitions)
uuid_parse(part->partition_uuid, table[i].uuid);
table[i].first_lba = htole64(part->offset/512);
table[i].last_lba = htole64((part->offset + part->size)/512 - 1);
+ table[i].flags = part->bootable ? GPT_PE_FLAG_BOOTABLE : 0;
for (j = 0; j < strlen(part->name) && j < 36; j++)
table[i].name[j] = htole16(part->name[j]);
i++;