Skip to content
Snippets Groups Projects
Forked from postmarketOS / boot-deploy
27 commits behind the upstream repository.
Clayton Craft's avatar
Clayton Craft authored
The Linux kernel supports live patching CPU microcode on boot, something
we should definitely support. This patch adds support to grub and
sd-boot / bootloader spec config.

A new function is added to list out ucode in a directory (currently just
the output dir, which is almost always /boot). It's very basic at the
moment, it makes some pretty big assumptions about the name of the ucode
patch file (i.e. currently expects it to match *ucode.img) This if fine
for the ucode fw filenames that Alpine Linux / pmOS support. These
things can/should be improved later if we need to support more
situations.

For context/background, see: https://gitlab.com/postmarketOS/pmaports/-/issues/2370

Earlier versions of this patch tried to preserve writing the whole
configs for each bootloader in one call to `cat`, e.g. by generating the
list of lines to add ucode files, but it was a bit unruly (extraneous
newlines and formatting was inconsistent)
6b011dd1
History

Boot Deploy

boot-deploy is a distro-agnostic script for finalizing and deploying files related to booting Linux on mobile devices. It's used extensively by postmarketOS for all supported devices, but was split off into a separate project to allow other distributions to utilize it too.

Configuration

deviceinfo

boot-deploy uses the "deviceinfo" format from postmarketOS, which is specified here on the postmarketOS wiki.

The deviceinfo file is sourced by boot-deploy, providing configuration at runtime.

Note: not all of the variables on the deviceinfo reference wiki page are used by boot-deploy, some of them are used internally by postmarketOS. For an up to date list of variables that boot-deploy can use at runtime, see the top of the boot-deploy-functions.sh file.

OS-level Customization

boot-deploy requires a file at /usr/share/boot-deploy/os-customization, which is used to provide OS distribution customization for some aspects of its output. This file is sourced in shell script, so it must be in var=value format. It must contain the following variables (the given values are just examples):

distro_name="postmarketOS"
distro_prefix="pmos"
crypttab_entry="root"

Usage

Usage:
	./boot-deploy -i <file> -k <file> -d <path> [-o <path>] [files...]
Where:
	-i  filename of the initfs in the input directory
	-k  filename of the kernel in the input directory
	-d  path to directory containing input initfs, kernel
	-o  path to output directory {default: /boot}
	-c  path to deviceinfo {default: both /usr/share/deviceinfo/deviceinfo and /etc/deviceinfo are sourced, in that order }

		Additional files listed are copied from the input directory into the output directory as-is

The script implementation is found in boot_deploy_functions.sh, which it looks for under /usr/share/boot-deploy/boot_deploy_functions.sh. The default location can be overridden, e.g. for testing purposes, by setting the environment variable BOOT_DEPLOY_FUNCTIONS.