Commit Graph

15 Commits

Author SHA1 Message Date
Gordon Tetlow
666df9ddf3 Add support for reading an additional loader configuration file. By default,
this is called /boot/nextboot.conf. This file is required to have it's first
line be nextboot_enable="YES" for it to be read. Also, this file is
rewritten by the loader to nextboot_enable="NO"<space> after it is read.
This makes it so the file is read exactly once. Finally, the nextboot.conf
is removed shortly after the filesystems are mounted r/w.

Caution should be taken as you can shoot yourself in the foot. This is only
the loader piece. There will be a tool called nextboot(8) that will manage
the nextboot.conf file for you. It is coming shortly.

Reviewed by:	dcs
Approved by:	jake (mentor)
2002-05-24 02:28:58 +00:00
John Baldwin
0889b9be41 - Add 'fwrite' and 'fseek' words for writing to and seeking on files.
- Change the 'fopen' keyword to accept a mode parameter.  Note that this
  will break existing 4th scripts that use fopen.  Thus, the loader
  version has been bumped and loader.4th has been changed to check for a
  sufficient version on i386 and alpha.  Be sure that you either do a full
  world build or install or full build and install of sys/boot after this
  since loader.old won't work with the new 4th files and vice versa.

PR:		kern/32389
Submitted by:	Jonathan Mini <mini@haikugeek.com>
Sponsored by:	ClickArray, Inc.
2001-12-11 00:49:34 +00:00
Daniel C. Sobral
530df9baad Get rid of garbage left on the stack. 2000-09-25 11:36:55 +00:00
Daniel C. Sobral
818c39998e Use _ instead or - where proper, according to the style I have been
using.

Overload "?" so it will also show loader.4th commands.
2000-09-16 21:04:49 +00:00
Daniel C. Sobral
df3c7d3993 Solve a name clash.
Add something to help debugging.
2000-09-16 20:20:44 +00:00
Daniel C. Sobral
7b9e034490 Both boot and boot-conf were using a different algorithm from the one
used by start to find the kernel. Fix this.

Also, boot would proceed immediately in the absence of a path as
argument. Check first if a kernel has already been loaded, and, if
not, fall back to load kernel&modules behavior.

Some further factorizing. I deem this code to be mostly readable by
now! :-)

Many thanks to: Makoto MATSUSHITA <matusita@jp.FreeBSD.org>
2000-09-16 19:49:52 +00:00
Daniel C. Sobral
1cb190742f Factorize, reorganize, and move code around.
The boot-conf and boot code had various bugs, and some of it was big,
ugly, unwieldy, and, sometimes, plain incorrect. I'm just about
completely replaced these ugly parts with something much more manageable.

Minor changes were made to the well-factorized parts of it, to accomodate
the new code.

Of note:

	* make sure boot-conf has the exact same behavior wrt boot order
as start.

	* Correct both boot and boot-conf so they'll work correctly when
compiled in, as they both had some bugs, minor and major.

	* Remove all the crud from loader.4th back into support.4th, for
the first time since boot-conf was first improved. Hurray!

I'm fairly satisfied with the code at this time. Time to see about those
man pages...
2000-09-15 08:05:52 +00:00
Daniel C. Sobral
23aecb0109 Upon reflection, I decided that bootfile must have priority over kernel
as the kernel name. The one very unfortunate consequence is that kernel
as an absolute path loses the priority. It will only be tried after
/boot/${kernel}/${bootfile}. I'll see what can be done about it later.
2000-09-09 18:20:00 +00:00
Daniel C. Sobral
88a7f9eb70 First tackle at trying to handle the New Deal on kernels.
Load the first of the following kernels to be found:

${kernel} if ${kernel} is an absolute path
/boot/${kernel}/${kernel}
/boot/${kernel}/${bootfile}
${kernel}/${kernel}
${kernel}/${bootfile}
${kernel}
${bootfile}

The last instance of ${kernel} and ${bootfile} will be treated as a
list of semicolon separated file names, and each will be tried in turn,
from left to right.

Also, for each filename loader(8) will try filename, filename.ko,
filename.gz, filename.ko.gz, in that order, but that's not related
to this code.

This resulted in a major reorganization of the code, and much of what
was accumulating on loader.4th was rightly transfered to support.4th.

The semantics of boot-conf and boot also changed. Both will try to load
a kernel the same as above.

After a kernel was loaded, the variable module_path may get changed. Such
change will happen if the kernel was found with a directory prefix. In
that case, the module path will be set to ${directory};${module_path}.

Next, the modules are loaded as usual.

This is intended so kernel="xyzzy" in /boot/loader.conf will load
/boot/xyzzy/kernel.ko, load system modules from /boot/xyzzy/, and
load third party modules from /boot/modules or /modules. If that doesn't
work, it's a bug.

Also, fix a breakage of "boot" which was recently introduced. Boot without
any arguments would fail. No longer. Also, boot will only unload/reload
if the first argument is a path. If no argument exists or the first
argument is a flag, boot will use whatever is already loaded. I hope this
is POLA. That behavior is markedly different from that of boot-conf, which
will always unload/reload.

The semantics introduced here are experimental. Even if the code works,
we might decide this is not the prefered behavior. If you feel so, send
your feedback. (Yeah, this belongs in a HEADS UP or something, but I've
been working for the past 16 hours on this stuff, so gimme a break.)
2000-09-09 04:52:34 +00:00
Daniel C. Sobral
d39b220c77 Fix an error message which was using the wrong variable to get the
kernel name from.
2000-09-08 16:58:31 +00:00
Daniel C. Sobral
297c9cab3e Add constructors to crude structure support. Rework some of the
code into a more modular interface, with hidden vocabularies and
such. Remove the need to a lot of ugly initialization.

Also, add a few structure definitions, from stuff used on the C
part of loader. Some of this will disappear, and the crude structure
support will most likely be replaced by full-blown OOP support
already present on FICL, but not installed by default. But it was
getting increasingly inconvenient to keep this separate on my tree,
and I already lost lots of work once because of the hurdles, so
commit this.

Anyway, it makes support.4th more structured, and I'm not proceeding
with the work on it any time soon, unfortunately.
2000-09-08 16:57:28 +00:00
Daniel C. Sobral
14a7c31a0c Remove AGAIN definition, as FICL 2.04 provides it.
Add strlen, to help handling data generated by C code.

Add 2>r 2r>, because OO programming without them sucks.
2000-06-07 22:03:37 +00:00
Daniel C. Sobral
d2290dd57e Add silly password feature. If people want to depend on a flawed
security measures, so be it. It costs us almost nothing.

Document some code in support.4th that I was unable to understand
just by reading.
1999-11-24 17:56:40 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Daniel C. Sobral
7caa817b0e New loader.rc stuff.
Reviewed by:	jkh
1999-03-09 14:06:55 +00:00