manually created BSD partitions

Hello, installing FreeBSD 15 I tried to use layout "swap first" to have ability to easily expand root filesystem if needed.
I do not need MBR so just created BSD disklabel and two partitions - freebsd-swap and freebsd-ufs as root.
Everything went ok until first reboot - I got message 'No /boot/loader' etc, and system booted only with manually specifying 0:ad(0,b)/boot/loader
I looked boot2.c and seen that dsk.part is never initialized or written by default, so loader and even config is looked only on first partition.
So I made patch to scan all eight partition until config or loader found.
Does it cost to include in sources, or my case is too specific? I still use aged hardware from BIOS epoch and hyper-v v1 VMs.

--- boot2.c-orig 2026-03-09 10:59:26.654756000 +0000
+++ boot2.c 2026-03-09 14:29:10.651139000 +0000
@@ -216,11 +216,25 @@

autoboot = 1;

- if ((ino = lookup(PATH_CONFIG)) ||
- (ino = lookup(PATH_DOTCONFIG))) {
- nbyte = fsread(ino, cmd, sizeof(cmd) - 1);
- cmd[nbyte] = '\0';
+ for(dsk.part=0; dsk.part<8; dsk.part++) {
+ if ( (ino = lookup(PATH_CONFIG)) ||
+ (ino = lookup(PATH_DOTCONFIG)) ) {
+ // config found
+ nbyte = fsread(ino, cmd, sizeof(cmd) - 1);
+ cmd[nbyte] = '\0';
+ goto part_found;
+ }
+
+ if (lookup(PATH_LOADER)) {
+ // loader found, but no config in this partition
+// if (!OPT_CHECK(RBX_QUIET))
+ goto part_found;
+ }
}
+ // nothing found so proceed with default value
+ dsk.part=0;
+part_found:
+ printf("use part %c\n", 'a'+dsk.part);

if (*cmd) {
memcpy(cmddup, cmd, sizeof(cmd));
 
Back
Top