Very minimalistic UEFI boot menu / Stivale2 bootloader

Overview

Tosaithe

Tosaithe is a minimalistic UEFI-firmware menu/bootloader. It can chain-load other EFI programs and loaders, including Linux kernels, and has basic support for the Stivale2 boot protocol. It is currently x86-64 only.

This is free software, with as few restrictions as legally possible. It comes with no warranty and will not be supported by the original author. Use it at your own risk.

I began writing Tosaithe when I was experimenting with writing a "toy" OS kernel. Using Stivale2, via its flagship Limine bootloader, allowed me to get off the ground quickly. However, Limine did not (at the time) work properly on my desktop machine and had design flaws that bothered me greatly (eg it wrote to disks at boot time when trying to identify boot partition), which have been fixed now as far as I know. There's little reason to use Tosaithe in preference to Limine now.

Tosaithe mainly serves now as:

  • An example UEFI bootloader
  • ... written in C++, exceptions and all
  • ... that can be built using standard Linux toolchain (GCC and GNU binutils)
  • ... that doesn't require EDK II or GNU-EFI

It also serves as an example client of the bmcxxabi, bmunwind, and libbmcxx libraries which together provide a C++ runtime and standard library.

Limitations of Stivale2 implementation

For Stivale2, only 64-bit ELF kernels are supported, and most optional features are not implemented (no terminal is provided, no PMRs, only 4-level page tables are supported). High-half kernels are supported but pointers in the information tags given to the kernel will not be adjusted to the high half.

Position independence is not supported (the kernel will be loaded at its nominal address).

The ELF segments must be contiguous and their virtual address must not be less than their file offset. (Both requirements are met by most common ELF files, and it would take a fairly funky linker script or linker to produce an ELF file that Tosaithe won't handle).

The Stivale2 requirement that PIC and APIC IRQs are disabled is not currently implemented. The kernel should ensure IRQs are masked itself before enabling interrupts.

No text mode is available in UEFI. The kernel will be booted regardless of whether it supports support from framebuffer. A framebuffer tag will be provided to the kernel if possible.

Building Tosaithe

Requires GCC and Binutils (may or may not work with Clang/LLVM/LLD). I have built with GCC 9.4.0 and Binutils 2.37. I recommend not trying to use older Binutils as there have been bugs with the PE+ output format support. Binutils must have been built with appropriate support (this is usually the case with distro-provided Binutils, use --enable-targets=x86_64-none-pe,x86_64-none-pep when configuring if building it yourself).

  1. sh clone-libs.sh to clone the dependencies
  2. sh rebuild-libs.sh to build the dependencies (in-tree)
  3. make to build Tosaithe.

Installing Tosaithe

Copy tosaithe.efi to your EFI system partition. You can copy it over \EFI\BOOT\bootx64.efi in order to boot with it, but I highly recommend you don't do that until you're sure that it works; copy it somewhere else and run it via Grub or the UEFI shell for example. (Check your motherboard manual for access to see if UEFI shell access is possible; check web for help using it).

You will need a tosaithe.conf text file (UTF-8) in the root directory of the same partition. This should look something like:

entry: {
    description = 'Linux - 5.10.47'
    type = chain
    exec = '\vmlinuz-5.10.47'
    cmdline = 'linux root=/dev/sda1'
}

entry: {
    description = 'EFI Shell'
    type = chain
    exec = '\EFI\Shell.efi'
    cmdline = 'Shell.efi'
}

entry: {
    description = 'My Stivale2 Kernel'
    type = stivale2
    exec = '\mykernel.elf'
    cmdline = ''
}

Note that when chaining to an EFI program (when type = chain) the command line should include the program name as first argument. Paths are on the boot partition (or rather the partition that Tosaithe itself is run from).

Using Tosaithe

When Tosaithe runs it reads the configuration file, prints a banner and lists the entries found in order. The entries are numbered and to select an entry you press the corresponding number on the keyboard.

This is of course very limited - it only properly supports up to 9 entries.

Owner
Davin McCall
Computer scientist, software developer. I write code for fun and profit. Use open-source software, sometimes try to improve it. A BSD-friendly Linux user.
Davin McCall
Simple EFI runtime driver that hooks GetVariable function and returns data expected by Windows to make it think that it's running with secure boot enabled (faking secure boot)

SecureFakePkg is a simple EFI runtime driver that hooks GetVariable function and returns data expected by Windows to make it think that it's running with secure boot enabled. In other words, it fakes secure boot status.

Samuel Tulach 67 Jun 22, 2022
The simple UEFI application to create a Windows Platform Binary Table (WPBT) from the UEFI shell.

WPBT Builder This is a simple UEFI application to create a Windows Platform Binary Table (WPBT) from the UEFI shell. Motivation WPBT is one of the Adv

Satoshi Tanda 60 Jun 20, 2022
⚡ Kernel written for NeticOS (UEFI bootloader)

AirKernel ⚡ Kernel written for NeticOS (UEFI bootloader) Report bug | Request a feature ❗️ Requirements Debian/Debian-based sudo apt install gcc g++ q

null 7 May 26, 2022
ColecoAdam a boot menu and configurator for ADE virtual drives

VHS HEAD For Coleco Adam users with Adamnet Disk Emulator (ADE) devices. VHS Head is a boot menu and configuration program for ADE (Pro and Lite) user

Thomas Cherryhomes 3 Dec 24, 2021
very basic and minimalistic hooking "library" for windows (x64 support soon)

IceHook very basic and minimalistic hooking "library" for windows (x64 support soon) Example how to use: typedef void(__stdcall* twglSwapBuffers)(HDC

null 6 Oct 17, 2021
STM32 firmware for a physical switch to set the GRUB boot selection

STM32 firmware for a physical switch to set the GRUB boot selection

Stephen Holdaway 307 Jun 14, 2022
🎨 A secure boot compatible in-memory UxTheme patcher

SecureUxTheme About SecureUxTheme is a software that removes signature verification of styles from Windows. Features No system file modifications No d

null 1.3k Jun 27, 2022
A pre-boot execution environment for Apple boards built on top of checkra1n

archOS A pre-boot execution environment for Apple boards built on top of checkra1n - currently based off the Checkra1n/PongoOS Repo. Building on macOS

ScarletAI 2 Jan 17, 2022
Tutorials on how the UEFI works

Step by Step Tutorials on how to use the UEFI for OS Development from scratch THIS IS WINDOWS BASED TUTS, BUT CODE SHOULD WORK IN LINUX AND MAC. NOTE

ThatOSDev 2 May 24, 2022
UEFI Application for CPU Voltage/Frquency and Power Management adjustment. Great for undervolting.

Reduce CPU Power Waste and Gain Performance. Greener and Meaner! ______ ______ _ (_____ \

null 91 Jun 15, 2022
Getting started with uefi

Hello UEFI 此项目是uefi入门实践指导,因为我也是一路踩坑踩过来,所以想要记录一下。 UEFI开发环境搭建非常的复杂。 linux和windows和其他操作系统上都可以编译,这里主要讲windows。 此项目完成的效果仅仅是使用我们开发的uefi模块,在vmware上测试,并在shell

0000000000 2 Nov 8, 2021
Make Epsilon Great again - Project Mu UEFI Firmware for Surface Duo (First Generation) Devices

Project Mu UEFI Implementation for Surface Duo Build Quick notes for building: Use Ubuntu 20.04 x64 Generate ACPI tables with IASL Follow this quick d

WOA Project 48 Jun 30, 2022
A bootloader and experimentation playground for Apple Silicon

m1n1: an experimentation playground for Apple Silicon (And to some extent a Linux bootloader) Building You need an aarch64-linux-gnu-gcc cross-compile

Asahi Linux 2k Jul 1, 2022
Supercharged USB bootloader for various PIC24/dsPIC33 MCUs.

PICoBoot Supercharged USB bootloader for various PIC24/dsPIC33 MCUs. Features Community version Supports all PIC24/dsPIC33 MCUs with USB module No dri

SudoMaker 6 Jun 11, 2022
x86_64, PE32+, FAT32 bootloader

carboot This project is a small x86_64 bootloader capable of reading FAT32 and mapping PE32+ images. It is the bootloader for carbon and is designed t

null 22 Jun 3, 2022
Bootloader for mimrxt MicroPython port

iMX RT10XX bootloader Bootloader for mimrxt MicroPython port The bootloader must be programed into RT10XX qspi Flash (or Hyperflash, not tested) using

Boris Lovosevic 3 May 26, 2022
This is an upgrade to the initial TerminalOS source, supporting real hardware other than just QEMU, using GRUB as a bootloader instead of the crappy one i wrote

Terminal OS Author: Maheswaran Date: 20th Nov 2021 PROGRESS Multiboot compilance achieved VGA driver from complete with print_hex, print_dec, printf f

Maheswaran Parameswaran 1 Nov 28, 2021
minimal bootloader + app example for ARM Cortex-M

cortex-m-bootloader-sample Based on https://github.com/noahp/pico-c-cortex-m , this project shows a simple bootloader+application configuration for an

Noah Pendleton 5 Jan 9, 2022
A customized LGL Android mod menu, containing ESP only for PUBG Mobile 1.3.0 for Android

PUBG Mobile ESP Mod Menu A customized LGL mod menu, containing ESP only for PUBG Mobile 1.3.0 for Android. Everything are fixed so it works with both

null 42 Mar 19, 2022