Bug 246986 - userboot.so can't open rootfs partition if you use raw BSD partitions directly on disk without any slices
Summary: userboot.so can't open rootfs partition if you use raw BSD partitions directl...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.1-STABLE
Hardware: amd64 Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-04 16:31 UTC by misho
Modified: 2020-06-04 16:31 UTC (History)
0 users

See Also:


Attachments
Patch for disk_open() (478 bytes, patch)
2020-06-04 16:31 UTC, misho
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description misho 2020-06-04 16:31:17 UTC
Created attachment 215231 [details]
Patch for disk_open()

From FreeBSD 12.1 till current version of FreeBSD. userboot.so loader haves issue with raw BSD partitions directly on disk without any PC slice schema aka MBR or GPT.

Bug came after commit, when predefine constant values was replaced with macro definitions in userboot/main.c and common/disk.c. These two members of devsw structure d_slice and d_partition now have defined constants. One of them have different value from previous version of code.
D_PARTWILD now have value -2, before that change dev.d_partition has 0.

I didn't take easy step directly to change macro D_PARTWILD to 0, because I saw that uboot loader already used this macro.
I made patch in common/disk.c file into disk_open() function