Commit Graph

647 Commits

Author SHA1 Message Date
Peter Wemm
a5bd71a96d Argh. This was broken by the last-minute elf32/elf64/"elf kernel" changes. 2003-05-01 04:31:33 +00:00
Peter Wemm
2f0eeb54eb Nuke; repocopied to elf32_freebsd.c where it lives on. 2003-05-01 03:57:19 +00:00
Peter Wemm
48a0b96a50 Enable the i386 loader to load and run an amd64 kernel. If this puts
things over floppy size limits, I can exclude it for release builds or
something like that.  Most of the changes are to get the load_elf.c file
into a seperate elf32_ or elf64_ namespace so that you can have two
ELF loaders present at once.  Note that for 64 bit kernels, it actually
starts up the kernel already in 64 bit mode with paging enabled.  This
is really easy because we have a known minimum feature set.

Of note is that for amd64, we have to pass in the bios int 15 0xe821
memory map because once in long mode, you absolutely cannot make VM86
calls.  amd64 does not use 'struct bootinfo' at all.  It is a pure loader
metadata startup, just like sparc64 and powerpc.  Much of the
infrastructure to support this was adapted from sparc64.
2003-05-01 03:56:30 +00:00
Peter Wemm
d6d3ae55c3 ACPI will always be present on AMD64 - it will never be an autodetect
module.
2003-04-30 22:02:39 +00:00
Nate Lawson
51773ddf47 Support functions for the new ACPI import.
* AcpiOsDerivePciId(): finds a bus number, given the slot/func and the
    acpi parse tree.
  * AcpiOsPredefinedOverride(): use the sysctl hw.acpi.os_name to
    override the value for _OS.

Ideas from:	takawata, jhb
Reviewed by:	takawata, marcel
Tested on:	i386, ia64
2003-04-29 18:50:34 +00:00
Poul-Henning Kamp
197e5e73ef Libdisk does not need to include <sys/diskslice.h> any more.
Move the remaining bits of <sys/diskslice.h> to <i386/include/bootinfo.h>

Move i386/pc98 specific bits from <sys/reboot.h> to
<i386/include/bootinfo.h> as well.

Adjust includes in sys/boot accordingly.
2003-04-04 16:35:16 +00:00
Ruslan Ermilov
e478cf0a5a Fixed CLEANFILES.
Submitted by:	cron
2003-02-25 15:41:49 +00:00
Poul-Henning Kamp
b04b95ab47 Build a file "boot" which consists of boot1 and boot2 concatenated.
There is little if any reason to treat the two components separately
and it will simplify disklabel(8) and libdisk if we didn't.
2003-01-26 13:33:57 +00:00
Poul-Henning Kamp
63fc86da6f Use NEXTDOSPART instead of MAX_SLICES. 2003-01-20 11:15:12 +00:00
David E. O'Brien
90949c8331 Simplify the Makefile by just using our standard PROG variable. 2003-01-18 23:09:56 +00:00
Warner Losh
b24431ad30 Save 4 more bytes by not initializing opts to 0. This moves it from
the data section to the bss section givig us initialization for free.

Noticed by: bde
2003-01-14 16:33:37 +00:00
Warner Losh
8e6206d943 Fix interactive booting:
o Revision 1.38 introduced the -n flag.  It conflicted with the
  RB_BOOTINFO flag, so was in effect always on.  Change the -n flag to
  be bit 0x1c instead of 0x1f.  This also had the consequence that a mal-formed
  /boot.config would render the system unbootable because the user was
  unable to enter anything at all on the command line.
o Remove the initialization of opt to be RB_BOOTINFO since we filter that bit
  out and do not otherwise use it.

Reviewed by: jhb
MFC after: 3 days
2003-01-13 21:28:24 +00:00
David E. O'Brien
f62a945f30 RIP liloldr.
It is not complete (the LILO root= specification isn't passed to our
loader for instance), it has not been touched in over 2 years.  Linux has
moved on to GRUB, so this is OBE now.  If someone creeps up to work on it,
it could become a port.
2002-12-31 02:29:03 +00:00
David E. O'Brien
cf47cae1f5 -mno-align-long-strings can make things smaller, so lets use it in hopes
that it does here.
2002-12-21 02:03:31 +00:00
Warner Losh
1e315c9022 Put back the casts to unsigned. While no strictly necessary for its
current uses, the name strcmp has strong connotations that shouldn't
lightly be discarded.  This doesn't cost us anything.

Submitted by: bde
2002-12-20 05:49:40 +00:00
Jake Burkholder
7c6c018c0c Renamed the loader's zipfs to gzipfs. zipfs.c was repo-copied to gzipfs.c. 2002-12-19 19:34:59 +00:00
Warner Losh
79cfd4b63b I didn't intend to delete this rm from the Makefile. It snuck in at
the last second before the commit.

# likely we can remove this hack now that gcc generates better aligned code
# in the align to word case.

Noticed by: bde
2002-12-18 07:13:53 +00:00
Warner Losh
1c584b760c Reduce diffs with Peter's expanded diffs:
1) Put back the keyboard printing printf, at the cost of 58 bytes.
2) Minor tweak to getstr at no apparent cost.
2002-12-17 22:00:06 +00:00
Warner Losh
2db4f48c6a Make both UFS1 and UFS2 fit on the same boot blocks. These are a
subset of Peter's patchs that are believed to be safe.

Makefile tweaks:
o -fomit-frame-pointer
o Change default to building both UFS1 and UFS2 bootblocks.

Lots of boot2 tweaks:
o lookup is only ever called with kname, so use it directly.
o inline memsize
o getstr are only ever called with cmd, so hardware that.
o tweaks to the parsing code to test after the conversion rather than
  before since we tested after anyways.
o eliminate support for %x in printf.
o eliminate a few bytes in printfs.
o Tweak the boot banner.
o eliminate support for wd and "  " devices (I might add wd back to
  keep bde happy).
o eliminate support for a few arguments.

This takes us from -162 bytes free to 67 bytes free.

I've tested this only on a few systems, so be careful when updating to
this change.

Submitted by: peter, imp, ian
2002-12-17 21:10:34 +00:00
David E. O'Brien
70e9a2fedd Remove unneeded casts. Add others to make WARNS=5 happy. 2002-12-15 02:15:19 +00:00
Poul-Henning Kamp
a3b5a4369c Employ the unused bytes after the disklabel in the second sector. This makes
it possible to make UFS1_ONLY and UFS2_ONLY versions which fit inside the
traditional 16 sectors.

Remove assorted now unneeded hackery.

UFS1_AND_UFS2 still needs another 150 bytes to work, and that is probably
not within our reach, ever.
2002-12-14 19:44:13 +00:00
Poul-Henning Kamp
a22c4dc517 Remove unnecessary call to fsread(). 2002-12-14 19:40:35 +00:00
Poul-Henning Kamp
2bfe8dcc0a Always use the smaller GCC builtin memcpy 2002-12-14 19:15:27 +00:00
Poul-Henning Kamp
c176645976 Remove unused variable. 2002-12-14 19:09:37 +00:00
Poul-Henning Kamp
03fff82196 Don't fill in the table with the BIOS idea about disk-geometry, we don't
use it.  This saves a surprising number of bytes.
2002-12-14 17:34:28 +00:00
Ruslan Ermilov
8d5d039f80 Uniformly refer to a file system as "file system".
Approved by:	re
2002-12-12 17:26:04 +00:00
Poul-Henning Kamp
fb8b107e52 Correctly recognize both bogus and genuine BSD disklabels.
Don't expect me to participate in a discussion which is which.

Sponsored by:	DARPA & NAI Labs.
2002-11-03 21:47:55 +00:00
John Baldwin
66648a06a0 Revert MEM_USR back to 0xa000 for BTX clients. Instead, adjust boot2
to run at 0xc000 by changing its virtual start address from 0x1000 to
0x2000.

Tested by:	phk
2002-10-08 18:19:02 +00:00
Poul-Henning Kamp
c80ba0ad1b Now that ufsread.c doesn't do 64bit divide remainder operations,
don't bother with libkern.

Sponsored by:	DARPA & NAI Labs.
2002-10-08 15:49:35 +00:00
Poul-Henning Kamp
26baf05377 Save a couple of bytes by not returning ints nobody care about.
Sponsored by:	DARPA & NAI labs
2002-10-08 15:48:43 +00:00
Brian Feldman
3cfeca5326 Reinstate rev 1.36 with an important line that got missed. Note this
also improves the "random undocumented offsets into various memory
spaces" a little bit.
2002-10-08 12:09:16 +00:00
Poul-Henning Kamp
ae02ceb621 Remove unused TYPE_WD and TYPE_WFD. 2002-10-08 10:17:16 +00:00
Poul-Henning Kamp
ed025d6983 Correctly calculate dmadat: We need to take the address of _end, it's
contents is irrelevant and likely to be zero;

This doesn't change the resultant value, but it does save a couple of bytes
because &_end is constant.
2002-10-08 10:15:42 +00:00
Poul-Henning Kamp
a201162d71 Unbreak boot2 by backing out rev 1.36 to Makefile, which does not
work as advertised:

	bang# pwd
	/bang/src/sys/boot/i386/boot2
	bang# make clean >& /dev/null
	bang# cvs -q update -r 1.35 Makefile >& /dev/null
	bang# make >& /dev/null
	bang# cat /usr/obj/`pwd`/boot2.h
	#define XREADORG 0x725
	bang# cvs -q update -r 1.36 Makefile > & /dev/null
	bang# make clean > & /dev/null
	bang# make > & /dev/null
	bang# cat /usr/obj/`pwd`/boot2.h
	#define XREADORG 0x25
	bang#
2002-10-08 07:52:28 +00:00
Poul-Henning Kamp
68541f7c16 Save four bytes by shortening a string two chars.
Sponsored by:	DARPA & NAI Labs.
2002-10-08 07:06:24 +00:00
Brian Feldman
6c598ff615 Correct a bug in adding 0x700 to a number. 2002-10-07 22:21:16 +00:00
Poul-Henning Kamp
15cfc1833c Conditionalize the number of sectors loaded by boot1.s on UFS1/UFS12.
Conditionalize the "XX bytes left" checks reference on UFS1/UFS12.

Conditionally build the necessary 64bit math for boot2 if UFS12.

Sponsored by:	DARPA & NAI Labs.
2002-10-07 21:36:06 +00:00
Poul-Henning Kamp
b410146034 Change the comment character from # to // in boot1.s and run
it through CPP so we can conditionalized things.

Sponsored by:	DARPA & NAI Labs
2002-10-07 20:56:09 +00:00
Poul-Henning Kamp
10aabd9039 Correctly adjust for moved start address.
It seems that the existence of a "depend" target in src/sys/boot is not
to be taken as an indication that it actually does what one would expect,
at least it clearly threw my testing off.

Apologies to:	jhb
2002-10-07 19:12:36 +00:00
Poul-Henning Kamp
dfaf0d8cf1 Correctly compensate for both offset and unoffset on-disk BSD disklabels.
Sponsored by:	DARPA & NAI Labs.
2002-10-07 13:11:28 +00:00
Poul-Henning Kamp
e74334caae Move MEM_USR a page upwards to make space for larger UFS1 boot2.
Load 4 sectors more than we used to.  This is harmless overhead for
the UFS1_ONLY case, but sufficient for boot2(UFS1+2).

Sponsored by:	DARPA & NAI Labs
2002-10-07 12:15:11 +00:00
Poul-Henning Kamp
5765b4ef72 Move the definition of UFS1_ONLY into the Makefiles where it belongs.
Sponsored by:	DARPA & NAI Labs.
2002-10-07 08:09:20 +00:00
Mitsuru IWASAKI
31db71276a Don't call INT 12H anymore in boot program.
Many recent machine have a broken INT 12H (Get base memory size)
implementation and boot program stops if INT 12H is called.

This commit should solve the problem at very first step of FreeBSD
installation occurred on newer some machines.

Reviewed by:	bde, jhb
MFC after:	1 week
2002-10-01 19:31:09 +00:00
Poul-Henning Kamp
3bb24c35f2 Split MBR and PC98 on-disk sliceformats out from disklabel.h, step 1:
Peter had repocopied sys/disklabel.h to sys/diskpc98.h and sys/diskmbr.h.

These two new copies are still intact copies of disklabel.h and
therefore protected by #ifndef _SYS_DISKLABEL_H_ so #including them
in programs which already include <sys.disklabel.h> is currently a
no-op.

This commit adds a number of such #includes.

Once I have verified that I have fixed all the places which need fixing,
I will commit the updated versions of the three #include files.

Sponsored by:   DARPA & NAI Labs.
2002-10-01 07:24:55 +00:00
Peter Wemm
425f8660a7 Use as's --defsym switch to compensate for the loss of the M4 substitution
of SIOPRT which broke kgzldr and therefore make release.

Pointed out by:	 murray
2002-09-30 20:37:58 +00:00
Alfred Perlstein
4f492bfab5 use __packed. 2002-09-23 18:54:32 +00:00
Peter Wemm
66422f5b7a Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports.  As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL.  It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha
2002-09-17 01:49:00 +00:00
Mitsuru IWASAKI
8380f272e6 Parse hint.acpi.0.disabled correctly.
Now that hint.acpi.0.disabled="0" won't disable acpi as expected.

Pointed-out by:	bde
2002-09-05 11:16:23 +00:00
Alexander Kabaev
0f8a5e9b3f Restore Rev. 1.40 (remove "Keyboard yes/no" printf).
GCC 3.2 overflows boot2 by 12 bytes, this patch brings it back
within the boundaries, with 12 bytes available for future bloat.

Approved by:	obrien
2002-09-01 21:29:10 +00:00
John Baldwin
401e7fff61 Revert previous untested revision. The i386 loader consists of three parts:
At the front is btxldr, in the middle is BTX itself (our mini-kernel), and
then the 'client' (loader.bin) which is the actual loader itself.  boot2
just executes a raw ELF or a.out binary with the only setup provided being
that a bootinfo structure is passed on the stack.  Now, since loader.bin
is a BTX client, the loader needs to be able to locate a BTX kernel for
the client to execute in the context.  Thus, just like pxelder, btxldr
uses the a.out header on the loader binary to find the BTX kernel stored
in the loader and set it up.  It does _not_ just reuse the BTX kernel
that boot2 invoked it with.  This is because it can't assume that it will
_have_ a "spare" BTX kernel lying around.  For example, when cdboot
loads the loader there isn't an existing BTX kernel.  In fact, cdboot
will only work with an a.out loader as well since it also "borrows" the
BTX kernel in the loader binary (which it finds by parsing the a.out
header) just as pxeldr does.  The only difference between cdboot and
pxeldr is where they get /boot/loader from.

If we wanted to make /boot/loader be an actual ELF binary we would need
to change the following utilites to handle that (and they all have to be
able to handle locating the BTX kernel inside of an ELF binary somehow):
- btxldr
- pxeldr
- cdboot

If we didn't want to require a flag day but make the transition smooth
then we need to be able to support both a.out and ELF versions of
/boot/loader which isn't exactly trivial since all three of these utilities
are written in assembly.

Pointy-hat to:	peter
2002-08-30 14:59:47 +00:00
Mitsuru IWASAKI
6c40705212 s/hint.acpi.0.disable/hint.acpi.0.disabled/
Fix device hints entry for disabling acpi(4).
This also should fix the arbitration with apm(4) when both drivers
are enabled.

Note that your /boot/device.hints needs to be updated if you want to
stop auto-loading acpi.ko or disable acpi(4).
2002-08-30 11:11:07 +00:00
Peter Wemm
c34fd0a79a Try #2 at having /boot/loader default to ELF. Have pxeldr build its
own a.out version of loader.bin rather than depend on ../loader/loader
being a.out.
2002-08-29 23:37:44 +00:00
Peter Wemm
ba568b7e46 Actually remove the stale a.out kld support. This is the stuff that was
never updated for the metadata infrastructure.
2002-08-29 23:02:37 +00:00
Peter Wemm
e581f644a4 Initiate deorbit burn of i386 a.out kld "support" in loader. Note that
this was quite broken, it never was updated for metadata support.
The a.out kld file support was never really used, as it wasn't necessary.
You could always load elf kld's, even in an a.out kernel.
2002-08-29 02:02:28 +00:00
Mitsuru IWASAKI
27d18856c9 Add help about hint.acpi.0.disable. 2002-08-09 20:07:51 +00:00
David E. O'Brien
ac03993585 Restore autoloading of ACPI module.
Document the approved ways of disabling it.
Submitted by:	Daniel O'Connor <doconnor@gsoft.com.au>
2002-08-09 06:07:33 +00:00
David E. O'Brien
438b0be9fa Don't auto load ACPI -- it causes trouble with my laptop and is TOTALLY
undocumented how to control its loading and queries to freebsd-current
go unanswered.
2002-08-09 05:21:01 +00:00
Ruslan Ermilov
d2893b161b Drop support for COPY, -c has been the default mode of install(1)
for a long time now.

Approved by:	bde
2002-07-29 09:40:17 +00:00
Philippe Charnier
12c63a03c5 The .Nm bootloader 2002-07-14 15:22:49 +00:00
Mitsuru IWASAKI
98479b041b Resolve conflicts arising from the ACPI CA 20020611 import. 2002-07-09 17:54:02 +00:00
Mitsuru IWASAKI
fc57439987 Fix a build problem for the ACPI CA 20020404 import.
Add definition of COMPILER_DEPENDENT_INT64 and also
fix definition of COMPILER_DEPENDENT_UINT64.

Pointed-out by:	Michael Nottebrock <michaelnottebrock@gmx.net>
2002-06-30 23:22:22 +00:00
Poul-Henning Kamp
cb37d870a6 Revert the part of Kirks UFS2 commit which added divdi3.c and moddi3.c
to libi386, this issue was resolved already in a cleaner way.
2002-06-21 11:00:00 +00:00
Kirk McKusick
1c85e6a35d This commit adds basic support for the UFS2 filesystem. The UFS2
filesystem expands the inode to 256 bytes to make space for 64-bit
block pointers. It also adds a file-creation time field, an ability
to use jumbo blocks per inode to allow extent like pointer density,
and space for extended attributes (up to twice the filesystem block
size worth of attributes, e.g., on a 16K filesystem, there is space
for 32K of attributes). UFS2 fully supports and runs existing UFS1
filesystems. New filesystems built using newfs can be built in either
UFS1 or UFS2 format using the -O option. In this commit UFS1 is
the default format, so if you want to build UFS2 format filesystems,
you must specify -O 2. This default will be changed to UFS2 when
UFS2 proves itself to be stable. In this commit the boot code for
reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c)
as there is insufficient space in the boot block. Once the size of the
boot block is increased, this code can be defined.

Things to note: the definition of SBSIZE has changed to SBLOCKSIZE.
The header file <ufs/ufs/dinode.h> must be included before
<ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and
ufs_lbn_t.

Still TODO:
Verify that the first level bootstraps work for all the architectures.
Convert the utility ffsinfo to understand UFS2 and test growfs.
Add support for the extended attribute storage. Update soft updates
to ensure integrity of extended attribute storage. Switch the
current extended attribute interfaces to use the extended attribute
storage. Add the extent like functionality (framework is there,
but is currently never used).

Sponsored by: DARPA & NAI Labs.
Reviewed by:	Poul-Henning Kamp <phk@freebsd.org>
2002-06-21 06:18:05 +00:00
Peter Wemm
92caa29d8e Add boot_serial and boot_multicons variables to set RB_SERIAL and
RB_MULTIPLE since this seems to be the easiest way to add these flags
for non-forth loaders etc.
2002-06-20 06:29:42 +00:00
Poul-Henning Kamp
080ef30b20 Add explicit dependency on ufsread.c 2002-06-05 12:30:45 +00:00
Poul-Henning Kamp
833468e219 Preparation for UFS2 commit:
Factor the ufs reading code out of the i386/boot2 loader so it can
be reused by for instance sparc64.

Sponsored by: DARPA and NAI Labs.
2002-06-05 11:10:38 +00:00
Poul-Henning Kamp
8d48b118f2 Fix one of the va_arg() with less than int sized type probelms. 2002-05-18 09:12:32 +00:00
John Hay
c7c7cac2fb DEV_BSIZE lives in sys/param.h and not in machine/param.h anymore. 2002-05-15 11:32:53 +00:00
Ruslan Ermilov
475ab3cda6 Align CLEANFILES with revision 1.25 changes. 2002-05-13 16:16:00 +00:00
Ruslan Ermilov
26aace39ab Fixed CLEANFILES after bsd.lib.mk sweep. 2002-05-13 15:48:05 +00:00
Ruslan Ermilov
46f8fdc34e Removed now unused INTERNALSTATICLIB.
INTERNALLIB now implies NOPIC and NOPROFILE.
Removed gratuitous NOMAN.
2002-05-13 11:09:07 +00:00
Ruslan Ermilov
2a53f3fb35 Major cleanup of bsd.lib.mk.
Get rid of the INTERNALSTATICLIB knob and just use plain INTERNALLIB.
INTERNALLIB now means to build static library only and don't install
anything.  Added a NOINSTALLLIB knob for libpam/modules.  To not
build any library at all, just do not set LIB.
2002-05-13 10:53:24 +00:00
Bruce Evans
e754a32842 Saved 176 bytes by compiling with -fno-guess-branch-probability. The
default of -fguess-branch-probablility causes time optimizations (?)
like rewriting `if (foo) x++;' as
`if (!foo) goto forth; back: ; ...; forth: x++; goto back;".  This is
pessimizes space especially well on i386's because one short branch
gets converted to 2 long ones.

Removed -fno-align-foo since it is implied by -Os.  Previous commit
messages seem to have overstated the new alignment bugs in gcc.  The
only case that affects boot2 is that -fno-align-functions (or
equivalently -falign-functions=1) actually gives -falign-functions=2.
This is caused by FUNCTION_BOUNDARY being 2 (bytes) instead of 1.
The default case where the optimization level is 1 and no alignment
options are given is more broken.  All alignments are minimal, modulo
the bug in FUNCTION_BOUNDARY.  This is caused by toplev.c setting
defaults too early.

Some hacks in previous commits ar not needed now, but may as well be
kept until gcc is fixed.  The previous on in the Makefile saved 96
bytes of text due to the wrong FUNCTION_BOUNDARY and 32 bytes of data
due to unrelated bloat in the alignment of large objects.  There aren't
even any options to control alignment of data.
2002-05-12 15:45:28 +00:00
David E. O'Brien
95cfc25d0d Back out last commit. I expect our bsd.*.mk gods to remove the need for
defining so many extra things in addition to INTERNALLIB.  We don't like
repetitive C code and we shouldn't for make code either.
2002-05-12 13:54:42 +00:00
Peter Wemm
92948f4701 Save about 60 bytes by #define memcpy __builtin_memcpy and removing
the function we provided.  Restore the Keyboard: yes/no  printf for the
probe diagnostics.  We end up with 40 bytes free.
2002-05-11 21:49:39 +00:00
Peter Wemm
1333378a61 Reconnect boot2. I'm sure I'll regret this though. :-) 2002-05-11 21:41:03 +00:00
Peter Wemm
7a163a83da Use a crowbar and duct-tape to make boot2 fit again. This gets it down
to 4 bytes free.  I removed a printf (the Keyboard yes/no) since it is of
marginal value and sed'ed the generated asm output to remove the unwanted
aligns.  There's probably a better way to gain a few extra bytes than
losing the printf.  Shortening strings is probably a better option but this
should get us over the hurdle.
2002-05-11 21:39:59 +00:00
David E. O'Brien
3bf8b9cee3 NOPIC, NOPROFILE, NOMAN, and INTERNALSTATICLIB are redundant when using
INTERNALLIB now.
2002-05-11 18:02:33 +00:00
John Baldwin
88f0d73da4 - Axe -mpreferred-stack-boundary=2 as -Os turns this on by default.
- Axe -fdata-sections as turning it on or off makes no difference.  If
  it did make a difference it would serve to bloat boot2 even further with
  extra padding.
- Axe -fforce-addr.  This gets us 32 bytes so we are down to only being
  64-bytes over.

We still can't compile this with gcc 3.1.  The problem seems to be that
the -fno-align-foo options don't actually work.  Comparing the new and
old output it turns out that gcc is 4-byte padding all the functions and
labels and what not despite the passed in arguments thus adding the
unfortunate bloat to boot2.
2002-05-10 04:05:42 +00:00
David E. O'Brien
07776d8fb2 Don't be redundant. 2002-05-10 01:06:52 +00:00
David E. O'Brien
7571ef5ae3 -ffreestanding is the word for /sys. 2002-05-10 00:53:45 +00:00
David E. O'Brien
708a23c342 Turn off boot2 -- it gained over 96 bytes dieting on the in-tree Gcc 3.1. 2002-05-10 00:52:00 +00:00
Ruslan Ermilov
2ecf206550 Install files via FILES, there's no reason to compare them before installing. 2002-04-17 16:56:36 +00:00
Ruslan Ermilov
092179f985 Really unbreak it this time (clean and install were still broken). 2002-04-17 15:33:40 +00:00
Ruslan Ermilov
2f42caa5de Unbreak this as well.
At the extra bonus of fixing the contents of the .depend file.

Not really my day.
2002-04-12 15:49:30 +00:00
Pierre Beyssac
2b9592079f Code cleanup, no functional change.
Patch adapted from PR.

PR:		i386/36015
Submitted by:	thomas@cuivre.fr.eu.org
MFC after:	1 week
2002-04-11 09:21:10 +00:00
David E. O'Brien
10d23bba69 Needs a.out support built into the loader. 2002-03-28 19:09:44 +00:00
Pierre Beyssac
038148d678 Add option -n to i386 boot2 to disallow boot interruption by keypress.
PR:		i386/36016
Submitted by:	Thomas Quinot <thomas@cuivre.fr.eu.org>
Reviewed by:	rnordier
MFC after:	1 week
2002-03-23 19:40:27 +00:00
Maxim Sobolev
fb74e5f595 Add splitfs vfs layer into libstand, which allows loading big kernels and
modules split across several physical medias. Following is how it works:

The splitfs code, when asked to open "foo" looks for a file "foo.split"
which is a text file containing a list of filenames and media names, e.g.

	foo.aa "Kernel floppy 1"
	foo.ab "Kernel floppy 2"
	foo.ac "Kernel and modules floppy"

For each file segment, the process is:

- try to open the file
- prompt "Insert the disk labelled <whatever> and press any key..."
- try to open the file
- return error if file could not be located

RE team is free to use this feature in the upcoming 5.0-DP1.

Reviewed by:	msmith, dcs
2002-03-17 12:18:05 +00:00
Ruslan Ermilov
9662d32c73 Implement -m and -p loader(8) "boot" command options in boot2.
(This is more useful for 4.x where boot blocks can still load
kernels, modulo the PR kern/17422.)
2002-03-13 11:03:36 +00:00
Ian Dowse
870fb18bc1 Oops, the previous revision (1.35) broke booting from floppies
because the buffers we use could end up spanning a 64k boundary.
Unfortunately it causes too much bloat (228 -> 72 bytes free) to
just reinstate the old malloc() function.

Instead, define a structure that contains all 4 buffers which must
not cross 64k boundaries. We allocate a 64k-aligned instance in
main() using the magic that was in the old boot2 malloc() function.
This brings the free space down to 168 bytes, but that is still
better than it was before revision 1.35 (136 bytes).

Reported by:	Mike Brancato <funnyguy@digitalsmackdown.net>
Pointy-hat to:	iedowse
2002-01-17 22:39:19 +00:00
Ian Dowse
e9f9046337 Make the i386 boot2 fully blocksize-agnostic, as has already been
done with boot1 on the alpha. We use 4k buffers regardless of the
actual filesystem block size.

Remove the simple malloc() implementation, as it is no longer used.
2002-01-14 19:39:19 +00:00
John Baldwin
83f4b92050 Unrevert revision 1.12. Revision 1.14 backed this out saying it was
backing out the 1024 sector boot0, but revision 1.12 had nothing to do with
that.  Instead, it documented various compile time options for boot0 and
allowed them to be overridden via make.conf or options on the make
command line.
2002-01-10 21:40:33 +00:00
Ian Dowse
7e9c85d4ce Increase BSIZEMAX from 8k to 16k, so that we can reliably boot from
filesystems with 16k blocks.
2002-01-09 15:46:17 +00:00
John Baldwin
db283fd6d5 Don't turn on RB_CDROM if the rootdev is a BIOS cd device for now as this
breaks when cdboot is used with an MFS root.
2002-01-04 07:59:27 +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
John Baldwin
3c3a6fe0e0 Add support for writing to BIOS disks.
PR:		kern/32389
Submitted by:	Jonathan Mini <mini@haikugeek.com>
Sponsored by:	ClickArray, Inc.
2001-12-11 00:08:10 +00:00
Guido van Rooij
28703190c5 Add new boot flag to i386 boot: -p.
This flag adds a pausing utility. When ran with -p, during the kernel
probing phase, the kernel will pause after each line of output.
This pausing can be ended with the '.' key, and is automatically
suspended when entering ddb.

This flag comes in handy at systems without a serial port that either hang
during booting or reser.
Reviewed by:	(partly by jlemon)
MFC after:	1 week
2001-12-10 20:02:22 +00:00
David E. O'Brien
6e551fb628 Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.
2001-12-10 08:09:49 +00:00
John Baldwin
6a50ba658c Remove a few more debugging bits and turn on twiddle output while reading
from the CD.  This turns off the dual console output to COM1.
2001-11-07 01:20:33 +00:00
John Baldwin
4c3bb58384 - If we are booted via cdboot, use bc_add() to instantiate the cd0 device
from the loader.
- Cleanup extract_currdev() some and add support for setting the currdev
  to cd0 when booted via cdboot.
2001-11-05 19:03:01 +00:00
John Baldwin
6514d92792 Hook up the bioscd driver and the cd9660 filesystem. 2001-11-05 18:59:13 +00:00
John Baldwin
0322b80600 Add a device driver for the BIOS device for CD-ROM's booted via El Torito
no emulation mode.  Unlike other BIOS devices, this device uses 2048 byte
sectors.  Also, the bioscd driver does not have to worry about slices
or partitions.
2001-11-05 18:58:33 +00:00
John Baldwin
0a0fed8681 Trim all the extra debugging output including hexdumps, debug messages,
etc.  The only bit of debugging left is performing dual output to both
the screen and COM1.  Also, the twiddle is still disabled since it seems
to do weird things to the serial dump.  cdboot now has 880 bytes to spare.
2001-11-04 03:51:59 +00:00
John Baldwin
f941b4c14e Axe the old cdldr. 2001-11-04 03:28:10 +00:00
John Baldwin
6bbbde38ca Use the new cdboot instead of cdldr. 2001-11-04 03:27:06 +00:00
John Baldwin
5af9115c77 This is a new CD bootstrap utility designed to replace cdldr. According
to the El Torito standard for CD booting, a CD may boot in "No emulation"
mode without using a floppy image.  In this mode, the BIOS loads a program
off of the CD into memory and creates a BIOS device using 2048 byte sectors
for the CD.  According to the standard, this program can be up to 0xFFFF
virtual (512-byte) sectors long.  The old cdldr depended on this by having
the BIOS load the entire loader and the small cdldr stub as one binary
similar to pxeboot so that cdldr didn't have to read the CD to find the
loader.  However, the NT no emulation loader just uses 1 disk sector
(4 virtual sectors), so it seems that at least some BIOS writers just did
enough to get NT to boot by only loading 1 sector and ignoring the sector
count.  Thus, while cdldr should have worked in theory, it doesn't in
practice.  This replacment fits entirely in 1 sector and includes simple
ISO 9660 support.  It looks for /boot/loader on the CD and loads it up
using the BIOS.  This allows us to not have to depend on the limited size
of floppy images but use a full GENERIC kernel for CD-ROM installs in the
future, among other things.

This version of cdboot is a bit bloated as it includes some useful
debugging routines that people can pull to use in other x86 assembly
modules.  Even with all the debugging cruft, we still have 272 bytes to
spare.
2001-11-04 03:24:16 +00:00
John Baldwin
dfd89d691e Whoops, missed these bits in the previous commit. 2001-11-03 22:21:21 +00:00
John Baldwin
580d63df68 Add support for sending messages to the serial console which is helpful
when debugging boot problems.  It is not on by default but is enabled via
the BTX_SERIAL variable.  The port and speed can be set via the same
variables used by boot2 and the loader.
2001-11-03 22:09:30 +00:00
John Baldwin
0535c2bbad Add support for outputting multiple lines when dumping memory during the
register dump.  Change the default to bump 2 lines of output (32 bytes)
instead of 1 line (16 byte).
2001-11-03 21:53:46 +00:00
John Baldwin
5eef06c222 Add support for trace traps by returning from them just as for breakpoint
traps rather than halting.  Ideally, we should avoid printing the
'BTX halted' message for debug register dumps.
2001-11-03 21:42:25 +00:00
John Baldwin
25895accd8 Output a newline at the end of a dump so that there are blank lines between
dumps when using breakpoints or tracing.
2001-11-03 21:40:47 +00:00
Peter Wemm
ce4c60d38d Fix the ILLEGAL fdisk table that is there for supporting "dangerously
dedicated" mode.  This was specifying that there are 256 (illegal!)
heads on the disk.  If bioses store that in a byte, and it gets truncated
to 0, then that almost certainly causes the infamous divide-by-zero
nightmare.

This is also most likely the reason why the Thinkpad T20/A20 series
were locking up when FreeBSD was installed.  This is also the most likely
reason why a boot1 being present causes an IA64 box to lock up at boot.
(removing the "part4" stuff from boot1.s fixes the IA64 boxes and would
most likely have fixed the T20/A20 and some TP600E series thinkpads)
2001-11-01 06:19:32 +00:00
Jonathan Lemon
22dc069c24 Set RB_MULTIPLE (multiple console support) if the kernel is booted
with the -D flag.
2001-10-23 20:27:48 +00:00
Jonathan Lemon
c80bd6e378 Allow the RBX_DUAL flag to appear in bootinfo. 2001-10-23 20:27:05 +00:00
John Baldwin
69ad5bdd3f Whitespace fixes. 2001-10-04 10:18:00 +00:00
Kazutaka YOKOTA
82fe828980 Fix the ANSI color escape sequence \E[m.
- Corretly map the ansi color number to a PC BIOS color.
- Handle multiple arguments to the escape sequence.
2001-10-02 13:11:35 +00:00
Kazutaka YOKOTA
4238458ba2 Fix the local macro: isvisible().
- The space char (0x20) IS a visible char :-)
2001-10-02 09:13:07 +00:00
Kazutaka YOKOTA
b827a63aa6 Fix the function CD(): "Clear to the end of the screen".
- When the video BIOS is called to clear the region (x, y)-(79, 24)
  (by scrolling), the slashed region in Fig.1 is cleared.  CD() is
  supposed to clear the region shown in Fig.2.
        x                 x
    +-------+         +-------+
    |       |         |       |
   y|   ////|        y|   ////|
    |   ////|         |///////|
    |   ////|         |///////|
    +-------+         +-------+
      Fig.1             Fig.2

- Don't move the cursor during this operation.
2001-10-01 11:48:02 +00:00
Kazutaka YOKOTA
6c8e596705 This is white-space only change. No functional difference.
- Be consistent about placing spaces around keywords and
  operators; don't mix statements like "if(A==B)" and "if (X == Y)",
  "return(0)" and "return (-1)", "P=10" and "Q = 0", etc.

- Consitently indent lines. It's not good to indent by 8 columns
  in one part of the file, and by 4 columns in the other part.
2001-10-01 11:42:25 +00:00
Maxim Sobolev
0f2c85b335 Add support for loading bzip2-compressed kernels and modules. This support
is turned off by default and could be enabled by defining LOADER_BZIP2_SUPPORT
make variable. Also make gzip support optional (turned on by default) -
it could be turned off via LOADER_NO_GZIP_SUPPORT make variable.

Please note, that due to limit on the amount of memory available to the
loader(8), it is possible to load modules/kernels compressed with the smallest
block size supported by the bzip2 - 100k (`-1' bzip2(1) option), however
even in this mode bzip2(1) usually provides better compression ratio than
gzip(1) in its best compression mode.

MFC after:	1 month
2001-09-18 14:52:36 +00:00
Ruslan Ermilov
188cdfac56 Create backup copies using install(1). 2001-09-12 10:25:50 +00:00
Peter Wemm
505222d35f Implement the long-awaited module->file cache database. A userland
tool (kldxref(8)) keeps a cache of what modules and versions are inside
what .ko files.  I have tested this on both Alpha and i386.

Submitted by:	bp
2001-09-11 01:09:24 +00:00
Mike Smith
595aba526e Mention that the ACPI module load can be disabled by unsetting $acpi_load 2001-08-30 01:05:28 +00:00
Mike Smith
ad41f9a8f7 Teach the loader how to find the system ACPI information, and autoload
the ACPI module if the system apperars to be ACPI compliant.

This is an initial cut; the load should really be done by Forth support
code, and we should check both the BIOS build date and a blacklist.
2001-08-30 00:42:12 +00:00
Peter Wemm
94ad1d3eb7 OK, now I am scared of pxeldr. It had /boot/loader appended onto
the end of it and decoded the headers.

Submitted by:	jhb
2001-08-22 08:02:01 +00:00
Peter Wemm
89ea00a7d8 Generate an ELF /boot/loader instead of fake a.out. The fake a.out wrapper
did not work with old a.out-only bootblocks anyway. :-(
2001-08-22 05:29:25 +00:00
Mark Peek
7684ab55c6 Allow for text section alignment to properly align the "end" symbol at the
actual end of the section. The new gas (binutils) puts in additional padding
which was misaligning the concatenated btx loader.

Reported by:	Oliver Hartmann <ohartman@klima.physik.uni-mainz.de>,
		Harti Brandt <brandt@fokus.gmd.de>
Tested by:	Oliver Hartmann <ohartman@klima.physik.uni-mainz.de>,
		David Wolfskill <dhw@whistle.com>, ps
Reviewed by:	jhb
MFC after:	1 day
2001-08-09 20:47:58 +00:00
John Baldwin
8b42d7fc11 Trim trailing whitespace. 2001-08-09 18:07:45 +00:00
John Baldwin
b0606ca15f Add in a hack to support IBM "El Torito" CD-ROM booting BIOS's which expect
the first sector of the emulated floppy to contain a valid MS-DOS BPB that
it can modify.  Since boot1 is the first sector of boot.flp, this resulted
in the BIOS overwriting part of boot1: specifically the function used to
read in sectors from the disk.

Submitted by:	Mark Peek <mark@whistle.com>
Submitted by:	Doug Ambrisko <ambrisko@ambrisko.com>
PR:		i386/26382
Obtained from:	NetBSD, OpenBSD (the example BPB)
MFC after:	1 month
2001-07-31 19:50:09 +00:00
Kris Kennaway
56bded8a29 s/adress/address/
Inspired by:    OpenBSD
MFC After:      1 week
2001-07-23 12:05:27 +00:00
Robert Nordier
816aa3c0b5 Unset MAINTAINER. 2001-07-21 14:32:47 +00:00
Peter Wemm
47f1082c4f Remove -DNEW_LINKERSET, it is not used here anymore. This is now native. 2001-06-21 00:08:23 +00:00
Robert Nordier
9dfe98e24e Fix reboot buglet when BOOT_BTX_NOHANG is defined.
Submitted by: Umesh Krishnaswamy <umesh@juniper.net>
2001-05-27 20:15:10 +00:00
David E. O'Brien
5e6220d9d0 * include/elf.h has been repo copied to include/elf-hints.h, and it no
longer includes machine/elf.h.
* consumers of elf.h now use the minimalist elf header possible.

This change is motivated by Binutils 2.11.0 and too much clashing over
our base elf headers and the Binutils elf headers.
2001-05-02 23:56:21 +00:00
Ruslan Ermilov
aa7664372f MAN[1-9] -> MAN. 2001-03-27 11:59:22 +00:00
John Baldwin
b833d157c7 Always disable paging when exiting back to real mode after receiving a
fatal trap.  Also, reload the GDT register to point to BTX's GDT before
playing around with the segment registers to return to real mode.  This is
helpful if the kernel causes a fatal exception before it has setup its own
IDT and fault handlers.  For example, if one happens to break mtx_init().
Without these changes BTX would recursively page fault (if paging was not
disabled) or triple fault and reset the CPU (without the GDT reload)
instead of providing a potentially useful register dump.

Reviewed by:	rnordier
2001-03-21 20:08:07 +00:00
Paul Saab
c6fe53998a Don't set the gateway address if the netmask is zero or we're on
the same network.  PXE does not do netmask calculations, so if the
gateway is set it will use it.

Submitted by:	peter & FreeBSD cluster ACLs
2001-03-14 23:53:25 +00:00
Jeroen Ruigrok van der Werven
7c63796828 Preceed/preceeding are not english words. Use precede or preceding. 2001-02-18 10:25:42 +00:00
Jeroen Ruigrok van der Werven
1a6e52d0e9 Fix typo: seperate -> separate.
Seperate does not exist in the english language.
2001-02-06 11:21:58 +00:00
Robert Nordier
1165e4c9a4 Fix column alignment (whitespace-only change). 2000-12-19 00:17:36 +00:00
Robert Nordier
81578f4a33 Strip the .comment and .note sections when stripping. There's no
point in retaining this info, particularly under BTX.
2000-12-13 17:10:38 +00:00
Robert Nordier
1ec5afb81e Add a magic number, for easier identification of boot0. At present,
this is used only by libdisk.
2000-12-12 17:27:35 +00:00
John Baldwin
0a7f15c202 Set the proper bit in the howto flags for a serial console rather than
setting the index of the bit.  (0xc vs. 0x1000)
2000-11-30 18:33:59 +00:00
Paul Saab
43ab35c8c7 Add support for probing the keyboard from pxeboot which will behave
exactly the same as passing -P to boot2.

Submitted by:	jhb
2000-11-30 14:55:10 +00:00
Ruslan Ermilov
f4d874a1db mdoc(7) police: do not split author names in the AUTHORS section. 2000-11-22 09:35:58 +00:00
Ruslan Ermilov
251c176f41 mdoc(7) police: use certified section headers wherever possible. 2000-11-17 11:44:16 +00:00
Paul Saab
3d122d8e2c Honor the ip address given in the root-path dhcp option.
PR:	21743
Submitted by:	Brian Candler <B.Candler@pobox.com>
2000-11-05 14:55:09 +00:00
Robert Nordier
9e3377b8b3 Support a.out: avoid (%dx) in in/out instructions, and use an m4
macro to supply underscores for externals.
2000-11-04 13:03:52 +00:00
Paul Saab
9193b12844 MF4: Add LOADER_TFTP_SUPPORT make.conf flag. 2000-11-04 08:43:13 +00:00
John Baldwin
f251e6cfa1 The Number of Fixed Disks at memory location 0x475 is only 1 byte, not a
2 byte word.  This fixes machines that probe 30-odd hard drives during boot
in the loader.

Submitted by:	Helpful folks at Tyan via ps
2000-11-02 23:28:12 +00:00
Matthew Hunt
26b5d23688 "it's" --> "its" (possessive).
Correct a malformed sentence.
2000-11-01 00:36:12 +00:00
Robert Nordier
8c964b9bca Go back to occupying just a single sector, reverting r1.17 - r1.20.
Taking over the sector following the MBR causes problems on some
machines, and the actual gains are fairly small in terms of how
the space is presently used.

Since we need a number of further features (eg. handling extended
partitions) that can't be readily accommodated in the basic boot0
design anyway, rather choose to implement the additional stuff
separately and concentrate on compatibility rather than features
here.
2000-10-02 17:30:22 +00:00
Robert Nordier
ce6a6a0f90 Set MAINTAINER. 2000-10-02 17:23:16 +00:00
Archie Cobbs
474afc4230 Add support for the "nullconsole" console type, for systems with
neither a video console nor a serial port. Use it if the RB_MUTE
flag is set.

Submitted by:	Doug Ambrisko <ambrisko@whistle.com>
Reviewed by:	jhb
2000-09-20 18:13:36 +00:00
Daniel C. Sobral
9714dd1a3a Bump up version as a result of the recent changes to kernel path,
and boot-conf&boot semantic changes.

Also, make it 1.0.

Reminded by: peter (even though he doesn't know it)
2000-09-10 13:51:44 +00:00
Robert Nordier
3348fae50d Correct BSD/OS slice type.
PR:           21099
Submitted by: Alan Clegg <abc@bsdi.com>
2000-09-09 18:05:22 +00:00
Warner Losh
799c0f62dd Look for libstand in the built tree rather than in /usr/lib. This
likely could be done better, but the tree is broken and I wanted to
get a fix into the tree.

Reviewed by: msmith
2000-09-08 04:26:55 +00:00
Mike Smith
0153af6a16 Fix a bug which prevents parsing this Makefile without having a
previously-built loader binary elsewhere.
2000-09-05 22:33:07 +00:00
Mike Smith
bb65fdf6e0 Export the salient configuration items in a non-pxe-specific namespace
to allow commonality between varying platforms.  This is a step
towards parsing the diskless configuration information with MI code
inside the kernel.

Export the interface hardware address to the kernel, so that it is possible
to determine the boot interface with certainty.

Export the NFS filehandle for the root mount to the kernel, so that the
kernel does not need to perform a mount RPC call.
2000-09-05 22:32:31 +00:00
John Baldwin
6bd9abd49a Add a new compile-time tweak to BTX. If you set the make(1) variable
BOOT_BTX_NOHANG, then BTX will be compiled with the appropriate flags so
that it reboots after a fault instead of hanging forever.

Requested by:	ps
Approved by:	rnordier
2000-08-24 20:57:44 +00:00
Peter Wemm
5aef48a16b Add -mpreferred-stack-boundary=2 to CFLAGS for i386. This and libstand
reduces /boot/loader from 163840 bytes to 155648 and pxeboot from 165888
bytes to 157696 bytes.
2000-08-11 23:23:20 +00:00
Paul Saab
646cf5017b Add support to send the string 'PXEClient' as the Vendor class
identifier to the DHCP server.  Now you can check for this string
in your dhcp configuration to decide whether you will hand out a
lease to the client or not.
2000-08-11 08:36:17 +00:00
Paul Saab
f6940c1842 Pass along the interesting variables we were given from DHCP so we
can utilize them in the kernel and with kenv.
2000-08-11 05:31:59 +00:00
Robert Nordier
ff7ed3a234 Typo/spelling fixes. 2000-08-08 07:20:25 +00:00
John Baldwin
ab9e9f9d2d Argh! Fix a brainfart of mine. In the old boot0, we relocated ourself
to 0x600 via a 'rep movsw'.  Once that was done, %cx was zero, so we could
simply use 'movb' to update the lower byte of %cx in preparation for
zeroing out the fake partition entry used to boot to other drives via F5.
Well, in the new boot0, we don't actually relocate ourselves, instead it
is easier to create the fake partition entry first and then just use it to
get the BIOS to load all of boot0 into memory at 0x600.  However, since we
aren't doing the relocate code anymore, we don't know that %cx == 0 when
we hit the 'movb' to setup %cx for clearning the fake partition entry.
Thus, if %ch != 0 when the BIOS started boot0, then it would end up zeroing
a lot more memory than just 8 words.  The solution is to do a word move of
$8 into %cx.

Debugging help from:	David Wolfskill <dhw@whistle.com>
2000-08-04 22:37:21 +00:00
John Baldwin
4ae4202e70 Cleanup warnings. Most of these are signed/unsigned warnings, as well as
some added const's.
2000-08-03 09:14:02 +00:00
John Baldwin
c2fa9f3e89 Fix several BDECFLAGS warnings. Also, actually use the 'verbose' parameter
for lsdev when printing out slice information.  Now, you only get the
sizes and LBA's of slices if you use 'lsdev -v'.
2000-08-03 09:09:49 +00:00
John Baldwin
f15da231c5 Oops. Remove some debugging code used to display a hexdump of the sector
we just loaded from the disk.  The code to call it was commented out, and
it easily fit into the extra sector, but remove it anyway as it is
unneeded.
2000-07-17 19:39:50 +00:00
Jonathan Lemon
cd914f8fa0 Unbreak the build -- no manual page for this yet. 2000-07-17 19:03:58 +00:00
Jonathan Lemon
15602c8dd8 Hook up liloldr 2000-07-17 17:06:27 +00:00
Jonathan Lemon
9ebf93dc6d This is `liloboot', which creates a file which can be treated like a
Linux kernel image, and is designed to be dropped into a Linux system
and booted via LILO.  Once booted, the user is greeted by the FreeBSD
loader.  This still isn't quite complete, as the the root= specification
from LILO isn't currently passed to the loader yet.
2000-07-17 17:06:04 +00:00
John Baldwin
1dce5cb37f The new and improved boot0, v1.1. This version adds the following:
- Autodetection and support of the BIOS EDD extensions to work around the
  1024 cylinder limit on all but really ancient BIOS's.
- To work around some BIOS's which break when EDD is used with older drives,
  we only attempt to use EDD if the cylinder is > 1023.
- Since this new code required more space than we had left, expand boot0 to
  2 sectors (1024 bytes) in length.
- Add support for boot0 being multiple sectors using predefined constants.
  If boot0 needs to be extended in the future, all that is required is
  bumping the NUM_SECTORS constant.
- Now that we have more room to work with, add a few more fs type
  descriptions while making others more verbose.
2000-07-12 18:11:54 +00:00
John Baldwin
18601b5712 Remove commented out NOMAN variable. 2000-07-07 20:37:11 +00:00
John Baldwin
8dfe6fb59c - Inline all the functions that are only called once. This results in a
savings of 68 bytes in boot2.
- Also add a comment warning that you can't remove the empty exit()
  function.
2000-07-06 01:51:27 +00:00
John Baldwin
54ff3ae038 Doh. The disklabel is not 0x200 bytes of zeros, but it is 0x200 bytes long. 2000-07-06 00:29:40 +00:00
John Baldwin
a6bef20793 Clarify the comments in here a bit. The first sector of boot2 is not just
zeros, it is actually the disklabel itself.  boot2.ldr is simply a
placeholder in the boot2 binary.
2000-07-06 00:22:50 +00:00
John Baldwin
bd61ce880f Emulate the WBINVD instruction when it is called by the BIOS. 2000-07-06 00:13:21 +00:00
John Baldwin
0b74850760 Change the fault message to say 'BTX halted' isntead of 'System halted' to
avoid confusion.

Submitted by:	George Scott <George.Scott@its.monash.edu.au>
2000-06-29 08:24:50 +00:00
John Baldwin
52f5035190 Rework the detecting of the rdmsr and wrmsr instructions in the v86
monitor so that the codepath is cleaner and easier to maintain in the
future.
2000-06-29 01:25:31 +00:00
John Baldwin
bce816b9cc - Don't blindly assume that there are 8 hard drives installed. Instead,
use the BIOS Equipment List to determine how many hard drives are
  installed and if the drive number we received in %dl is valid.
- Don't bother to disable interrupts when setting up the stack.  The 8086
  and beyond implicitly disable interrupts after an instruction that sets
  %ss (for example, a pop or a mov) so that you can safely set %ss and %sp
  in two consecutive instructions.  An exception to this is the lss
  instruction, which can set both registers simultaneously and thus doesn't
  need this hack.
- Add support for EDD BIOS extensions to support booting off of hard drives
  of nearly arbitrary length.
2000-06-27 20:04:10 +00:00
John Baldwin
2960c255b4 Comment this. 2000-06-26 23:58:04 +00:00
John Baldwin
cbf3fb883e Add in support for EDD to support large disks via LBA. This uses a
method similar to that of the loader to avoid potentially breaking older
drives in that we only use EDD if the desired cylinder is > 1023.
2000-06-26 22:57:16 +00:00
John Baldwin
35bdac5bbd Comment this bad boy. Hopefully the next person that comes along won't
have to spend a few hours reading the code to figure all this out.
2000-06-19 22:50:46 +00:00
John Baldwin
335dd56674 - Add some more details to the 'lsdev' output for FAT file systems.
- Add in support for the EDD (Enhanced Disk Drive) BIOS extensions to
  use LBA mode for accessing drives past cylinder 1024.  This should allow
  us to load a kernel from anywhere on a newer drive up to 2 TB.  Part
  of this came from the PR below.

PR:		i386/13847
Submitted by:	Tor Egge <Tor.Egge@fast.no>
2000-06-19 17:44:40 +00:00
John Baldwin
1ddb0ab555 Add support for emulating the RDMSR and WRMSR instructions into BTX. In
theory, this should allow the K7V Athlon motherboard to boot ok with boot
virus protection enabled.  However, I have no hardware to test this.  It
shouldn't break anything though. :)

Prodded by:	Kelly Yancey <kbyanc@posi.net>
2000-06-17 06:45:40 +00:00
Paul Saab
cc3d937224 Delay calling the device cleanup routines until the absolute last
moment.  We were cleaning up after PXE too early and the module
dependancy code would not be able to load any files if it needed
too.
2000-06-14 10:34:29 +00:00
Ruslan Ermilov
5737d0e1d4 Treat \t and \n inside /boot.config as whitespaces.
PR:		19215
2000-06-13 13:07:53 +00:00
Daniel C. Sobral
5ae8a644f6 Bump loader version due to copyin, copyout, setenv&cia. 2000-06-07 22:12:21 +00:00
John Baldwin
e1efa49a84 Convert the short stub of real-mode code into 16-bit assembly. 2000-05-24 02:20:34 +00:00
John Baldwin
a1a611ed6b Grrr, fix a silly 'movl' -> 'movw' typo in both pxeldr and cdldr. Also,
remove unnecessary cruft from the Makefiles for both.
2000-05-23 12:31:32 +00:00
John Baldwin
af54a4fe47 Clean up some more 16-bit code and get rid of more m4 macros. 2000-05-23 12:28:31 +00:00
John Baldwin
638bac9fc0 Clean up all of the 16-bit assembly code in the x86 bootstrap to work
with the new binutils.  Now that we have a decent assembler, all the old
m4 macros are no longer needed.  Instead, straight assembly can be used
since as(1) now understands 16-bit addressing, branches, etc.  Also,
several bugs have been fixed in as(1), allowing boot0.s to be further
cleaned up.
2000-05-23 12:18:49 +00:00
Daniel C. Sobral
536f89a623 This file got repo-copied to common/. 2000-05-19 08:44:48 +00:00
Daniel C. Sobral
a2aa3427cf Move man page directives to common/Makefile.inc. 2000-05-19 08:41:45 +00:00
Daniel C. Sobral
d9f7c44adf Make corrections to allow for Alpha. 2000-05-18 12:44:50 +00:00
Doug White
325bde0fb7 Remove metion of the 'magic options.' Apparently PXE doesn't require the
special options on 0.99c (it mumbles something about 'PXE server not found'
but works anyway), and it won't work at all with PXE 2.0.
2000-05-09 18:28:07 +00:00
John Baldwin
773065b3b8 Switch to using the .code16 as(1) directive and using 16-bit assembly
code instead of using 32-bit code and having to just "know" that it's
really 16-bit instructions when things run.  This also allows the code
to use fewer macros and more actual assembly statements, which eases
maintenance.  Unfortunately, due to as(1) brokenness, we still use m4
macros for all 16-bit addresses, and all short jumps (i.e., 8-bit
relative addresses in the jump instruction) must be wrapped in .code32
directives to avoid useless bloat by as(1).  This also fixes a few
problems that were preventing boot0 from compiling with the latest
and greatest version of as(1).
2000-05-05 13:22:10 +00:00
Paul Saab
90c25bd74a Remove the static heap. It is unknown why it was needed in the
beginning, but it no longer is required.  This has been tested with
many different revisions of the PXE rom from Intel.
2000-05-05 07:24:03 +00:00
Daniel C. Sobral
4eb5b7979d Make documentation on recently added heap? command reflect reality. 2000-05-04 22:51:21 +00:00
Daniel C. Sobral
a1d54dfc62 Add "heap?" to loader's man page. 2000-05-04 21:26:26 +00:00
Daniel C. Sobral
19c80876dc Further improve ordering. 2000-05-04 21:22:55 +00:00
Daniel C. Sobral
c45393b59c Sort entries in FreeBSD-specific FICL commands. 2000-05-04 21:18:26 +00:00
Doug White
55ebf88553 Add man page for pxeboot.
Reviewed By:	asmodai
2000-05-02 05:01:38 +00:00
Paul Saab
482cb52dcb Wrap the failure warnings around PXE_DEBUG in the cleanup routine.
It does not matter if they fail, so dont print anything about it
unless we are debugging.
2000-05-01 17:55:05 +00:00
Boris Popov
801e789e01 Update loader logic to distinguish modules vs. files.
Add support for module metadata. The old way of dependancy
handling will be supported for a while.

Reviewed by:	peter
2000-05-01 17:41:25 +00:00
Paul Saab
95394e643f Fall back to /pxeroot as the location of the NFS exported directory
if we are not given one by dhcp.
Remove extra includes while I am here.

Reminded by:	jlemon
2000-04-29 23:08:49 +00:00
Jonathan Lemon
8e30378f89 Teach the loader about the ext2fs filesystem, extended partitions, and
the new readdir function.
2000-04-29 20:49:33 +00:00
Paul Saab
f14ad6978f Make PXE do a dhcp request to find out where its files are. The
DHCP server is no longer required to also act as the NFS/TFTP
server.
2000-04-27 12:30:28 +00:00
Paul Saab
e7fd6f003e Don't report errors when we UDP_WRITE fails with a status of 1. 2000-04-27 03:23:50 +00:00
John Baldwin
eeb5db2946 Now that we are compiling PXE into libi386, we don't need ../libi386 in
.PATH anymore.
2000-04-26 19:54:49 +00:00
Paul Saab
d08ae64b1d Bring support in for Intel Wired for Management 1.1 (PXE 0.99 and
below).  This did not work previously because interrupts were
disabled when PXE calls were being made, and they must be enabled.
This should also allow us to be compliant with all newer PXE rom's
from Intel.

For PXE 0.99, this has been tested using the Intel N440BX motherboard
and I am confident it will work on the Intel L440GX motherboard.

Lots of help/information from: jhb, peter

I would like to thank Michael Johnston <michael.johnston@intel.com>,
Mike Henry <mike.henry@intel.com>, and all the other PXE developers
at Intel for their help, and information in helping solve this
problem.
2000-04-26 07:38:40 +00:00
John Baldwin
36273c5d79 Don't disable interrupts when calling a vm86 mode interrupt or routine
from user mode.  Don't disable interrupts when returning from vm86 mode
to user mode either.  Now, we only disable interrupts before calling a
hardware interrupt handler, which is the only time we _should_ be
disabling interrupts.

Because of this, err, feature, any routine that one called in vm86 mode
had to re-enable interrupts by setting the interrupt flag or interrupts
would remain disabled even after the routine returned.  For example, I
have a simple debugging routine that uses a vm86 mode function to dump
any arbitrary memory word that I use to read the BIOS timer or any other
memory location.  This function does 1 load instruction from memory and
then returns.  Since it didn't re-enable interrupts, the first time I
called it to read the BIOS timer, it disabled interrupts.   This also
affected the PXE bootstrap as it needs interrupts enabled while it is
processing.  This patch fixes both of those situations so that those
functions do not worry about having to enable interrupts.  Hardware
interrupt handlers worked fine with the old code because they always
enable interrupts as part of their routine.

If you have any problems with the loader after this commit, please
let me know.  I'd like to MFC it in a week or two since PXE support
needs it.

Noticed by:	ps, Michael Johnston <michael.johnston@intel.com>
2000-04-26 04:35:25 +00:00
Paul Saab
43e797fd31 Move the building of the PXE module into libi386. 2000-04-21 22:06:02 +00:00
Paul Saab
2339dc037f Make the loader a little smarter about when it is and is not allowed
to call PXE.
2000-04-21 04:58:51 +00:00
Paul Saab
5d5b2077f1 Don't call the PXE cleanup routine if PXE is not enabled. This
should fix the "Invalid partition table" error people were seeing.
2000-04-21 03:04:16 +00:00
Paul Saab
6450dd3cb4 Add a cleanup function. This is needed for PXE where you should
shutdown the UNDI and unload the stack.
2000-04-20 00:06:15 +00:00
Paul Saab
e938899cc3 Use !PXE api over PXENV+ api.
Magic trampoline by: peter (at 4am and after a good whipping at airhockey)
Do a better job of returning and detecting errors.
2000-04-19 11:22:38 +00:00
John Baldwin
2cb6d95d48 Add a missing dependency: boot2 depends on the BTX kernel. 2000-04-11 14:49:13 +00:00
Jordan K. Hubbard
4fbd258bcc Nuke duplicate struct declaration from somebody's paste-o 2000-04-08 22:50:18 +00:00
Paul Saab
d8af287caf Make PXE use the UDP API. This allows for both TFTP and NFS support.
You may specify TFTP or NFS via compile time options in the loader,
but not both at this time.

Also, remove a warning about not knowing how to boot from network
devices.  We can obviously do that now.
2000-04-08 01:22:14 +00:00
Paul Saab
dbe3e0f575 Add a missing PXE API call and structure. 2000-04-04 07:28:54 +00:00
Paul Saab
2efc827d19 Add all the PXE related structures from the 2.1 PXE spec from Intel.
Fix exsisting code to match the spec.
2000-04-04 00:38:59 +00:00
John Baldwin
48a0c4ea04 Mega i386 loader commit.
- Don't hard code 0x10000 as the entry point for the loader.  Instead add
  src/sys/boot/i386/Makefile.inc which defines a make variable with the
  entry point for the loader.  Move the loader's entry point up to
  0x20000, which makes PXE happy.
- Don't try to use cpp to parse btxldr for the optional BTXLDR_VERBOSE,
  instead use m4 to achieve this.  Also, add a BTXLDR_VERBOSE knob in the
  btxldr Makefile to turn this option on.
- Redo parts of cdldr's Makefile so that it now builds and installs cdboot
  instead of having i386/loader/Makefile do that.  Also, add in some more
  variables to make the pxeldr Makefile almost identical and thus to ease
  maintainability.
- Teach cdldr about the a.out format.  Cdldr now parsers the a.out header
  of the loader binary and relocates it based on that.  The entry point of
  the loader no longer has to be hardcoded into cdldr.  Also, the boot
  info table from mkisofs is no longer required to get a useful cdboot.
- Update the lsdev function for BIOS disks to parse other file systems
  (such as DOS FAT) that we currently support.  This is still buggy as
  it assumes that a floppy with a DOS boot sector actually has a MBR and
  parses it as such.  I'll be fixing this in the future.
- The biggie:  Add in support for booting off of PXE-enabled network
  adapters.  Currently, we use the TFTP API provided by the PXE BIOS.
  Eventually we will switch to using the low-level NIC driver thus
  allowing both TFTP and NFS to be used, but for now it's just TFTP.

Submitted by:	ps, alfred
Testing by:	Benno Rice <benno@netizen.com.au>
2000-03-28 01:19:53 +00:00
John Baldwin
7be31bb1b2 Remove some extra spammage that made it into this commit. This will be
revisited later with a better fix, or at least one that compiles. :)

Approved by:	dcs
2000-03-15 16:36:55 +00:00
Daniel C. Sobral
7b12e51659 Pass an unit number to bcache_strategy, so it can flush the cache when
necessary. Pass an absolute block number too, instead of receiving a
relative one in realstrategy(), as bcache_strategy() requires this.

The fix is sligthly different from the one in the PR.

PR:		17098
Submitted by:	John Hood <jhood@sitaranetworks.com>
2000-03-15 01:58:45 +00:00
John Baldwin
536fcb08bf This patch to BTX fixes several small things:
1) Fix a bug in the int15 function 87 emulation where we only copied half
   of what the BIOS asked for.  This caused the Mylex RAID adapter to go
   haywire and start trashing memory when you tried to boot from it.
2) Don't use interrupt 19 to reboot.  Instead, set the reboot flag to a warm
   boot and jump to the BIOS's reboot handler.  int 19 doesn't clear memory
   or restore the interrupt vector table, and thus really isn't safe.  For
   example, when booting off of PXE, the PXE BIOS eats up a chunk of memory
   for its internal data and structures.  Since we rebooted via int 19,
   using the 'reboot' command in the loader resulted in that memory not
   being reclaimed by the BIOS.  Thus, after a few PXE boots, the system
   was out of lower memory.
3) Catch any int 19 calls made by a BTX client or a user pressing
   Ctrl-Alt-Delete and shutdown BTX and reboot the machine cleanly.  This
   fixes Ctrl-Alt-Delete in the loader and in boot2 instead of presenting
   the user with a BTX fault.

Approved by:	jkh
Found by:	1) by msmith
2000-02-16 07:00:16 +00:00
Ruslan Ermilov
a6120246a2 Support the new ata(4) syntax, while providing backward compatibility for wd(4).
Reviewed by:	jkh, msmith, sos
Approved by:	jkh
2000-02-09 19:23:46 +00:00
Luigi Rizzo
2dea85d508 Add a NOFORTH variable so we can build a smaller loader without
Forth support, for use with PicoBSD

Approved-By: jordan
2000-02-04 20:57:09 +00:00
John Baldwin
4e60d653ce Fix bogon in previous commit. Re-enable Forth in the loader.
Noticed by:	dcs
Approved by:	jkh
2000-01-30 06:56:27 +00:00
John Baldwin
064b3244ec Allow for cdldr to be built in ${.OBJDIR}/../cdldr/cdldr instead of
only looking for it in ${.CURDIR}/../cdldr/cdldr.  This fixes world.
2000-01-28 15:19:22 +00:00
John Baldwin
c8bb85f758 Add the new cdldr CD bootstrap loader. This patch includes the following:
- Fix btxldr to preserve a NULL bootinfo pointer when it copies the kernel
  arguments.
- Add the cdldr bootstrap program.  This program is tacked onto the
  beginning of the standard 3rd stage boot loader (/boot/loader) to form
  the CD boot loader (/boot/cdboot).  When a CD is booted, the cdboot file
  is copied into memory instead and executed.  The cdldr stub emulates the
  environment normally provided by boot2 and then starts the loader.  This
  booting method does not emulate a floppy drive, but boots directly off of
  the CD.  This should fix the problems some BIOS's have with emulating a
  2.88 MB floppy image.
- Add support to the loader to recognize that it has been booted by cdldr
  instead of boot2 and use a simpler method of extracting the BIOS boot
  device.
2000-01-27 21:21:01 +00:00
John Baldwin
c299f41fd9 Fix brokenness introduced with the PAGING conditional variable. The value
of %cr0 wasn't reloaded into %eax before being modified to turn protected
mode off if PAGING was not defined.  The result was that the processor did
not exit protected mode, so when it tried to jump to segment 0x0 in the
next instruction to clear the prefetch cache like one should when leaving
protected mode, it actually tried to jump to a null selector, causing a
GPF.
2000-01-27 21:06:13 +00:00
Mike Smith
627249c7b1 Substantially revamp the way that we determine the amount of memory available
for our use.  Use the same search order for BIOS memory size functions
as the kernel will later use.

Allow the loader to use all of the detected physical memory (this will
greatly help people trying to load enormous memory disk images).

More correctly handle running out of memory when loading an object.

Use the end of base memory for the top of the heap, rather than
blindly hoping that there is 384k left.

Add copyrights to a couple of files I forgot.
1999-12-29 09:54:46 +00:00
Poul-Henning Kamp
7d5961670c Remove BAD144 support, it has already been disabled for some time. 1999-12-08 09:33:00 +00:00
Daniel C. Sobral
8a3f7b6ba9 Add machine-specific include path to ficl's sysdep.h. Wishes I had
gone to bed earlier.

Pointed by: peter
1999-11-23 16:30:48 +00:00
David E. O'Brien
c8e02dfe73 Add -fdata-sections, which is a new GCC 2.95 optimization. Remove
-fschedule-insns as it wasn't such a big win with 2.95 after all.

Add the *BIG* win "-mpreferred-stack-boundary=2" optimiztion submitted by
Dima.  GCC 2.95 ensures the stack frame is always properly [opitimally]
aligned by surrounding every function call by code simular to
"addl $-12, %esp" / "addl $12, %esp".  Here we need the reduction in space,
with speed not an issue.
1999-11-15 04:23:40 +00:00
David E. O'Brien
cd37fe517b Return this file to its pre-spammed version. Thanks to some new compiler
optimizations, we can go from 3 bytes free with the spammed version, to
279 bytes free with the full version.
1999-11-14 22:17:06 +00:00
David E. O'Brien
cf49270ac3 Enter complier upgrade mode again. We need to cut 169 bytes from this:
Remove some printf() calls, reduce size of buffers, and abbreviate
	some strings.

Hopefully the boot people will fix this spamage after the cut over to
Gcc 2.95.2 as the system compiler.
1999-11-14 00:41:54 +00:00
David E. O'Brien
73de3d0ff7 Turn on the -fforce-addr and -fschedule-insns optimizations. Adding
either one gives us an additional 32 bytes of additional space available
when using EGCS 1.1.2.  With GCC 2.95.2 -fforce-addr gives us 12 more bytes,
and adding -fschedule-insns gives us an additional 4 bytes.
1999-11-13 23:08:46 +00:00
John Baldwin
260c5d350e If PAGING is defined then actually turn it on when entering protected
mode.
1999-10-27 02:22:52 +00:00
Daniel C. Sobral
33ebc8c952 Make the "machine" target a prequisite to all source files.
Hinted-at by: bde
1999-10-19 03:53:59 +00:00
John Baldwin
228ace6ebf aThis patch updates the BTX to emulate the BIOS function "Copy Extended
Memory" called as function 0x87 of interrupt 0x15.  Since the Mylex RAID
adapter's BIOS used this function to access memory (actually PCI bus
space) beyond 16 MB, this patch also allows BTX to address all 4 Gig of
possible address space on i386+.  Since the loader does not have room for
4 MB of page tables, this was done by turning off paging.

Paging was turned off via a compile time setting which defaults to off.
To enable paging, simply define the make variable PAGING.

rnordier might want to clean this up later.

Submitted by:	W. Gerald Hicks <wghicks@bellsouth.net>,
		Bosko Milekic <bmilekic@ares.dsuper.net>
Reviewed by:	msmith
Required by:	Mylex RAID adapter's BIOS
1999-10-12 21:33:49 +00:00
Brian Somers
ad128796fd Blank out the twiddly thing when outputting the ``BTX loader'' message. 1999-10-12 06:57:26 +00:00
Julian Elischer
d721abf23c Remove accidental cut&paste garbage in a comment. 1999-09-03 01:38:29 +00:00
Julian Elischer
14c457c23f Comment the boot manager. So I don't have to work it all out again :-)
Reviewed by:	rnordier@freebsd.org
1999-09-03 01:35:06 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Nik Clayton
51e09cd72a Fix some typos.
PR:             docs/11955
Submitted by:   Christian Weisgerber <naddy@mips.rhein-neckar.de>
1999-07-28 20:30:59 +00:00
Robert Nordier
fad2f0e686 Recognise NetBSD slices.
Submitted by : Lars Koeller <lkoeller@cc.fh-lippe.de>
PR           : 12772
1999-07-24 17:40:40 +00:00
Mike Smith
73332890ea Walk around the end of all the silly guessing of device types and unit
numbers that we have been doing in the past, and read /etc/fstab off the
proposed root filesystem to determine the actual device name and vfs
type for the root filesystem.  These are then exported to the kernel
via the environment variable vfs.root.mountfrom.
1999-07-21 00:08:54 +00:00