In case the firmware falls through to executing startup.sh, populate it
with the name of our boot loader. In normal operation this should not be
necessary but may allow the system to boot if it would otherwise just
remain at a shell prompt.
Reviewed by: andrew, imp, smh
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5878
Both objdump and nm are equally capable of reporting undefined symbols.
This gets us a step closer to building without binutils as we have an nm
implementation from ELF Tool Chain.
Reviewed by: bdrewery
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5613
With warnings now enabled some plaforms where failing due to warnings.
* Fix st_size printed as a size_t when its actually an off_t.
* Fix pointer conversion in load_elf for some 32bit platforms due to 64bit
off in ef.
MFC after: 2 days
X-MFC-With:
Sponsored by: Multiplay
Fix EFI boot support when presented with multiple valid boot partitions
across multiple devices.
It now prefers to boot from partitions that are present on the underlying
device that the boot1 image was loaded from. This means that it will boot
from the partitions on device the user chose from EFI boot menu in
preference to those on other devices.
Also fixed is the recovery from a failed attempt to boot, from a seemingly
valid partition, by continuing to trying all other available partitions
no matter what the error.
boot1 now use * to signify a partition what was accepted from the preferred
device and + otherwise.
Finally some error messages where improved and DPRINTF's with slowed boot
to aid debugging.
ZFS will still be preferred over UFS when both are available on the boot
device.
Reviewed by: imp
MFC after: 1 week
Sponsored by: Multiplay
Differential Revision: https://reviews.freebsd.org/D5108
EFI was mixing caching in two separate places causing issues when multiple
partitions where tested.
Eliminate this by removing fsstat and re-factoring fsread into fsread_size,
adding basic parameter validation.
Also:
* Enhance some error print outs.
* Fix compilation under UFS1_ONLY and UFS2_ONLY
* Use sizeof on vars instead of structs.
* Add basic parameter validation to fsread_size.
MFC after: 1 week
X-MFC-With: r293268
Sponsored by: Multiplay
Differential Revision: https://reviews.freebsd.org/D4989
This builds on the modular EFI loader support added r294060 adding a
module to provide ZFS boot support on EFI systems.
It should be noted that EFI uses a fixed size memory block for all
allocations performed by the loader so it may be necessary to tune this
size.
For example when building an image which uses mfs_root e.g. mfsbsd, adding
the following to /etc/make.conf would be needed to prevent EFI from running
out of memory when loading the mfs_root image.
EFI_STAGING_SIZE=128
Submitted by: Eric McCorkle
MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay
Make EFI boot loader modular in preparation for adding ZFS support.
This is a partial commit of the D4515.
Submitted by: Eric McCorkle
Reviewed by: emaste (in part)
MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay
Differential Revision: https://reviews.freebsd.org/D4515
As the in-tree GCC does not support __attribute__((ms_abi)) EFI can only
be built with Clang.
The EFI loader and boot1 validated this, but unused libefi was still built
causing issues under GCC after warnings where enabled by r293724.
Disable building all of EFI when the selected compiler is GCC.
MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay
Set WARNS if not set for EFI boot code and fix the issues highlighted by
setting it.
Most components are set to WARNS level 6 with few being left at lower
levels due to the amount of changes needed to fix at higher levels.
Error types fixed:
* Missing / invalid casts
* Missing inner structs
* Unused vars
* Missing static for internal only funcs
* Missing prototypes
* Alignment changes
* Use of uninitialised vars
* Unknown pragma (intrinsic)
* Missing types etc due to missing includes
* printf formatting types
Reviewed by: emaste (in part)
MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay
Differential Revision: https://reviews.freebsd.org/D4839
Remove the printf("Not ufs\n") from the boot code which was hidden by the
local printf implementations, allowing these to have that code removed too.
MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay
ARM and i386 already required libstand so switch to using it for all
patforms, allowing the removal of custom print and memory methods.
This is also a pre-cursor to enabling WARNS which highlighted a number
of issues with the removed methods.
MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay
r279533 increased the boot1 size from 64k to 128k but didn't regenerate the
fat templates, hence the change was never activated.
With recent and upcoming changes the efi boot1 binary is now > 64k.
To avoid fat corruption in the created boot images regenerate the
templates to activate the boot1 size increase.
MFC after: 2 weeks
X-MFC-With: r293268
EFI return values set the high bit to indicate an error. The log
messages changed here are printed only in the case of an error,
so including the error bit is redundant. Also switch to decimal to
match the error definitions (in sys/boot/efi/include/efierr.h).
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
This is not properly respecting WITHOUT or ARCH dependencies in target/.
Doing so requires a massive effort to rework targets/ to do so. A
better approach will be to either include the SUBDIR Makefiles directly
and map to DIRDEPS or just dynamically lookup the SUBDIR. These lose
the benefit of having a userland/lib, userland/libexec, etc, though and
results in a massive package. The current implementation of targets/ is
very unmaintainable.
Currently rescue/rescue and sys/modules are still not connected.
Sponsored by: EMC / Isilon Storage Division
The function was defined as taking 4 parameters and returning EFI_STATUS,
but all existing callers (in asm code) passed only two parameters and don't
use the return value. The function signature now matches that usage, and
doesn't refer to efi-specific types.
Parameters and variables now use the cannonical typenames set up by elf.h
(Elf_Word, Elf_Addr, etc) instead of raw C types. Hopefully this will
prevent suprises as new platforms come along and use this code.
The function was renamed from _reloc() to self_reloc() to emphasize its
difference from the other elf relocation code found in boot/common.
Differential Revision: https://reviews.freebsd.org/D2490
x86 symlink on i386 and amd64. Before this incorrect symlinks were being
created on armi and i386.
Differential Revision: https://reviews.freebsd.org/D2283
Reviewed by: emaste, imp
Sponsored by: The FreeBSD Foundation
loader.efi still needs work, but boot1.efi now builds.
Differential Revision: https://reviews.freebsd.org/D2244
Reviewed by: rpaulo
Sponsored by: The FreeBSD Foundation
Much of this file is common to the architectures we support, so share
an implementation by adding a little #ifdef-ery.
Differential Revision: https://reviews.freebsd.org/D2241
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
It's necessary to reset the screen to make sure any vendor pixels are
gone when we start boot1. In the Lenovo X1 (3rd gen), this is the
only way to clear the screen. Previously, the Lenovo logo would only
disappear after the kernel started scrolling the display.
After resetting the screen, EFI could put us in the worst LCD mode
(oversized characters), so we now find the largest mode we can use and
hope it's the most appropriate one (it's not trivial to tell what's
the correct LCD resolution at this point). It's worth noting that the
final stage loader has a 'mode' command that can be used to switch
text modes.
While there, enable the software cursor, just like in the legacy boot
mode.
MFC after: 1 week
support for booting arm and arm64 from UEFI.
Differential Revision: https://reviews.freebsd.org/D2164
Reviewed by: emaste, imp (previous version)
Sponsored by: The FreeBSD Foundation