libreboot!

this is forked from the "libre" branch in osboot, which is itself a libre,
deblobbed fork of osboot, a blobbed up fork of libreboot

libreboot needed to be purged clean. this is the new libreboot development
repository. the old one has been abandoned
This commit is contained in:
Leah Rowe
2021-05-18 13:56:12 +01:00
commit 89517ed6b9
219 changed files with 67311 additions and 0 deletions
+100
View File
@@ -0,0 +1,100 @@
#!/bin/bash
#
# helper script: build coreboot images with various payloads
#
# Copyright (C) 2014, 2015, 2016, 2020, 2021 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the working directory is the root
# of git or release archive
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
projectname="$(cat projectname)"
listboards() {
for boarddir in resources/coreboot/*; do
if [ ! -d "${boarddir}" ]; then continue; fi
board="${boarddir##resources/coreboot/}"
board="${board%/}"
printf '%s\n' "${board##*/}"
done
}
help() {
cat <<- EOF
USAGE: ./build boot roms boardname
To build *all* boards, do this: ./build boot roms all
To list *all* boards, do this: ./build boot roms list
possible values for 'options':
$(listboards)
Example: ./build boot roms x60
Example: ./build boot roms x200_8mb x60
Refer to the ${projectname} documentation for more information.
EOF
}
die() {
printf 'Error: %s\n' "${@}" 1>&2
exit 1
}
# Build ROM images for supported boards
buildrom() {
board="$1"
if [ -d "resources/coreboot/${board}/" ]; then
./build boot roms_helper "${board}"
else
die "\nbuild/roms: target not defined in the build system: %s\n" "${board}"
fi
}
if [ $# -gt 0 ]; then
firstoption="${1}"
if [ "${firstoption}" = "help" ]; then
help
exit 0
fi
if [ "${firstoption}" = "list" ]; then
listboards
exit 0
fi
printf "Building %s ROM images\n" "${projectname}"
if [ "${firstoption}" = "all" ]; then
for boardname in $(listboards); do
buildrom "${boardname}" || die "build/roms: something went wrong"
done
else
for board in ${@}; do
buildrom "${board}" || die "build/roms: something went wrong"
done
fi
else
help
exit 1
fi
printf "\n\nDone! Your ROMs are in bin/\n\n"
+454
View File
@@ -0,0 +1,454 @@
#!/bin/bash
# helper script: create ROM images for a given mainboard
#
# Copyright (C) 2020,2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the working directory is the root
# of git or release archive
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
projectname="$(cat projectname)"
if (( $# != 1 )); then
printf "Usage: ./build boot roms boardname\n"
printf "Example: ./build boot roms x60\n"
printf "Example: ./build boot roms x60 x200_8mb\n"
printf "Example: ./build boot roms all\n"
printf "You need to specify exactly 1 argument\n"
exit 1
fi
board="${1}"
if [ ! -d "resources/coreboot/${board}" ]; then
printf "build/roms: Target %s does not exist in the %s build system. Skipping build.\n" "${projectname}" "${board}"
exit 1
fi
if [ ! -f "resources/coreboot/${board}/board.cfg" ]; then
printf "build/roms: Target %s does not have a board.cfg. Skipping build.\n" "${board}"
exit 1
fi
cbtree="undefined"
romtype="normal" # optional parameter in board.cfg. "normal" is default
arch="undefined"
# Disable all payloads by default.
# 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"
# Override the above defaults using board.cfg
source "resources/coreboot/${board}/board.cfg"
if [ "${cbtree}" = "undefined" ]; then
printf "build/roms: Target %s does not define a coreboot tree. Skipping build.\n" "${board}"
exit 1
fi
if [ "${arch}" = "undefined" ]; then
printf "build/roms: Target %s does not define a CPU type. Skipping build.\n" "${board}"
exit 1
fi
if [ "${seabios_opromloadonly}" != "0" ] && \
[ "${seabios_opromloadonly}" != "1" ]; then
seabios_opromloadonly="0"
fi
if [ "${payload_grub_withseabios}" = "y" ] \
|| [ "${payload_grub_withtianocore}" = "y" ]; then
payload_grub="y"
fi
if [ "${payload_grub_withseabios}" = "y" ]; then
payload_seabios="y"
payload_seabios_withgrub="y" # if grub-first works, then seabios-with-grub will also work
fi
if [ "${payload_seabios_withgrub}" = "y" ]; then
payload_seabios="y" # if seabios-with-grub works, then SeaBIOS-alone should also work
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
while true; do
for configfile in "resources/coreboot/${board}/config/"*; do
if [ -f "${configfile}" ]; then
printf "ERROR build/roms: Target '%s' does not define a payload. Exiting.\n" "${board}"
exit 1
fi
done
break
done
fi
if [ ! -f "memtest86plus/memtest" ]; then
./build module memtest86plus
fi
romdir="bin/${board}"
cbdir="coreboot/${board}"
if [ "${board}" != "${cbtree}" ]; then
cbdir="coreboot/${cbtree}"
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}
fi
if [ "${arch}" = "x86_32" ] || [ "${arch}" = "x86_64" ]; then
if [ ! -d "${cbdir}/util/crossgcc/xgcc/i386-elf/" ]; then
(
cd "${cbdir}"
make crossgcc-i386 CPUS=$(nproc) # even for 64-bit machines, coreboot builds
# 32-bit ROM images, so we only need to worry about i386-elf
)
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
if [ "${payload_seabios}" = "y" ]; then
./build payload seabios
elif [ "${payload_grub}" = "y" ] \
&& [ "${payload_grub_withseabios}" = "y" ]; then
./build payload seabios
fi
fi
[ -d "${romdir}/" ] || mkdir -p "${romdir}/"
rm -f "${romdir}"/*
if [ "${payload_grub}" = "y" ] || [ "${payload_seabios_withgrub}" = "y" ]; then
if [ -f "payload/grub/grub_usqwerty.cfg" ]; then
grubrefchecksum="$(sha1sum resources/grub/config/grub.cfg)"
grubrefchecksum="${grubrefchecksum% resources/grub/config/grub.cfg}"
grubbuildchecksum="$(sha1sum payload/grub/grub_usqwerty.cfg)"
grubbuildchecksum="${grubbuildchecksum% payload/grub/grub_usqwerty.cfg}"
if [ "${grubrefchecksum}" != "${grubbuildchecksum}" ]; then
rm -Rf payload/grub/
printf "Changes detected to GRUB. Re-building now:\n"
fi
else
printf "Required GRUB payloads not yet built. Building now:\n"
rm -Rf payload/grub/ # just in case
fi
for keymapfile in resources/grub/keymap/*; do
if [ ! -f "${keymapfile}" ]; then
continue
fi
keymap="${keymapfile##*/}"
keymap="${keymap%.gkb}"
grubelf="payload/grub/grub_${keymap}.elf"
grubcfg="payload/grub/grub_${keymap}.cfg"
grubtestcfg="payload/grub/grub_${keymap}_test.cfg"
if [ ! -f "${grubelf}" ] || [ ! -f "${grubcfg}" ] || \
[ ! -f "${grubtestcfg}" ]; then
./build payload grub
fi
done
fi
# it is assumed that no other work will be done on the ROM
# after calling this function. therefore this function is "final"
moverom() {
rompath="$1"
newrompath="$2"
cuttype="$3"
printf "\nCreating new ROM image: %s\n" "${newrompath}"
if [ "${cuttype}" = "4MiB IFD BIOS region" ]; then
dd if=${rompath} of=${newrompath} bs=1 skip=$[$(stat -c %s ${rompath}) - 0x400000] count=4194304
else
cp ${rompath} ${newrompath}
fi
for romsize in 4 8 16; do
if [ "${cuttype}" = "${romsize}MiB ICH9 IFD NOR flash" ]; then
if [ ! -f "descriptors/ich9m/ich9fdgbe_${romsize}m.bin" ]; then
./build descriptors ich9m
fi
dd if=descriptors/ich9m/ich9fdgbe_${romsize}m.bin of=${newrompath} bs=1 count=12k conv=notrunc
fi
if [ "${cuttype}" = "${romsize}MiB ICH9 IFD NOGBE NOR flash" ]; then
if [ ! -f "descriptors/ich9m/ich9fdnogbe_${romsize}m.bin" ]; then
./build descriptors ich9m
fi
dd if=descriptors/ich9m/ich9fdnogbe_${romsize}m.bin of=${newrompath} bs=1 count=4k conv=notrunc
fi
done
if [ "${cuttype}" = "i945 laptop" ]; then
dd if=${newrompath} of=top64k.bin bs=1 skip=$[$(stat -c %s ${newrompath}) - 0x10000] count=64k
dd if=top64k.bin of=${newrompath} bs=1 seek=$[$(stat -c %s ${newrompath}) - 0x20000] count=64k conv=notrunc
rm -f top64k.bin
fi
}
# expected: configs must not specify a payload
mkCoreboot() {
cbdir="${1}" # e.g. coreboot/default
cbcfgpath="${2}" # e.g. resources/coreboot/x200_8mb/config/libgfxinit_txtmode
if [ ! -f "${cbcfgpath}" ]; then
printf "\nmkCoreboot: Coreboot config '%s' does not exist. Skipping build.\n" \
"${cbcfgpath}"
return 0
fi
printf "%s-%s\n" "$(cat projectname)" "$(cat version)" > "${cbdir}/.coreboot-version"
(
cd "${cbdir}"
make distclean
)
cp "${cbcfgpath}" "${cbdir}"/.config
(
cd "${cbdir}"
make -j$(nproc)
)
}
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
# a tmpfile will be made instead
target_seabios_cbfs_path="${2}" # e.g. fallback/payload
target_opromloadonly="${3}" # 0 or 1. if 1, only load but don't execute oproms
target_initmode="${4}" # e.g. libgfxinit
cbfstool_path="${5}"
if [ "${target_initmode}" = "normal" ]; then
target_seabioself="payload/seabios/seabios_vgarom.elf"
# if normal, etc/pci-optionrom-exec will be set to 2
else
target_seabioself="payload/seabios/seabios_${target_initmode}.elf"
# if libgfxinit, etc/pci-optionrom-exec will be set to 2
# if vgarom, etc/pci-optionrom-exec will be set to 0
fi
target_seavgabios_rom="payload/seabios/seavgabios.bin"
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)
cp "${target_cbrom}" "${tmprom}"
"${cbfstool}" "${tmprom}" add-payload -f "${target_seabioself}" -n ${target_seabios_cbfs_path} -c lzma
"${cbfstool}" "${tmprom}" add-int -i 3000 -n etc/ps2-keyboard-spinup
if [ "${target_initmode}" = "normal" ] || [ "${target_initmode}" = "libgfxinit" ]; then
"${cbfstool}" "${tmprom}" add-int -i 2 -n etc/pci-optionrom-exec
elif [ "${target_initmode}" = "vgarom" ]; then
"${cbfstool}" "${tmprom}" add-int -i 0 -n etc/pci-optionrom-exec
fi # for undefined modes, don't add this integer. rely on SeaBIOS defaults
"${cbfstool}" "${tmprom}" add-int -i 0 -n etc/optionroms-checksum
"${cbfstool}" "${tmprom}" add-int -i ${target_opromloadonly} -n etc/only-load-option-roms
if [ "${target_initmode}" = "libgfxinit" ]; then
"${cbfstool_path}" "${tmprom}" add -f "${target_seavgabios_rom}" -n vgaroms/seavgabios.bin -t raw
fi
printf "%s\n" "${tmprom}"
}
# make a rom in /tmp/ and then print the path of that ROM
make_grubrom_from_keymap() {
target_keymap="${1}"
target_cbrom="${2}"
cbfstool_path="${3}"
target_grubelf_cbfs_path="${4}" # e.g. fallback/payload
grubelf="payload/grub/grub_${target_keymap}.elf"
grubcfg="payload/grub/grub_${target_keymap}.cfg"
grubtestcfg="payload/grub/grub_${target_keymap}_test.cfg"
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)
cp "${target_cbrom}" "${tmprom}"
"${cbfstool_path}" "${tmprom}" add-payload -f "${grubelf}" -n ${target_grubelf_cbfs_path} -c lzma
"${cbfstool_path}" "${tmprom}" add -f "${grubcfg}" -n grub.cfg -t raw
"${cbfstool_path}" "${tmprom}" add -f "${grubtestcfg}" -n grubtest.cfg -t raw
printf "%s\n" "${tmprom}"
}
# Make separate ROM images with GRUB payload, for each supported keymap
mkRomsWithGrub() {
tmprompath="${1}"
initmode="${2}"
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
mv "$(make_seabios_rom "${tmprompath}" "fallback/payload" "${seabios_opromloadonly}" "${initmode}" "${cbfstool}")" "${tmprompath}"
if [ "${firstpayloadname}" = "seabios_grubfirst" ]; then
tmpbootorder=$(mktemp -t coreboot_rom.XXXXXXXXXX)
printf "/rom@img/grub2\n" > "${tmpbootorder}"
"${cbfstool}" "${tmprompath}" add -f "${tmpbootorder}" -n bootorder -t raw
rm -f "${tmpbootorder}"
"${cbfstool}" "${tmprompath}" add-int -i 0 -n etc/show-boot-menu
fi
fi
for keymapfile in resources/grub/keymap/*; do
if [ ! -f "${keymapfile}" ]; then
continue
fi
keymap="${keymapfile##*/}"
keymap="${keymap%.gkb}"
grub_path_in_cbfs="fallback/payload"
if [ "${firstpayloadname}" != "grub" ]; then
grub_path_in_cbfs="img/grub2"
fi
tmpgrubrom="$(make_grubrom_from_keymap "${keymap}" "${tmprompath}" "${cbfstool}" "${grub_path_in_cbfs}")"
if [ "${initmode}" = "normal" ]; then
newrompath="${romdir}/${firstpayloadname}_${board}_${initmode}_${keymap}.rom"
else
newrompath="${romdir}/${firstpayloadname}_${board}_${initmode}_${displaymode}_${keymap}.rom"
fi
moverom "${tmpgrubrom}" "${newrompath}" "${romtype}"
rm -f "${tmpgrubrom}"
done
}
# Main ROM building function. This calls all other functions
mkRoms() {
tianocoreRequiredDisplayMode="${1}"
cbcfgpath="${2}"
displaymode="${3}"
initmode="${4}"
if [ ! -f "${cbcfgpath}" ]; then
printf "'%s' does not exist. Skipping build for %s %s %s\n" \
"${cbcfgpath}" "${board}" "${displaymode}" "${initmode}"
return 0
fi
mkCoreboot "${cbdir}" "${cbcfgpath}"
if [ "${displaymode}" = "${tianocoreRequiredDisplayMode}" ]; then
mkRomWithTianocoreOnly "${corebootrom}" "${initmode}"
fi
if [ "${displaymode}" = "txtmode" ]; then
"${cbfstool}" "${corebootrom}" add-payload -f memtest86plus/memtest -n img/memtest -c lzma
fi
if [ "${payload_seabios}" = "y" ]; then
if [ "${payload_seabios_withgrub}" = "n" ]; then
tmpseabiosrom="$(make_seabios_rom "${corebootrom}" "fallback/payload" "${seabios_opromloadonly}" "${initmode}" "${cbfstool}")"
if [ "${initmode}" = "normal" ]; then
newrompath="${romdir}/seabios_${board}_${initmode}.rom"
else
newrompath="${romdir}/seabios_${board}_${initmode}_${displaymode}.rom"
fi
moverom "${tmpseabiosrom}" "${newrompath}" "${romtype}"
rm -f "${tmpseabiosrom}"
else
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)
cp "${corebootrom}" "${tmprom}"
mkRomsWithGrub "${tmprom}" "${initmode}" "${displaymode}" "seabios_withgrub"
cp "${corebootrom}" "${tmprom}"
mkRomsWithGrub "${tmprom}" "${initmode}" "${displaymode}" "seabios_grubfirst"
rm -f "${tmprom}"
fi
fi
if [ "${payload_grub}" = "y" ]; then
mkRomsWithGrub "${corebootrom}" "${initmode}" "${displaymode}" "grub"
fi
}
initmode="libgfxinit"
tianocoreRequiredDisplayMode="corebootfb"
for displaymode in corebootfb txtmode; do
cbcfgpath="resources/coreboot/${board}/config/${initmode}_${displaymode}"
mkRoms "${tianocoreRequiredDisplayMode}" "${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}"
done
initmode="normal"
displaymode="txtmode"
tianocoreRequiredDisplayMode="unsupported"
cbcfgpath="resources/coreboot/${board}/config/${initmode}"
mkRoms "${tianocoreRequiredDisplayMode}" "${cbcfgpath}" "${displaymode}" "${initmode}"
(
cd "${cbdir}"
make distclean
)
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
# helper script: clean the dependencies that were built in coreboot
#
# Copyright (C) 2014, 2015, 2016, 2020 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the current working directory is the root
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# clean coreboot utilities (dependencies for 'build'):
printf "Cleaning the previous build of coreboot and its utilities\n"
[ ! -d "coreboot/" ] && exit 0
for board in coreboot/*; do
if [ "${board##*/}" = "coreboot" ]; then
continue
fi
# Clean coreboot, of course
make -C "${board}/" distclean
# Clean its utilities as well
for util in {cbfs,ifd,nvram}tool cbmem; do
make -C "${board}/util/${util}/" clean
done
make -C "${board}/payloads/libpayload/" distclean
done
printf "\n\n"
+44
View File
@@ -0,0 +1,44 @@
#!/bin/bash
# helper script: clean the crossgcc builds
#
# Copyright (C) 2014, 2015, 2016, 2020 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the current working directory is the root
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# clean coreboot utilities (dependencies for 'build'):
printf "Cleaning crossgcc builds in all coreboot archives\n"
[ ! -d "coreboot/" ] && exit 0
# clean coreboot and crossgcc (source archives preserved)
for board in coreboot/*; do
if [ "${board##*/}" = "coreboot" ]; then
continue
fi
if [ ! -d "${board}" ]; then
continue
fi
make -C "${board}/" crossgcc-clean
done
printf "\n\n"
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
# helper script: clean the dependencies that were built in flashrom
#
# Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
printf "Cleaning the previous build of flashrom\n"
[ ! -d "flashrom/" ] && exit 0
# clean flashrom
make -C flashrom clean
printf "\n\n"
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
# helper script: clean the dependencies that were built in GRUB
#
# Copyright (C) 2014, 2015, 2016 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
printf "Cleaning the previous build of GRUB\n"
[ ! -d "grub/" ] && exit 0
(
cd grub/
if [ -f Makefile ]; then
make distclean
fi
)
printf "\n\n"
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# helper script: clean the previous build of ich9utils
#
# Copyright (C) 2014, 2015, 2020 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the current working directory is the root
# of libreboot_src or libreboot git
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# clean ich9deblob utility
# --------------------------------------------------------------------
if [ ! -d ich9utils ]; then
exit 0
fi
printf "Cleaning the previous build of ich9utils\n"
(
cd "ich9utils/"
make clean
)
rm -Rf descriptors/
printf "\n\n"
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
# helper script: clean the dependencies that were built in memtest86+
#
# Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
printf "Cleaning the previous build of MemTest86+\n"
[ ! -d "memtest86plus" ] && exit 0
# clean MemTest86+
make -C memtest86plus clean
printf "\n\n"
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
# helper script: nothing to see here, forks!
#
# Copyright (C) 2020, 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# clean bucts
# --------------------------------------------------------
printf "Cleaning up payloads\n"
rm -Rf payload/
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
# helper script: delete the ROM images
#
# Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
# Delete the ROM images
rm -Rf "bin/"
printf "Deleted the bin/ directory containing the ROM images.\n\n"
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# helper script: clean the dependencies that were built in seabios
#
# Copyright (C) 2015, 2020, 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# clean bucts
# --------------------------------------------------------
printf "Cleaning the previous build of seabios\n"
rm -f seabios_libgfxinit.elf seavgabios.bin seabios_vgarom.elf
[ ! -d "seabios/" ] && exit 0
(
cd "seabios/"
make distclean
)
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
# Copyright (C) 2020 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# 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
+90
View File
@@ -0,0 +1,90 @@
#!/bin/bash
# arch script: installs build dependencies for Arch Linux
#
# Copyright (C) 2021 Melissa Goad <mszoopers@protonmail.com>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
if [ $EUID -ne 0 ]; then
printf "This script must be run as root\n"
exit 1
fi
# Duplications are intentional. Please do not re-factor.
#
# This is so that they can moved to separate scripts.
#
pacman -S --needed --noconfirm wget
# For downloading source code
# ------------------------------------------------------------
pacman -S --needed --noconfirm git
# For building the documentation
# ------------------------------------------------------------
pacman -S --needed --noconfirm pandoc
# For Tianocore and iPXE
# TODO: check whether this is the full list
pacman -S --needed --noconfirm nasm perl-libwww python2 subversion
# For building source code:
# ------------------------------------------------------------
pacman -S --needed --noconfirm base-devel
# for running the crostool script (to get mrc.bin file for t440p)
pacman -S --needed --noconfirm sharutils curl parted e2fsprogs unzip
# for cross-compiling ARM binaries
pacman -S --needed --noconfirm arm-none-eabi-gcc
# Memtest86+ build dependencies
# ------------------------------------------------------------
pacman -S --needed --noconfirm base-devel python2
# i945-pwm build dependencies
# ------------------------------------------------------------
pacman -S --needed --noconfirm base-devel perl
# Coreboot build dependencies (also requires build-essential and git)
# ------------------------------------------------------------
pacman -S --needed --noconfirm ncurses doxygen acpica gdb flex bison base-devel git openssl gcc-ada
# GRUB build dependencies (also requires build-essential, bison and flex)
# ------------------------------------------------------------
pacman -S --needed --noconfirm bdf-unifont autogen help2man base-devel bison flex ttf-dejavu texinfo rsync python libusb xz gawk device-mapper fuse2 gettext freetype2
# BucTS build dependencies (external script)
# ------------------------------------------------------------
pacman -S --needed --noconfirm base-devel
# Flashrom build dependencies (also requires build-essential)
# ------------------------------------------------------------
pacman -S --needed --noconfirm libpciaccess pciutils zlib libftdi base-devel libusb
+110
View File
@@ -0,0 +1,110 @@
#!/bin/bash
# ubuntu2004 script: installs build dependencies for Ubuntu 20.04
#
# Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
if [ $EUID -ne 0 ]; then
printf "This script must be run as root\n"
exit 1
fi
# Duplications are intentional. Please do not re-factor.
#
# This is so that they can moved to separate scripts.
#
apt-get -y install wget
# For downloading source code
# ------------------------------------------------------------
apt-get -y install git
# For building the documentation
# ------------------------------------------------------------
apt-get -y install pandoc
# For Tianocore and iPXE
# TODO: check whether this is the full list
apt-get -y install uuid-dev nasm
# For building source code:
# ------------------------------------------------------------
apt-get -y install build-essential
# for running the crostool script (to get mrc.bin file for t440p)
apt-get -y install sharutils curl parted e2fsprogs unzip
# to use the right software versions and links for compiling
apt-get -y install pkg-config
# for cross-compiling ARM binaries
apt-get -y install gcc-arm-linux-gnueabi
[ "$(uname -i)" = x86_64 ] || [ "$(uname -m)" = x86_64 ]
arch=${?}
# For cross-compiling i686 target on x86_64 host.
if [ "${arch}" -eq 0 ]; then
apt-get -y install gcc-multilib libc6-i386 libc6-dev-i386
apt-get -y install lib32stdc++6 g++-multilib dh-autoreconf
# recommended, but not sure what for:
apt-get -y install lib32tinfo-dev
fi
# Memtest86+ build dependencies
# ------------------------------------------------------------
apt-get -y install build-essential python2.7
# i945-pwm build dependencies
# ------------------------------------------------------------
apt-get -y install build-essential perl
# Coreboot build dependencies (also requires build-essential and git)
# ------------------------------------------------------------
apt-get -y install libncurses5-dev doxygen iasl gdb flex bison build-essential git libssl-dev gnat
# For cross-compiling i686 target on x86_64 host.
[ "${arch}" -eq 0 ] && apt-get -y install lib32ncurses5-dev
# GRUB build dependencies (also requires build-essential, bison and flex)
# ------------------------------------------------------------
apt-get -y install ttf-unifont libopts25 libselinux1-dev autogen m4 autoconf help2man libopts25-dev libfont-freetype-perl automake autotools-dev build-essential bison flex libfuse-dev liblzma-dev gawk libdevmapper-dev libtool libfreetype6-dev
# BucTS build dependencies (external script)
# ------------------------------------------------------------
apt-get -y install build-essential
# Flashrom build dependencies (also requires build-essential)
# ------------------------------------------------------------
apt-get -y install libpci-dev pciutils zlib1g-dev libftdi-dev build-essential libusb-1.0-0-dev libusb-1.0 libusb-1.0-0-dev libusb-dev
# For cross-compiling i686 target on x86_64 host.
[ "${arch}" -eq 0 ] && apt-get -y install lib32z1-dev
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
# Copyright (C) 2020 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the current working directory is the root
# of libreboot_src or libreboot git
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
if [ ! -d ich9utils ]; then
./download ich9utils
fi
if [ ! -d ich9utils ]; then
printf "build/descriptors/ich9m: no ich9utils directory. Exiting\n"
exit 1
fi
if [ ! -f "ich9utils/ich9gen" ]; then
(
cd ich9utils/
make clean
make -j$(nproc)
)
fi
if [ ! -f "ich9utils/ich9gen" ]; then
printf "build/descriptors/ich9m: ich9gen wasn't compiled. Exiting\n"
exit 1
fi
[ -d "descriptors/" ] || mkdir -p "descriptors/"
[ -d "descriptors/ich9m/" ] || mkdir -p "descriptors/ich9m/"
rm -f descriptors/ich9m/*
(
cd descriptors/ich9m/
../../ich9utils/ich9gen
)
+78
View File
@@ -0,0 +1,78 @@
#!/bin/bash
# helper script: build various coreboot utilities
#
# Copyright (C) 2014, 2015, 2016, 2020, 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the current working directory is the root
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
printf "Building coreboot utils\n"
buildutils() {
cbtree="${1}"
if [ ! -d "coreboot/${cbtree}/" ]; then
./download coreboot $cbtree || return 1
fi
if [ ! -d "coreboot/${cbtree}/" ]; then
printf "build/cbutils: coreboot/%s not found. Exiting\n" "${cbtree}"
return 1
fi
for util in {cbfs,ifd}tool; do
(
cd "coreboot/${cbtree}/util/${util}/"
make -j$(nproc) || return 1
)
done
return 0
}
buildfromboardconfig() {
board="${1}"
if [ ! -d "resources/coreboot/${board}" ]; then
continue
fi
if [ ! -f "resources/coreboot/${board}/board.cfg" ]; then
continue
fi
cbtree="undefined"
source "resources/coreboot/${board}/board.cfg"
if [ "${cbtree}" = "undefined" ]; then
printf "build/cbutils: improper cbtree definition for '%s'" "${board}"
return 1
fi
buildutils "${cbtree}" || return 1
return 0
}
if [ $# -gt 0 ]; then
for board in "${@}"; do
buildfromboardconfig ${board} || exit 1
done
else
for boarddir in resources/coreboot/*; do
if [ ! -d "${boarddir}" ]; then
continue
fi
buildfromboardconfig ${boarddir##*/} || exit 1
done
fi
printf "\n\n"
exit 0
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
# helper script: builds flashrom source code
#
# Copyright (C) 2014, 2015 <info@minifree.org>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the working directory is the root
# of git or release archive
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# Build "flashrom" (utility for flashing/dumping ROMs)
# --------------------------------------------------------------------
if [ ! -d "flashrom/" ]; then
./download flashrom
fi
printf "Building flashrom\n"
(
cd "flashrom/"
make clean
make -j$(nproc)
)
+49
View File
@@ -0,0 +1,49 @@
#!/bin/bash
# helper script: builds GRUB2 source code
#
# Copyright (C) 2014, 2015, 2020 Leah Rowe <info@minifree.org>
# Copyright (C) 2015, 2016 Klemens Nanni <contact@autoboot.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the working directory is the root
# of git or release archive
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# Build GRUB2 as coreboot payload
printf "Building GRUB\n"
if [ ! -d "grub/" ]; then
./download grub
fi
# use a subshell to not end up in grub/ in case of build issues
(
cd grub/
# clean up first
[ -d Makefile ] && make distclean
./bootstrap --gnulib-srcdir=gnulib/ --no-git
# build
./autogen.sh
./configure --with-platform=coreboot
make -j$(nproc)
)
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# helper script: build ich9utils
#
# Copyright (C) 2014, 2015, 2020 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the current working directory is the root
# of libreboot_src or libreboot git
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
if [ ! -d ich9utils ]; then
./download ich9utils
fi
if [ ! -d ich9utils ]; then
printf "build/module/ich9utils: ich9utils not found. Exiting\n"
exit 1
fi
printf "Build ich9utils\n"
(
cd "ich9utils/"
make -j$(nproc)
)
printf "\n\n"
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# helper script: builds memtest86+ source code
#
# Copyright (C) 2014, 2015, 2020 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the working directory is the root
# of git or release archive
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# Build MemTest86+ payload
# --------------------------------------------------------------------
printf "Building MemTest86+\n"
if [ ! -d "memtest86plus/" ]; then
./download memtest86plus
fi
make -j$(nproc) -BC memtest86plus
+75
View File
@@ -0,0 +1,75 @@
#!/bin/bash
# generate GRUB ELF files (coreboot payload) and configuration files
#
# Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# This is where GRUB is expected to be (outside of the grub-assemble, instead in main checkout)
source "resources/grub/modules.list"
printf "Creating GRUB payloads and configuration files\n"
if [ ! -d "grub/" ]; then
./download grub
fi
if [ ! -f "grub/grub-mkstandalone" ]; then
./build module grub
fi
[ ! -d "payload/" ] && mkdir -p payload/
[ ! -d "payload/grub" ] && mkdir -p payload/grub/
rm -f payload/grub/*
# Separate GRUB payload per keymap. This saves space in the ROM, otherwise
# a lot of space would be used if every keymap was stored in a single image
for keylayoutfile in resources/grub/keymap/*.gkb; do
if [ ! -f "${keylayoutfile}" ]; then
continue
fi
keymap="${keylayoutfile##resources/grub/keymap/}"
keymap="${keymap%.gkb}"
grub/grub-mkstandalone \
--grub-mkimage="grub/grub-mkimage" \
-O i386-coreboot \
-o payload/grub/grub_${keymap}.elf \
-d grub/grub-core/ \
--fonts= --themes= --locales= \
--modules="${grub_modules}" \
--install-modules="${grub_install_modules}" \
/boot/grub/grub.cfg=resources/grub/config/grub_memdisk.cfg \
/boot/grub/layouts/${keymap}.gkb=${keylayoutfile}
if [ "${keymap}" = "usqwerty" ]; then
cp resources/grub/config/grub.cfg payload/grub/grub_usqwerty.cfg
else
sed "s/usqwerty/${keymap}/" < resources/grub/config/grub.cfg > payload/grub/grub_${keymap}.cfg
fi
sed "s/grubtest.cfg/grub.cfg/" < payload/grub/grub_${keymap}.cfg > payload/grub/grub_${keymap}_test.cfg
printf "Generated: 'payload/grub/grub_%s.elf' and configs.'\n" "${keymap}"
done
printf "Done! Check payload/grub/ to see the files.\n\n"
+63
View File
@@ -0,0 +1,63 @@
#!/bin/bash
# helper script: builds SeaBIOS source code
#
# Copyright (C) 2020, 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# Build SeaBIOS
# ---------------------------------------------------------------------
printf "Building SeaBIOS payloads and SeaVGABIOS\n"
[ ! -d "payload/" ] && mkdir -p payload/
[ ! -d "payload/seabios" ] && mkdir -p payload/seabios/
rm -f payload/seabios/*
if [ ! -d "seabios/" ]; then
./download seabios
fi
cd seabios/
# for libgfxinit setup:
[[ -f Makefile ]] && make distclean
cp ../resources/seabios/config/libgfxinit .config
make -j$(nproc)
mv out/bios.bin.elf ../payload/seabios/seabios_libgfxinit.elf
mv out/vgabios.bin ../payload/seabios/seavgabios.bin
rm .config
# for vgarom setup:
[[ -f Makefile ]] && make distclean
cp ../resources/seabios/config/vgarom .config
make -j$(nproc)
mv out/bios.bin.elf ../payload/seabios/seabios_vgarom.elf
rm .config
# clean it again. gotta keep it clean!
[[ -f Makefile ]] && make distclean
printf "Done! SeaBIOS files are in payload/seabios/\n\n"
# done. go back to main directory
cd ../
# ------------------- DONE ----------------------
+77
View File
@@ -0,0 +1,77 @@
#!/bin/bash
# helper script: builds Tianocore source code
#
# Copyright (C) 2020, 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "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
(
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
)
+70
View File
@@ -0,0 +1,70 @@
#!/bin/bash
#
# helper script: generate release archive (ROM images)
#
# Copyright (C) 2020,2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the working directory is the root
# of git or release archive
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
projectname="$(cat projectname)"
version="version-unknown"
if [ -f version ]; then
version="$(cat version)"
fi
versiondate="version-date-unknown"
if [ -f versiondate ]; then
versiondate="$(cat versiondate)"
fi
if [ ! -d "bin/" ]; then
./build boot roms all
fi
[ ! -d "release/" ] && \
mkdir -p release/
[ ! -d "release/${version}/" ] && \
mkdir -p "release/${version}/"
[ -d "release/${version}/roms/" ] && \
rm -Rf "release/${version}/roms/"
[ ! -d "release/${version}/roms/" ] && \
mkdir -p "release/${version}/roms/"
printf "Building ROM image archives for version %s\n" "${version}"
(
cd bin/
for target in *; do
if [ ! -d "${target}/" ]; then
continue
fi
printf "Generating release/%s/roms/%s-%s_%s.tar.xz\n" "${projectname}" "${version}" "${version}" "${target##*/}"
printf "%s\n" "${version}" > "${target}/version"
printf "%s\n" "${versiondate}" > "${target}/versiondate"
printf "%s\n" "${projectname}" > "${target}/projectname"
tar -c "${target}/" | xz -9e >"../release/${version}/roms/${projectname}-${version}_${target##*/}.tar.xz"
done
)
printf "\nROM image release archives available at release/%s/roms/\n\n" "${version}"
+120
View File
@@ -0,0 +1,120 @@
#!/bin/bash
#
# helper script: generate release archive (source code)
#
# Copyright (C) 2020,2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the working directory is the root
# of git or release archive
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
projectname="$(cat projectname)"
version="version-unknown"
if [ -f version ]; then
version="$(cat version)"
fi
versiondate="version-date-unknown"
if [ -f versiondate ]; then
versiondate="$(cat versiondate)"
fi
reldir="release/${version}"
dirname="${projectname}-${version}_src"
srcdir="${reldir}/${dirname}"
printf "Building source code archive, version %s\n" "${version}"
[ ! -d "release/" ] && mkdir -p release/
[ ! -d "${reldir}/" ] && mkdir -p "${reldir}/"
[ -d "${srcdir}/" ] && \
rm -Rf "${srcdir}/"
[ -f "${srcdir}.tar.xz" ] && \
rm -f "${srcdir}.tar.xz/"
mkdir -p "${srcdir}/"
printf "%s" "${version}" > "${srcdir}"/version
modlist="coreboot flashrom grub memtest86plus seabios ich9utils"
dirlist="resources"
filelist="download build README COPYING Makefile"
if [ ! -d "coreboot/default/payloads/external/tianocore/tianocore" ]; then
./download tianocore
fi
for modname in ${modlist}; do
if [ ! -d "${modname}/" ]; then
./download ${modname}
fi
done
for dir in ${modlist} ${dirlist}; do
cp -R "${dir}/" "${srcdir}/"
done
for i in ${filelist}; do
if [ ! -f "${i}" ]; then
printf "build/release/src: ERROR: file '%s' does not exist.\n" "${i}"
rm -Rf "${srcdir}"
exit 1
fi
cp ${i} "${srcdir}/"
done
(
cd "${srcdir}/coreboot/"
for i in *; do
[ ! -d "${i}" ] && continue
(
cd "${i}/"
make distclean
)
done
)
(
cd "${srcdir}/"
./build clean all
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*
)
(
cd "${reldir}/"
printf "%s\n" "${version}" > "${dirname}/version"
printf "%s\n" "${versiondate}" > "${dirname}/versiondate"
printf "%s\n" "${projectname}" > "${dirname}/projectname"
tar -c "${dirname}/" | xz -9e >"${dirname}.tar.xz"
rm -Rf "${dirname}/"
)
printf "Source code archive available at %s.tar.xz\n\n" "${srcdir}"
+226
View File
@@ -0,0 +1,226 @@
#!/bin/bash
# helper script: download coreboot
#
# Copyright (C) 2014, 2015, 2016, 2020, 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# set this when you want to modify each coreboot tree
# for example, you want to test custom patches
# NODELETE= ./download coreboot
deleteblobs="true"
[ "x${NODELETE+set}" = 'xset' ] && deleteblobs="false"
# Error handling is extreme in this script.
# This script handles the internet, and Git. Both are inherently unreliable.
[[ -f build_error ]] && rm -f build_error
rm -f resources/coreboot/*/seen
downloadfor() {
board="${1}"
cbtree="undefined"
cbrevision="undefined"
# The loop will always exit, but this while loop is crafted
# such that a tree referencing a tree that references another tree is possible
# (and so on)
while true; do
cbrevision="undefined"
cbtree="undefined"
if [ ! -f "resources/coreboot/${board}/board.cfg" ]; then
printf "ERROR: download/coreboot: board.cfg does not exist for '%s'\n" "${board}"
return 1
fi
if [ -f "resources/coreboot/${board}/seen" ]; then
printf "ERROR: download/coreboot: logical loop; '%s' board.cfg refers to another tree, which ultimately refers back to '%s'.\n" "${board}" "${board}"
return 1
fi
# This is to override $cbrevision and $cbtree
source "resources/coreboot/${board}/board.cfg" || touch ../build_error
if [ -f build_error ]; then
printf "ERROR: download/coreboot: problem sourcing %s/board.cfg\n" "${board}"
return 1
fi
touch "resources/coreboot/${board}/seen"
if [ "${board}" != "${cbtree}" ]; then
board="${cbtree}"
else
if [ "${cbtree}" = "undefined" ]; then
printf "ERROR: download/coreboot: tree name undefined for '%s\n'" "${board}"
return 1
fi
if [ "${cbrevision}" = "undefined" ]; then
printf "ERROR: download/coreboot: commit ID undefined for '%s'\n" "${board}"
return 1
fi
break
fi
done
rm -f resources/coreboot/*/seen
if [ -d "coreboot/${cbtree}" ]; then
printf "REMARK: download/coreboot: directory for '%s' already exists. Skipping setup.\n" "${cbtree}"
if [ "${cbtree}" != "${1}" ]; then
printf "(for board: '${1}')\n"
fi
return 0
fi
if [ ! -d coreboot ]; then
mkdir "coreboot/"
fi
if [ ! -d coreboot ]; then
printf "ERROR: download/coreboot: directory not created. Check file system permissions\n"
return 1
fi
cd "coreboot/"
if [ ! -d coreboot/.git ] && [ -d coreboot ]; then
rm -Rf coreboot/
fi
if [ ! -d coreboot ]; then
printf "Download coreboot from upstream:\n"
git clone https://review.coreboot.org/coreboot || rm -Rf coreboot
if [ ! -d coreboot ]; then
printf "WARNING: Upstream failed. Trying backup github repository:\n"
git clone https://github.com/coreboot/coreboot.git || rm -Rf coreboot
fi
if [ ! -d coreboot ]; then
printf "ERROR: download/coreboot: Problem with git-clone. Network issue?\n"
cd ../; return 1
fi
else
( cd coreboot/; git pull || touch ../build_error )
if [ -f ../build_error ]; then
printf "ERROR: download/coreboot: Problem with git-pull. Network issue?\n"
cd ../; return 1
fi
fi
cp -R coreboot "${cbtree}" || touch ../build_error
if [ -d ../build_error ]; then
printf "ERROR: download/coreboot: Unable to copy directory. Check file system permissions or free space.\n"
rm -Rf "${cbtree}/"
cd ../; return 1
fi
cd ${cbtree}/
git reset --hard ${cbrevision} || touch ../../build_error
if [ -f ../../build_error ]; then
printf "ERROR: download/coreboot: Unable to reset to commit ID/tag '%s' for board '%s' on tree '%s'\n" "${cbrevision}" "${1}" "${cbtree}"
cd ../../; return 1
fi
git submodule update --init || touch ../../build_error
if [ -f ../../build_error ]; then
printf "ERROR: download/coreboot: Unable to update submodules for tree '%s'\n" "${cbtree}"
cd ../../; return 1
fi
for patch in ../../resources/coreboot/${cbtree}/patches/*.patch; do
if [ ! -f "${patch}" ]; then
continue
fi
git am "${patch}" || touch ../../build_error
if [ -f ../../build_error ]; then
printf "ERROR: download/coreboot: Unable to apply patch '%s' for board '%s' on tree '%s'" "${patch}" "${1}" "${cbtree}"
git am --abort
cd ../../; return 1
fi
done
# extra.sh could be used to patch submodules, if you wanted to
# It's impossible to predict what submodules will be available, and
# it's rare that you'd want to patch them, so this is handled by
# extra.sh on a per-board basis
# In fact, extra.sh can be used for anything you want.
if [ -f "../../resources/coreboot/${board}/extra.sh" ]; then
"../../resources/coreboot/${board}/extra.sh" || touch ../../build_error
if [ -f ../../build_error ]; then
cd ../../; return 1
fi
return 0
else
cd ../../
return 0
fi
}
printf "Downloading coreboot and (if exist in build system) applying patches\n"
if [ $# -gt 0 ]; then
for board in "${@}"; do
rm -f resources/coreboot/*/seen
downloadfor "${board}"
if [ -f build_error ]; then break; fi
done
else
for board in resources/coreboot/*; do
rm -f resources/coreboot/*/seen
if [ ! -d "${board}/" ]; then
continue
fi
downloadfor "${board##*/}"
if [ -f build_error ]; then break; fi
done
fi
rm -f resources/coreboot/*/seen
rm -f "build_error"
printf "\n\n"
if [ "${deleteblobs}" = "true" ]; then
rm -Rf coreboot/coreboot/
rm -Rf coreboot/.git* coreboot/*/.git* coreboot/*/3rdparty/*/.git*
rm -Rf coreboot/*/util/nvidia/cbootimage/.git*
for cbdir in coreboot/*; do
if [ ! -d "${cbdir}" ]; then continue; fi
cbtree="${cbdir##coreboot/}"
cbtree="${cbtree%/}"
if [ ! -d "coreboot/${cbtree}" ]; then continue; fi
bloblist="resources/coreboot/${cbtree}/blobs.list"
if [ -f "${bloblist}" ]; then
for blobfile in $(cat "${bloblist}"); do
printf "Deleting blob: 'coreboot/%s/%s'\n" "${cbtree}" "${blobfile}"
rm -f "coreboot/${cbtree}/${blobfile}"
done
fi
rmlist="resources/coreboot/${cbtree}/rm.list"
if [ -f "${rmlist}" ]; then
for rmentry in $(cat "${rmlist}"); do
printf "Deleting directory to save space: 'coreboot/%s/%s'\n" "${cbtree}" "${rmentry}"
rm -Rf "coreboot/${cbtree}/${rmentry}"
done
fi
done
fi
exit 0
+51
View File
@@ -0,0 +1,51 @@
#!/bin/bash
# helper script: downloads flashrom and patches it
#
# Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# Get flashrom at the last previously tested revision
# Remove the old version that may still exist:
# ------------------------------------------------------------------------------
printf "Downloading flashrom\n"
rm -Rf "flashrom/"
# Get flashrom
# ------------------------------------------------------------------------------
# download it using git
git clone https://review.coreboot.org/flashrom.git
if [ ! -d "flashrom" ]; then
printf "flashrom not downloaded; check network connection?\n\n"
exit 1
fi
(
cd "flashrom/"
# reset to known revision
git reset --hard v1.2
)
printf "\n\n"
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
# helper script: Downloads GRUB and patches it.
#
# Copyright (C) 2014, 2015, 2016, 2020, 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# Remove the old version that may still exist
# ------------------------------------------------------------------------------
printf "Downloading GRUB\n"
rm -Rf "grub/"
# Get latest GRUB
# ------------------------------------------------------------------------------
# download it using git
git clone git://git.savannah.gnu.org/grub.git || git clone http://git.savannah.gnu.org/r/grub.git
if [ ! -d "grub" ]; then
printf "grub not downloaded; check network connection?\n\n"
exit 1
fi
(
# modifications are required
cd "grub/"
# reset to known revision
git reset --hard c0e647eb0e2bd09315612446cb4d90f7f75cb44c
git clone git://git.sv.gnu.org/gnulib gnulib
cd gnulib/
# NOTE: when updating this, make sure it's the version specified
# in bootstrap.conf on that version of GRUB, as specified above
git reset --hard d271f868a8df9bbec29049d01e056481b7a1a263
rm -Rf .git*
)
printf "\n\n"
+49
View File
@@ -0,0 +1,49 @@
#!/bin/bash
# helper script: downloads ich9utils
#
# Copyright (C) 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
printf "Downloading ich9utils\n"
if [ -d ich9utils ]; then
printf "ich9utils already downloaded. skipping\n"
exit 0
fi
# Get flashrom
# ------------------------------------------------------------------------------
# download it using git
git clone https://notabug.org/osboot/ich9utils.git
if [ ! -d "ich9utils" ]; then
printf "ich9utils not downloaded; check network connection?\n\n"
exit 1
fi
(
cd "ich9utils/"
# reset to known revision
git reset --hard 53749b0c6f7c5778bdd1ec2b91cd230626752579
)
printf "\n\n"
+68
View File
@@ -0,0 +1,68 @@
#!/bin/bash
# helper script: Downloads MemTest86+ and patches it
#
# Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Joseph Michael Thompson <jmt@josepht.me>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# Get the last version of MemTest86+ used, apply patches, build it.
# Remove the old version that may exist
# ------------------------------------------------------------------------------
printf "Downloading MemTest86+\n"
rm -Rf "memtest86plus/"
# Get latest memtest86+:
# ------------------------------------------------------------------------------
# download it using wget
wget http://memtest.org/download/5.31b/memtest86+-5.31b.tar.gz
if [ "$(sha512sum memtest86+-5.31b.tar.gz | cut -c1-128)" = "ad5891fd0c430ce7a5d0cde2d10dee20b66ad8060d47c3e70e038461d9cde3a78dfc13442b5b09da7c662741945a670353c72dbc08fd5ee8bae82256001a9541" ]; then
printf "Valid checksum for memtest86plus\n"
else
rm -f "memtest86+-5.31b.tar.gz"
printf "Invalid checksum for memtest86plus, or memtest86plus not downloaded\n"
exit 1
fi
# extract it
tar -xzf "memtest86+-5.31b.tar.gz"
# delete the tar file (no longer needed)
rm -f "memtest86+-5.31b.tar.gz"
# make direcotory name consistent
mv "memtest86+-5.31b/" "memtest86plus/"
# Apply necessary patches
# ------------------------------------------------------------------------------
(
cd "memtest86plus/"
for patch in ../resources/memtest86plus/patch/*; do
patch < "${patch}"
done
)
printf "\n\n"
+67
View File
@@ -0,0 +1,67 @@
#!/bin/bash
#
# Copyright (C) 2015, 2016, 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# Get SeaBIOS, revert to commit last used and apply patches.
# Remove the old version that may still exist
# ------------------------------------------------------------------------------
printf "Downloading SeaBIOS\n"
rm -f build_error
rm -rf "seabios/"
# Get latest SeaBIOS
# ------------------------------------------------------------------------------
# download it using git
git clone https://git.seabios.org/seabios.git
if [ ! -d "seabios" ]; then
printf "seabios not downloaded; check network connection?\n\n"
exit 1
fi
(
# modifications are required
cd "seabios/"
# Reset to the last commit that was tested (we use stable releases for seabios)
# ------------------------------------------------------------------------------
git reset --hard b0d61ecef66eb05bd7a4eb7ada88ec5dab06dfee
for patchfile in ../resources/seabios/patches/*.patch; do
git am "${patchfile}" || touch ../build_error
if [ -f ../build_error ]; then
git am --abort
break
fi
done
)
if [ -f build_error ]; then
rm -f build_error
exit 1
fi
exit 0
+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
#
# Copyright (C) 2020 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
printf "Downloading Tianocore\n"
if [ ! -d "coreboot/default/" ]; then
./download coreboot default
fi
(
cd "coreboot/default/payloads/external/tianocore/"
rm -Rf tianocore
make download && make update
)
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
# Copyright (C) 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
version="version-unknown"
if [ -f version ]; then
version="$(cat version)"
fi
version_="${version}"
if [ -d ".git/" ]; then
version="$(git describe --tags HEAD 2>&1)" \
|| version="git-$(git rev-parse HEAD 2>&1)" \
|| version="${version_}"
printf "%s\n" "${version}" > version
fi
versiondate="version-date-unknown"
if [ -f versiondate ]; then
versiondate="$(cat versiondate)"
fi
versiondate_="${versiondate}"
if [ -d ".git/" ]; then
versiondate="$(git show --no-patch --no-notes --pretty='%ct' HEAD)" \
|| versiondate="${versiondate_}"
printf "%s\n" "${versiondate}" > versiondate
fi
+82
View File
@@ -0,0 +1,82 @@
#!/bin/bash
#
# helper script: update coreboot configs (run make oldconfig)
#
# Copyright (C) 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the working directory is the root
# of git or release archive
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
printf "Updating coreboot configs\n"
# Build ROM images for supported boards
updateconf() {
board="$1"
if [ -f "resources/coreboot/${board}/board.cfg" ]; then
cbtree="undefined"
source "resources/coreboot/${board}/board.cfg"
if [ "${cbtree}" = "undefined" ]; then
return 0
fi
if [ ! -d "coreboot/${cbtree}" ]; then
./download coreboot ${cbtree}
fi
for cbcfg in resources/coreboot/${board}/config/*; do
if [ ! -f ${cbcfg} ]; then
continue
fi
(
cd coreboot/${cbtree}/
rm -f .config*
make distclean
)
mv $cbcfg coreboot/${cbtree}/.config
(
cd coreboot/${cbtree}/
make oldconfig
)
mv coreboot/${cbtree}/.config $cbcfg
rm -f coreboot/${cbtree}/.config*
(
cd coreboot/${cbtree}/
make distclean
)
done
else
printf "\nupdate/config/coreboot: no board.cfg for: %s\n" "${board}"
fi
}
if [ $# -gt 0 ]; then
for board in "${@}"; do
updateconf "${board}"
done
else
for board in resources/coreboot/*; do
if [ ! -d "${board}" ]; then
continue
fi
updateconf "${board##*/}"
done
fi
printf "\n\n"
+64
View File
@@ -0,0 +1,64 @@
#!/bin/bash
#
# helper script: update coreboot configs (run make oldconfig)
#
# Copyright (C) 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the working directory is the root
# of git or release archive
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
printf "Updating seabios configs\n"
if [ ! -d "seabios" ]; then
./download seabios
fi
if [ ! -d "seabios" ]; then
printf "error: Failed to download SeaBIOS. check internet connection?\n"
exit 1
fi
for config in resources/seabios/config/*; do
if [ ! -f "${config}" ]; then continue; fi
(
cd seabios
make distclean
)
mv "${config}" seabios/.config
(
cd seabios
make oldconfig
)
cp seabios/.config "${config}"
(
cd seabios
make distclean
)
done
printf "\n\n"
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
#
# helper script: update coreboot configs (run make oldconfig)
#
# Copyright (C) 2021 Leah Rowe <info@minifree.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
# This script assumes that the working directory is the root
# of git or release archive
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
printf "Updating tianocore dummy config\n"
# Build ROM images for supported boards
cbtree="default"
if [ ! -d coreboot/${cbtree} ]; then
./download coreboot ${cbtree}
fi
(
cd coreboot/${cbtree}/
rm -f .config*
make distclean
)
mv resources/tianocore/dummy.coreboot.config coreboot/${cbtree}/.config
(
cd coreboot/${cbtree}/
make oldconfig
)
mv coreboot/${cbtree}/.config resources/tianocore/dummy.coreboot.config
rm -f coreboot/${cbtree}/.config*
(
cd coreboot/${cbtree}/
make distclean
)
printf "\n\n"