Page MenuHomeFreeBSD

stand: Improve common "boot" command
AbandonedPublic

Authored by kevans on Feb 19 2018, 9:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 9, 11:23 AM
Unknown Object (File)
Fri, Sep 26, 4:41 PM
Unknown Object (File)
Sep 12 2025, 7:12 AM
Unknown Object (File)
Aug 20 2025, 3:06 AM
Unknown Object (File)
Jun 28 2025, 3:09 AM
Unknown Object (File)
Jun 27 2025, 3:58 AM
Unknown Object (File)
Jun 23 2025, 1:43 PM
Unknown Object (File)
Jun 17 2025, 10:32 PM
Subscribers
None

Details

Reviewers
dteske
imp
Summary

The common boot command claims to be able to take an explicit kernel to boot. If one specifies "boot kernel.GENERIC", boot will attempt to load a module named "kernel.GENERIC." The common case tends to be that a directory in /boot is named "kernel.GENERIC" with a "kernel" binary inside and this command will fail because it is not searching it.

Re-work it a little bit, fallback to try prepending /boot/$kernel to module_path and loading the "common_bootfiles" (i.e. kernel). This still doesn't quite match the functionality of the "boot" that forth seems to install because it doesn't load modules, but it at least allows the expected "boot $kernelname" to work.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 15157

Event Timeline

Instead of doing arithmetic on argc, argv in try_kernel, just pass in the argc/argv that we're expecting to be passed to mod_loadkld.

I'd honestly feel better if we did this in Lua instead.

stand/common/boot.c
53

This gets used uninitialized if we take the first rv == 0 path.

74–75

we have asprintf, I thought, in libstand which would simplify this.

96

This test isn't needed. libsa's free copes with NULL. See bigger issue above.

stand/common/boot.c
53

actually, it doesn't n/m.

Abandon ship, this is a bad idea.