Home | History | Annotate | Download | only in efiboot
History log of /src/sys/stand/efiboot/boot.c
RevisionDateAuthorComments
 1.45  14-Jun-2023  rin Add missing member for terminating sentinel.
 1.44  14-Aug-2022  jmcneill branches: 1.44.4;
Align output of "version" command.
 1.43  25-Mar-2022  jmcneill efiboot: Add support for 'userconf' command.

Add support for the 'userconf' command at the boot prompt and in boot.cfg,
and for FDT based booting, pass the commands as a string list property
named "netbsd,userconf" on the /chosen node.
 1.42  04-Nov-2021  skrll Fix non-ACPI builds.
 1.41  03-Nov-2021  skrll Provide the ablity to ignore ACPI with an 'acpi' command:

acpi [{on|off}]
 1.40  17-Oct-2021  jmcneill Honour the timeout= entry in boot.cfg
 1.39  09-Oct-2021  jmcneill efiboot: add "setup" command

The "setup" command sets the 64-bit "OsIndications" variable to the value of
EFI_OS_INDICATIONS_BOOT_TO_FW_UI and requests a reboot. On firmware that
supports this, after reboot the user will be presented with the firmware
setup menu.
 1.38  06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.37  28-Sep-2021  jmcneill efiboot: Add support for changing the video mode.

Add a new "gop" command that can query the list of available video modes.
With a mode number as argument (eg. "gop 16"), the new display mode will
be selected.

The "version" command prints the current display mode.
 1.36  07-Sep-2021  nia Remove banner printing code from bootloaders, add it to libsa.

This harmonizes efiboot and the various x86 bootloaders to use shared
code for printing the banner. By friendly coincidence, it also adds
support for specifying 'banner=' in arm efiboot's boot.cfg, as on x86.
 1.35  24-Jul-2021  jmcneill efiboot: Allow "fs" as alias for "initrd", for compat with x86
 1.34  23-Jun-2021  jmcneill When printing memory size, don't promote to next unit size unless it is at
two digits.
 1.33  23-Jun-2021  jmcneill print_banner: Print memory size like x86 does
 1.32  21-Jun-2021  jmcneill efiboot: Add readahead support.

Reading data through libsa file-systems ends up breaking block I/O
accesses into very small (512-byte or 2048-byte) accesses. This can be
very inefficient, and causes Ampere eMAG w/ BMC image direction to take
_minutes_ to load the install image and kernel. So slow in fact that
the default watchdog timeout will fire before it finishes.

So, when loading big files, optimistically read ahead up to 64KB of data.
Brings the time to boot the install ISO down to around 40 seconds -- still
not ideal but way better than before.
 1.31  21-Jun-2021  nia efiboot: Add ASCII art.
 1.30  31-May-2021  rin Generalize boot.cfg workaround for ISO9660; fallback to default_device
whenever efi_file_path() fails (due to broken firmware), in addition to
the case of ISO9660 (for which efi_file_path() succeeds but does not
work correctly).
 1.29  28-Nov-2020  jmcneill branches: 1.29.4; 1.29.6;
Add a hook for MD specific info to print in the "ver" command. Use this
to print the value of the current execution level in bootaa64.
 1.28  11-Oct-2020  jmcneill branches: 1.28.2;
Add ISO9660 support.
 1.27  28-Jun-2020  jmcneill Remove support for storing settings in EFI environment variables now that
we have boot.cfg support.
 1.26  27-Jun-2020  jmcneill command_version: print config file path
 1.25  27-Jun-2020  jmcneill Load boot.cfg from the EFI system partition instead of the first FFS
partition on that device.
 1.24  26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.23  21-Jun-2020  jmcneill Add boot.cfg support.
 1.22  21-Jun-2020  jmcneill Add module support.
 1.21  14-May-2020  riastradh Draft logic to get at EFI RNG.
 1.20  25-Jan-2020  jmcneill Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.19  18-Dec-2019  riastradh branches: 1.19.2;
Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.

Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.18  21-Apr-2019  thorpej branches: 1.18.2; 1.18.4;
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)
 1.17  20-Apr-2019  jmcneill ST FirmwareRevision field is in a vendor defined format, so just print the raw value
 1.16  10-Apr-2019  skrll Print bootargs from the environment

Pass the enironment boot args if none are provided by the boot command
 1.15  18-Jan-2019  skrll Add support for "bootargs" environment variable from jmcneill@

Doesn't work with some (all?) u-boots.
 1.14  15-Nov-2018  jmcneill Add support for loading kernels over NFS.
 1.13  02-Nov-2018  jmcneill Add a "mem" command to print the EFI memory map.
 1.12  29-Oct-2018  mrg avoid sign/unsigned issue and for NUMNAMES to an integer when it is
compared against a value that may be -1.

fixes autoboot when boot-file is set. (serves me right for removing
code that looked odd when it was tested :-)
 1.11  26-Oct-2018  mrg add "boot-file" support. now one can automatically boot a
non-default kernel with "setenv boot-file host/netbsd".

this is particularly useful with the current net / tftp
kernel boot, so the tftproot does not need a "/netbsd"
visible to all hosts, but some host-specific path.

some minor clean up.

version 1.4.

ok jmcneill@.
 1.10  12-Oct-2018  jmcneill Add ACPI support (enable with -DEFIBOOT_ACPI, currently disabled).

When UEFI reports that ACPI tables are available, generate a DTB with
compatible string "netbsd,generic-acpi" and pass this to the booted
kernel.

The DTB contains a /chosen property "netbsd,acpi-root-table" that contains
the physical address of the ACPI RSDP, along with a special /acpi node
with compatible string "netbsd,acpi" for the kernel to attach an acpi(4)
device driver.
 1.9  09-Sep-2018  jmcneill Add a reboot command to the bootloader
 1.8  09-Sep-2018  jmcneill Add support for setting environment variables. Currently the following env
vars are supported: "fdtfile", "initrd", and "rootdev".
 1.7  09-Sep-2018  jmcneill Add "dtb" command for loading a custom .dtb file.
 1.6  07-Sep-2018  jmcneill Add initrd support.
 1.5  03-Sep-2018  jmcneill branches: 1.5.2;
Print FDT model and compatible strings with "version" command
 1.4  03-Sep-2018  jmcneill Add PXE support.
 1.3  26-Aug-2018  jmcneill Add support for booting kernels from FFS partitions.
 1.2  24-Aug-2018  jmcneill Use absolute paths for default kernel filenames
 1.1  24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.5.2.6  26-Jan-2019  pgoyette Sync with HEAD
 1.5.2.5  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.5.2.4  20-Oct-2018  pgoyette Sync with head
 1.5.2.3  30-Sep-2018  pgoyette Ssync with HEAD
 1.5.2.2  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.5.2.1  03-Sep-2018  pgoyette file boot.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.18.4.2  12-Feb-2020  martin Pull up following revision(s) (requested by riastradh in ticket #705):

sys/arch/aarch64/aarch64/aarch64_machdep.c: revision 1.35
sys/stand/efiboot/efifdt.c: revision 1.20
sys/stand/efiboot/efifdt.h: revision 1.7
sys/arch/aarch64/include/machdep.h: revision 1.9
sys/stand/efiboot/efiboot.h: revision 1.11
sys/arch/arm/arm32/arm32_machdep.c: revision 1.129
sys/arch/arm/include/arm32/machdep.h: revision 1.30
sys/stand/efiboot/exec.c: revision 1.12
sys/arch/evbarm/fdt/fdt_machdep.c: revision 1.65
sys/stand/efiboot/version: revision 1.14
sys/stand/efiboot/boot.c: revision 1.19

New function cpu_startup_hook on arm.

Called at end of cpu_startup. Can be defined in, e.g., evbarm to do
additional stuff after cpu_startup. Defined as a weak alias to a
function that does nothing, so optional.
ok jmcneill

Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.
Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.18.4.1  26-Jan-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #653):

sys/stand/efiboot/prompt.c: revision 1.6
sys/stand/efiboot/boot.c: revision 1.20
sys/stand/efiboot/bootarm/Makefile: revision 1.4
sys/stand/efiboot/efiacpi.c: revision 1.6
sys/stand/efiboot/exec.c: revision 1.13
sys/stand/efiboot/Makefile.efiboot: revision 1.10
sys/stand/efiboot/bootaa64/Makefile: revision 1.7

Fix for disappearing counters on graphics consoles

Hide the twiddle while loading efiboot plist

Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.18.2.3  08-Apr-2020  martin Merge changes from current as of 20200406
 1.18.2.2  10-Jun-2019  christos Sync with HEAD
 1.18.2.1  21-Apr-2019  christos file boot.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.19.2.1  25-Jan-2020  ad Sync with head.
 1.28.2.1  14-Dec-2020  thorpej Sync w/ HEAD.
 1.29.6.1  31-May-2021  cjep sync with head
 1.29.4.2  01-Aug-2021  thorpej Sync with HEAD.
 1.29.4.1  17-Jun-2021  thorpej Sync w/ HEAD.
 1.44.4.1  03-Nov-2023  martin Pull up following revision(s) (requested by rin in ticket #451):

sys/stand/efiboot/efiblock.c: revision 1.20
sys/stand/efiboot/exec.c: revision 1.24
sys/stand/efiboot/Makefile.efiboot: revision 1.29
sys/stand/efiboot/boot.c: revision 1.45

Add missing member for terminating sentinel.

Avoid void * pointer arithmetic; cast to UINT8 * explicitly.
No binary changes for aarch64 at least.

Use %zd instead of %ld for ssize_t.

Add missing include paths for libz. Not used at the moment although.

RSS XML Feed