Page MenuHomeFreeBSD

stand: add ability to reference partitions by label
Needs ReviewPublic

Authored by audrey_rhelmot.io on Fri, Mar 14, 11:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 19, 2:02 PM
Unknown Object (File)
Wed, Mar 19, 8:20 AM
Unknown Object (File)
Wed, Mar 19, 6:00 AM

Details

Reviewers
manu
Summary

This allows the bootloader to reference files by partition label with the syntax label:$LABEL:$PATH similar to zfs:$DATASET:$PATH. The main mechanism by which this is achieved is by allowing devsw dv_parsedev functions to specify a different devsw than itself as the resulting idev's d_dev field, meaning that we can just create a new "label" devsw and have it swap out to an appropriate partition driver after parsedev. This is currently only implemented for GPT partitions, but it could realistically be extended to MBR or BSD.

I find this useful because I am trying to boot a system without the kernel copied onto the ESP, and it would be nice to not have to rely on disk indices in order to name the kernel in a loader script.

Test Plan

I'm not really sure what to write here.

I have tested this code and it works for loading kernels. This patch is currently vendored (rebased on 14.1) in the distro I'm working on and it should see a lot of use in the coming weeks.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped