Page MenuHomeFreeBSD

Add chain loader support for loader
ClosedPublic

Authored by tsoome on Apr 19 2016, 6:29 AM.
Tags
None
Referenced Files
F103265330: D5992.diff
Fri, Nov 22, 8:01 PM
Unknown Object (File)
Sun, Nov 17, 1:45 AM
Unknown Object (File)
Sat, Nov 16, 12:04 PM
Unknown Object (File)
Fri, Nov 15, 8:01 AM
Unknown Object (File)
Thu, Nov 14, 3:40 AM
Unknown Object (File)
Tue, Nov 5, 3:38 AM
Unknown Object (File)
Mon, Nov 4, 2:14 AM
Unknown Object (File)
Sat, Oct 26, 10:41 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!