helloSystem / helloSystem/ISO

Make it possible to boot from loop-mounted ISO using the FreeBSD boot loader

Open
#307 12 comments 0 reactions 0 assignees View on GitHub
enhancement freebsd help wanted
Dominant language
Shell
Stars
847
Forks
66
PR merge metrics
No merged PRs in 30d

Description

It would be very useful (not just for helloSystem but in general) if one could boot into ISO files from the FreeBSD boot loader.

https://reviews.freebsd.org/D19733 seems to implement at least the first half of it:

> By mapping file, we create vdiskX device, the device will be listed by `lsdev [-v]`
> and can be accessed directly as ls `vdisk0p1:/path` or can be used as value for `currdev` variable.

`map-vdisk` can be used to loop-mount an ISO and to boot the kernel from it. I tested it and it works great:

```
map-vdisk aaa.iso # vdisk0 gets created
lsdev -v # shows vdisk0
set currdev=vdisk0:
unset vfs.root.mountfrom
boot -v
```

starts the kernel that is stored inside the ISO.
This is the first half of the needed functionality.

But then the **kernel does not see the vdisk** when trying to mount rootfs... is this functionality not implemented yet?

For this, we need the second half of the functionality.

Could it be ported from the ventoy kernel module?

This is what [Ventoy](https://github.com/ventoy/Ventoy) seems to be doing in GRUB; can we achieve the same effect using the FreeBSD bootloader? If yes, then the [existing Ventoy FreeBSD kernel module](https://github.com/ventoy/Ventoy/tree/master/Unix/ventoy_unix_src/FreeBSD/geom_ventoy_src/13.x/sys/geom/ventoy) could possibly do the rest of the work?

```
vtoy_ssprintf(buf, pos, "hint.ventoy.0.disksize=%llu\n", (ulonglong)(disk->total_sectors * (1 << disk->log_sector_size)));
vtoy_ssprintf(buf, pos, "hint.ventoy.0.diskuuid=\"%s\"\n", uuid);
vtoy_ssprintf(buf, pos, "hint.ventoy.0.disksignature=%02x%02x%02x%02x\n", disk_sig[0], disk_sig[1], disk_sig[2], disk_sig[3]);
vtoy_ssprintf(buf, pos, "hint.ventoy.0.segnum=%u\n", g_img_chunk_list.cur_chunk);

for (i = 0; i < g_img_chunk_list.cur_chunk; i++)
{
chunk = g_img_chunk_list.chunk + i;
vtoy_ssprintf(buf, pos, "hint.ventoy.%u.seg=\"0x%llx@0x%llx\"\n",
i, (ulonglong)(chunk->disk_start_sector * 512),
(ulonglong)((chunk->disk_end_sector + 1) * 512));
}
```

https://github.com/ventoy/Ventoy/blob/a4200ed99eaae5ec2b3034077d9a5ff461d5e8e8/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_unix.c#L313

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.