From eed25bd2209a4c9f7c21a15689b5c90bd3757a6c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 21 Nov 2021 15:57:40 +0000 Subject: update coreboot and nuke tianocore tianocore is a liability for the libreboot project. it's a bloated mess, and unreliable, broken on many boards, and basically impossible to audit. i don't trust tianocore, so i'm removing it. --- resources/scripts/build/boot/roms_helper | 64 ++++--------------------- resources/scripts/build/clean/tianocore | 30 ------------ resources/scripts/build/payload/tianocore | 79 ------------------------------- resources/scripts/build/release/src | 7 --- 4 files changed, 8 insertions(+), 172 deletions(-) delete mode 100755 resources/scripts/build/clean/tianocore delete mode 100755 resources/scripts/build/payload/tianocore (limited to 'resources/scripts/build') diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index 1936c4d8..5c109c82 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -54,10 +54,8 @@ arch="undefined" # board.cfg files have to specifically enable [a] payload(s) payload_grub="n" payload_grub_withseabios="n" # seabios chainloaded from grub -payload_grub_withtianocore="n" # tianocore chainloaded from grub payload_seabios="n" payload_seabios_withgrub="n" # i386-coreboot grub accessible from SeaBIOS boot menu -payload_tianocore="n" seabios_opromloadonly="0" payload_memtest="n" # Override the above defaults using board.cfg @@ -79,8 +77,7 @@ if [ "${payload_memtest}" != "n" ] && \ [ "${payload_memtest}" != "y" ]; then payload_memtest="n" fi -if [ "${payload_grub_withseabios}" = "y" ] \ - || [ "${payload_grub_withtianocore}" = "y" ]; then +if [ "${payload_grub_withseabios}" = "y" ]; then payload_grub="y" fi if [ "${payload_grub_withseabios}" = "y" ]; then @@ -93,11 +90,7 @@ fi # NOTE: reverse logic must not be applied. If SeaBIOS-with-GRUB works, that doesn't # necessarily mean GRUB-with-SeaBIOS will work nicely. for example, the board might # only have an add-on GPU available, where it's recommended to boot SeaBIOS first -if [ "${payload_grub_withtianocore}" = "y" ]; then - payload_tianocore="y" -fi -if [ "${payload_grub}" != "y" ] && [ "${payload_seabios}" != "y" ] \ - && [ "${payload_tianocore}" != "y" ]; then +if [ "${payload_grub}" != "y" ] && [ "${payload_seabios}" != "y" ]; then while true; do for configfile in "resources/coreboot/${board}/config/"*; do if [ -f "${configfile}" ]; then @@ -123,7 +116,6 @@ fi cbfstool="${cbdir}/util/cbfstool/cbfstool" corebootrom="${cbdir}/build/coreboot.rom" seavgabiosrom="payload/seabios/seavgabios.bin" -tianocoreelf="payload/tianocore/tianocore.elf" if [ ! -d "${cbdir}" ]; then ./download coreboot ${cbtree} @@ -140,24 +132,10 @@ if [ "${arch}" = "x86_32" ] || [ "${arch}" = "x86_64" ]; then fi fi -if [ "${arch}" != "x86_64" ]; then - payload_tianocore="n" - payload_grub_withtianocore="n" -fi - if [ ! -f "${cbfstool}" ]; then ./build module cbutils ${cbtree} fi -if [ ! -f "${tianocoreelf}" ]; then - if [ "${payload_tianocore}" = "y" ]; then - ./build payload tianocore - elif [ "${payload_grub}" = "y" ] \ - && [ "${payload_grub_withtianocore}" = "y" ]; then - ./build payload tianocore - fi -fi - if [ ! -f "${seavgabiosrom}" ] \ || [ ! -f payload/seabios/seabios_libgfxinit.elf ] \ || [ ! -f payload/seabios/seabios_vgarom.elf ]; then @@ -276,20 +254,6 @@ mkCoreboot() { ) } -mkRomWithTianocoreOnly() { - rompath="${1}" - initmode="${2}" - if [ "${payload_tianocore}" = "y" ] && [ "${arch}" = "x86_64" ]; then - # do not include on 32-bit-only machines. this is 64-bit tianocore - - tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX) - cp "${corebootrom}" "${tmprom}" - "${cbfstool}" "${tmprom}" add-payload -f ${tianocoreelf} -n fallback/payload -c lzma - moverom "${tmprom}" "${romdir}/tianocore_${board}_${initmode}.rom" "${romtype}" - rm -f "${tmprom}" - fi -} - # make a rom in /tmp/ and then print the path of that ROM make_seabios_rom() { target_cbrom="${1}" # rom to insert seabios in. this rom won't be touched @@ -365,10 +329,6 @@ mkRomsWithGrub() { displaymode="${3}" firstpayloadname="${4}" # allow values: grub, seabios, seabios_withgrub, seabios_grubfirst - if [ "${payload_grub_withtianocore}" = "y" ] && [ "${firstpayloadname}" = "grub" ]; then - "${cbfstool}" "${tmprompath}" add-payload -f ${tianocoreelf} -n tianocore.elf -c lzma - fi - if [ "${payload_grub_withseabios}" = "y" ] && [ "${firstpayloadname}" = "grub" ]; then mv "$(make_seabios_rom "${tmprompath}" "seabios.elf" "${seabios_opromloadonly}" "${initmode}" "${cbfstool}")" "${tmprompath}" elif [ "${payload_seabios_withgrub}" ] && [ "${firstpayloadname}" != "grub" ]; then @@ -409,10 +369,9 @@ mkRomsWithGrub() { # Main ROM building function. This calls all other functions mkRoms() { - tianocoreRequiredDisplayMode="${1}" - cbcfgpath="${2}" - displaymode="${3}" - initmode="${4}" + cbcfgpath="${1}" + displaymode="${2}" + initmode="${3}" if [ ! -f "${cbcfgpath}" ]; then printf "'%s' does not exist. Skipping build for %s %s %s\n" \ @@ -422,10 +381,6 @@ mkRoms() { mkCoreboot "${cbdir}" "${cbcfgpath}" - if [ "${displaymode}" = "${tianocoreRequiredDisplayMode}" ]; then - mkRomWithTianocoreOnly "${corebootrom}" "${initmode}" - fi - if [ "${displaymode}" = "txtmode" ] && [ "${payload_memtest}" = "y" ]; then "${cbfstool}" "${corebootrom}" add-payload -f memtest86plus/memtest -n img/memtest -c lzma fi @@ -457,24 +412,21 @@ mkRoms() { } initmode="libgfxinit" -tianocoreRequiredDisplayMode="corebootfb" for displaymode in corebootfb txtmode; do cbcfgpath="resources/coreboot/${board}/config/${initmode}_${displaymode}" - mkRoms "${tianocoreRequiredDisplayMode}" "${cbcfgpath}" "${displaymode}" "${initmode}" + mkRoms "${cbcfgpath}" "${displaymode}" "${initmode}" done initmode="vgarom" -tianocoreRequiredDisplayMode="vesafb" for displaymode in vesafb txtmode; do cbcfgpath="resources/coreboot/${board}/config/${initmode}_${displaymode}" - mkRoms "${tianocoreRequiredDisplayMode}" "${cbcfgpath}" "${displaymode}" "${initmode}" + mkRoms "${cbcfgpath}" "${displaymode}" "${initmode}" done initmode="normal" displaymode="txtmode" -tianocoreRequiredDisplayMode="unsupported" cbcfgpath="resources/coreboot/${board}/config/${initmode}" -mkRoms "${tianocoreRequiredDisplayMode}" "${cbcfgpath}" "${displaymode}" "${initmode}" +mkRoms "${cbcfgpath}" "${displaymode}" "${initmode}" ( cd "${cbdir}" diff --git a/resources/scripts/build/clean/tianocore b/resources/scripts/build/clean/tianocore deleted file mode 100755 index a3ac119e..00000000 --- a/resources/scripts/build/clean/tianocore +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2020 Leah Rowe -# -# 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 . -# - -# This script assumes that the current working directory is the root -# of git or release archive - -[ "x${DEBUG+set}" = 'xset' ] && set -v -set -u -e - -if [ -d "coreboot/default/payloads/external/tianocore/tianocore" ]; then - ( - cd "coreboot/default/payloads/external/tianocore/" - make clean - ) -fi diff --git a/resources/scripts/build/payload/tianocore b/resources/scripts/build/payload/tianocore deleted file mode 100755 index f8bff805..00000000 --- a/resources/scripts/build/payload/tianocore +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env bash - -# helper script: builds Tianocore source code -# -# Copyright (C) 2020, 2021 Leah Rowe -# -# 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 . -# - -[ "x${DEBUG+set}" = 'xset' ] && set -v -set -u -e - -printf "Building Tianocore\n" - -[ ! -d "payload/" ] && mkdir -p payload/ -[ ! -d "payload/tianocore/" ] && mkdir -p payload/tianocore/ - -rm -f payload/tianocore/* - -if [ ! -d "coreboot/default/" ]; then - ./download coreboot default - ./build module cbutils default -fi - -if [ ! -d "coreboot/default/util/crossgcc/xgcc/i386-elf" ]; then - ( - # cat version coreboot/default/.coreboot-version -> breaks the build process; this file is not available, at the moment - - cd coreboot/default/ - make crossgcc-i386 CPUS=$(nproc) # tianocore actually uses host gcc, which means - # right now you should be building this on a 64-bit x86 host. - # It does not currently use coreboot crossgcc. However, a dummy coreboot - # ROM is compiled using Tianocore in order to derive tianocore.elf - - # and of course, that implies crossgcc. tianocore is only really use - # on x86, so we only care about i386 crossgcc here - ) -fi - -if [ ! -d "coreboot/default/payloads/external/tianocore/tianocore/" ]; then - ./download tianocore -fi - -( -cd coreboot/default/payloads/external/tianocore/ -make clean -) - -( -cd coreboot/default/ -make distclean -cp ../../resources/tianocore/dummy.coreboot.config .config -make -j$(nproc) -) - -cp coreboot/default/payloads/external/tianocore/tianocore/Build/UEFIPAYLOAD.fd \ - payload/tianocore/tianocore.elf - -( -cd coreboot/default/ -make distclean -) - -( -cd coreboot/default/payloads/external/tianocore/ -make clean -) - diff --git a/resources/scripts/build/release/src b/resources/scripts/build/release/src index 700b3d6c..8dcf0ec8 100755 --- a/resources/scripts/build/release/src +++ b/resources/scripts/build/release/src @@ -94,13 +94,6 @@ done rm -Rf coreboot/coreboot/ rm -Rf .git* */.git* coreboot/*/.git* coreboot/*/3rdparty/*/.git* rm -Rf coreboot/*/util/nvidia/cbootimage/.git* - rm -Rf coreboot/*/payloads/external/tianocore/tianocore/.git* - rm -Rf coreboot/*/payloads/external/tianocore/tianocore/CryptoPkg/Library/OpensslLib/openssl/.git* - rm -Rf coreboot/*/payloads/external/tianocore/tianocore/ArmPkg/Library/ArmSoftFloatLib/"berkeley-softfloat-3"/.git* - rm -Rf coreboot/*/payloads/external/tianocore/tianocore/UnitTestFrameworkPkg/Library/CmockaLib/cmocka/.git* - rm -Rf coreboot/*/payloads/external/tianocore/tianocore/MdeModulePkg/Universal/RegularExpressionDxe/oniguruma/.git* - rm -Rf coreboot/*/payloads/external/tianocore/tianocore/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/.git* - rm -Rf coreboot/*/payloads/external/tianocore/tianocore/BaseTools/Source/C/BrotliCompress/brotli/.git* ) ( -- cgit v1.2.1