Page MenuHomeFreeBSD

Allow "gpart bootcode" to work with version 1 boot0/boot0sio and to set new Volume Serial Number via boot0cfg

Authored by lev on Oct 2 2018, 10:13 PM.



There is bug in "gpart_mbr" bootcode command, which prevents boot0cfg from setting volume serial number (via "boot0cfg -i") and breaks "version 1" boot0/boot0sio blocks (which doesn't support serial number at all and .
It happens, because gpart_mbr always preserve 4 bytes of serial number, no matter what.

Thsi change add new flag to "gpart bootcode" command: "-N" which prevents copying these 4 bytes from old bootblock to new one.

boot0cfg adds this flag if it configures "old" boot0 or if it sets new serial number.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

lev created this revision.Oct 2 2018, 10:13 PM
yuripv added a subscriber: yuripv.Oct 2 2018, 10:42 PM

Please provide the diff with full context, e.g. by using -U10000 (a number big enough to include entire file contents) for git diff or git log.

121 ↗(On Diff #48663)

Options without arguments come first, i.e. [-N] [-b bootcode] [-p partcode -i index] [-f flags] geom.

54 ↗(On Diff #48663)

Move this just after the .Cm bootcode line.

249 ↗(On Diff #48663)

Some issues here: missing .It; please move this above to be sorted the same as in synopsis; start new sentences from new lines; and, finally, the text has too many repetitions of "volume serial number", reword it a bit like below:

.It Fl N
Don't preserve the Volume Serial Number for MBR.
MBR bootcode contains Volume Serial Number by default, and
tries to preserve it when installing new bootstrap code.
This option allows to skip the preservation to help with some versions of
.Xr boot0 8
that don't support Volume Serial Number.
lev updated this revision to Diff 48672.Oct 3 2018, 11:50 AM

Fix all issues pointed out by

des requested changes to this revision.Oct 9 2018, 9:59 AM
des added a subscriber: des.
des added inline comments.
375 ↗(On Diff #48672)

Break this line before the last int, indent continuation by four spaces.

420–421 ↗(On Diff #48672)

Either break the second line, or remove the first and unindent.

This revision now requires changes to proceed.Oct 9 2018, 9:59 AM
lev updated this revision to Diff 48934.Oct 9 2018, 2:57 PM
lev marked 3 inline comments as done.
Address new comments on style(9).
lev marked 2 inline comments as done.Oct 9 2018, 2:58 PM
des accepted this revision.Oct 30 2018, 8:00 AM
This revision is now accepted and ready to land.Oct 30 2018, 8:00 AM
lev added a comment.Nov 26 2018, 12:24 PM

Who could/should commit this? I don't have src commit bit.

This revision was automatically updated to reflect the committed changes.