Page MenuHomeFreeBSD

Add chain loader support for loader
ClosedPublic

Authored by tsoome on Apr 19 2016, 6:29 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jun 27, 11:35 AM
Unknown Object (File)
Tue, Jun 25, 12:21 PM
Unknown Object (File)
Thu, Jun 20, 11:17 PM
Unknown Object (File)
Thu, Jun 13, 12:28 PM
Unknown Object (File)
Fri, May 31, 10:49 PM
Unknown Object (File)
May 23 2024, 4:19 PM
Unknown Object (File)
May 21 2024, 7:13 PM
Unknown Object (File)
May 18 2024, 4:00 AM

Details

Summary

This update adds chain command to support simple chain loader. chain command accepts disk
device name as argument, then attempts to read MBR or VBR block (512B) into memory
and will jump to it. As an update to initial version, the bios chain is also allowed to read the bootcode from the file.

In addition, if variable "chain_disk" is set to disk device name, beastie menu will show an
ChainLoader menu entry for quick access to chain loading.

The UEFI chain command is intended to load efi application from ESP.

Test Plan

This update can only be tested in multiboot setups, to load another operating system.

The bios chain is in use in loader illumos port and appears to function quite nicely. The uefi chain I have tested only with loader boot1.efi (chaining illumos from freebsd:)

Diff Detail

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

Event Timeline

tsoome retitled this revision from to Add chain loader support for loader.
tsoome updated this object.
tsoome edited the test plan for this revision. (Show Details)

Updated to revision 298901.

Update to rev 301412.
Reserve extra space in relocator.

Updated to revision 302853.

Can you add some instructions or a man page explaining how to use it? (and how one would test it)

Can you add some instructions or a man page explaining how to use it? (and how one would test it)

from OK prompt: chain disk1: or chain disk1p1:

if the same device is set as value for chain_disk="disk1:" the menu would appear (hopefully). I guess the man update would be good indeed, I'll set note for myself:)

Updated to revision 318337.

allow to read boot code from file

bios chain is missing size, add efi chain.

tsoome edited the test plan for this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.
cem added inline comments.
head/sys/boot/i386/loader/chain.c
111–113

This is totally bogus. uintptr points at relocater_data, which is a uint32_t, not an array type.

Coverity rightly warns about it in CID 1376405 — Memory corruption.

tsoome added inline comments.
head/sys/boot/i386/loader/chain.c
111–113

Addressed in https://reviews.freebsd.org/D11321, thank you!