History log of /freebsd-9.3-release/sys/boot/i386/boot0/
Revision Date Author Comments
267654 20-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


232930 13-Mar-2012 dim

MFC r232263:

Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, to
get rid of testing explicitly for clang (using ${CC:T:Mclang}) in
individual Makefiles.

Instead, use the following extra macros, for use with clang:
- NO_WERROR.clang (disables -Werror)
- NO_WCAST_ALIGN.clang (disables -Wcast-align)
- NO_WFORMAT.clang (disables -Wformat and friends)
- CLANG_NO_IAS (disables integrated assembler)
- CLANG_OPT_SMALL (adds flags for extra small size optimizations)

As a side effect, this enables setting CC/CXX/CPP in src.conf instead of
make.conf! For clang, use the following:

CC=clang
CXX=clang++
CPP=clang-cpp


230065 13-Jan-2012 jhb

MFC 228738:
Allow boot0cfg to force a PXE boot via boot0 on the next boot.
- Fix boot0 to check for PXE when using the pre-set setting for the
preferred slice.
- Update boot0cfg to use slice 6 to select PXE. Accept a 'pxe' argument
instead of a number for the 's' option as a way to select PXE as well.


225736 23-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


218893 20-Feb-2011 dim

Upgrade our copy of llvm/clang to r126079, from upstream's trunk.

This contains many improvements, primarily better C++ support, an
integrated assembler for x86 and support for -pg.


208789 03-Jun-2010 ed

Use -Wl,-N instead of the undocumented -N option for GCC.

GCC forwards the -N flag directly to ld. This flag is not documented and
not supported by (for example) Clang. Just use -Wl,-N.

Submitted by: Pawel Worach


186598 30-Dec-2008 luigi

A number of small changes to make the 'save choice to disk' safer,
and re-enable it as default.

In particular:

+ re-enable the 'update' flag in the Makefile (of course!);

+ commit Warner's patch "orb $NOUPDATE,_FLAGS(%bp)"
to avoid writing to disk in case of a timeout/default choice;

+ fix an off-by-one count in the partition scan code that would
print the wrong name for unknown partitions;

+ unconditionally change the boot prompt to 'Boot:' instead of 'Default:'
to make room for the extra code/checks/messages. Some of the changes
listed below are also made to save space;

+ rearrange and fix comments for known partition types. Right now we
explicitly recognise *BSD, Linux, FAT16 (type 6, used on many USB keys),
NTFS (type 7), FAT32 (type 11).
Depending on other options we also recognise Extended (type 5),
FAT12 (type 1) and FAT16 < 32MB (type 4).

+ Add an entry "F6 PXE" when the code is built with -DPXE (which is
a default now). Technically, F6 boots through INT18, so the prompt 'PXE'
is a bit misleading. Unfortunately the name INT18
is too long and does not fit in - we could use ROM perhaps.
The reason I picked 'PXE' is that on many (I believe) new systems
INT18 calls PXE.

Apart from the choice of the name for PXE/ROM/INT18, this should close
pending issues on the 1-sector boot0 code and we should be able to
move the code to RELENG_7 when it reopens.

No boot0cfg changes are necessary.

MFC after: 3 weeks


185776 08-Dec-2008 sobomax

Fix typo in the comment %is -> %si.


185579 03-Dec-2008 luigi

Another, hopefully final set of changes to boot0 and boot0cfg.

boot0.S changes:

+ import a patch from Christoph Mallon to rearrange the various
print functions and save another couple of bytes;

+ implement the suggestion in PR 70531 to enable booting from
any valid partition because even the extended partitions that
were previously in our kill list may contain a valid boot loader.
This simplifies the code and saves some bytes;

+ followwing up PR 127764, implement conditional code to preserve
the 'Volume ID' which might be used by other OS (NT, XP, Vista)
and is located at offset 0x1b8. This requires a relocation of the
parameter block within the boot sector -- there is no other
possible workaround.
To address this, boot0cfg has been updated to handle both
versions of the boot code;

+ slightly rearrange the strings printed in the menus to make
the code buildable with all options. Given the tight memory
budget, this means that with certain options we need to
shrink or remove certain labels.

and especially:

make -DVOLUME_LABEL -DPXE the default options.

This means that the newly built boot0 block will preserve the
Volume ID, and has the (hidden) option F6 to boot from INT18/PXE.
I think the extra functionality is well worth the change.

The most visible difference here is that the 'Default: ' string
now becomes 'Boot: ' (it can be reverted to the old value
but then we need to nuke 1/2 partition name or entries to
make up for the extra room).

boot0cfg changes:

+ modify the code to recognise the new boot0 structure (with the
relocated options block to make room for the Volume id).

+ add two options, '-i xxxx-xxxx' to set the volume ID, -e c
to modify the character printed in case of bad input

PR: 127764 70531
Submitted by: Christoph Mallon (portions)
MFC after: 4 weeks


185562 02-Dec-2008 luigi

This commits brings in a lot of documentation and some enhancement
of the boot0.S code, with a number of compile-time selectable options,
the most interesting one being the ability to select PXE booting.

The code is completely compatible with the previous one, and with
the boot0cfg program. Even the actual code is largely unmodified,
with only minor rearrangements or fixes to make room for the new
features.

The behaviour of the standard build differs from the previous
version in the following, minor things:

+ 'noupdate' is the default, which means the code does not
write back the selection to disk. You can enable the feature
at runtime with boot0cfg, or changing the flags in the Makefile.

+ a drive number of 0x00 (floppy, or USB in floppy emulation) is
now accepted as valid. Previously, it was overridden with 0x80,
meaning that the partition table coming from the media was
used to access sectors on a possibly different media.
You can revert to the previous mode building with -DCHECK_DRIVE,
and you can always use the 'setdrv' option in boot0cfg

+ certain FAT or NTFS partitions are listed as WIN instead of DOS.

+ the 'bel' character on a bad selection is replaced by a '#' to
make it clear that the system is not hang even if the machine
does not have a speaker. This can be reverted back at compile
time, or at runtime with an upcoming boot0cfg option.

Additional features are available as compile time options,
and may be become the default if deemed useful. In particular:

+ INT18/PXE boot (make -DPXE)
This option enables booting through INT 18h (which on certain
BIOSes can be hooked to PXE) by pressing F6. There is unfortunately
no room to print the additional menu option.
Also, to make room for the code, the 'Default: ' string is
changed to 'Boot: '

+ print current drive number (make -DTEST)
Prints a line indicating the current drive number.
This is useful to figure out what is going on for machines/bioses
which remap drives in sometimes surprising ways.

+ disable numeric keys in console mode (make -DONLY_F_KEYS)
Not really a significant option, but it is needed to make
room for the -DTEST mode.

+ disable floppy support (make -DCHECK_DRIVE)
Revert to the old behaviour of only accepting 0x80 and above
as valid drive numbers.

MFC after: 6 weeks


185346 26-Nov-2008 luigi

Fix a typo in previous commit: must call "putn" to print a crlf,
instead of "puts" which prints whatever is at %si, followed by a CRLF.

It was not noticed during tests because at that point %si points
to a partition entry whose first byte is 0x80, which is both a
terminator for the string and a non printable character.

Submitted by: Christoph Mallon


185339 26-Nov-2008 luigi

Pass the pointer to the selected partition in %si to the next stage
boot code. The bug was introduced in rev.1.13, and went unnoticed
because FreeBSD's boot1 does not use it, but other systems might.

(I have been struggling for almost a full day trying to figure out
why a syslinux'ed partition would not boot when started with the
FreeBSD /boot/boot0, only to realize that the bug was ours!)

The space for the two extra bytes (push %si and pop %si) is reclaimed
by removing an extra CRLF that is printed before booting.

The bug is not a major one but if there is time it might be a good
thing to merge it into the upcoming releases.


167914 26-Mar-2007 thomas

Fix setting of serial port speed. A junk value was passed in AX when
bioscom is called to set up serial port parameters because COMSPEED
was treated as an address instead of an immediate value, causing
serial port parameters to never be set.

PR: i386/110828
Reviewed by: jhb
MFC after: 2 weeks


158265 03-May-2006 jhb

Restore the pre-5.x behavior of only beeping if the user makes a bad
selection and not always beeping on startup. The two bytes for the extra
'jmp' instruction were obtained by removing recognition of BSD/OS
partitions.

Requested by: many
Tested by: subset of many
Head nod: imp, keramida
MFC after: 2 weeks


145515 25-Apr-2005 ru

Allow BOOT_BOOT0_COMCONSOLE_SPEED to be derived from BOOT_COMCONSOLE_SPEED
at compile time.


141540 08-Feb-2005 des

Remove type 0x4 (FAT12 <32MB) to make room for type 0x7 (NTFS).


139948 09-Jan-2005 peadar

Only update the boot sector when there is a valid drive number provided.
(After squeezing a few more bytes out of boot0)

Discussed With: jhb, julian
PR: 66248
Submitted By: Hans Petter Selasky
MFC After: 1 week


139103 21-Dec-2004 ru

Start the dreaded NOFOO -> NO_FOO conversion.

OK'ed by: core


138048 24-Nov-2004 jhb

- If the COMSPEED is set to 0, then don't try to initialize the serial port
and assume that the BIOS has set it up for us. This allows folks with a
serial-aware BIOS to set the BIOS to speeds above 9600 and allow boot0 to
just use the existing settings.
- Purge some gratuitous cpp comments as per style(9).

Submitted by: Danny Braniss danny at cs dot huji dot ac dot il (1)
MFC after: 1 month


137298 06-Nov-2004 keramida

Clean up the comments, rewording, adding missing punctuation
and other minor nits.

Approved by: jhb


134357 27-Aug-2004 obrien

In conjunction with having boot0cfg(8) default boot0 to packet mode.

Submitted by: Tor.Egge@cvsup.no.freebsd.org


130632 17-Jun-2004 phk

Save a couple of bytes for the SIO case.


130343 11-Jun-2004 phk

Merge boot0 and boot0sio so they behave the same.


129239 14-May-2004 ru

Partly back out last revision that unnecessarily changed valid
assembler line comments and damaged the CVS history.

Prompted by: bde, jhb


128741 29-Apr-2004 ru

Convert block comments into C-style that is understood by cpp(1).
Keep line comments in assembler style. A few lines that match
the '^[[:space:]]+#' regexp still need to be fixed, somehow.

OK'ed by: bde, jhb


128725 28-Apr-2004 ru

Thanks to David's patches, we can now simplify these makefiles
further, and just use PROG directly (without FILES).

Suggested by: bde


128723 28-Apr-2004 ru

Switch to using C99 comments in assembler preprocessed with cpp(1).


128722 28-Apr-2004 ru

- Properly merge boot0sio.s and boot0.s into boot0.S.
boot0sio.s was repo-copied to boot0.S.

- Rename boot0ext.s to boot0ext.S, to stay consistent
with other preprocessed asm files around here, and
for better portability.

Repocopied by: joe


128718 28-Apr-2004 ru

Temporary precaution measure until repocopy requests are
processed: don't forget to clean generated .s sources.


128691 27-Apr-2004 phk

Change from '#' to "//" comment character to allow CPP preprocessing.

Merge boot0.s and boot0sio.s into boot0_512.s controlled by "#ifdef SIO".

Add Makefile magic to generate boot0.s and boot0sio.s from boot0_512.s.

The compile boot0 and boot0sio have unchanged MD5 checksums.


128651 25-Apr-2004 obrien

Use a more compact syntax for passing the "binary" options to 'ld'.


128649 25-Apr-2004 obrien

Simplify the building of our i386 'binary' boot components by directly
producing them using 'ld' options rather than post-processing with 'objcopy'.

Idea by: Ryan Sommers <ryans@gamersimpact.com>


128471 20-Apr-2004 obrien

Fix a last second typo in 'vi' that caused a problem.


128451 20-Apr-2004 obrien

White space style cleanup.


128441 19-Apr-2004 obrien

MFp4: merge version #5 of the 2-sector boot0 from the "jhb boot" branch.


127458 26-Mar-2004 obrien

Bring back jhb's two sector (1024 bytes) 'boot0' [rev 1.22] as 'boot0ext'.


125621 09-Feb-2004 ru

- Factor out -nostdlib to an upper level Makefile.inc.

- Now that bsd.prog.mk deals with programs linked with -nostdlib
better, and has a notion of an "internal" program, use PROG
where possible. This has a good impact on the contents of
.depend files and causes programs to be linked with cc(1).

XXX: boot2 couldn't be converted as it's actually two programs.

Tested on: i386, amd64


125537 06-Feb-2004 ru

First round of cleanups to sys/boot/ makefiles:

- do not use PROG for what's not a real C program,
- use sys.mk transformation rules where possible,
- only create the "machine" symlink on AMD64,
- removed MAINTAINER lines in individual makefiles,
- added the LIBSTAND defitinion to <bsd.libnames.mk>,
- somewhat better contents in .depend files.

Tested on: i386, amd64
Prodded by: bde


125517 06-Feb-2004 ru

Inherit BINDIR from a parent Makefile.inc.


124179 06-Jan-2004 obrien

Allow one to specify the com port settings for boot0sio.


123470 11-Dec-2003 jhb

Properly fix a typo that the previous revision made even worse.


123336 09-Dec-2003 obrien

Sync these two files.


123302 08-Dec-2003 obrien

Hook boot0sio to the build. Use 'boot0cfg -b /boot/boot0sio' to use.


123301 08-Dec-2003 bms

Add a serial console capable version of the FreeBSD boot manager. This has
been lying around my tree(s) for the past year or so. It could do with TLC.

Requested by: obrien
Sponsored by: Weyland-Yutani Corporation


122923 20-Nov-2003 jhb

Update the size of the OS string table that wasn't updated in the previous
commit that removed the UNIX entry.

Submitted by: Rudolf Cejka <cejkar@fit.vutbr.cz>
Approved by: re (rwatson)


115638 01-Jun-2003 obrien

Accpet '1'..'5' in place of F1..F5 for serial console users.

Reviewed by: Bruce M Simpson <bms@spc.org>


103436 17-Sep-2002 peter

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


89240 10-Jan-2002 jhb

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.


80084 21-Jul-2001 rnordier

Unset MAINTAINER.


70177 19-Dec-2000 rnordier

Fix column alignment (whitespace-only change).


69921 12-Dec-2000 rnordier

Add a magic number, for easier identification of boot0. At present,
this is used only by libdisk.


66556 02-Oct-2000 rnordier

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.


66555 02-Oct-2000 rnordier

Set MAINTAINER.


65640 09-Sep-2000 rnordier

Correct BSD/OS slice type.

PR: 21099
Submitted by: Alan Clegg <abc@bsdi.com>


64385 08-Aug-2000 rnordier

Typo/spelling fixes.


64260 04-Aug-2000 jhb

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>


64187 03-Aug-2000 jhb

Cleanup warnings. Most of these are signed/unsigned warnings, as well as
some added const's.


63328 17-Jul-2000 jhb

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.


63032 12-Jul-2000 jhb

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.


60821 23-May-2000 jhb

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.


60046 05-May-2000 jhb

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).


50822 03-Sep-1999 julian

Remove accidental cut&paste garbage in a comment.


50820 03-Sep-1999 julian

Comment the boot manager. So I don't have to work it all out again :-)

Reviewed by: rnordier@freebsd.org


50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


49060 24-Jul-1999 rnordier

Recognise NetBSD slices.

Submitted by : Lars Koeller <lkoeller@cc.fh-lippe.de>
PR : 12772


48037 19-Jun-1999 rnordier

Provide for enabling/disabling each slice individually.


48010 18-Jun-1999 rnordier

Change active flag handling; sanity check passed drive number; pass
partition pointer to bootstrap; optimise away 10 bytes; cosmetics.


44357 01-Mar-1999 rnordier

Save option, rather than slice, selected. This permits unattended
booting from other than drive 0, as the F5 keypress is saved and
"replayed."

Requested (some time ago) by: archie


44296 26-Feb-1999 rnordier

Implement "setdrv" option


41540 05-Dec-1998 rnordier

Revise some comments and labels.


41412 29-Nov-1998 rnordier

Drop EDD support detection, though retain configurable use of disk
packet interface. Add booteasy-style F5 support. Add no-update
option. Implement various space optimizations and consistency fixes.


40524 19-Oct-1998 rnordier

Make configurable (a) whether to use int 0x13 extensions; (b) timeout
value. Ignore failure to update mbr sector. Disable interrupts while
using extended registers. Default to F1 not F2.


40493 17-Oct-1998 rnordier

Set BINMODE to 444.


40308 13-Oct-1998 rnordier

Don't use an absolute path to objcopy.
Noticed by: Scott Mace <smace@intt.org>


40182 10-Oct-1998 rnordier

Fix a typo.
Output another newline before invoking bootstrap.


40124 09-Oct-1998 rnordier

Get this building as a.out or ELF.

With thanks to: jdp


39980 05-Oct-1998 rnordier

Install in /boot.


39974 05-Oct-1998 rnordier

This commit was generated by cvs2svn to compensate for changes in r39973,
which included commits to RCS files with non-trunk default branches.