History log of /netbsd-current/sys/arch/i386/stand/boot/boot2.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.79 08-Jun-2022 wiz

Do not use default entry's parameters for for plain "boot" command

Go back to the "menu" instead of you want that.

Patch from RVP in PR 56862, ok uwe@


# 1.78 07-Sep-2021 nia

Remove banner printing code from bootloaders, add it to libsa.

This harmonizes efiboot and the various x86 bootloaders to use shared
code for printing the banner. By friendly coincidence, it also adds
support for specifying 'banner=' in arm efiboot's boot.cfg, as on x86.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 1.77 21-Jun-2021 nia

use a single printf call for readability


# 1.76 21-Jun-2021 nia

biosboot: Add ASCII art.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1
# 1.75 30-May-2021 mlelstv

Add "root" command to provide a BTINFO_ROOTDEVICE parameter.


Revision tags: cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 1.74 15-Jul-2020 kim

branches: 1.74.6; 1.74.8;
Let consdev command also set speed

Adapted from PR install/55490 by Sunil Nimmagadda


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.73 04-Apr-2020 christos

Infrastructure for putting kernel+modules in /netbsd/kernel and
/netbsd/modules respectively instead of /netbsd and
/stand/<arch>/<version>/modules. This is only supported for x86,
and is turned off by default. To try it, add KERNEL_DIR=yes in your
/mk.conf and install a system from that build.


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.72 02-Sep-2019 manu

Make sure devices names are copied including last byte

Fix from M. Levinson.


# 1.71 18-Aug-2019 manu

Add GPT and RAIDframe support to bootloaders

Classic BIOS (/boot) and EFI bootloaders can now name devices
using the NAME=gpt_label syntax, or using raid partitions. Here
are examples:
boot NAME=root:/netbsd
boot raid0e:/netbsd


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.70 14-Nov-2017 maxv

branches: 1.70.4; 1.70.8;
Add missing ).


# 1.69 08-Nov-2017 maxv

Add pkboot in "help".


# 1.68 11-Oct-2017 maxv

Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


# 1.67 07-Oct-2017 maxv

Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

branches: 1.66.10;
PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader


# 1.78 07-Sep-2021 nia

Remove banner printing code from bootloaders, add it to libsa.

This harmonizes efiboot and the various x86 bootloaders to use shared
code for printing the banner. By friendly coincidence, it also adds
support for specifying 'banner=' in arm efiboot's boot.cfg, as on x86.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 1.77 21-Jun-2021 nia

use a single printf call for readability


# 1.76 21-Jun-2021 nia

biosboot: Add ASCII art.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1
# 1.75 30-May-2021 mlelstv

Add "root" command to provide a BTINFO_ROOTDEVICE parameter.


Revision tags: cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 1.74 15-Jul-2020 kim

branches: 1.74.6; 1.74.8;
Let consdev command also set speed

Adapted from PR install/55490 by Sunil Nimmagadda


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.73 04-Apr-2020 christos

Infrastructure for putting kernel+modules in /netbsd/kernel and
/netbsd/modules respectively instead of /netbsd and
/stand/<arch>/<version>/modules. This is only supported for x86,
and is turned off by default. To try it, add KERNEL_DIR=yes in your
/mk.conf and install a system from that build.


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.72 02-Sep-2019 manu

Make sure devices names are copied including last byte

Fix from M. Levinson.


# 1.71 18-Aug-2019 manu

Add GPT and RAIDframe support to bootloaders

Classic BIOS (/boot) and EFI bootloaders can now name devices
using the NAME=gpt_label syntax, or using raid partitions. Here
are examples:
boot NAME=root:/netbsd
boot raid0e:/netbsd


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.70 14-Nov-2017 maxv

branches: 1.70.4; 1.70.8;
Add missing ).


# 1.69 08-Nov-2017 maxv

Add pkboot in "help".


# 1.68 11-Oct-2017 maxv

Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


# 1.67 07-Oct-2017 maxv

Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

branches: 1.66.10;
PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader


# 1.77 21-Jun-2021 nia

use a single printf call for readability


# 1.76 21-Jun-2021 nia

biosboot: Add ASCII art.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 thorpej-i2c-spi-conf-base
# 1.75 30-May-2021 mlelstv

Add "root" command to provide a BTINFO_ROOTDEVICE parameter.


Revision tags: cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 1.74 15-Jul-2020 kim

branches: 1.74.6; 1.74.8;
Let consdev command also set speed

Adapted from PR install/55490 by Sunil Nimmagadda


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.73 04-Apr-2020 christos

Infrastructure for putting kernel+modules in /netbsd/kernel and
/netbsd/modules respectively instead of /netbsd and
/stand/<arch>/<version>/modules. This is only supported for x86,
and is turned off by default. To try it, add KERNEL_DIR=yes in your
/mk.conf and install a system from that build.


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.72 02-Sep-2019 manu

Make sure devices names are copied including last byte

Fix from M. Levinson.


# 1.71 18-Aug-2019 manu

Add GPT and RAIDframe support to bootloaders

Classic BIOS (/boot) and EFI bootloaders can now name devices
using the NAME=gpt_label syntax, or using raid partitions. Here
are examples:
boot NAME=root:/netbsd
boot raid0e:/netbsd


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.70 14-Nov-2017 maxv

branches: 1.70.4; 1.70.8;
Add missing ).


# 1.69 08-Nov-2017 maxv

Add pkboot in "help".


# 1.68 11-Oct-2017 maxv

Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


# 1.67 07-Oct-2017 maxv

Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

branches: 1.66.10;
PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader


# 1.75 30-May-2021 mlelstv

Add "root" command to provide a BTINFO_ROOTDEVICE parameter.


Revision tags: cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.74 15-Jul-2020 kim

Let consdev command also set speed

Adapted from PR install/55490 by Sunil Nimmagadda


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.73 04-Apr-2020 christos

Infrastructure for putting kernel+modules in /netbsd/kernel and
/netbsd/modules respectively instead of /netbsd and
/stand/<arch>/<version>/modules. This is only supported for x86,
and is turned off by default. To try it, add KERNEL_DIR=yes in your
/mk.conf and install a system from that build.


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.72 02-Sep-2019 manu

Make sure devices names are copied including last byte

Fix from M. Levinson.


# 1.71 18-Aug-2019 manu

Add GPT and RAIDframe support to bootloaders

Classic BIOS (/boot) and EFI bootloaders can now name devices
using the NAME=gpt_label syntax, or using raid partitions. Here
are examples:
boot NAME=root:/netbsd
boot raid0e:/netbsd


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.70 14-Nov-2017 maxv

branches: 1.70.4; 1.70.8;
Add missing ).


# 1.69 08-Nov-2017 maxv

Add pkboot in "help".


# 1.68 11-Oct-2017 maxv

Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


# 1.67 07-Oct-2017 maxv

Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

branches: 1.66.10;
PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader


# 1.74 15-Jul-2020 kim

Let consdev command also set speed

Adapted from PR install/55490 by Sunil Nimmagadda


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.73 04-Apr-2020 christos

Infrastructure for putting kernel+modules in /netbsd/kernel and
/netbsd/modules respectively instead of /netbsd and
/stand/<arch>/<version>/modules. This is only supported for x86,
and is turned off by default. To try it, add KERNEL_DIR=yes in your
/mk.conf and install a system from that build.


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.72 02-Sep-2019 manu

Make sure devices names are copied including last byte

Fix from M. Levinson.


# 1.71 18-Aug-2019 manu

Add GPT and RAIDframe support to bootloaders

Classic BIOS (/boot) and EFI bootloaders can now name devices
using the NAME=gpt_label syntax, or using raid partitions. Here
are examples:
boot NAME=root:/netbsd
boot raid0e:/netbsd


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.70 14-Nov-2017 maxv

branches: 1.70.4; 1.70.8;
Add missing ).


# 1.69 08-Nov-2017 maxv

Add pkboot in "help".


# 1.68 11-Oct-2017 maxv

Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


# 1.67 07-Oct-2017 maxv

Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

branches: 1.66.10;
PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader


# 1.73 04-Apr-2020 christos

Infrastructure for putting kernel+modules in /netbsd/kernel and
/netbsd/modules respectively instead of /netbsd and
/stand/<arch>/<version>/modules. This is only supported for x86,
and is turned off by default. To try it, add KERNEL_DIR=yes in your
/mk.conf and install a system from that build.


Revision tags: ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.72 02-Sep-2019 manu

Make sure devices names are copied including last byte

Fix from M. Levinson.


# 1.71 18-Aug-2019 manu

Add GPT and RAIDframe support to bootloaders

Classic BIOS (/boot) and EFI bootloaders can now name devices
using the NAME=gpt_label syntax, or using raid partitions. Here
are examples:
boot NAME=root:/netbsd
boot raid0e:/netbsd


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.70 14-Nov-2017 maxv

branches: 1.70.8;
Add missing ).


# 1.69 08-Nov-2017 maxv

Add pkboot in "help".


# 1.68 11-Oct-2017 maxv

Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


# 1.67 07-Oct-2017 maxv

Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

branches: 1.66.10;
PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader


# 1.72 02-Sep-2019 manu

Make sure devices names are copied including last byte

Fix from M. Levinson.


# 1.71 18-Aug-2019 manu

Add GPT and RAIDframe support to bootloaders

Classic BIOS (/boot) and EFI bootloaders can now name devices
using the NAME=gpt_label syntax, or using raid partitions. Here
are examples:
boot NAME=root:/netbsd
boot raid0e:/netbsd


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.70 14-Nov-2017 maxv

Add missing ).


# 1.69 08-Nov-2017 maxv

Add pkboot in "help".


# 1.68 11-Oct-2017 maxv

Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


# 1.67 07-Oct-2017 maxv

Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader


# 1.71 18-Aug-2019 manu

Add GPT and RAIDframe support to bootloaders

Classic BIOS (/boot) and EFI bootloaders can now name devices
using the NAME=gpt_label syntax, or using raid partitions. Here
are examples:
boot NAME=root:/netbsd
boot raid0e:/netbsd


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.70 14-Nov-2017 maxv

Add missing ).


# 1.69 08-Nov-2017 maxv

Add pkboot in "help".


# 1.68 11-Oct-2017 maxv

Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


# 1.67 07-Oct-2017 maxv

Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader


Revision tags: tls-maxphys-base-20171202
# 1.70 14-Nov-2017 maxv

Add missing ).


# 1.69 08-Nov-2017 maxv

Add pkboot in "help".


# 1.68 11-Oct-2017 maxv

Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


# 1.67 07-Oct-2017 maxv

Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)


Revision tags: matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader


# 1.69 08-Nov-2017 maxv

Add pkboot in "help".


# 1.68 11-Oct-2017 maxv

Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


# 1.67 07-Oct-2017 maxv

Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)


Revision tags: matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader


# 1.68 11-Oct-2017 maxv

Reset has_prekern if pkboot fails. Otherwise here:
pkboot wrong_kernel_path
boot netbsd
the prekern still gets invoked in the second command.


# 1.67 07-Oct-2017 maxv

Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.66 03-Feb-2016 christos

PR/50748: David Binderman: check bounds before dereference


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 11-Jun-2015 khorben

Also document the "splash" command in boot(8)


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 16-Jan-2015 christos

Restore previous behavior: "boot -s" == "boot netbsd -s"
Instead of ignoring the flags and doing the default boot. Merge some
extraneous code.
XXX: Find the PR for this, close it and pullup to -7


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 28-Jun-2014 rtr

branches: 1.63.2; 1.63.4;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base
# 1.62 26-Mar-2014 christos

branches: 1.62.2;
kill sprintf.


# 1.61 20-Mar-2014 christos

allow LS to be commented out


Revision tags: riastradh-drm2-base3
# 1.60 30-Aug-2013 jmcneill

Add support for using a raw file-system image as memory disk root with
the x86 bootloader.


# 1.59 28-Jul-2013 he

Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

* Add a "menu" command which re-displays the menu and initiates
the timed countdown
* Use any default command defined in boot.cfg as default args
if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.58 04-Aug-2012 riastradh

branches: 1.58.2; 1.58.4;
Fix i386 `boot' command to try the usual set of kernel names.

Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.57 25-Dec-2011 tsutsui

branches: 1.57.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.56 28-Nov-2011 tls

branches: 1.56.2;

Add support for passing saved entropy (random seed file) to the kernel
from the bootloader. This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.55 23-Jun-2011 mrg

branches: 1.55.2;
cast a uint8_t * to a char * for a function that takes char *.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.54 26-May-2011 uebayasi

Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html


# 1.53 18-Mar-2011 jakllsch

Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.52 06-Feb-2011 jmcneill

add support for passing image files to the kernel with the 'splash' keyword:

vesa on;splash /netbsd.jpg;boot -z


Revision tags: jruoho-x86intr-base
# 1.51 05-Jan-2011 jakllsch

branches: 1.51.2; 1.51.4;
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


Revision tags: matt-mips64-premerge-20101231
# 1.50 20-Dec-2010 jakllsch

MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5
# 1.49 06-Nov-2010 jym

Bring the help command output from boot and pxeboot on par with their
code.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.48 08-Feb-2010 hubertf

branches: 1.48.2;
When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: *
Password: *
Password: *
unknown command
commands are:
boot [xdNx:][filename] [-12acdqsvxz]
(ex. "hd0a:netbsd.old -s"
ls [path]
dev xd[N[x]]:
consdev {pc|com[0123]|com[0123]kbd|auto}
modules {enabled|disabled}
load {path_to_module}
multiboot [xdNx:][filename] [<args>]
help|?
quit

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

...
Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
Password: ****
Password: ****
Password: ****
Wrong password.

Choose an option; RETURN for default; SPACE to stop countdown.
...

Implement the latter behaviour.


Revision tags: uebayasi-xip-base
# 1.47 17-Jan-2010 drochner

branches: 1.47.2;
Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.


# 1.46 14-Jan-2010 drochner

On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8
# 1.45 13-Sep-2009 jmcneill

Make the 'dev' command print out a list of known boot devices based on
information from the BIOS in addition to the currently selected default
partition. Handy when you don't know where to boot from. Here's a demo:

type "?" or "help" for help.
> dev
disk hd0 size 3815 MB
hd0a(4.2BSD) hd0b(swap)
disk cd0
cd0a(unknown)
default hd0a
>


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.44 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.43 16-Feb-2009 jmcneill

Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
* vesa {enabled|disabled}
Enable / disable linear framebuffer, default mode is 640x480x8. May
be changed in the future to determine mode based on VBE/DDC where
available.
* vesa list
List modes supported by the firmware that meet the following criteria:
* linear framebuffer
* packed pixel or direct colour mode
* vesa {modenum|modestr}
Enable specific VBE mode. The mode can be specified either as a
VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).


Revision tags: mjf-devfs2-base
# 1.42 11-Jan-2009 christos

branches: 1.42.2;
merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base
# 1.41 13-Dec-2008 christos

add a boot.cfg option to clear the screen; default off. From Anon Ymous


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.40 25-Nov-2008 ad

Make pxeboot understand boot.cfg.


# 1.39 19-Nov-2008 ad

For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.38 11-Oct-2008 joerg

branches: 1.38.2; 1.38.4; 1.38.8;
Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.


Revision tags: wrstuden-revivesa-base-4
# 1.37 26-Sep-2008 tsutsui

Remove a hack which disables loading boot.cfg from ustarfs.
Now all bootfloppies have a proper boot.cfg file in ustarfs.

Tested on qemu.
(though qemu doesn't emulate timeout on the boot prompt properly)


# 1.36 26-Sep-2008 christos

The structure of our elf kernel is:

elf header/program headers/text/data/note/
section headers/symbol table/string table

We need to read the section headers first to find the offset of the note
and thus we requite backwards seek. The only reason we need to read the
note is to find the version of the kernel, and this seems not to be used
anywhere. We could potentially change the kernel ldscript to add the note
information in the program headers, but dealing with ldscripts is painful
and producing a more complex binary could break some dumb standalone loader.
So the simple solution is to just disable the note loading for floppies
which is what this patch does. If someone wants to fix it in a better way,
be my guest.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.35 20-Aug-2008 sborrill

Fix display of "Option X will be chosen in" banner. The letter version of it
was always displayed even if number format was selected.


# 1.34 12-Aug-2008 sborrill

Increase number of menu options to 20.
Add support for switching menu format between numbers and letters. Will
prefer numbers, but will automatically switch to letters if > 9 options
and timeout > 0 (i.e. need a single key press to choose).
Menu format can be explicitly set in boot.cfg file.
Add support for reading numeric choices of more than 1 digit.


# 1.33 08-Aug-2008 simonb

Don't run off the end of the bootconf.desc[] array when printing out
the boot menu choices. Fixes problems with funny display when MAXMENU
or more "menu" items are in /boot.cfg.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.32 15-Jul-2008 perry

Change the x86 boot blocks so they don't include builder login and date.

For now, we include kernel revision as a way of allowing users to
notice that boot blocks have gotten very old, so the first line of the
printout looks like this (depending on the particular block):

>> NetBSD/x86 BIOS Boot, Revision 3.4 (from NetBSD 5.0)

This may be changed a bit pending feedback. (Some people think that
the kernel revision shouldn't be there at all, for example.)

Part of the project to assure that bit-identical sources produce
bit-identical release binaries.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.31 21-May-2008 ad

branches: 1.31.2; 1.31.4;
- Stop the twiddler going awry.
- Clear screen if on a glass tty (!).


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.30 06-May-2008 lukem

branches: 1.30.2;
Add a missing semicolon.
(mmm, compile before commit :)


# 1.29 06-May-2008 apb

Change the wording of a message, to make it clear that pressing SPACE
will stop the countdown timer. The message now reads "Choose an option;
RETURN for default; SPACE to stop countdown." It no longer says what
the default choice actually is, because the message printed on the
following line will do that.


# 1.28 05-May-2008 chris

Increase banner entries from 10 to 12. This allows all 12 lines of the cd
boot.cfg banner to be displayed.


# 1.27 03-May-2008 ad

Handle compressed modules.


# 1.26 03-May-2008 sborrill

Add support for multiple commands separated by semi-colons on menu lines
in boot.cfg.
e.g.
menu=Boot with module foo:load=/foo.kmod;boot


# 1.25 02-May-2008 ad

- Give x86 BIOS boot the ability to load new style modules and pass them
into the kernel. Based on a patch by jmcneill@, with many fixes and
improvements by me.

- Put MEMORY_DISK_DYNAMIC and MODULAR into the GENERIC kernels, so that
you can load miniroot.kmod from the boot blocks and boot into the
installer!


# 1.24 30-Apr-2008 ad

Tidy up console output slightly.


# 1.23 29-Apr-2008 ad

Adjust the help string for new options.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.22 23-Feb-2008 sborrill

branches: 1.22.2; 1.22.4; 1.22.6;
Only attempt to output up to MAXBANNER banner lines


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.21 05-Jan-2008 apb

branches: 1.21.2; 1.21.6;
If a menu line in boot.cfg has an empty description, then re-use the
command as the description. For example,

menu=:boot netbsd -s

now works like

menu=boot netbsd -s:boot netbsd -s


# 1.20 02-Jan-2008 sborrill

Configuration file is boot.cfg, not boot.cnf, so fix comments


# 1.19 29-Dec-2007 jmcneill

Add -z to usage strings.


# 1.18 29-Dec-2007 jmcneill

Mention -x in command_help


Revision tags: vmlocking2-base3
# 1.17 13-Dec-2007 sborrill

Check whether we are loading from ustarfs and if so, do not attempt to
read boot.cfg.

Fixes PR install/37521. Heavily based on patch by Izumi Tsutsui.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.16 23-Nov-2007 sborrill

branches: 1.16.2; 1.16.6;
Print a newline above the menu, but not below the custom banner.
This means that there is a consistent empty line above the menu both with
and without a custom banner.


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.15 20-Nov-2007 sborrill

Add support for /boot.cfg configuration file in x86 boot loader.
This allows easy configuration of banner text, console device and timeout
as well as allowing menus of commands to be displayed. If /boot.cfg
is not present, then the existing behaviour does not change.

The sections in the boot loader source are surrounded by #ifdef SMALL
allowing this functionality to be removed if space is at a premium.


Revision tags: jmcneill-base yamt-x86pmap-base4
# 1.14 17-Oct-2007 garbled

branches: 1.14.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.13 08-Jul-2007 ws

branches: 1.13.8; 1.13.10; 1.13.14;
Fix "Fix a garbage in previous commit." in 1.10.

Hi, junyoung!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.12 11-Dec-2005 christos

branches: 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.11 22-Jun-2005 junyoung

branches: 1.11.2;
Add support for cd9660 file system to the i386 BIOS bootloader.


# 1.10 21-Jun-2005 junyoung

- It is worthless to endlessly try to boot unbootable images. If all predefined
boot images are failed to boot, fall into the prompt.
- Fix a garbage in previous commit.


# 1.9 21-Jun-2005 junyoung

More cosmetic changes.


# 1.8 21-Jun-2005 junyoung

- KNF & cosmetic changes
- Remove #if 0'ed netbsd.el{,.gz} from bootfile list. I have no idea what
those files are (emacs lisp source??? :-).


# 1.7 15-Jun-2005 junyoung

Cosmetic changes.


# 1.6 15-Jun-2005 junyoung

KNF & notably, use u_int rather than unsigned int for now for consistency.
This should be reversed eventually...


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.5 25-Nov-2004 christos

include sys/types.h to make this compile again.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.4 08-Oct-2003 lukem

branches: 1.4.4;
Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).


# 1.3 06-Oct-2003 lukem

Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)


# 1.2 27-Jul-2003 mrg

rewrite an undefined assignment


# 1.1 16-Apr-2003 dsl

branches: 1.1.2;
Add files for 2nd stage boot loader