Page MenuHomeFreeBSD

Set bootme GPT flag to mark "active" partition on a GPT-labelled image
AbandonedPublic

Authored by sobomax on Feb 7 2024, 12:51 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 1:22 AM
Unknown Object (File)
Sun, Nov 24, 1:20 PM
Unknown Object (File)
Thu, Nov 21, 7:06 PM
Unknown Object (File)
Thu, Nov 21, 1:40 PM
Unknown Object (File)
Nov 7 2024, 5:10 AM
Unknown Object (File)
Nov 6 2024, 3:25 PM
Unknown Object (File)
Nov 5 2024, 2:49 PM
Unknown Object (File)
Nov 1 2024, 5:32 PM
Subscribers
None

Details

Reviewers
imp
marius
marcel
Summary

mkimg(1) is a fantastic tool to build all sorts of partitioned disk images, however it lacks the ability to mark GPT boot partition "active".

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sobomax created this revision.
This revision is now accepted and ready to land.Feb 7 2024, 2:49 AM
marius requested changes to this revision.Feb 7 2024, 10:43 PM
marius added inline comments.
usr.bin/mkimg/mkimg.1
163

It would be nice to have this list sorted alphabetically. Apart from that, this change looks good to me. Don't forget to bump .Dd when commtting, though.

This revision now requires changes to proceed.Feb 7 2024, 10:43 PM

o sorted alphabetically;
o updated .Dd.

marius requested changes to this revision.Feb 8 2024, 12:48 AM
marius added inline comments.
usr.bin/mkimg/mkimg.1
160

Uhm, the "and" should go onto a separate line so it's not an argument to the .Ar macro and not rendered specially as expected.

This revision now requires changes to proceed.Feb 8 2024, 12:48 AM
usr.bin/mkimg/gpt.c
211

One final nit... For GPT this is FreeBSD specific. The GPT standard just sets these bits aside for the OS to do what it wants... Linux, windows and MacOS all ignore it.
A small comment to this effect would be good.

looks unnecessary.

usr.bin/mkimg/gpt.c
211

Hmm, yet Windows at least sets those bits when installing itself:

$ sudo parted /dev/nvme0n1 print
Model: INTEL SSDPEKNW512G8 (nvme)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 525MB 524MB fat32 EFI system partition boot, esp, no_automount
2 525MB 660MB 134MB Microsoft reserved partition msftres, no_automount
3 660MB 151GB 150GB ntfs Basic data partition msftdata

usr.bin/mkimg/gpt.c
211

Are you sure? They aren't in the GPT/UEFI standard.

'boot' flag for parted has the value of '1' and is generated within parted. while the bootme flag for FreeBSD has a value of (1ULL << 59) and is definitely outside of the standard flags.