History log of /freebsd-current/stand/kboot/Makefile
Revision Date Author Comments
# a03411e8 28-Jan-2024 Warner Losh <imp@FreeBSD.org>

kboot: Move _start out of kboot and into libkboot

Move the startup code from kboot/kboot to kboot/libkboot and add the
necessary infrastructure for it to build. move start_arch.h, a private
header for libkboot, over as well.

Sponsored by: Netflix


# 091c255b 28-Jan-2024 Warner Losh <imp@FreeBSD.org>

kboot: Move to kboot/kboot

In anticipation of separating the library elements from the kboot
prorgam elements, move kboot down a level into a subdirectory. There
will be libkboot and include directories in subsequent commits,
mirroring other subsystems like i386 and efi.

Sponsored by: Netflix


# b247ff70 07-Nov-2023 Mark Johnston <markj@FreeBSD.org>

stand: Rename LIBFDT to LIBSAFDT

Preemptively address a collision with LIBFDT (to be added in the future)
from src.libnames.mk, which gets included via bsd.progs.mk. No
functional change intended.

Reviewed by: imp
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D42486


# d0b2dbfa 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line sh pattern

Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/


# 88599604 11-Feb-2021 Mitchell Horne <mhorne@FreeBSD.org>

loader: always install help files

Address two issues with current help file logic:

The existing condition prevents the common help file from being
installed when there are no additional help files defined. This results
in no loader.help on EFI platforms, for example.

Second, due to the fact that we build and install multiple loader types,
each successive install will clobber the previous loader.help. The
result is that we could lose type-specific commands, or possibly list
them in loaders that do not have such commands.

Instead, give each loader type a uniquely named help file. The EFI
loader will look for /boot/loader.help.efi, userboot will look for
/boot/loader.help.userboot, etc. The interpreter variant has no effect
on which help file is loaded.

This leaves the old /boot/loader.help unused.

Some credit for the final approach goes to Mathieu <sigsys@gmail.com>
for their version of the fix in https://reviews.freebsd.org/D22951.

PR: 267134
Reported by: Daniel O'Connor <darius@dons.net.au>
Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28591


# 0928550c 03-Feb-2023 Warner Losh <imp@FreeBSD.org>

stand: share bootinfo.c between EFI and KBOOT

Connect efi's bootinfo.c to the kboot build, and adjust to use
the kboot specific routines.

The getrootmount() call is independent of EFI. Remove ifdefs so it's
called for kboot too.

The differences between the kboot and efi bootinfo.c files are now tiny.
This could use some more refactoring, but this is a working checkpoint.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D38350


# 08779e83 03-Feb-2023 Warner Losh <imp@FreeBSD.org>

kboot: Create segment handling code at main level

Create segment handling code up to the top level. Move it all into
seg.c, and make necessary adjustments for it being in a new file,
including inventing print_avail() and first_avail() to print the array
and find the first large enough memory hole. aarch64 will use this,
and I'll refactor the other platforms to use it as I make them work.

Sponsored by: Netflix
Discussed with: kevans
Differential Revision: https://reviews.freebsd.org/D38308


# 42e37d8c 13-Jan-2023 Warner Losh <imp@FreeBSD.org>

kboot: Add ZFS support build glue

Now that all the pieces are in place, allow kboot to be built with ZFS
support.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D38009


# cc623784 03-Dec-2022 Warner Losh <imp@FreeBSD.org>

kboot: Enable fewer things by default

We don't need NFS / network support by default, nor do we need gzip
support. Remove them for now.

Sponsored by: Netflix


# 7e1a2e46 02-Dec-2022 Warner Losh <imp@FreeBSD.org>

kboot: Create routines to read Linux tiny files

Most of the files in /sys/ and /proc/ are small with one value. Create
two routines to help us read the file and decode that value.

Sponsored by: Netflix


# 02dba4f7 27-Oct-2022 Warner Losh <imp@FreeBSD.org>

kboot: Add hostfs

Add hostfs for the Linux environment. We can't use the userboot one
that's kinda similar because the Linux system calls we have in kboot are
not quite POSIX compliant (Linux takes care of providing the POSIX
interface in libc), so we have to cope with a number of quirks in that
area.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36607


# cc7b630c 04-Sep-2022 Warner Losh <imp@FreeBSD.org>

stand/kboot: Add note about why we use MACHINE_ARCH here

Normally in the boot loader, we key off of MACHINE since that specifies
the kernel and the loader is very tuned to each type of MACHINE in
general. In this case, however, we're producing a Linux binary, with
Linux system calls encoded in it. These align better along the
MACHINE_ARCH axis of FreeBSD. For PowerPC the system calls are radically
different for each of our MACHINE_ARCHes, with only powerpc64 and
powerpc64le sharing the same numbers and memory layout. The same was
true about mips when it was in the tree. 32-bit arm uses the same
layout, however, for both armv6 and armv7 ports: that can be easily
shared in the unlikely event we support that in the future.

Sponsored by: Netflix


# 69818bcf 01-Sep-2022 Warner Losh <imp@FreeBSD.org>

kboot: List sources one per line to make merges easier

Make SRC an alphabetical list of files, one per line.

Sponsored by: Netflix


# 57f90cf8 01-Sep-2022 Warner Losh <imp@FreeBSD.org>

kboot: add minmalist init functionality

It is desirable to run kboot as the first program in some LinuxBoot
environments. This is the traditional "pid 1" or "init" program. When
running as pid 1. rovide a minimal environment based on what sysvinit,
u-root, initramfs-tools and other like projects do. We mount /dev, /sys,
/proc, make symlinks from /dev/fd to /dev/proc, and create /tmp, /run,
and /var. We also setup stdin/out/err to the console, set the tty
characteristics of same and block the appropriate signals.

This is indended as an environment that never does a fork/exec. If
that's required, the process groups, session leaders and all things
POSIX terminal handlers will need to be added.

Unlike the general purpose linux projects in this area, no attempt is
made to support very old kernels.

When not pid 1, we skip all of the above.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36368


# 96303778 26-Jul-2022 Warner Losh <imp@FreeBSD.org>

kboot: implement stripped down termios

Implement a stripped down termios, obtained from various files in musl
and HOST_ or host_ prepended to most things and a few unavoidable style
tweaks. Only implements the bits of termios we need for the boot loader:
put the terminal into raw mode, restore terminal settings and speed
stuff.

Sponsored by: Netflix


# a0c07522 28-Jul-2022 Warner Losh <imp@FreeBSD.org>

kboot: Move conf.c up to top level

conf.c is the same now between powerpc64 and amd64, so move it up to
kboot. Move powerpc file formats defines to ppc64_elf_freebsd.c

Sponsored by: Netflix


# f5ed1b0f 13-Jul-2022 Warner Losh <imp@FreeBSD.org>

kboot: Rework _start

Split _start into _start and _start_c (inspired by musl and the powerpc
impl is copied from there). This allows us to actually get the command
line arguments on all the platforms. We have a very simplified startup
that supports only static linking.

Sponsored by: Netflix


# 5974cfe1 30-Dec-2021 Warner Losh <imp@FreeBSD.org>

kboot: move to generic syscall interface

Just have the MD code provide syscall and have generic code for the
rest.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33515


# 6497250f 30-Dec-2021 Warner Losh <imp@FreeBSD.org>

kboot: Split out powerpc build

Split the powerpc specific parts into kboot/arch/powerpc64. More may be
needed here.

Sponsored by: Netflix
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D33514


# 43661996 30-Dec-2021 Warner Losh <imp@FreeBSD.org>

kboot: Move powerpc kboot to top level

As the first step at making this more generic, move kboot to top level.

Sponsored by: Netflix
Reviewed by: luporl, tsoome
Differential Revision: https://reviews.freebsd.org/D33513