diff --git a/.gitcheck b/.gitcheck new file mode 100755 index 00000000..3467a80b --- /dev/null +++ b/.gitcheck @@ -0,0 +1,38 @@ +#!/bin/sh +# SPDX-FileCopyrightText: 2022 Caleb La Grange +# SPDX-License-Identifier: GPL-3.0-only + +Set_placeholder(){ + # Check if username and or email is set. + if ! git config user.name || git config user.email ; then + git config user.name || git config user.name 'lbmkplaceholder' + git config user.email || git config user.email 'placeholder@lbmkplaceholder.com' + fi +} + +Clean(){ + if [ "$(git config user.name)" = "lbmkplaceholder" ]; then + git config --unset user.name + fi + + if [ "$(git config user.email)" = "placeholder@lbmkplaceholder.com" ]; then + git config --unset user.email + fi +} + +Run(){ +if [ "${1}" = "clean" ]; then + Clean +else + Set_placeholder + + # Check coreboot as well to prevent errors during building + if [ -d coreboot ]; then + cd coreboot + Set_placeholder + cd - + fi +fi +} + +Run >/dev/null diff --git a/.gitignore b/.gitignore index 4979e1f9..5fb035b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,14 @@ *~ *.o -/cache/ -/lbmk.err.log -/repo/ -/docs/ -/pciroms/ -/util/dell-flash-unlock/dell_flash_unlock +/util/ich9utils/*.bin +/util/ich9utils/demefactory +/util/ich9utils/ich9deblob +/util/ich9utils/ich9show +/util/ich9utils/ich9gen /TODO -/ec/ /tmp/ -/elf/ +/payload/ +/me_cleaner/ *.s[a-w]? *.vim /*.elf @@ -17,30 +16,26 @@ /*.rom /build_error /TODO/ -/config/*/*/seen +/docs/version +/bucts/ +/coreboot/ +/crossgcc/ +/depthcharge/ +/flashrom/ +/resources/coreboot/*/seen +/grub/ +/memtest86plus/ +/seabios/ +/u-boot/ /bin/ /release/ +/descriptors/ /*.bin /push /version /versiondate -/.version -/.versiondate -/vendorfiles/ +/blobs/app/ +/blobs/vendorupdate *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/Makefile b/Makefile new file mode 100644 index 00000000..dad9ab28 --- /dev/null +++ b/Makefile @@ -0,0 +1,75 @@ +# +# Makefile for compatibility purposes +# You can use this, but it's recommended to run build system commands directly +# +# See docs/maintain/ and docs/git/ for information about the build system +# +# Copyright (C) 2020, 2021 Leah Rowe +# Copyright (C) 2022 Ferass El Hafidi +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +.POSIX: + +#.PHONY: all check download modules ich9m-descriptors payloads roms release \ +# clean crossgcc-clean install-dependencies-ubuntu \ +# install-dependencies-debian install-dependencies-arch \ +# install-dependencies-void + +all: roms + +download: + ./download all + +modules: + ./build module all + +ich9m-descriptors: + ./build descriptors ich9m + +payloads: + ./build payload all + +roms: + ./build boot roms all + +release: + ./build release src + ./build release roms + +clean: + ./build clean cbutils + ./build clean flashrom + ./build clean ich9utils + ./build clean payloads + ./build clean seabios + ./build clean grub + ./build clean memtest86plus + ./build clean rom_images + +crossgcc-clean: + ./build clean crossgcc + +install-dependencies-ubuntu: + ./build dependencies ubuntu2004 + +install-dependencies-debian: + ./build dependencies debian + +install-dependencies-arch: + ./build dependencies arch + +install-dependencies-void: + ./build dependencies void diff --git a/README.md b/README.md index e6452dbd..fc94085e 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 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 the contact page of libreboot.org. -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/config/ifd/t440p/gbe b/blobs/t440p/gbe.bin similarity index 100% rename from config/ifd/t440p/gbe rename to blobs/t440p/gbe.bin diff --git a/config/ifd/t440p/ifd b/blobs/t440p/ifd.bin similarity index 98% rename from config/ifd/t440p/ifd rename to blobs/t440p/ifd.bin index 241266e6..daa6c3d0 100644 Binary files a/config/ifd/t440p/ifd and b/blobs/t440p/ifd.bin differ diff --git a/config/ifd/xx20/gbe b/blobs/xx20/gbe.bin similarity index 100% rename from config/ifd/xx20/gbe rename to blobs/xx20/gbe.bin diff --git a/config/ifd/xx20/ifd b/blobs/xx20/ifd.bin similarity index 98% rename from config/ifd/xx20/ifd rename to blobs/xx20/ifd.bin index d042aba3..6ab44929 100644 Binary files a/config/ifd/xx20/ifd and b/blobs/xx20/ifd.bin differ diff --git a/config/ifd/xx30/16_ifd b/blobs/xx30/16_ifd.bin similarity index 96% rename from config/ifd/xx30/16_ifd rename to blobs/xx30/16_ifd.bin index f5c852a8..f97051c3 100644 Binary files a/config/ifd/xx30/16_ifd and b/blobs/xx30/16_ifd.bin differ diff --git a/config/ifd/xx30/gbe b/blobs/xx30/gbe.bin similarity index 100% rename from config/ifd/xx30/gbe rename to blobs/xx30/gbe.bin diff --git a/config/ifd/xx30/ifd b/blobs/xx30/ifd.bin similarity index 98% rename from config/ifd/xx30/ifd rename to blobs/xx30/ifd.bin index c377200f..24bc3c57 100644 Binary files a/config/ifd/xx30/ifd and b/blobs/xx30/ifd.bin differ diff --git a/blobutil b/blobutil new file mode 100755 index 00000000..4f00b27f --- /dev/null +++ b/blobutil @@ -0,0 +1,44 @@ +#!/bin/sh +# SPDX-FileCopyrightText: 2022 Caleb La Grange +# SPDX-License-Identifier: GPL-3.0-only + +./.gitcheck + +script_dir="resources/scripts/blobs" +modes=$(ls -1 ${script_dir}) + +Print_help(){ + cat <<- EOF + Usage: ./blobutil [mode] + Example: ./blobutil download x230_12mb + + Possible options for mode are + ${modes} + + Mode descriptions: + download: Try to automatically generate blobs for specified board + inject: Inject blobs for specified board into specified rom + extract: Extract blobs from specified rom for specified board + EOF +} + + +if [ $# -gt 0 ]; then + mode="${1}" + shift + args="$@" + + if [ ! -f "${script_dir}/${mode}" ]; then + printf "Error: No mode ${mode}\n" + Print_help + exit 1 + else + ./${script_dir}/${mode} ${args} + fi + +else + printf 'Error: You must specify a mode\n' + Print_help +fi + +./.gitcheck clean diff --git a/build b/build new file mode 100755 index 00000000..d050a48c --- /dev/null +++ b/build @@ -0,0 +1,111 @@ +#!/bin/sh + +# generic build script, for building components (all of them) +# +# Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe +# Copyright (C) 2015 Patrick "P. J." McDermott +# Copyright (C) 2015, 2016 Klemens Nanni +# Copyright (C) 2022, Caleb La Grange +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +./.gitcheck + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +projectname="$(cat projectname)" + +build=./resources/scripts/build + +listmodes() { + for mode in "${build}"/*; do + printf '%s\n' "${mode##*/}" + done +} + +# Takes exactly one mode as parameter +listoptions() { + for option in "${build}"/"${1}"/*; do + printf '%s\n' "${option##*/}" + done +} + +help() { + cat <<- EOF + USAGE: ./build