Commit Graph

3860 Commits

Author SHA1 Message Date
Toomas Soome
9d3fb104c9 libsa/ip.c: misplaced comment, ip_v is half char, not ip_p
The comment should be at previous line.

Reported by:	Dan McDonald
2017-10-18 07:39:21 +00:00
Warner Losh
b0900232b9 Revert "Unify boot1 with loader" change r324646
Back out the unification commit to boot1. There's some issues on the
arm and arm64 platforms that need to be addressed with code
changes. There's also a discussion on arch@ about the future of
boot1.efi vs just using loader.efi that needs to play out. So take a
pause on these changes until the arm issues can be fixed and it's
clear boot1.efi will survive into FreeBSD 12.

OK'd by: Eric@meatspace
2017-10-17 23:38:27 +00:00
Ed Maste
14481f92c4 loader.mk: clean md.o even if MD_IMAGE_SIZE not defined
We don't normally provide special handling for optionally-included src
files, but md.o depends on both md.c and the value of ${MD_IMAGE_SIZE}.
Previously if one built with MD_IMAGE_SIZE, executed "make clean", and
then built with a different MD_IMAGE_SIZE md.o would not be rebuilt.

Reported by:	Zakary Nafziger
Sponsored by:	The FreeBSD Foundation
2017-10-17 19:11:29 +00:00
Warner Losh
1118d57b36 We need to include disk.o in libuboot.a when we're building with
support for disk access.

Sponsored by: Netflix
2017-10-17 19:11:19 +00:00
Ed Maste
3a4661b9b4 loader: initialize dv_cleanup in md.c to eliminate clang warning
Submitted by:	Zakary Nafziger <worldofzak@gmail.com>
Sponsored by:	The FreeBSD Foundation
2017-10-17 18:00:01 +00:00
Warner Losh
e4e7fb2337 Explicitly inlcude SYSDIR in the include path -- need machine path too? 2017-10-16 03:59:58 +00:00
Warner Losh
a7fa2fb669 LOADER_foo_SUPPORTED 2017-10-16 03:59:52 +00:00
Warner Losh
6b9f688352 Move all the ficl common code into ficl.mk
There's a number of copies of basically identical code to enable
building forth in /boot/loader. Move it all into ficl.mk.
2017-10-16 03:59:44 +00:00
Warner Losh
8ed8e50775 create defs.mk for common definitions 2017-10-16 03:59:38 +00:00
Warner Losh
bcbe0c006e tweak style 2017-10-16 03:59:33 +00:00
Warner Losh
7f20726e4b Move common/Makefile.inc to sys/boot/loader.mk.
Makefile.inc has a specific meaning in the tree, and
common/Makefile.inc doesn't quite fit into that. Rename it to
loader.mk and it will be a place to collect common things to all
/boot/loader programs there.

Sponsored by: Netflix
2017-10-16 03:59:28 +00:00
Warner Losh
7e705f54f8 Rename top level Makefile.ficl to ficl.mk. 2017-10-16 03:59:22 +00:00
Warner Losh
6c4b856dbe Move orphaned man pages into new man directory from common. This helps
keep cleaer that common is just for the MI files for /boot/loader
programs.

Sponsored by: Netflix
2017-10-16 03:59:17 +00:00
Warner Losh
cb0ba37ec5 Unify boot1 with loader
Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor
to use the common efi_main.c.

Submitted by: Eric McCorkle
Differential Revision: https://reviews.freebsd.org/D10447
2017-10-16 03:59:11 +00:00
Warner Losh
042ea0aa16 Move panic back into libsa. It's documented in libstand(3) to belong
there.

Sponsored by: Netflix
2017-10-12 15:16:27 +00:00
Warner Losh
a37f4eb659 Define prototype for exit and ensure references
Define a prototype for exit in stand.h. Provide a reference to exit in
a few conf.c files to ensure that its definition gets pulled in early.
Since exit() is a MD routine, it isn't defined in libsa. However,
libsa tends to be listed last and will soon have panic() in it which
calls exit(). The reference to exit early ensures that the MD exit is
available to satisfy linking for static libraries.
2017-10-12 15:16:22 +00:00
Warner Losh
1461c26d38 Rename exit to efi_exit to avoid clashing with libsa exit definition
Rename exit to efi_exit. It doesn't have the proper signature and
conflicts with standard definition. Provide the standard definition as
well.

Sponsored by: Netflix
2017-10-12 15:16:16 +00:00
Warner Losh
9576e1ee54 Move ufsread.c
Move ufsread.c from sys/boot/common (which used to be all the common
files for /boot/loader, but grew to be all the common files for
sys/boot, but that's now sys/boot/libsa's job) to sys/boot/libsa.

Sponsored by: Netflix
2017-10-12 14:57:05 +00:00
Warner Losh
cd955ec800 Honor CFLAGS modifications in Makefile.inc by using += here. There's
no hyper-small space constraints, so there's no reason to tightly
control it.

Sponsored by: Netflix
2017-10-12 14:57:00 +00:00
Warner Losh
6f0970a4c6 Move crc32.c, util.c and gpt.c over to libsa.
Sponsored by: Netflix
2017-10-12 14:56:54 +00:00
Warner Losh
917587f435 Rename libstand.a to libsa.a and libstand32.a to libsa32.a
Sponsored by: Netflix
2017-10-12 14:56:48 +00:00
Warner Losh
3006b7c8a9 Kill the userboot copy of libstand.
It's not needed (it's now identical to libsa, and seems to have been
for some time).

Sponsored by: Netflix
2017-10-12 14:56:42 +00:00
Warner Losh
4eb1313ff2 Move lib/libstand to sys/boot/libsa
Move the sources to sys/boot. Make adjustments related to the
move. Kill LIBSTAND_SRC since it's no longer needed.

Sponsored by: Netflix
2017-10-12 14:56:28 +00:00
Enji Cooper
6cea2e6b1a Fix typos: stand alon{e,g} should be spelled like standalone 2017-10-10 04:53:26 +00:00
Warner Losh
b9b9a7c3a2 Rather than laying whack-a-mole with including the path to stand.h,
always include it. Remove places where we explicitly include it. This
also helps reduce the 'cut-and-paste' factor of these Makefiles.

Sponsored by: Netflix
2017-10-10 01:31:44 +00:00
Warner Losh
e1ff8b2f35 Create sys/boot/libsa and build libstand.a there
Build libstand from inside the sys/boot build. Redirect all users in
sys/boot to grab it from there. We still build it as libstand.a for
the moment. When lib/libstand is moved here, we'll change the name.

Sponsored by: Netflix
2017-10-09 22:12:53 +00:00
Warner Losh
8f409b435a Define LIBSA* and use them instead of overloaded LIBSTAND
LIBSA is the current stand alone library. LIBSA32 is the 32-bit
version of the library. LIBSAU is the userboot version of libsa. Use
the proper define instead of the more generic define.

Sponsored by: Netflix
2017-10-09 22:12:46 +00:00
Warner Losh
0b2c7b3f7e Add missing -I${SASRC} in a couple of places so that stand.h doesn't
accidentally come in via host pollution.

Sponsored by: Netflix
2017-10-09 22:12:39 +00:00
Warner Losh
eca8b9c449 Define SASRC and use it
Define SASRC to point to the current libstand sources. Include
../Makefile.inc early enough in a few places so we can .include
"${SASRC}/Makefile" and have it work. Create a new pass-up
Makefile.inc in sys/boot/userboot to allow this pattern to work.

Sponsored by: Netflix
2017-10-09 22:12:32 +00:00
Warner Losh
6a971c1732 Prefer ${LIBSTAND} to -lstand
Sponsored by: Netflix
2017-10-09 22:11:57 +00:00
Enji Cooper
851fe8f6ed Unbreak building efiboot with MK_ZFS == no
Wrap `efi_zfs_is_preferred` with `#ifdef EFI_ZFS_BOOT`.

Reported by:	Guy Yur <guyyur@gmail.com>
2017-10-07 17:40:31 +00:00
Warner Losh
e836f6f402 Encapsulate ZFS preferences into efi_zfs_is_preferred
Move the retrieval of the image information into loader's main instead
of doing it in efizfs.c

Differential Revision: https://reviews.freebsd.org/D12564
Submitted by: Eric McCorkle
2017-10-06 12:21:46 +00:00
Warner Losh
2e1b4c6fee Add efi_devpath_is_prefix
efi_devpath_is_prefix determines if a path matches a passed-in prefix.

Differential Revision: https://reviews.freebsd.org/D12564
Submitted by: Eric McCorkle
2017-10-06 12:20:24 +00:00
Warner Losh
fee563bc57 This README file was quite relevant for FreeBSD 3 or 4. However, the
information in this file is now somewhat dated, or is present mostly
correct in the man pages. Retire this file rather than fix it.

Noticed by: cognet@
Sponsored by: Netflix
2017-10-05 16:48:05 +00:00
Ian Lepore
c5765d84ac Allow Raspberry Pi platform and drivers to be configured with upstream DTBs.
- Added more compatibility strings to drivers not yet converted
 - Added new RPI platform code compatibility string to match the ones used
   upstream
 - Adapted RPI and RPI2 DTS to match the new platform code compatibility
   string

The goal is to use the upstream DTBs as a replacement for our custom one.
This is now possible with these changes.

Additionally, as the RPI firmware automatically chooses the right DTB for
us, this would allow to have one common armv6 kernel for RPI0 and RPI1
(BCM2835-based), and one common armv7 kernel for RPI2 v1.1 (BCM2836-based),
and RPI2 v1.2 / RPI3 (BCM2837-based).

Submitted by:	Sylvain Garrigues <sylgar@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D12360
2017-10-02 00:49:33 +00:00
Wojciech Macek
76541eb0a7 Compile loader as Little-Endian on PPC64/POWER8
Add flag to the makefile to allow loader compilation as
  Little-Endian 32-bit executable.
  Usage:

  make WITH_LOADER_FORCE_LE=yes -C sys/boot all

Submitted by:          Wojciech Macek <wma@freebsd.org>
Reviewed by:           imp, nwhitehorn
Obtained from:         Semihalf
Sponsored by:          QCM Technologies
Differential revision: https://reviews.freebsd.org/D12421
2017-09-29 06:36:19 +00:00
Toomas Soome
f6eef0f9a2 libefi: efipart_floppy() will should not pass acpi pointer if the HID test fails
The current efipart_floppy() implementation is leaking the acpi pointer.
2017-09-25 19:49:56 +00:00
Mariusz Zaborski
290e7bac6e After the r317886 support for TFTP and NFS can be enable simultaneously.
The cleanup of this distinction was done in the r318988, but this Makefile
was omitted.

Submitted by:	kczekirda@
2017-09-23 12:44:42 +00:00
Toomas Soome
c57460d994 libefi: define EISA PNP constants
Define EISA PNP constants and use them, also fix ID for 0x701
2017-09-22 07:44:36 +00:00
Toomas Soome
f43a98e6c2 libefi: efipart_hdinfo_add_filepath should check strtol result
Use errno for error checking.
2017-09-22 07:40:05 +00:00
Toomas Soome
abf054b4c6 libefi: efipart.c cstyle fix for efipart_print_common()
The else statement should have { }
2017-09-22 07:37:42 +00:00
Toomas Soome
5af584ffc1 libefi: efipart_strategy() should return ENXIO when there is no media
We should return ENXIO to indicate the situation with device present,
but no media.
2017-09-22 07:34:08 +00:00
Toomas Soome
b07d6aa2ae libefi: pdinfo_t pd_unit and pd_open should be unsigned
The device index, partition index and reference counter are all positive
numbers. However, since our internal partition number may be negative
to indicate GPT table, the compare expression need to take care when comparing
pdinfo_t and partition data.
2017-09-22 07:29:26 +00:00
Toomas Soome
832d45d219 efilib.h: typo in structure member description
The link should be replaced by list.
2017-09-22 02:58:47 +00:00
Toomas Soome
024cc69661 r323885 did miss efilib.h update
The efilib.h update was left out from r323885 by mistake.
2017-09-22 02:56:26 +00:00
Toomas Soome
cbc1b3de8f libefi: efi_devpath_match local len should be unsigned
DevicePathNodeLength() will always return unsigned value.
2017-09-22 02:53:01 +00:00
Toomas Soome
cfe103a2ac libefi: efipart.c should use calloc()
The device specific *_add functions are using malloc() + memset,
should use calloc instead.
2017-09-21 23:22:18 +00:00
Toomas Soome
59fcc285f4 libefi: efi_devpath_match() should return bool
The current implementation of efi_devpath_match() is returning values 0 or 1,
so it should be updated to return bool.
2017-09-21 23:14:07 +00:00
Toomas Soome
5370de88cc libefi: devicename.c cleanups
Remove duplicated free()+return statements, default unit to 0
and improve strtol error processing.
2017-09-21 15:30:20 +00:00
Toomas Soome
3f247eab7a loader: biosmem allocate heap just below 4GB
The current biosmem code is walking bios smap entries and looking for smap
entry just below 4GB line, if there is such entry, its base and size is set
for heap base and size. Instead of entry base, we should use last HEAP_MIN
(currently 64MB) bytes just below 4GB, to make maximum space for kernel and
modules.

The problem was revealed on ASUS B350M-A system board, an AMD Ryzen 3 1200 CPU

memory map:

SMAP type=01 base=0000000000000000 len=000000000009d400 attr=01
SMAP type=02 base=000000000009d400 len=0000000000002c00 attr=01
SMAP type=02 base=00000000000e0000 len=0000000000020000 attr=01
SMAP type=01 base=0000000000100000 len=0000000009c00000 attr=01
SMAP type=02 base=0000000009d00000 len=0000000000300000 attr=01
SMAP type=01 base=000000000a000000 len=00000000be69b000 attr=01
SMAP type=03 base=00000000c869b000 len=0000000000016000 attr=01
SMAP type=01 base=00000000c86b1000 len=00000000124e7000 attr=01
SMAP type=02 base=00000000dab98000 len=0000000000138000 attr=01
SMAP type=03 base=00000000dacd0000 len=0000000000008000 attr=01
SMAP type=01 base=00000000dacd8000 len=0000000000100000 attr=01
SMAP type=04 base=00000000dadd8000 len=00000000003b3000 attr=01
SMAP type=02 base=00000000db18b000 len=0000000000d42000 attr=01
SMAP type=01 base=00000000dbecd000 len=0000000002133000 attr=01
SMAP type=01 base=0000000100000000 len=000000011f380000 attr=01
SMAP type=02 base=00000000de000000 len=0000000002000000 attr=01
SMAP type=02 base=00000000f8000000 len=0000000004000000 attr=01
SMAP type=02 base=00000000fdf00000 len=0000000000100000 attr=01
SMAP type=02 base=00000000fea00000 len=0000000000010000 attr=01
SMAP type=02 base=00000000feb80000 len=0000000000082000 attr=01
SMAP type=02 base=00000000fec10000 len=0000000000001000 attr=01
SMAP type=02 base=00000000fec30000 len=0000000000001000 attr=01
SMAP type=02 base=00000000fed00000 len=0000000000001000 attr=01
SMAP type=02 base=00000000fed40000 len=0000000000005000 attr=01
SMAP type=02 base=00000000fed80000 len=0000000000010000 attr=01
SMAP type=02 base=00000000fedc2000 len=000000000000e000 attr=01
SMAP type=02 base=00000000fedd4000 len=0000000000002000 attr=01
SMAP type=02 base=00000000fee00000 len=0000000000100000 attr=01
SMAP type=02 base=00000000ff000000 len=0000000001000000 attr=01

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D12368
2017-09-18 15:17:01 +00:00