Skip to content

Commit

Permalink
Merge pull request #58 from tpetazzoni/gpt-bootable
Browse files Browse the repository at this point in the history
image-hd: add support for bootable flags on GPT
  • Loading branch information
michaelolbrich authored May 4, 2019
2 parents abc1c32 + f23a09b commit 28152c2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions image-hd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++;
Expand Down

0 comments on commit 28152c2

Please sign in to comment.