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, May 23, 4:19 PM
Unknown Object (File)
Tue, May 21, 7:13 PM
Unknown Object (File)
Sat, May 18, 4:00 AM
Unknown Object (File)
Fri, May 17, 6:56 PM
Unknown Object (File)
Thu, May 16, 1:48 PM
Unknown Object (File)
Thu, May 16, 2:15 AM
Unknown Object (File)
Tue, May 14, 6:16 AM
Unknown Object (File)
Mon, May 13, 9:26 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

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 ↗(On Diff #29731)

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 ↗(On Diff #29731)

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