Commit Graph

7 Commits

Author SHA1 Message Date
Michael Marineau 176fe49cf0 gpt: rename and update documentation for grub_gpt_update
The function now does more than just recompute checksums so give it a
more general name to reflect that.
2018-03-29 22:18:54 -04:00
Michael Marineau 38cc185319 gpt: allow repair function to noop
Simplifies usage a little.
2018-03-29 22:18:54 -04:00
Michael Marineau a794435ae9 gpt: use inline functions for checking status bits
This should prevent bugs like 6078f836 and 4268f3da.
2018-03-29 22:18:54 -04:00
Michael Marineau 72b178950d gpt: fix partition table indexing and validation
Portions of the code attempted to handle the fact that GPT entries on
disk may be larger than the currently defined struct while others
assumed the data could be indexed by the struct size directly. This
never came up because no utility uses a size larger than 128 bytes but
for the sake of safety we need to do this by the spec.
2018-03-29 22:18:54 -04:00
Michael Marineau b1ef48849c gpt: properly detect and repair invalid tables
GPT_BOTH_VALID is 4 bits so simple a boolean check is not sufficient.
This broken condition allowed gptprio to trust bogus disk locations in
headers that were marked invalid causing arbitrary disk corruption.
2018-03-29 22:18:54 -04:00
Michael Marineau d9bdbc1048 gpt: move gpt guid printing function to common library 2018-03-29 22:18:52 -04:00
Michael Marineau 508b02fc8a gpt: new gptprio.next command for selecting priority based partitions
Basic usage would look something like this:

    gptprio.next -d usr_dev -u usr_uuid
    linuxefi ($usr_dev)/boot/vmlinuz mount.usr=PARTUUID=$usr_uuid

After booting the system should set the 'successful' bit on the
partition that was used.
2018-03-29 22:18:52 -04:00