clean up all the irrevelant shit on bsd guides

hslick-master
Leah Rowe 2022-08-24 03:22:03 +01:00
parent 26b530101f
commit 551be50aaa
4 changed files with 117 additions and 497 deletions

View File

@ -1,130 +0,0 @@
---
title: How to install FreeBSD on x86 GNU GRUB payload
x-toc-enable: true
...
FreeBSD might show graphical corruption during bootup. You can fix this by
altering the order in which kernel modules/drivers are loaded. First, try moving
video to an earlier stage on the boot process, or try moving it to a later stage
instead. With this, you should be able to get a working display.
freebsd.img is the installation image for FreeBSD. Adapt the filename
accordingly, for whatever FreeBSD version you use.
Prepare the USB drive (in FreeBSD)
----------------------------------
[This page](https://www.freebsd.org/doc/handbook/bsdinstall-pre.html) on
the FreeBSD website shows how to create a bootable USB drive for
installing FreeBSD. Use the *dd* on that page.
Prepare the USB drive (in NetBSD)
---------------------------------
[This
page](https://wiki.netbsd.org/tutorials/how_to_install_netbsd_from_an_usb_memory_stick/)
on the NetBSD website shows how to create a NetBSD bootable USB drive
from within NetBSD itself. You should use the *dd* method documented
there; you can use this with any ISO, including FreeBSD.
Prepare the USB drive (in LibertyBSD or OpenBSD)
------------------------------------------------
If you downloaded your ISO on a LibertyBSD or OpenBSD system, here is
how to create the bootable FreeBSD USB drive:
Connect the USB drive. Check dmesg:
dmesg | tail
Check to confirm which drive it is, for example, if you think its sd3:
disklabel sd3
Check that it wasn't automatically mounted. If it was, unmount it. For
example:
doas umount /dev/sd3i
dmesg told you what device it is. Overwrite the drive, writing the
FreeBSD installer to it with dd. For example:
doas dd if=freebsd.img of=/dev/rsdXc bs=1M; sync
You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.
Prepare the USB drive (in GNU+Linux)
------------------------------------
If you downloaded your ISO on a GNU+Linux system, here is how to create
the bootable FreeBSD USB drive:
Connect the USB drive. Check dmesg:
dmesg
Check lsblk to confirm which drive it is:
lsblk
Check that it wasn't automatically mounted. If it was, unmount it. For
example:
sudo umount /dev/sdX\*
umount /dev/sdX\*
dmesg told you what device it is. Overwrite the drive, writing your
distro ISO to it with dd. For example:
sudo dd if=freebsd.img of=/dev/sdX bs=8M; sync
dd if=freebsd.img of=/dev/sdX bs=8M; sync
You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.
Installing FreeBSD without full disk encryption
-----------------------------------------------
Press C in GRUB to access the command line:
grub> kfreebsd (usb0,gpt3)/boot/kernel/kernel
grub> set FreeBSD.vfs.mountfrom=ufs:/dev/da1p3\
grub> boot
It will start booting into the FreeBSD installer. Follow the normal
process for installing FreeBSD.
Installing FreeBSD with full disk encryption
--------------------------------------------
TODO
Booting
-------
TODO
Configuring Grub
----------------
TODO
Troubleshooting
===============
Most of these issues occur when using libreboot with coreboot's 'text
mode' instead of the coreboot framebuffer. This mode is useful for
booting payloads like memtest86+ which expect text-mode, but for FreeBSD
it can be problematic when they are trying to switch to a framebuffer
because it doesn't exist.
In most cases, you should use the corebootfb ROM images. There ROM images
have `corebootfb` in the file name, and they start in a high resolution frame
buffer, provided by coreboot's `libgfxinit` library.
won't boot...something about file not found
---------------------------------------------
Your device names (i.e. usb0, usb1, sd0, sd1, wd0, ahci0, hd0, etc) and
numbers may differ. Use TAB completion.

View File

@ -3,78 +3,139 @@ title: BSD operating systems
x-toc-enable: true
...
This section is largely x86-centric, pertaining to use of BSD operating systems.
Although not as popular, BSD systems are also (in most cases) *Free Software*,
but they are non-copyleft.
Guide last updated on 24 August 2022.
Libreboot is capable of booting many BSD systems. This section mostly documents
the peculiarities of Libreboot as it pertains to BSD; you can otherwise refer to
osboot is capable of booting many BSD systems. This section mostly documents
the peculiarities of osboot as it pertains to BSD; you can otherwise refer to
the official documentation for whatever BSD system you would like to use.
Video modes
===========
Kernel Mode Setting
===================
For BSD systems, it is desirable that you boot in *text mode*. ROM images
with `txtmode` in the file name, on x86 systems, boot up with int10h text mode
in use. This is the most "compatible" option, and BSD operating systems have
excellent support for text-mode startup. Many of them also support *kernel mode
setting* (KMS) nowadays, which you *need* if you want a graphical desktop on
the X window system. The reason is that Libreboot does not currently implement
int10h VGA modes on x86 systems. However, basic video initialization is
provided on all platforms (int10h text mode, or coreboot framebuffer).
Your BSD system *must* support Kernel Mode Setting for your graphics
device (most of them do nowadays). The reasons will become apparent, as
you read this article.
Combined with the use of SeaBIOS payload, BSD systems (and any other OS that
can boot in text mode) will *just work*. If your BSD system supports kernel
mode setting, it can set up a framebuffer without making use of int10h VGA
modes. In this case, the driver (e.g. Intel video driver) will set modes
directly, and implement its own framebuffer.
Boot BSD, using SeaBIOS
=======================
Booting with a coreboot framebuffer will also work well on most BSD systems.
These ROM images have `corebootfb` in the filename, on recent Libreboot releases.
In this setup, you should make sure that your BSD system has a `corebootfb`
driver (to make use of the coreboot framebuffer), but when switching to X, your
video driver (e.g. Intel video driver) may already support kernel mode setting
which means that the coreboot framebuffer will no longer be used at that point.
On x86 platforms, osboot/libreboot both provide the choice of GNU GRUB and/or
SeaBIOS payload. GRUB can technically boot BSD kernels, but the code is
poorly maintained and unreliable for this use-case scenario; on BIOS systems,
GRUB can chainload BSD bootloaders, but on bare metal (as coreboot payload),
GRUB can only chainload other coreboot payloads or boot Linux/BSD kernels
directly (but direct booting is only really reliable for Linux, in GRUB).
Booting BSD
===========
It is recommended that you boot in text mode, with SeaBIOS. You can literally
just follow the official installation guides for your BSD system, whether it
be FreeBSD, OpenBSD or others.
On x86 platforms, Libreboot currently provides the choice of GNU GRUB and/or
SeaBIOS payload. You can use *either* payload, to boot BSD operating systems.
If you don't plan to set up Xorg/Wayland, then that's all you really need to
do. For example, you might want to run a headless server, in which case you
probably don't mind running in text mode all the time.
SeaBIOS payload
---------------
Warnings for X11 users
----------------------
It is highly recommended that you use the SeaBIOS payload. ROM images are
available in the latest Libreboot release, which start with the SeaBIOS payload.
One important peculiarity of most libreboot and osboot systems is: VGA mode
support exists, if booting with corebootfb (coreboot's own framebuffer) and
the SeaVGABIOS option ROM used in the SeaBIOS payload; however, the ability
to switch modes is not present, which means you can't switch to text mode
either.
The ROM images with GNU GRUB *also* have SeaBIOS available in the boot menu.
GNU GRUB, when compiled as a coreboot payload, runs on *bare metal* and it can
boot any other coreboot payload if you use the `chainloader` command.
Coreboot can start in framebuffer (corebootfb) or INT10H text mode, and it
stays in whatever mode was set, unless KMS is used to change the mode. It
should be noted that the coreboot framebuffer is not a VGA mode, but instead
coreboot implements minimal drivers for hardware that it supports, providing
a framebuffer directly in memory, which software (such as GRUB) can simply
use.
The way to use SeaBIOS is fairly self-explanatory. SeaBIOS functions the way
you would expect on a typical computer. Libreboot currently lacks any sort of
documentation for SeaBIOS, but you can refer to their
website: <https://seabios.org/SeaBIOS>
The BSD bootloaders on x86, in BIOS systems, typically expect text mode
startup. It is usually possible to set the console to higher VGA modes,
on most systems, but not on most coreboot systems with native video
initialisation used, due to the quirks already described. If you see any
documentation (in BSD land) pertaining to VESA modes, ignore it entirely;
unless you're using the proprietary VGA ROM for your device, it won't work,
and osboot/libreboot don't distribute these (instead, coreboot's own video
initialisation is used where possible, or a headless SeaBIOS payload setup
is provided, where you would either run it headless or install a graphics
card).
SeaBIOS is *especially* recommended if you're doing an encrypted installation.
Now, this would otherwise mean: no X11/Wayland. If you start in corebootfb
mode with SeaVGABIOS, you won't get a display in BSD bootloaders, and if you
boot in text mode, you can't set VESA modes from BSD. However, you're in luck:
The benefit to using SeaBIOS is that it's basically more reliable. For example,
ZFS support is less reliable in GRUB, but a FreeBSD system booted in SeaBIOS
would work just fine because you'd be using FreeBSD's own bootloader in that
instance.
At least OpenBSD and FreeBSD (possibly others) all have excellent KMS
support nowadays; short for `Kernel Mode Setting`. This avoids the inefficiency
of BIOS/UEFI methods, by having the kernel set modes directly. It is based on
KMS drivers that the BSD projects ported over from the Linux kernel. With this,
you can use X11/Wayland in FreeBSD (and just X11 in OpenBSD, for now).
GNU GRUB payload
----------------
For example: on FreeBSD, you can install `graphics/drm-kmod` as a package
or from ports, and (for Intel GPUs) do this:
GRUB can directly boot many BSD kernels, but support for this is quite unreliable
compared to its support for booting Linux kernels. However, you *can* use GRUB.
sysrc kld_list+="i915kms"
When you use GNU GRUB directly, in this way, the various BSD bootloaders are
bypassed entirely.
This creates the following entry in `/etc/rc.conf`:
We have separate pages for each BSD system:
kld_list="i915kms"
* [How to install NetBSD on x86 GNU GRUB payload](netbsd.md)
* [How to install OpenBSD on x86 GNU GRUB payload](openbsd.md)
* [How to install FreeBSD on a x86 GNU GRUB payload](freebsd.md)
On FreeBSD it is also recommended that you switch to KMS on the console/TTY;
add this to `/boot/loader.conf` so that you can still use the console after
terminating Xorg:
kern.vty=vt
You should not rely on the above instruction (for FreeBSD), because the exact
step might change, and it does not go into full detail either. Refer to the
documentation provided by your system, to know how KMS is configured.
ALWAYS READ THE MANUAL
----------------------
All of the BSDs have *excellent* documentation; it's one of the defining
characteristics, versus typical Linux distros.
Aside from this quirk in coreboot, regarding *BIOS* video modes, the BSDs
otherwise work in exactly the same way as you would expect, and you can
follow along to their official documentation without much fuss.
No specific or detailed guides will be provided here, because SeaBIOS is
fairly self-explanatory; you can otherwise refer to the SeaBIOS
documentation.
If you're flashing a ROM for a machine where `seabios_withgrub`
and `seabios_grubfirst` ROMs are available, choose `seabios_withgrub`.
Dubious mention: Tianocore
--------------------------
Tianocore is extremely bloated, and unauditable, so it is not included
in libreboot or osboot, but it is the reference UEFI implementation by
Intel and contributors. It can boot most BSD systems very well.
More robust ways to provide UEFI services in Libreboot and Osboot are
being explored. Tianocore integration will not be provided officially,
in any current or future releases of either project.
Desktop users
-------------
Desktop users on libreboot/osboot should just install a graphics card,
and again boot with SeaBIOS in text mode; however, when you do this,
SeaBIOS will execute the VGA option ROM on the card which will provide
early video initialisation instead of coreboot's initialisation, and that
VGA ROM will usually implement full INT10H modes, including the ability
to set modes in the BIOS (using interrupts), in which case you don't
need to worry about Kernel Mode Setting, but you should still use KMS
anyway.
The reason to use KMS is because it's more efficient. The INT10H service can
only be called in Real Mode or Virtual 8086 mode; v8086 is unavailable in
long mode (x86\_64) and switching into Real Mode just to set VGA modes is
extremely expensive computationally speaking. This is why modern kernels
(Linux and BSD one) do mode setting themselves.
You can learn more about INT10H text/VGA modes here:
<https://en.wikipedia.org/wiki/INT_10H>

View File

@ -1,148 +0,0 @@
---
title: How to install NetBSD on x86 GNU GRUB payload
x-toc-enable: true
...
GRUB supports booting NetBSD kernels directly. However, you're better off
simply using the SeaBIOS payload; BSD works well with BIOS or UEFI setups.
GRUB is acceptable for booting unencrypted BSD installations. However,
encrypted BSD installations will probably require the use of SeaBIOS/Tianocore.
Prepare the USB drive (in NetBSD)
---------------------------------
[This
page](https://wiki.netbsd.org/tutorials/how_to_install_netbsd_from_an_usb_memory_stick/)
on the NetBSD website shows how to create a NetBSD bootable USB drive
from within NetBSD itself. You should use the *dd* method documented
there.
Prepare the USB drive (in FreeBSD)
----------------------------------
[This page](https://www.freebsd.org/doc/handbook/bsdinstall-pre.html) on
the FreeBSD website shows how to create a bootable USB drive for
installing FreeBSD. Use the *dd* on that page. You can also use the same
instructions with a NetBSD ISO image.
Prepare the USB drive (in OpenBSD or NetBSD)
-----------------------------------------------
If you downloaded your ISO on a OpenBSD or NetBSD system, here is how
to create the bootable NetBSD USB drive:
Connect the USB drive. Check dmesg:
dmesg | tail
Check to confirm which drive it is, for example, if you think its sd3:
disklabel sd3
Check that it wasn't automatically mounted. If it was, unmount it. For
example:
doas umount /dev/sd3i
dmesg told you what device it is. Overwrite the drive, writing the
NetBSD installer to it with dd. For example:
doas netbsd.iso of=/dev/rsdXc bs=1M; sync
You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.
Prepare the USB drive (in GNU+Linux)
------------------------------------
If you downloaded your ISO on a GNU+Linux system, here is how to create
the bootable NetBSD USB drive:
Connect the USB drive. Check dmesg:
dmesg
Check lsblk to confirm which drive it is:
lsblk
Check that it wasn't automatically mounted. If it was, unmount it. For
example:
sudo umount /dev/sdX\*
umount /dev/sdX\*
dmesg told you what device it is. Overwrite the drive, writing your
distro ISO to it with dd. For example:
sudo dd if=install60.fs of=/dev/sdX bs=8M; sync
dd if=netbsd.iso of=/dev/sdX bs=8M; sync
You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.
Installing NetBSD without full disk encryption
----------------------------------------------
You might have to use an external USB keyboard during the installation.
Press C to access the GRUB terminal.
grub> knetbsd -r sd0a (usb0,netbsd1)/netbsd
grub> boot
It will start booting into the NetBSD installer. Follow the normal
process for installing NetBSD.
Installing NetBSD with full disk encryption
-------------------------------------------
TODO
Booting
-------
Press C in GRUB to access the command line:
grub> knetbsd -r wd0a (ahci0,netbsd1)/netbsd
grub> boot
NetBSD will start booting. Yay!
Configuring Grub
----------------
If you don't want to drop to the GRUB command line and type in a
command to boot NetBSD every time, you can create a GRUB configuration
that's aware of your NetBSD installation and that will automatically be
used by libreboot.
On your NetBSD root partition, create the `/grub` directory and add
the file `libreboot_grub.cfg` to it. Inside the
`libreboot_grub.cfg` add these lines:
default=0
timeout=3
menuentry "NetBSD" {
knetbsd -r wd0a (ahci0,netbsd1)/netbsd
}
The next time you boot, you'll see the old Grub menu for a few seconds,
then you'll see the a new menu with only NetBSD on the list. After 3
seconds NetBSD will boot, or you can hit enter to boot.
Troubleshooting
===============
Most of these issues occur when using Libreboot with coreboot's 'text
mode' instead of the coreboot framebuffer. This mode is useful for
booting payloads like memtest86+ which expect text-mode, but for NetBSD
it can be problematic when they are trying to switch to a framebuffer
because it doesn't exist.
won't boot...something about file not found
---------------------------------------------
Your device names (i.e. usb0, usb1, sd0, sd1, wd0, ahci0, hd0, etc) and
numbers may differ. Use TAB completion.

View File

@ -1,163 +0,0 @@
---
title: How to install OpenBSD on x86 GNU GRUB payload
x-toc-enable: true
...
This guide is written for OpenBSD 6.1, but it can be adapted easily for other
versions (of OpenBSD).
If you want an encrypted install, use SeaBIOS instead of GRUB and go here:
<https://www.openbsd.org/faq/faq4.html> (official installation guide, which
says how to use encryption)
GRUB supports booting OpenBSD kernels directly. However, you're better off
simply using the SeaBIOS payload; BSD works well with BIOS or UEFI setups.
GRUB is acceptable for booting unencrypted BSD installations. However,
encrypted BSD installations will probably require the use of SeaBIOS/Tianocore.
install61.fs is the installation image for OpenBSD 6.1. Adapt the
filename accordingly, for a different OpenBSD version or LibertyBSD.
Prepare the USB drive (in LibertyBSD or OpenBSD)
------------------------------------------------
If you downloaded your ISO on a LibertyBSD or OpenBSD system, here is
how to create the bootable LibertyBSD/OpenBSD USB drive:
Connect the USB drive and check the system message buffer:
dmesg | tail
Check to confirm which drive it is, for example, if you think it's `sd3`:
disklabel sd3
Check that it wasn't automatically mounted. If it was, unmount it:
doas umount /dev/sd3i
Now write the OpenBSD installer to the drive with `dd`:
doas dd if=install60.fs of=/dev/rsdXc bs=1M; sync
You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.
Prepare the USB drive (in NetBSD)
---------------------------------
[This
page](https://wiki.netbsd.org/tutorials/how_to_install_netbsd_from_an_usb_memory_stick/)
on the NetBSD website shows how to create a NetBSD bootable USB drive
from within NetBSD itself. You should use the `dd` method documented
there. This will also work with the OpenBSD image.
Prepare the USB drive (in FreeBSD)
----------------------------------
[This page](https://www.freebsd.org/doc/handbook/bsdinstall-pre.md) on
the FreeBSD website shows how to create a bootable USB drive for
installing FreeBSD. Use the `dd` on that page. You can also use the same
instructions with a OpenBSD ISO image.
Prepare the USB drive (in GNU+Linux)
------------------------------------
If you downloaded your ISO on a GNU+Linux system, here is how to create
the bootable OpenBSD USB drive:
Connect the USB drive. Check dmesg:
dmesg
Check lsblk to confirm which drive it is:
lsblk
Check that it wasn't automatically mounted. If it was, unmount it. For
example:
sudo umount /dev/sdX\*
umount /dev/sdX\*
dmesg told you what device it is. Overwrite the drive, writing your
distro ISO to it with dd. For example:
sudo dd if=install61.fs of=/dev/sdX bs=8M; sync
dd if=install61.fs of=/dev/sdX bs=8M; sync
You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.
Installing OpenBSD without full disk encryption
-----------------------------------------------
Press C in GRUB to access the command line:
grub> kopenbsd (usb0,openbsd1)/6.1/amd64/bsd.rd
grub> boot
It will start booting into the OpenBSD installer. Follow the normal
process for installing OpenBSD.
Installing OpenBSD with full disk encryption
--------------------------------------------
If you are using SeaBIOS, OpenBSD's bootloader will be
chainloaded automatically and everything will just work.
Alternatively, it would be good to port OpenBSD either natively as a
coreboot payload, or port it to libpayload (payload library in coreboot;
it has a basic C library and a few functions for certain operations e.g.
text/bitmap).
Booting
-------
Press C in GRUB to access the command line:
grub> kopenbsd -r sd0a (ahci0,openbsd1)/bsd
grub> boot
OpenBSD will start booting. Yay!
Configuring Grub
----------------
If you don't want to drop to the GRUB command line and type in a
command to boot OpenBSD every time, you can create a GRUB configuration
that's aware of your OpenBSD installation and that will automatically
be used by Libreboot.
On your OpenBSD root partition, create the `/grub` directory and add the file
`libreboot_grub.cfg` to it. Inside the `libreboot_grub.cfg` add these lines:
default=0
timeout=3
menuentry "OpenBSD" {
kopenbsd -r sd0a (ahci0,openbsd1)/bsd
}
If your OpenBSD installation uses a GPT scheme, use the `gpt4` partition
instead of `openbsd1`.
The next time you boot, you'll see the old Grub menu for a few seconds,
then you'll see the a new menu with only OpenBSD on the list. After 3
seconds OpenBSD will boot, or you can hit enter to boot.
Troubleshooting
===============
Most of these issues occur when using Libreboot with coreboot's 'text
mode' instead of the coreboot framebuffer. This mode is useful for
booting payloads like memtest86+ which expect text-mode, but for OpenBSD
it can be problematic when they are trying to switch to a framebuffer
because it doesn't exist.
Won't boot...something about file not found
---------------------------------------------
Your device names (i.e. usb0, usb1, sd0, sd1, wd0, ahci0, hd0, etc) and
numbers may differ. Use TAB completion.