1999-08-28 01:08:13 +00:00
|
|
|
# $FreeBSD$
|
1998-10-05 19:20:36 +00:00
|
|
|
|
2004-04-28 21:31:21 +00:00
|
|
|
PROG?= boot0
|
|
|
|
STRIP=
|
|
|
|
BINMODE=${NOBINMODE}
|
2014-04-13 05:21:56 +00:00
|
|
|
MAN=
|
2004-04-28 21:31:21 +00:00
|
|
|
SRCS= ${PROG}.S
|
1998-10-05 10:08:37 +00:00
|
|
|
|
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
2008-12-02 14:57:48 +00:00
|
|
|
# Additional options that you can specify with make OPTS="..."
|
|
|
|
# (these only apply to boot0.S)
|
|
|
|
#
|
2008-12-03 14:53:59 +00:00
|
|
|
# -DVOLUME_SERIAL support volume serial number (NT, XP, Vista)
|
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
2008-12-02 14:57:48 +00:00
|
|
|
# -DSIO do I/O using COM1:
|
|
|
|
# -DPXE fallback to INT18/PXE with F6
|
|
|
|
# -DCHECK_DRIVE enable checking drive number
|
|
|
|
# -DONLY_F_KEYS accept only Fx keys in console
|
|
|
|
# -DTEST print drive number on entry
|
|
|
|
#
|
2008-12-03 14:53:59 +00:00
|
|
|
OPTS ?= -DVOLUME_SERIAL -DPXE
|
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
2008-12-02 14:57:48 +00:00
|
|
|
CFLAGS += ${OPTS}
|
|
|
|
|
|
|
|
# Flags used in the boot0.S code:
|
|
|
|
# 0x0f all valid partitions enabled.
|
|
|
|
# 0x80 'packet', use BIOS EDD (LBA) extensions instead of CHS
|
|
|
|
# to read from disk. boot0.S does not check that the extensions
|
|
|
|
# are supported, but all modern BIOSes should have them.
|
|
|
|
# 0x40 'noupdate', disable writing boot0 back to disk so that
|
|
|
|
# the current selection is not preserved across reboots.
|
|
|
|
# 0x20 'setdrv', override the drive number supplied by the bios
|
|
|
|
# with the one in the boot sector.
|
|
|
|
|
|
|
|
# Default boot flags:
|
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
2008-12-30 09:40:50 +00:00
|
|
|
BOOT_BOOT0_FLAGS?= 0x8f
|
1998-10-19 19:13:53 +00:00
|
|
|
|
2002-01-10 21:40:33 +00:00
|
|
|
# The number of timer ticks to wait for a keypress before assuming the default
|
|
|
|
# selection. Since there are 18.2 ticks per second, the default value of
|
|
|
|
# 0xb6 (182d) corresponds to 10 seconds.
|
|
|
|
BOOT_BOOT0_TICKS?= 0xb6
|
|
|
|
|
|
|
|
# The base address that we the boot0 code to to run it. Don't change this
|
|
|
|
# unless you are glutton for punishment.
|
|
|
|
BOOT_BOOT0_ORG?= 0x600
|
1998-10-05 10:08:37 +00:00
|
|
|
|
2005-04-25 17:41:35 +00:00
|
|
|
# Comm settings for boot0sio.
|
|
|
|
# Bit(s) Description
|
|
|
|
# 7-5 data rate (110,150,300,600,1200,2400,4800,9600 bps)
|
|
|
|
# 4-3 parity (00 or 10 = none, 01 = odd, 11 = even)
|
|
|
|
# 2 stop bits (set = 2, clear = 1)
|
|
|
|
# 1-0 data bits (00 = 5, 01 = 6, 10 = 7, 11 = 8)
|
|
|
|
.if !defined(BOOT_BOOT0_COMCONSOLE_SPEED)
|
|
|
|
BOOT_COMCONSOLE_SPEED?= 9600
|
|
|
|
.if ${BOOT_COMCONSOLE_SPEED} == 9600
|
|
|
|
BOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3"
|
|
|
|
.elif ${BOOT_COMCONSOLE_SPEED} == 4800
|
|
|
|
BOOT_BOOT0_COMCONSOLE_SPEED= "6 << 5 + 3"
|
|
|
|
.elif ${BOOT_COMCONSOLE_SPEED} == 2400
|
|
|
|
BOOT_BOOT0_COMCONSOLE_SPEED= "5 << 5 + 3"
|
|
|
|
.elif ${BOOT_COMCONSOLE_SPEED} == 1200
|
|
|
|
BOOT_BOOT0_COMCONSOLE_SPEED= "4 << 5 + 3"
|
|
|
|
.elif ${BOOT_COMCONSOLE_SPEED} == 600
|
|
|
|
BOOT_BOOT0_COMCONSOLE_SPEED= "3 << 5 + 3"
|
|
|
|
.elif ${BOOT_COMCONSOLE_SPEED} == 300
|
|
|
|
BOOT_BOOT0_COMCONSOLE_SPEED= "2 << 5 + 3"
|
|
|
|
.elif ${BOOT_COMCONSOLE_SPEED} == 150
|
|
|
|
BOOT_BOOT0_COMCONSOLE_SPEED= "1 << 5 + 3"
|
|
|
|
.elif ${BOOT_COMCONSOLE_SPEED} == 110
|
|
|
|
BOOT_BOOT0_COMCONSOLE_SPEED= "0 << 5 + 3"
|
|
|
|
.else
|
|
|
|
BOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3"
|
|
|
|
.endif
|
|
|
|
.endif
|
2004-01-06 18:46:35 +00:00
|
|
|
|
2004-04-28 20:49:17 +00:00
|
|
|
CFLAGS+=-DFLAGS=${BOOT_BOOT0_FLAGS} \
|
|
|
|
-DTICKS=${BOOT_BOOT0_TICKS} \
|
|
|
|
-DCOMSPEED=${BOOT_BOOT0_COMCONSOLE_SPEED}
|
1998-10-05 10:08:37 +00:00
|
|
|
|
2010-06-03 17:42:32 +00:00
|
|
|
LDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-N,-S,--oformat,binary
|
1998-10-05 10:08:37 +00:00
|
|
|
|
2004-04-28 16:16:16 +00:00
|
|
|
.include <bsd.prog.mk>
|
2012-02-28 18:30:18 +00:00
|
|
|
|
|
|
|
# XXX: clang integrated-as doesn't grok .codeNN directives yet
|
|
|
|
CFLAGS.boot0.S= ${CLANG_NO_IAS}
|
|
|
|
CFLAGS.boot0ext.S= ${CLANG_NO_IAS}
|
|
|
|
CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
|