Page MenuHomeFreeBSD

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

Authored by lev on Oct 2 2018, 10:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 18, 12:57 PM
Unknown Object (File)
Thu, Apr 4, 2:15 AM
Unknown Object (File)
Mar 12 2024, 9:57 AM
Unknown Object (File)
Mar 12 2024, 9:57 AM
Unknown Object (File)
Mar 12 2024, 9:57 AM
Unknown Object (File)
Mar 12 2024, 9:56 AM
Unknown Object (File)
Mar 12 2024, 9:56 AM
Unknown Object (File)
Mar 8 2024, 5:37 AM
Subscribers

Details

Summary

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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.

lib/geom/part/geom_part.c
121 ↗(On Diff #48663)

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

lib/geom/part/gpart.8
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
.Nm
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.

Fix all issues pointed out by @yuripv_yuripv.net

des requested changes to this revision.Oct 9 2018, 9:59 AM
des added a subscriber: des.
des added inline comments.
usr.sbin/boot0cfg/boot0cfg.c
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 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
This revision is now accepted and ready to land.Oct 30 2018, 8:00 AM

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

This revision was automatically updated to reflect the committed changes.