diff --git a/.gitignore b/.gitignore index 4979e1f9..f743fddb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,7 @@ *~ *.o -/cache/ /lbmk.err.log -/repo/ -/docs/ +/cbutils/ /pciroms/ /util/dell-flash-unlock/dell_flash_unlock /TODO @@ -24,23 +22,9 @@ /push /version /versiondate -/.version -/.versiondate /vendorfiles/ *me.bin *sch5545ec.bin /mrc/ /util/nvmutil/nvm /src/ -/CHANGELOG -/todo.txt -/lock -/hash/ -/dump/ -/qrun*.sh -*.tar.* -/m -/f -/r -/e -/xbmkpath/ diff --git a/README.md b/README.md index e6452dbd..94c8824b 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,123 @@ Libreboot ========= -Documentation: [libreboot.org](https://libreboot.org)\ -Support: [\#libreboot](https://web.libera.chat/#libreboot) on - [Libera](https://libera.chat/) IRC +Find libreboot documentation at -Libreboot provides -[libre](https://libreboot.org/freedom-status.html) -boot firmware on -[supported motherboards](https://libreboot.org/docs/install/#which-systems-are-supported-by-libreboot). It replaces proprietary vendor BIOS/UEFI implementations, by -* Using coreboot to initialize the hardware (e.g. memory controller, CPU, etc.) while - minimizing unwanted functionality (e.g. backdoors such as the Intel Management Engine) -* ... which runs a payload such as SeaBIOS, GRUB, or U-Boot -* ... which loads your operating system's boot loader (BSD and Linux-based - [systems](systems) are supported). +The `libreboot` project provides +[libre](https://libreboot.org/freedom-status.html) *boot +firmware* that initializes the hardware (e.g. memory controller, CPU, +peripherals) on specific Intel/AMD x86 and ARM targets, which +then starts a bootloader for your operating system. Linux/BSD are +well-supported. It replaces proprietary BIOS/UEFI firmware. Help is available +via [\#libreboot IRC](https://web.libera.chat/#libreboot) +on [Libera](https://libera.chat/) IRC. -Why use Libreboot, and what is coreboot? ----------------------------------------- +Why use Libreboot? +================== -A lot of users who use libre operating systems still use proprietary boot -firmware, which often contain backdoors and bugs, hampering -[user freedom](https://writefreesoftware.org) and -[right to repair](https://www.eff.org/issues/right-to-repair). +Why should you use *libreboot*? +---------------------------- -[coreboot](https://coreboot.org) provides libre boot firmware by initializing -the hardware then running a payload. However, coreboot is notoriously difficult -to configure and install for most non-technical users, requiring detailed -technical knowledge of hardware. +Libreboot gives you freedoms that you otherwise can't get with most other +boot firmware. It's extremely powerful and configurable for many use cases. -Libreboot solves this by being **a coreboot distribution** (in the same way -that Alpine Linux is a Linux distribution). It provides a fully automated build -system that downloads and compiles pre-configured ROM images for supported -motherboards, so end-users could easily fetch images to flash onto their -devices. +You have rights. The right to privacy, freedom of thought, freedom of speech +and the right to read. In this context, Libreboot gives you these rights. +Your freedom matters. +[Right to repair](https://vid.puffyan.us/watch?v=Npd_xDuNi9k) matters. +Many people use proprietary (non-libre) +boot firmware, even if they use [a libre OS](https://www.openbsd.org/). +Proprietary firmware often contains backdoors (more info on the FAQ), and it +and can be buggy. The libreboot project was founded in December 2013, +with the express purpose of making coreboot firmware accessible for +non-technical users. -Libreboot also produces documentation aimed at non-technical users and -excellent user support via IRC. +The `libreboot` project uses [coreboot](https://www.coreboot.org/) for [hardware +initialisation](https://doc.coreboot.org/getting_started/architecture.html). +Coreboot is notoriously difficult to install for most non-technical users; it +handles only basic initialization and jumps to a separate +[payload](https://doc.coreboot.org/payloads.html) program (e.g. +[GRUB](https://www.gnu.org/software/grub/), +[Tianocore](https://www.tianocore.org/)), which must also be configured. +*The libreboot software solves this problem*; it is a *coreboot distribution* with +an automated build system (named *lbmk*) that builds complete *ROM images*, for +more robust installation. Documentation is provided. -Contribute ----------- +How does Libreboot differ from coreboot? +======================================== + +In the same way that *Debian* is a GNU+Linux distribution, `libreboot` is +a *coreboot distribution*. If you want to build a ROM image from scratch, you +otherwise have to perform expert-level configuration of coreboot, GRUB and +whatever other software you need, to prepare the ROM image. With *libreboot*, +you can literally download from Git or a source archive, and run `make`, and it +will build entire ROM images. An automated build system, named `lbmk` +(Libreboot MaKe), builds these ROM images automatically, without any user input +or intervention required. Configuration has already been performed in advance. + +If you were to build regular coreboot, without using libreboot's automated +build system, it would require a lot more intervention and decent technical +knowledge to produce a working configuration. + +Regular binary releases of `libreboot` provide these +ROM images pre-compiled, and you can simply install them, with no special +knowledge or skill except the ability to follow installation instructions +and run commands BSD/Linux. + +Project goals +============= + +- *Support as much hardware as possible!* Libreboot aims to eventually + have *maintainers* for every board supported by coreboot, at every + point in time. +- *Make coreboot easy to use*. Coreboot is notoriously difficult + to install, due to an overall lack of user-focused documentation + and support. Most people will simply give up before attempting to + install coreboot. Libreboot's automated build system and user-friendly + installation instructions solves this problem. + +Libreboot attempts to bridge this divide by providing a build system +automating much of the coreboot image creation and customization. +Secondly, the project produces documentation aimed at non-technical users. +Thirdly, the project attempts to provide excellent user support via IRC. + +Libreboot already comes with a payload (GRUB), flashrom and other +needed parts. Everything is fully integrated, in a way where most of +the complicated steps that are otherwise required, are instead done +for the user in advance. + +You can download ROM images for your libreboot system and install +them without having to build anything from source. If, however, you are +interested in building your own image, the build system makes it relatively +easy to do so. + +Not a coreboot fork! +-------------------- + +Libreboot is not a fork of coreboot. Every so often, the project +re-bases on the latest version of coreboot, with the number of custom +patches in use minimized. Tested, *stable* (static) releases are then provided +in Libreboot, based on specific coreboot revisions. + +How to help +=========== You can check bugs listed on the [bug tracker](https://codeberg.org/libreboot/lbmk/issues). -You may use Codeberg pull requests to send patches with bug fixes or other -improvements. This repository hosts the code for the main build system. -The website lives in [a separate repository](https://codeberg.org/libreboot/lbwww). +If you spot a bug and have a fix, the website has instructions for how to send +patches, and you can also report it. Also, this entire website is +written in Markdown and hosted in a [separate +repository](https://codeberg.org/libreboot/lbwww) where you can send patches. -Development is also done on the IRC channel. +Any and all development discussion and user support are all done on the IRC +channel. More information is on https://libreboot.org/contact.html. -License for this README ------------------------ +LICENSE FOR THIS README +======================= -It's just a README file. It is released under -[Creative Commons Zero, version 1.0](https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt). +It's just a README file. This README file is released under the terms of the +Creative Commons Zero license, version 1.0 of the license, which you can +read here: + diff --git a/build b/build new file mode 100755 index 00000000..9ca9de63 --- /dev/null +++ b/build @@ -0,0 +1,138 @@ +#!/usr/bin/env sh +# SPDX-License-Identifier: GPL-3.0-or-later +# SPDX-FileCopyrightText: 2014,2015,2020,2021,2023 Leah Rowe +# SPDX-FileCopyrightText: 2015 Patrick "P. J." McDermott +# SPDX-FileCopyrightText: 2015, 2016 Klemens Nanni +# SPDX-FileCopyrightText: 2022, Caleb La Grange + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +. "include/err.sh" +. "include/option.sh" + +eval "$(setvars "" option aur_notice tmpdir)" + +tmpdir_was_set="y" +set | grep TMPDIR 1>/dev/null 2>/dev/null || tmpdir_was_set="n" +if [ "${tmpdir_was_set}" = "y" ]; then + tmpdir="${TMPDIR##*/}" + tmpdir="${TMPDIR%_*}" + if [ "${tmpdir}" = "lbmk" ]; then + tmpdir="" + tmpdir_was_set="n" + fi +fi +if [ "${tmpdir_was_set}" = "n" ]; then + export TMPDIR="/tmp" + tmpdir="$(mktemp -d -t lbmk_XXXXXXXX)" + export TMPDIR="${tmpdir}" +else + export TMPDIR="${TMPDIR}" +fi +tmpdir="${TMPDIR}" + +linkpath="${0}" +linkname="${linkpath##*/}" +buildpath="./script/${linkname}" + +main() +{ + xx_ id -u 1>/dev/null 2>/dev/null + [ $# -lt 1 ] && fail "Too few arguments. Try: ${0} help" + [ "${1}" = "dependencies" ] && xx_ install_packages $@ && lbmk_exit 0 + + initialise_command $@ && shift 1 + + check_git + check_project "fail" + git_init + + execute_command $@ + lbmk_exit 0 +} + +initialise_command() +{ + [ "$(id -u)" != "0" ] || fail "this command as root is not permitted" + + case "${1}" in + help) usage ${0} && lbmk_exit 0 ;; + list) items "${buildpath}" && lbmk_exit 0 ;; + esac + option="${1}" +} + +install_packages() +{ + if [ $# -lt 2 ]; then + printf "You must specify a distro, namely:\n" 1>&2 + printf "Look at files under config/dependencies/\n" 1>&2 + printf "Example: ./build dependencies debian\n" 1>&2 + fail "install_packages: target not specified" + fi + + [ -f "config/dependencies/${2}" ] || fail "Unsupported target" + + . "config/dependencies/${2}" + + xx_ ${pkg_add} ${pkglist} + [ -z "${aur_notice}" ] && return 0 + printf "You must install AUR packages: %s\n" "${aur_notice}" 1>&2 +} + +# release archives contain .gitignore, but not .git. +# lbmk can be run from lbmk.git, or an archive. +git_init() +{ + [ -L ".git" ] && fail "Reference .git is a symlink" + [ -e ".git" ] && return 0 + eval "$(setvars "$(date -Rd @${versiondate})" cdate _nogit)" + + git init || fail "${PWD}: cannot initialise Git repository" + git add -A . || fail "${PWD}: cannot add files to Git repository" + git commit -m "${projectname} ${version}" --date "${cdate}" || \ + fail "${PWD}: can't commit ${projectname}/${version}, date ${cdate}" + git tag -a "${version}" -m "${projectname} ${version}" || \ + fail "${PWD}: cannot git-tag ${projectname}/${version}" +} + +execute_command() +{ + lbmkcmd="${buildpath}/${option}" + [ -f "${lbmkcmd}" ] || fail "Invalid command. Run: ${linkpath} help" + "${lbmkcmd}" $@ || fail "execute_command: ${lbmkcmd} ${@}" +} + +usage() +{ + progname=${0} + cat <<- EOF + USAGE: ${progname}