History log of /netbsd-current/sys/arch/i386/stand/lib/exec.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.80 06-Jan-2024 mlelstv

In efiboot
- create bootinfo information only once.
- add fake biosgeom entries so that the kernel can distinguish between
hard drives (with geom) and CD-ROM (without).


Revision tags: thorpej-ifq-base thorpej-altq-separation-base
# 1.79 20-Apr-2023 manu

Add reloc keyworkd to let EFI bootstrap load amd64 kernel at any address

EFI bootstrap assumes it can copy the amd64 kernel to its ELF load
address (that is KERNTEXTOFF - KERNBASE = 0x200000), but it can
clash with previous UEFI memory allocation, as described here:
http://mail-index.netbsd.org/tech-kern/2023/04/07/msg028833.html

This change adds a reloc keyword for controling where the EFI
boostrap will copy the kernel image. Possible values are:
default - the default and prior behavior, copy at 0x200000.
none - do not copy and use the kernel image where it was loaded.
address - specify an explicit address where to copy the kernel.

This comes with an amd64 kernel patch that makes it self-relocatable.
It first discover where it was loaded in memory, and if this is
different than the expected 0x200000, hhe the kernel relocates
itself and start over at the right address.


Revision tags: netbsd-10-base bouyer-sunxi-drm-base
# 1.78 21-Sep-2022 riastradh

branches: 1.78.4;
i386/stand: Handle 9.99.100 by taking four, not two, digits.

We haven't used the revision part of __NetBSD_Version__ = MMmmrrpp00
in almos two decades so we're apparently reclaiming it as MMmmpppp00.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 thorpej-i2c-spi-conf-base
# 1.77 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 bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.76 04-Apr-2020 christos

branches: 1.76.8; 1.76.10;
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
# 1.75 07-Dec-2019 christos

loadfile sets errno, return the correct error, not EIO.


Revision tags: phil-wifi-20191119
# 1.74 13-Sep-2019 manu

Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.
This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h


Revision tags: netbsd-9-base
# 1.73 26-Jul-2019 nonaka

branches: 1.73.2;
Pre-allocate memory for the kernel space at startup.


# 1.72 24-Jun-2019 pgoyette

Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.


# 1.71 24-Jun-2019 pgoyette

Remove double-include for reboot.h


# 1.70 20-Jun-2019 maxv

Add KASLR support in UEFI.


Revision tags: 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.69 07-Oct-2017 maxv

branches: 1.69.4;
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
# 1.68 24-Mar-2017 nonaka

branches: 1.68.6;
efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.79 20-Apr-2023 manu

Add reloc keyworkd to let EFI bootstrap load amd64 kernel at any address

EFI bootstrap assumes it can copy the amd64 kernel to its ELF load
address (that is KERNTEXTOFF - KERNBASE = 0x200000), but it can
clash with previous UEFI memory allocation, as described here:
http://mail-index.netbsd.org/tech-kern/2023/04/07/msg028833.html

This change adds a reloc keyword for controling where the EFI
boostrap will copy the kernel image. Possible values are:
default - the default and prior behavior, copy at 0x200000.
none - do not copy and use the kernel image where it was loaded.
address - specify an explicit address where to copy the kernel.

This comes with an amd64 kernel patch that makes it self-relocatable.
It first discover where it was loaded in memory, and if this is
different than the expected 0x200000, hhe the kernel relocates
itself and start over at the right address.


Revision tags: netbsd-10-base bouyer-sunxi-drm-base
# 1.78 21-Sep-2022 riastradh

i386/stand: Handle 9.99.100 by taking four, not two, digits.

We haven't used the revision part of __NetBSD_Version__ = MMmmrrpp00
in almos two decades so we're apparently reclaiming it as MMmmpppp00.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 thorpej-i2c-spi-conf-base
# 1.77 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 bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.76 04-Apr-2020 christos

branches: 1.76.8; 1.76.10;
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
# 1.75 07-Dec-2019 christos

loadfile sets errno, return the correct error, not EIO.


Revision tags: phil-wifi-20191119
# 1.74 13-Sep-2019 manu

Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.
This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h


Revision tags: netbsd-9-base
# 1.73 26-Jul-2019 nonaka

branches: 1.73.2;
Pre-allocate memory for the kernel space at startup.


# 1.72 24-Jun-2019 pgoyette

Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.


# 1.71 24-Jun-2019 pgoyette

Remove double-include for reboot.h


# 1.70 20-Jun-2019 maxv

Add KASLR support in UEFI.


Revision tags: 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.69 07-Oct-2017 maxv

branches: 1.69.4;
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
# 1.68 24-Mar-2017 nonaka

branches: 1.68.6;
efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.78 21-Sep-2022 riastradh

i386/stand: Handle 9.99.100 by taking four, not two, digits.

We haven't used the revision part of __NetBSD_Version__ = MMmmrrpp00
in almos two decades so we're apparently reclaiming it as MMmmpppp00.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 thorpej-i2c-spi-conf-base
# 1.77 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 bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.76 04-Apr-2020 christos

branches: 1.76.8; 1.76.10;
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
# 1.75 07-Dec-2019 christos

loadfile sets errno, return the correct error, not EIO.


Revision tags: phil-wifi-20191119
# 1.74 13-Sep-2019 manu

Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.
This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h


Revision tags: netbsd-9-base
# 1.73 26-Jul-2019 nonaka

branches: 1.73.2;
Pre-allocate memory for the kernel space at startup.


# 1.72 24-Jun-2019 pgoyette

Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.


# 1.71 24-Jun-2019 pgoyette

Remove double-include for reboot.h


# 1.70 20-Jun-2019 maxv

Add KASLR support in UEFI.


Revision tags: 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.69 07-Oct-2017 maxv

branches: 1.69.4;
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
# 1.68 24-Mar-2017 nonaka

branches: 1.68.6;
efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.77 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 bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.76 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
# 1.75 07-Dec-2019 christos

loadfile sets errno, return the correct error, not EIO.


Revision tags: phil-wifi-20191119
# 1.74 13-Sep-2019 manu

Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.
This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h


Revision tags: netbsd-9-base
# 1.73 26-Jul-2019 nonaka

branches: 1.73.2;
Pre-allocate memory for the kernel space at startup.


# 1.72 24-Jun-2019 pgoyette

Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.


# 1.71 24-Jun-2019 pgoyette

Remove double-include for reboot.h


# 1.70 20-Jun-2019 maxv

Add KASLR support in UEFI.


Revision tags: 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.69 07-Oct-2017 maxv

branches: 1.69.4;
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
# 1.68 24-Mar-2017 nonaka

branches: 1.68.6;
efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.76 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
# 1.75 07-Dec-2019 christos

loadfile sets errno, return the correct error, not EIO.


Revision tags: phil-wifi-20191119
# 1.74 13-Sep-2019 manu

Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.
This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h


Revision tags: netbsd-9-base
# 1.73 26-Jul-2019 nonaka

branches: 1.73.2;
Pre-allocate memory for the kernel space at startup.


# 1.72 24-Jun-2019 pgoyette

Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.


# 1.71 24-Jun-2019 pgoyette

Remove double-include for reboot.h


# 1.70 20-Jun-2019 maxv

Add KASLR support in UEFI.


Revision tags: 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.69 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
# 1.68 24-Mar-2017 nonaka

branches: 1.68.6;
efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.75 07-Dec-2019 christos

loadfile sets errno, return the correct error, not EIO.


Revision tags: phil-wifi-20191119
# 1.74 13-Sep-2019 manu

Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.
This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h


Revision tags: netbsd-9-base
# 1.73 26-Jul-2019 nonaka

branches: 1.73.2;
Pre-allocate memory for the kernel space at startup.


# 1.72 24-Jun-2019 pgoyette

Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.


# 1.71 24-Jun-2019 pgoyette

Remove double-include for reboot.h


# 1.70 20-Jun-2019 maxv

Add KASLR support in UEFI.


Revision tags: 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.69 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
# 1.68 24-Mar-2017 nonaka

branches: 1.68.6;
efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.74 13-Sep-2019 manu

Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.
This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h


Revision tags: netbsd-9-base
# 1.73 26-Jul-2019 nonaka

Pre-allocate memory for the kernel space at startup.


# 1.72 24-Jun-2019 pgoyette

Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.


# 1.71 24-Jun-2019 pgoyette

Remove double-include for reboot.h


# 1.70 20-Jun-2019 maxv

Add KASLR support in UEFI.


Revision tags: 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.69 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
# 1.68 24-Mar-2017 nonaka

branches: 1.68.6;
efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.73 26-Jul-2019 nonaka

Pre-allocate memory for the kernel space at startup.


# 1.72 24-Jun-2019 pgoyette

Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.


# 1.71 24-Jun-2019 pgoyette

Remove double-include for reboot.h


# 1.70 20-Jun-2019 maxv

Add KASLR support in UEFI.


Revision tags: 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.69 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
# 1.68 24-Mar-2017 nonaka

efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.72 24-Jun-2019 pgoyette

Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.


# 1.71 24-Jun-2019 pgoyette

Remove double-include for reboot.h


# 1.70 20-Jun-2019 maxv

Add KASLR support in UEFI.


Revision tags: 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.69 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
# 1.68 24-Mar-2017 nonaka

efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.71 24-Jun-2019 pgoyette

Remove double-include for reboot.h


# 1.70 20-Jun-2019 maxv

Add KASLR support in UEFI.


Revision tags: 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.69 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
# 1.68 24-Mar-2017 nonaka

efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.70 20-Jun-2019 maxv

Add KASLR support in UEFI.


Revision tags: 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.69 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
# 1.68 24-Mar-2017 nonaka

efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.69 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
# 1.68 24-Mar-2017 nonaka

efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.68 24-Mar-2017 nonaka

efiboot: fix calculation of the kernel size when loading modules.


Revision tags: pgoyette-localcount-20170320
# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

branches: 1.62.2;
KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.67 12-Mar-2017 nonaka

efiboot: Kernel modules are loaded in pre-allocated memory.


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.66 23-Feb-2017 nonaka

no need COUNT_KERNEL hack.


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.65 11-Feb-2017 nonaka

PR/51953: fix unable to boot on some AMD machine.

Delayed the timing to copy the kernel to actual address.
copy routine from common/lib/libc/arch/x86_64/string/bcopy.S


# 1.64 11-Feb-2017 nonaka

efiboot: Copy bootinfo to safe arena.


Revision tags: nick-nhusb-base-20170204
# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


# 1.63 24-Jan-2017 nonaka

Initial commit of native amd64 EFI boot loader.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

branches: 1.61.2;
Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision


Revision tags: nick-nhusb-base-20161204
# 1.62 04-Dec-2016 maxv

KNF and explain a few things


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.61 05-Jun-2016 maxv

Don't use a magic value. Define a limit, and enforce it.


# 1.60 05-Jun-2016 maxv

The bootinfo is refreshed each time the bootloader tries to execute a
kernel, so there's no point in using this global variable. Because of
this variable, only one "boot" command can be issued in the prompt, and
you have to reboot the machine if you mistyped the kernel name.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.59 06-Apr-2014 jakllsch

branches: 1.59.4;
Misc WARNS=4 fixes.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.58 10-Jan-2014 jakllsch

branches: 1.58.2;
fix style and whitespace nits


# 1.57 05-Jan-2014 jakllsch

Make name argument to module_add_common const; use this to allow the libsa
fsmod string to soon become const.


# 1.56 30-Dec-2013 jakllsch

Zero out on-stack 'marks' array before first use.
This is needed so the MARK_DATA index is properly filled in.


# 1.55 27-Nov-2013 jakllsch

Use the size of what's at the bootinfo_userconf pointer, not the size
of the pointer itself.


# 1.54 24-Nov-2013 jakllsch

The x86 kernel entry point stack arguments are always 32-bit, even on amd64.


# 1.53 24-Nov-2013 jakllsch

use <i386/multiboot.h> instead of <machine/multiboot.h> so this can be
compiled for amd64


# 1.52 24-Nov-2013 jakllsch

cast from 32-bit integer to void * though uintptr_t to avoid warnings
when compiling for x86_64.


# 1.51 30-Aug-2013 jmcneill

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


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.50 21-May-2012 dsl

branches: 1.50.2; 1.50.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).


Revision tags: 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-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.49 28-Nov-2011 tls

branches: 1.49.2; 1.49.4;

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.48 17-Jul-2011 joerg

branches: 1.48.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.47 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


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.46 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 matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4
# 1.45 30-Oct-2010 jnemeth

branches: 1.45.2; 1.45.4;
Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
> The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you. That is
> then followed by a standard four claus UCB licence. Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.44 25-Aug-2010 christos

use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.43 25-Jun-2010 tsutsui

Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8
# 1.42 14-Sep-2009 jmcneill

branches: 1.42.2; 1.42.4;
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.


# 1.41 13-Sep-2009 jmcneill

kmod improvements
- unless otherwise specified, modules are now loaded from the same device
as the kernel ('load miniroot' now implies 'load tftp:miniroot' if the
boot command is 'boot tftp:netbsd')
- the module name -> path expansion now works when a device prefix: is
specified ('load tftp:miniroot' now works)
- if the module name has been expanded to a path, print that path when
loading the module rather than the symbolic name
- only print an error in module_open if both the expanded path and the
raw path fail to open


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.40 21-Mar-2009 ad

Fix 'boot -z' bogons.


Revision tags: nick-hppapmap-base2
# 1.39 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).


# 1.38 24-Jan-2009 rmind

branches: 1.38.2;
Revert path of modules back to "/stand".


# 1.37 24-Jan-2009 rmind

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0. Proposed on <tech-kern>.


Revision tags: mjf-devfs2-base
# 1.36 14-Dec-2008 christos

ANSI and KNF from Anon Ymous


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

Make pxeboot understand boot.cfg.


# 1.34 19-Nov-2008 ad

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


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 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.33 11-Oct-2008 joerg

branches: 1.33.2;
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.32 08-Oct-2008 joerg

Move functionality for preparing the kernel (including XMS support) into
a new function common_load_kernel.


# 1.31 08-Oct-2008 joerg

Move initialisation of boot_argv after the full loading of the kernel,
directly before loading modules.


# 1.30 08-Oct-2008 joerg

Setup module_base in module_init().


# 1.29 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 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.28 25-May-2008 chris

branches: 1.28.4;
Fix pxeboot's load tftp:miniroot.i386.kmod to work again.

We now wrapper the open call for a module with module_open. It first
attempts to open the module_path munged path, if this fails it then tries
to open the original path.

This allows tftp files to be located correctly.


# 1.27 20-May-2008 ad

Take $MACHINE into account when looking for modules.


# 1.26 20-May-2008 ad

PR kern/38694 module dependencies do not work as expected

If a given module name/path does not start with '/', assume it's a module
name and choose a default path based on the kernel version.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.25 04-May-2008 martin

branches: 1.25.2;
Remove my personal license, the TNF one is good enough for me.


# 1.24 03-May-2008 ad

Handle compressed modules.


# 1.23 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!


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking wrstuden-fixsa-base-1 vmlocking2-base3 netbsd-4-0-RELEASE bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 netbsd-4-0-RC5 matt-nb4-arm-base matt-armv6-nbase jmcneill-base netbsd-4-0-RC4 mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 wrstuden-fixsa-base ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-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.22 11-Dec-2005 christos

branches: 1.22.74; 1.22.76; 1.22.78;
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.21 21-Jun-2005 junyoung

ANSI, KNF, trailing spaces, and etc.


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 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-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.20 10-Nov-2003 wiz

Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.


# 1.19 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.18 27-Feb-2003 hannken

branches: 1.18.2;
Change "i386_trunc_page" to "x86_trunc_page".


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 i386mp_plus16_stable netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base kqueue-base sommerfeld_i386mpnext sommerfeld_i386mpbase_1
# 1.17 01-Jun-2001 jdolecek

branches: 1.17.2;
g/c COMPAT_OLDBOOT from bootblocks, sprinkle some const
bump bootblock version to 2.10


# 1.16 19-May-2001 jdolecek

Add some IBM PS/2 support bits:
* recognize PS/2 L40 via biosmca() and biosmca_ps2model in gatea20.c, instead
of being a compile time option
* if the system is PS/2 with MCA bus, map DTYPE_ESDI disks to ed(4) for
COMPAT_OLDBOOT

The new code is conditional on SUPPORT_PS2 define, which is on by default
for biosboot-based bootblocks.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 sommerfeld_i386mp_houseclean netbsd-1-5-base minoura-xpg4dl-base sommerfeld_i386mpbase_20000422 thorpej_scsipi_base
# 1.15 22-Feb-2000 dbj

branches: 1.15.8;
use bios' idea of the basemem size and create the kernel stack
at the top of it instead of hard coding 0x90000


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.14 07-Sep-1999 ross

branches: 1.14.2;
spelling


Revision tags: chs-ubc2-base
# 1.13 15-May-1999 drochner

don't printf(NULL), not even in the DEBUG case
(It doesn't hurt the bootloader, but the junk output hangs my serial
console.)


# 1.12 28-Apr-1999 christos

use new loadfile


# 1.11 14-Apr-1999 drochner

add prototype


# 1.10 08-Apr-1999 drochner

Call bi_getbiosgeom() after loadfile() returned successfully. This avoids
a memory leak if loadfile() gets an error.


Revision tags: netbsd-1-4-base
# 1.9 08-Mar-1999 fvdl

branches: 1.9.2;
* query BIOS geometry information, possibly using the int 13 extensions.
* pass them on to the kernel
* print a message if the 2nd stage bootloader returns (i.e. fails)
instead of just hanging.


# 1.8 29-Jan-1999 christos

Merge XMS changes from exec_fromdos.c


# 1.7 28-Jan-1999 christos

Add support for selectively loading sections, and make this compile in
userland with -DINSTALLBOOT


# 1.6 28-Jan-1999 christos

Remove a.out loading code and use loadfile.c for everything.
Populate the btinfo_symtab structure.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 kenh-if-detach-base netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 chs-ubc-base eeh-paddr_t-base netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.5 28-Sep-1997 drochner

Pass new boot information per default.


# 1.4 17-Sep-1997 drochner

Use the "bootinfo" defined structures to collect information about boot
device/file and console setting, remove the old, limited, "xbootinfo".
Fix a printf() format warning in debug code.


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.3 22-Mar-1997 thorpej

branches: 1.3.4;
Mimmick the old boot block's hdN -> Xd0 (where X is specified by the
disklabel type) unit conversion behavior.


# 1.2 22-Mar-1997 thorpej

Purely cosmetic whitespace and indentation changes (mmm, indent(1))


# 1.1 14-Mar-1997 perry

branches: 1.1.1;
Initial revision