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)
Mar 23 2024, 1:08 AM
Unknown Object (File)
Mar 4 2024, 5:37 PM
Unknown Object (File)
Mar 4 2024, 11:50 AM
Unknown Object (File)
Feb 29 2024, 10:17 AM
Unknown Object (File)
Feb 22 2024, 10:17 PM
Unknown Object (File)
Feb 9 2024, 1:23 AM
Unknown Object (File)
Feb 6 2024, 2:09 PM
Unknown Object (File)
Jan 11 2024, 7:19 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!