Commit Graph

48 Commits

Author SHA1 Message Date
peter
aa07eb9f84 i386 ELF loader startup backend. On an ELF kernel booted with the 3-stage
bootblocks, the kernel shows up as the primary module:

[3:24am]~-100# kldstat
Id Refs Address  Size     Name
 1    1 0xf0100000 ff00000  /kernel
		   ^^^^ oops.. :-)

Based heavily on aout_freebsd.c.  Hmm.. There's so much in common that
these could probably be combined and just check the metadata to see which
format it is.
1998-09-30 19:48:09 +00:00
peter
736cc28307 Save booted kernel name. Cosmetic cleanups. 1998-09-30 19:42:06 +00:00
peter
3a7eff1835 Fix typos.. The vector for "int 0x12" (get base mem) is not written in
hex as "0x1a". :-)
Fix a comment about the extended memory checks, that's int 0x15.
1998-09-30 19:41:07 +00:00
peter
13ed7743e0 ELF loader, part 1. It works with ELF kernels generated on the i386
so far, and should probably be able to be made to work for the alpha
without too much trouble once it's connected up and my assumptions tested.

I think (but have not tested) it will also load "old" ELF kernels that
were not linked with DYNAMIC headers.

The module glue is yet to come. (oh fun.. :-)

It does not explicitly load symbols [yet].  The _DYNAMIC data contains a
runtime symbol set that ddb can use via ddb/db_kld.c.  It'll be missing
some detail that stabs normally provides (eg: number of args to a function,
line numbers, etc).  On the other hand, those minimal symbols will always
be available even on a stripped kernel.

This is mostly stolen from load_aout.c with some ideas from
alpha/libalpha/elf_freebsd.c.
1998-09-30 19:38:26 +00:00
peter
956d202701 s/out_loadmodule/aout_loadmodule/ in a printf diagnostic. 1998-09-30 19:26:23 +00:00
peter
f989be112e Uncomment prototype for elf_loadmodule 1998-09-30 19:25:26 +00:00
peter
fc873fcda4 The bootinfo struct was getting clobbered or not passed through correctly.
Presumably VTOP doesn't work for static objects.
The easiest way to get it working was to reserve some space after the
environment strings and copy the bootinfo struct there.
Also, set RB_BOOTINFO, it's needed.

I got the code to load and run an unmolested kernel OK for the first time
with this system a few minutes ago - at last!.  I did have to stop it
looking at the floppy though as BTX was trapping a mode 14 fault when
it look for /boot/boot.conf when no disk was in the drive. (I'm booting
from a scsi disk (bios disk 0x80)).

Now to teach it about ELF and modules :-)
1998-09-29 09:11:49 +00:00
peter
501805c399 Only bcopy the correct amount of data from the buffer in case it is ever
in an overrun situation.
1998-09-28 22:04:54 +00:00
peter
bc25156633 Use the variable with the path in it for the error message. 1998-09-28 22:03:01 +00:00
peter
51b3ea754e Reactivate the a.out kernel loader code. 1998-09-28 22:01:20 +00:00
peter
6f52c26500 Missing return value that was kinda important. 1998-09-28 21:59:21 +00:00
peter
21ca5b8d5a Argh, I don't believe how much time I wasted looking for this...
Bytes of extended memory = (extkb * 1024), not (extkb + 1024)
1998-09-28 21:39:11 +00:00
peter
d3c472a717 The comconsole mode is accessed as 'comconsole' not 'com'. 1998-09-28 20:17:05 +00:00
peter
652e75ae6c MBR magic is 0x55aa not 0xffaa. 1998-09-28 20:08:34 +00:00
peter
a9ac15c833 Precedence bug (?) causing probe problems. 1998-09-28 20:07:39 +00:00
dfr
ad6ddb7767 * Add old UFS compatibility code to alpha/boot1.
* Fix a raft of warnings, printf and otherwise.
* Allocate the correct amount in mod_searchmodule to prevent an overflow.
* Fix the makefiles so they work outside my home directory (oops).
1998-09-26 10:51:38 +00:00
msmith
73ca5cb35b Recover the arguments passed in from the previous load stage, use them to set
the default console.
Print malloc stats from the new libstand allocator.
1998-09-26 01:31:10 +00:00
msmith
bfe7e4f757 The BIOS can't perform a floppy operation where the destination crosses
a physical 64k boundary.  Allocate a bounce buffer for such a transaction.
1998-09-26 01:30:20 +00:00
msmith
7e33170a26 console.c
Allow the MI code to override the preferred console (eg. so that
	an RB_SERIAL flag from the i386 boot2 can override the default
	first active console)

isapnp.c
	Use the standard format for ISA PnP IDs.

pnp.c
	Allow trailing comments on lines, be less picky about line
	contents.

ls.c
	Cosmetic error message fix.

panic.c
	Print the right arguments.
1998-09-26 01:29:13 +00:00
peter
9f5a84eacb Make these compile when there is an obj dir. 1998-09-25 17:14:16 +00:00
dfr
00428fddff Make the alpha bootstrap build again, fix some warning and change sdboot to daboot. 1998-09-20 21:46:19 +00:00
msmith
0a0d8ce99a Make libstand movable.
This completes the basic work required to make the loader work with BTX. We
now have a third-stage bootstrap shared by the i386 and Alpha.
1998-09-19 01:35:53 +00:00
msmith
0523a3e013 - Improve debugging code.
- Make the "what do we do with a drunken disklabel" if-then-else-regardless
   tangle easier to read.
 - Don't count on the v86 structure being preserved between loop iterations,
   as it may be trampled eg. by the DEBUG call.
1998-09-19 01:33:29 +00:00
msmith
c820301756 Add a generic hexdump tool for debugging purposes. 1998-09-19 01:31:28 +00:00
msmith
c4d753268c Enable the biosdisk driver, duplicate -lstand as it both calls and is called
by the i386 platform library.
1998-09-18 02:03:30 +00:00
msmith
225ddd2fb1 Synch with development version. Compiles and opens but doesn't work yet. 1998-09-18 02:02:33 +00:00
msmith
ef33b3f094 Remove 'panic' command (it works), don't ask for a keypress in panic, as
exit() does.  Perhaps it shouldn't?
1998-09-18 02:01:38 +00:00
msmith
757180a4cf We lost all the files in crt/, so define the BIOS sector size here instead. 1998-09-18 01:12:46 +00:00
msmith
1f22597a12 Use a.out.h to get all the correct bits in one place. 1998-09-18 01:12:23 +00:00
msmith
0cf3eaddd6 Oops, missed these. Machine-independant ISA PnP enumerator. 1998-09-18 00:24:25 +00:00
msmith
f0b5ddae6f Initial integration of the i386 bootloader and BTX.
- Discard large amounts of BIOS-related code in favour of the more compact
   BTX vm86 interface.
 - Build the loader module as ELF, although the resulting object is a.out,
   make gensetdefs 32/64-bit sensitive and use a single copy of it.
 - Throw away installboot, as it's no longer required.
 - Use direct bcopy operations in the i386_copy module, as BTX
   maps the first 16M of memory.  Check operations against the
   detected size of actual memory.
1998-09-17 23:52:16 +00:00
rnordier
9e60491656 Add exec syscall. 1998-09-15 13:26:23 +00:00
msmith
97d5b83076 Resynch with working sources before BTX integration.
- Use format-independant module allocator.
 - Conditionalise ISA PnP support.
 - Simplify PnP enumerator interface.
 - Improve module/object searching.
 - Add missing depend/install targets in BTX makefiles.
 - Pass the kernel environment and module data in extended bootinfo fields.
 - Add a pointer to the end of the kernel + modules in bootinfo.
 - Fix parsing of old-style kernel arguments.
1998-09-14 18:27:06 +00:00
rnordier
71b1c34d38 Add BTX startup/interface code. 1998-09-14 10:37:00 +00:00
rnordier
ac5f389299 Enable client entry point support. 1998-09-13 13:28:07 +00:00
rnordier
b9a6cd3383 Add btxldr, a BTX loader for ELF clients. 1998-09-12 06:30:26 +00:00
rnordier
10a70998a1 This commit was generated by cvs2svn to compensate for changes in r39088,
which included commits to RCS files with non-trunk default branches.
1998-09-12 04:29:23 +00:00
rnordier
b599878e77 BTX (aka the boot extender) is an i386 kernel that hosts 32-bit
bootstrap programs, and provides page-level protection, hardware
interrupt reflection, a virtual-8086 mode interface to BIOS, etc.
1998-09-12 04:29:23 +00:00
rnordier
63bfe0d0ad BTX (aka the boot extender) is an i386 kernel that hosts 32-bit
bootstrap programs, and provides page-level protection, hardware
interrupt reflection, a virtual-8086 mode interface to BIOS, etc.
1998-09-12 04:29:23 +00:00
msmith
aa412001a9 Generic plug-and-play enumerator infrastructure. Query supplied
enumerators, crossreference returned identifiers with a text-format
database and automatically load corresponding modules and dependancies.
1998-09-04 02:43:26 +00:00
jkh
50ed861cdd Allow quoted strings (single or double) for grouping whitespace separated
items.  Eliminate warnings.
1998-09-03 06:14:41 +00:00
msmith
2feae82d78 Bootstrap updates.
- Move some startup code from MD to MI sections
 - Add a 'copyout' and some copyout-related functions.  These will be
   obsoleted when BTX is available for the 386 and the kernel load
   area becomes directly addressable.
 - Add the ability load an arbitrary file as a module, associating
   and arbitrary type string with it.  This can be used eg. for loading
   splash-screen images etc.
 - Add KLD module dependancy infrastructure.  We know how to look for
   dependancies inside KLD modules, how to resolve these dependancies
   and what to do if things go wrong.  Only works for a.out at the
   moment, due to lack of an MI ELF loader.  Attach KLD module information
   to loaded modules as metadata, but don't pass it to the kernel (it
   can find it itself).
 - Load a.out KLD modules on a page boundary.  Only pad the a.out BSS
   for the kernel, as it may want to throw symbols away.  (We might want
   to do this for KLD modules too.)
 - Allow commands to be hidden from the '?' display, to avoid cluttering
   it with things like 'echo'.  Add 'echo'.
 - Bring the 'prompt' command into line with the parser syntax.
 - Fix the verbose 'ls'; it was using an uninitialised stack variable.
 - Add a '-v' flag to 'lsmod' to have it display module metadata as well
   (not terribly useful for the average user)
 - Support a 'module searchpath' for required modules.
 - The bootstrap file on i386 is now called 'loader' to permit the
   /boot directory to use that name.
 - Discard the old i386 pread() function, as it's replaced by
   arch_readin()
1998-09-03 02:10:09 +00:00
msmith
a43b5b132e New commandline/script parser, supports backslash quoting and environment
variable substitution.

Submitted by:	Jordan Hubbard <jkh@freebsd.org>
1998-09-01 00:41:24 +00:00
msmith
815f3686d0 Bootloader update.
- Implement a new copyin/readin interface for loading modules.
   This allows the module loaders to become MI, reducing code duplication.
 - Simplify the search for an image activator for the loaded kernel.
 - Use the common module management code for all module metadata.
 - Add an 'unload' command that throws everything away.
 - Move the a.out module loader to MI code, add support for a.out
   kld modules.

Submitted by:	Alpha changes fixed by Doug Rabson <dfr@freebsd.org>
1998-08-31 21:10:43 +00:00
dfr
e2b188b518 Minor tweaks to track a couple of i386 changes and to make it compile. 1998-08-22 10:31:01 +00:00
msmith
a33756afc0 This commit was generated by cvs2svn to compensate for changes in r38465,
which included commits to RCS files with non-trunk default branches.
1998-08-21 03:17:42 +00:00
msmith
fc79e25bdf This is the new unified bootstrap, sometimes known previously as the
'three-stage' bootstrap.
There are a number of caveats with the code in its current state:
 - The i386 bootstrap only supports booting from a floppy.
 - The kernel and kld do not yet know how to deal with the extended
   information and module summary passed in.
 - PnP-based autodetection and demand loading of modules is not implemented.
 - i386 ELF kernel loading is not ready yet.
 - The i386 bootstrap is loaded via an ugly blockmap.

On the alpha, both net- and disk-booting (SRM console machines only) is
supported.  No blockmaps are used by this code.

Obtained from:	Parts from the NetBSD/i386 standalone bootstrap.
1998-08-21 03:17:42 +00:00
msmith
8adeb775c4 This is the new unified bootstrap, sometimes known previously as the
'three-stage' bootstrap.
There are a number of caveats with the code in its current state:
 - The i386 bootstrap only supports booting from a floppy.
 - The kernel and kld do not yet know how to deal with the extended
   information and module summary passed in.
 - PnP-based autodetection and demand loading of modules is not implemented.
 - i386 ELF kernel loading is not ready yet.
 - The i386 bootstrap is loaded via an ugly blockmap.

On the alpha, both net- and disk-booting (SRM console machines only) is
supported.  No blockmaps are used by this code.

Obtained from:	Parts from the NetBSD/i386 standalone bootstrap.
1998-08-21 03:17:42 +00:00