mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
gpt_write: use GPE LBA from header
When writing the GPT header, the tool always wrote the GPT entries belonging to the primary header to LBA following the header. Normally this is LBA 2 as the header is located in LBA 1. The GPT allows for up to 128 entries that all in all cover 16 KiB of storage space. However, on some systems, e.g. ARM-based machines, the bootloader can be stored in this region. For this reason the GPT entries may be moved to a different LBA. This commit changes the tool to adhere to then given GPE LBA in header when writing out the modified GPT data. Fixes #4720.
This commit is contained in:
parent
ddeaccf728
commit
5a558a64e1
@ -309,7 +309,7 @@ struct Gpt::Writer
|
|||||||
size_t const len = hdr.gpe_num * hdr.gpe_size;
|
size_t const len = hdr.gpe_num * hdr.gpe_size;
|
||||||
size_t const blocks = len / _block_size;
|
size_t const blocks = len / _block_size;
|
||||||
Block::sector_t const entries_lba = primary
|
Block::sector_t const entries_lba = primary
|
||||||
? hdr_lba + 1
|
? hdr.gpe_lba
|
||||||
: _block_count - (blocks + 1);
|
: _block_count - (blocks + 1);
|
||||||
Block_io entries_io(_block, _block_size, _ep, entries_lba, blocks, true,
|
Block_io entries_io(_block, _block_size, _ep, entries_lba, blocks, true,
|
||||||
entries, len);
|
entries, len);
|
||||||
|
Loading…
Reference in New Issue
Block a user