Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kboot status report for 2023 Q2 #202

Closed
wants to merge 11 commits into from
Closed
55 changes: 55 additions & 0 deletions website/content/en/status/report-2023-04-2023-06/kboot.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
=== LinuxBoot FreeBSD on aarch64

Contact: Warner Losh <[email protected]>

Links: +
link:https://www.linuxboot.org/[LinuxBoot Project] URL: link:https://www.linuxboot.org/[]+
link:https://docs.google.com/presentation/d/1N5Jp6XzYWv9Z9RhhETC-e6tFkqRHvp-ldRDW_9h2JCw/edit?usp=sharing[BSDCan 2023 kboot talk slides] URL: link:https://docs.google.com/presentation/d/1N5Jp6XzYWv9Z9RhhETC-e6tFkqRHvp-ldRDW_9h2JCw/edit?usp=sharing[]

LinuxBoot is an effort to create a clean, robust, auditable and repeatable boot firmware.
What originally started as a specific project at Google has grown to encompass any boot environment that uses Linux to launch the final operating system.
Many platfors now support this environment, in some cases it is the only available boot environment.
bsdimp marked this conversation as resolved.
Show resolved Hide resolved
In addition, some embedded boxes have a LinuxBoot environment hard-coded that is quite hard to change, and being able to reboot into FreeBSD is desirable.

The old Sony PlayStation 3 port used a boot loader called 'kboot' to accomplish booting the FreeBSD port from its Linux kernel (all predating the LinuxBoot project).
bsdimp marked this conversation as resolved.
Show resolved Hide resolved
That code has been greatly expanded, made generic with easily replaceable per-architecture plug ins.
The normal FreeBSD [.filename]#/boot/loader# is built as a Linux binary that reads in the FreeBSD kernel, modules and tunables.
It places them into memory as if it were running in a pre-boot environment and then loads that image into the Linux kernel with man:kexec_load[2] and does a special reboot to that kernel image.
bsdimp marked this conversation as resolved.
Show resolved Hide resolved
For UEFI enabled systems, it passes the UEFI memory table, and pointer to UEFI runtime services to the new kernel.
bsdimp marked this conversation as resolved.
Show resolved Hide resolved

It supports loading files from the host's filesystem, from any man:loader[8]-supported filesystem on the host's block devices (including pools that span multiple devices), from ram disk images and from files downloaded over the network.
Copy link
Contributor

@grahamperrin grahamperrin Jul 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It supports loading files from the host's filesystem, from any man:loader[8]-supported filesystem on the host's block devices (including pools that span multiple devices), from ram disk images and from files downloaded over the network.
It supports loading files from the local filesystem, from any man:loader[8]-supported filesystem on the host's block devices (including pools that span multiple devices), from ram disk images, and from remote filesystems.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your change. but would say 'from the network' rather than 'from networked files'. Comments?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Suggestion revised. Have I twisted the meaning?

Any mix of these is available, so configuration overrides can be loaded from the host's filesystem, but the kernel can be loaded from dedicated storage (say NVME) or a ram disk image.
bsdimp marked this conversation as resolved.
Show resolved Hide resolved
It supports a host console running over stdin/stdout.
It supports explicit locations such as `/dev/nvme0ns1:/boot/loader/gerbil.conf` for where to load filesystems from.
It supports ZFS boot environments, including the boot-once feature.

Additional details about kboot, what it supports and some general background can be found in Warner's BSDcan talk (slides linked above).

FreeBSD/aarch64 now can boot from Linux in a LinuxBoot environment, with support and functionality comparable to man:loader.efi[8].
Memory layout passed in for GICv3 workarounds.
Need patch for aarch64 kernel for the GICv3 workaround.
link:https://reviews.freebsd.org/D40902[]
bsdimp marked this conversation as resolved.
Show resolved Hide resolved

FreBSD/amd64 support is in progress and is maybe 80% done.
The amd64 boot environment places more requirements on the boot loader to provide data for the kenrel than aarch64 due to amd64 being an older port.
bsdimp marked this conversation as resolved.
Show resolved Hide resolved
All sources for data in the BIOS enviornment had to be provided by the boot loader since the kernel had no access to them from long mode.
While UEFI and ACPI provide ways for the kernel to get this data, much of the data must still be provided by the boot loader.
The kernel panics during initialization since all these prerequisites have not been discovered and implemented.
Copy link
Contributor

@grahamperrin grahamperrin Jul 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The kernel panics during initialization since all these prerequisites have not been discovered and implemented.
[.filename]#loader.kboot# does not yet implement the entire amd64 boot protocol, so the kernel still panics.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

Loader.kboot does not yet implement the entire amd64 boot protocol, so the kernel still panics.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion revised, NB:

  • lowercase l
  • [.filename]#⋯# markup seems reasonable here.


PowerPC builds, but nothing more of its state is known.
Attempts to acquire a suitable Playstation 3 proved to be too time consuming for the author.

Help needed:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Help needed:
==== Help Needed
  • a simple subheading
  • and then, what's currently an ordered list of numbered items can become an unnumbered series of simple paragraphs.

The final paragraph, sponsorship already in place, will not be misinterpreted as something with which you need help.


1. man:loader.kboot[8] needs to be written. It should document how to use loader.kboot, how to create images, and the different use cases that work today.
bsdimp marked this conversation as resolved.
Show resolved Hide resolved
1. Finish amd64 support.
1. The current elf arch-specific metadata code is copied from efi. +
Unifying the kboot and efi copies is needed. +
While they are mostly the same, compile-time differences remain that complicate sharing. +
bsdimp marked this conversation as resolved.
Show resolved Hide resolved
In addtion, the build infrastructure makes sharing awkward.
1. It would be nice to add riscv64 support
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. It would be nice to add riscv64 support
1. It would be nice to add riscv64 support.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rolled into (superseded by) #202 (comment)

1. PowerPC testing (it has been untested since the refactoring started).
1. Help creating a script to repackage EDK-II image (say from QEMU) as a linux-boot image with a Linux kernel built on FreeBSD for CI testing.
1. Help testing it from the coreboot LinuxBoot
bsdimp marked this conversation as resolved.
Show resolved Hide resolved

Sponsored by: Netflix, Inc