Page MenuHomeFreeBSD

Teach ufs_module.c about bsd partitions, at least a little.

Authored by imp on May 28 2018, 4:31 PM.



In addition to seeing if we can find a UFS partition at offset 0 on
the disk, check to see if there's a BSD disklabel at offset 512
(bytes) and if so, try to use the 'a' partition from that to boot
probe as well.

Diff Detail

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

Event Timeline

Doh! blocks, not bytes, for this arg.

A MBR+EFI image with this change booted for me in QEMU in both UEFI and BIOS modes.

82 ↗(On Diff #43074)

char *buffer[]?
also stack variable ordering

89 ↗(On Diff #43074)

s/normal/common/ or s/normal//?

99–100 ↗(On Diff #43074)

Maybe a static_assert that we're building on a little-endian system? Although hopefully we svn rm efi/boot1 before we look at EFI on say BE MIPS.

106 ↗(On Diff #43074)

return style

105 ↗(On Diff #43074)

perhaps include a || dl->d_partitions[0].p_offset == 0) case?

Better comment about GPT case

imp marked 5 inline comments as done.May 28 2018, 5:08 PM

Updated to address comments

82 ↗(On Diff #43074)

Doh! Yea, right. bad. It works because sizeof(char *) > sizeof(char)

99–100 ↗(On Diff #43074)

I don't see the point. UEFI is defined in the standard to be little endian. It's quite pervasive through everything, top to bottom. We will never have a BE UEFI thing it's so pervasive....

105 ↗(On Diff #43074)

Sure, it's an optimization, but likely a good one.

99–100 ↗(On Diff #43074)

Fair enough - this one spot is not the right place to make sure we don't try going down the UEFI path on a BE host.

Overall looks good to me. Potential worries would be stack usage and 4k block size issues.

This revision is now accepted and ready to land.May 28 2018, 6:14 PM
82 ↗(On Diff #43074)

these should still be reordered largest to smallest

imp marked 3 inline comments as done.

Multiple disks require that we don't use globals.

This revision now requires review to proceed.May 28 2018, 7:08 PM

Successfully tested the updated version in QEMU in both EFI and CSM modes.

emaste added a subscriber: releng.
This revision is now accepted and ready to land.May 29 2018, 12:00 AM
This revision was automatically updated to reflect the committed changes.