diff options
author | 4 of 7 (Leah Rowe) info@minifree.org <info@minifree.org> | 2017-01-21 18:14:33 +0000 |
---|---|---|
committer | 4 of 7 (Leah Rowe) info@minifree.org <info@minifree.org> | 2017-01-21 18:18:20 +0000 |
commit | 4b0752e1c264c4ba2a354507ca97bb2e039dda1a (patch) | |
tree | dca24f3d11087443aa9c8b2d823ed1d5b8dad001 /resources/scripts/helpers | |
parent | 3c17e8d80e5bacacddb8be37b598cd91cf543539 (diff) | |
download | librebootfr-4b0752e1c264c4ba2a354507ca97bb2e039dda1a.tar.gz librebootfr-4b0752e1c264c4ba2a354507ca97bb2e039dda1a.zip |
re-add old build system (for x86 boards/utils)
Everything will be migrated over to the new build system after release.
Diffstat (limited to 'resources/scripts/helpers')
61 files changed, 4231 insertions, 0 deletions
diff --git a/resources/scripts/helpers/build/clean/bucts b/resources/scripts/helpers/build/clean/bucts new file mode 100755 index 00000000..f7f7edd5 --- /dev/null +++ b/resources/scripts/helpers/build/clean/bucts @@ -0,0 +1,38 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in bucts +# +# 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/>. +# + +# 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 bucts +# -------------------------------------------------------- + +printf "Cleaning the previous build of bucts\n" + +cd "bucts/" +make clean + +printf "\n\n" + +# done. go back to main directory. +cd "../" diff --git a/resources/scripts/helpers/build/clean/coreboot b/resources/scripts/helpers/build/clean/coreboot new file mode 100755 index 00000000..f72e2f1f --- /dev/null +++ b/resources/scripts/helpers/build/clean/coreboot @@ -0,0 +1,48 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in coreboot +# +# 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 + +[ "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" + +# clean coreboot and crossgcc (source archives preserved) +for payload in coreboot/*; do + for board in "${payload}/"*; do + + # 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 + + rm -f "${board}/util/crossgcc" + done +done + +printf "\n\n" diff --git a/resources/scripts/helpers/build/clean/crossgcc b/resources/scripts/helpers/build/clean/crossgcc new file mode 100755 index 00000000..78a89349 --- /dev/null +++ b/resources/scripts/helpers/build/clean/crossgcc @@ -0,0 +1,28 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in coreboot +# +# 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 + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +make -C "crossgcc/" crossgcc-clean + diff --git a/resources/scripts/helpers/build/clean/depthcharge b/resources/scripts/helpers/build/clean/depthcharge new file mode 100755 index 00000000..9751d924 --- /dev/null +++ b/resources/scripts/helpers/build/clean/depthcharge @@ -0,0 +1,38 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in depthcharge +# +# Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr> +# +# 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 depthcharge +# -------------------------------------------------------- + +cd "depthcharge/" + +printf "Cleaning the previous build of depthcharge\n" +make distclean + +# done. go back to main directoy +cd "../" + +printf "\n\n" diff --git a/resources/scripts/helpers/build/clean/flashrom b/resources/scripts/helpers/build/clean/flashrom new file mode 100755 index 00000000..241917f0 --- /dev/null +++ b/resources/scripts/helpers/build/clean/flashrom @@ -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" + +# clean flashrom +make -C flashrom clean +rm -f "flashrom/flashrom_lenovobios_sst" +rm -f "flashrom/flashrom_lenovobios_macronix" + +printf "\n\n" diff --git a/resources/scripts/helpers/build/clean/grub b/resources/scripts/helpers/build/clean/grub new file mode 100755 index 00000000..2b2f6a5d --- /dev/null +++ b/resources/scripts/helpers/build/clean/grub @@ -0,0 +1,35 @@ +#!/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" +# clean GURB +[ -d grub/Makefile ] && make -C grub distclean + +# Also clean SeaBIOS +./build clean seabios + +printf "\n\n" diff --git a/resources/scripts/helpers/build/clean/i945pwm b/resources/scripts/helpers/build/clean/i945pwm new file mode 100755 index 00000000..91bf6f78 --- /dev/null +++ b/resources/scripts/helpers/build/clean/i945pwm @@ -0,0 +1,34 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in i945pwm +# +# 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/>. +# + +# 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 i945-pwm utility +# -------------------------------------------------------------------- + +printf "Cleaning the previous build of i945-pwm\n" +cd "resources/utilities/i945-pwm/" +make clean +cd "../../../" +printf "\n\n" diff --git a/resources/scripts/helpers/build/clean/ich9deblob b/resources/scripts/helpers/build/clean/ich9deblob new file mode 100755 index 00000000..d9019fc3 --- /dev/null +++ b/resources/scripts/helpers/build/clean/ich9deblob @@ -0,0 +1,34 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in ich9deblob +# +# 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/>. +# + +# 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 +# -------------------------------------------------------------------- + +printf "Cleaning the previous build of ich9deblob\n" +cd "resources/utilities/ich9deblob/" +make clean +cd "../../../" +printf "\n\n" diff --git a/resources/scripts/helpers/build/clean/memtest86plus b/resources/scripts/helpers/build/clean/memtest86plus new file mode 100755 index 00000000..db40be32 --- /dev/null +++ b/resources/scripts/helpers/build/clean/memtest86plus @@ -0,0 +1,33 @@ +#!/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" + +# clean MemTest86+ +make -C memtest86plus clean + +printf "\n\n" diff --git a/resources/scripts/helpers/build/clean/rom_images b/resources/scripts/helpers/build/clean/rom_images new file mode 100755 index 00000000..abf352d0 --- /dev/null +++ b/resources/scripts/helpers/build/clean/rom_images @@ -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" diff --git a/resources/scripts/helpers/build/clean/seabios b/resources/scripts/helpers/build/clean/seabios new file mode 100755 index 00000000..09203ab8 --- /dev/null +++ b/resources/scripts/helpers/build/clean/seabios @@ -0,0 +1,37 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in seabios +# +# Copyright (C) 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/>. +# + +# 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 bucts +# -------------------------------------------------------- + +printf "Cleaning the previous build of seabios\n" + +( +cd "seabios/" +rm -f "out/bios.bin.vga.elf" +make distclean +) + diff --git a/resources/scripts/helpers/build/config/dcmodify b/resources/scripts/helpers/build/config/dcmodify new file mode 100755 index 00000000..81e8756e --- /dev/null +++ b/resources/scripts/helpers/build/config/dcmodify @@ -0,0 +1,72 @@ +#!/bin/bash + +# +# helper script: run "make menuconfig" on config(s) to modify them +# +# Copyright (C) 2014, 2015, 2016 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 libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +payload="depthcharge" +configpath="resources/libreboot/config/${payload}" + +hackconfig () { + board="${1}" + cbrevision="$(cat ${configpath}/${board}/cbrevision)" + vbootrevision="$(cat ${configpath}/${board}/vbootrevision)" +( + cd "coreboot/${cbrevision}/${cbrevision}/" + git checkout ${payload}_${board} + ( + cd "3rdparty/vboot/" + git checkout ${payload}_${board} + ) + + printf "Modifying config for %s (%s payload)\n" "${board}" "${payload}" + sleep 2 + + if [ ! -d "../../../${configpath}/${board}/" ]; then + printf "build/config/dcmodify WARNING: config '%s' does not exist. Skipping.\n" "${board}" + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) + return + fi + + mv "../../../${configpath}/${board}/config" ".config" + make menuconfig + mv ".config" "../../../${configpath}/${board}/config" + + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) +) +} + +if [ $# -lt 1 ]; then + for config in ${configpath}/*; do hackconfig "${config##*/}"; done +else + for config in "${@}"; do hackconfig "${config}"; done +fi diff --git a/resources/scripts/helpers/build/config/dcreplace b/resources/scripts/helpers/build/config/dcreplace new file mode 100755 index 00000000..d3265ae2 --- /dev/null +++ b/resources/scripts/helpers/build/config/dcreplace @@ -0,0 +1,63 @@ +#!/bin/bash + +# +# helper script: run "make menuconfig" on config(s) to replace them +# +# Copyright (C) 2014, 2015, 2016 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 libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +payload="depthcharge" +configpath="resources/libreboot/config/${payload}" + +hackconfig () { + board="${1}" + cbrevision="$(cat ${configpath}/${board}/cbrevision)" + vbootrevision="$(cat ${configpath}/${board}/vbootrevision)" +( + cd "coreboot/${cbrevision}/${cbrevision}/" + git checkout ${payload}_${board} + ( + cd "3rdparty/vboot/" + git checkout ${payload}_${board} + ) + + printf "Replacing or creating new config for %s (%s payload)\n" "${board}" "${payload}" + sleep 2 + + make menuconfig + + [ ! -d "../../../${configpath}/${board}/" ] && mkdir -p "../../../${configpath}/${board}/" + mv ".config" "../../../${configpath}/${board}/config" + + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) +) +} + +if [ $# -lt 1 ]; then + for config in ${configpath}/*; do hackconfig "${config##*/}"; done +else + for config in "${@}"; do hackconfig "${config}"; done +fi diff --git a/resources/scripts/helpers/build/config/dcupdate b/resources/scripts/helpers/build/config/dcupdate new file mode 100755 index 00000000..8d45c9de --- /dev/null +++ b/resources/scripts/helpers/build/config/dcupdate @@ -0,0 +1,72 @@ +#!/bin/bash + +# +# helper script: run "make oldconfig" on all coreboot config files +# +# Copyright (C) 2014, 2015, 2016 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 libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +payload="depthcharge" +configpath="resources/libreboot/config/${payload}" + +hackconfig () { + board="${1}" + cbrevision="$(cat ${configpath}/${board}/cbrevision)" + vbootrevision="$(cat ${configpath}/${board}/vbootrevision)" +( + cd "coreboot/${cbrevision}/${cbrevision}/" + git checkout ${payload}_${board} + ( + cd "3rdparty/vboot/" + git checkout ${payload}_${board} + ) + + printf "Updating config for %s (%s payload)\n" "${board}" "${payload}" + sleep 2 + + if [ ! -d "../../../${configpath}/${board}/" ]; then + printf "build/config/dcupdate WARNING: config '%s' does not exist. Skipping.\n" "${board}" + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) + return + fi + + mv "../../../${configpath}/${board}/config" ".config" + make oldconfig + mv ".config" "../../../${configpath}/${board}/config" + + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) +) +} + +if [ $# -lt 1 ]; then + for config in ${configpath}/*; do hackconfig "${config##*/}"; done +else + for config in "${@}"; do hackconfig "${config}"; done +fi diff --git a/resources/scripts/helpers/build/config/grubmodify b/resources/scripts/helpers/build/config/grubmodify new file mode 100755 index 00000000..f6075034 --- /dev/null +++ b/resources/scripts/helpers/build/config/grubmodify @@ -0,0 +1,72 @@ +#!/bin/bash + +# +# helper script: run "make menuconfig" on config(s) to modify them +# +# Copyright (C) 2014, 2015, 2016 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 libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +payload="grub" +configpath="resources/libreboot/config/${payload}" + +hackconfig () { + board="${1}" + cbrevision="$(cat ${configpath}/${board}/cbrevision)" + vbootrevision="$(cat ${configpath}/${board}/vbootrevision)" +( + cd "coreboot/${cbrevision}/${cbrevision}/" + git checkout ${payload}_${board} + ( + cd "3rdparty/vboot/" + git checkout ${payload}_${board} + ) + + printf "Modifying config for %s (%s payload)\n" "${board}" "${payload}" + sleep 2 + + if [ ! -d "../../../${configpath}/${board}/" ]; then + printf "build/config/grubmodify WARNING: config '%s' does not exist. Skipping.\n" "${board}" + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) + return + fi + + mv "../../../${configpath}/${board}/config" ".config" + make menuconfig + mv ".config" "../../../${configpath}/${board}/config" + + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) +) +} + +if [ $# -lt 1 ]; then + for config in ${configpath}/*; do hackconfig "${config##*/}"; done +else + for config in "${@}"; do hackconfig "${config}"; done +fi diff --git a/resources/scripts/helpers/build/config/grubreplace b/resources/scripts/helpers/build/config/grubreplace new file mode 100755 index 00000000..ba8d55b8 --- /dev/null +++ b/resources/scripts/helpers/build/config/grubreplace @@ -0,0 +1,63 @@ +#!/bin/bash + +# +# helper script: run "make menuconfig" on config(s) to replace them +# +# Copyright (C) 2014, 2015, 2016 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 libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +payload="grub" +configpath="resources/libreboot/config/${payload}" + +hackconfig () { + board="${1}" + cbrevision="$(cat ${configpath}/${board}/cbrevision)" + vbootrevision="$(cat ${configpath}/${board}/vbootrevision)" +( + cd "coreboot/${cbrevision}/${cbrevision}/" + git checkout ${payload}_${board} + ( + cd "3rdparty/vboot/" + git checkout ${payload}_${board} + ) + + printf "Replacing or creating new config for %s (%s payload)\n" "${board}" "${payload}" + sleep 2 + + make menuconfig + + [ ! -d "../../../${configpath}/${board}/" ] && mkdir -p "../../../${configpath}/${board}/" + mv ".config" "../../../${configpath}/${board}/config" + + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) +) +} + +if [ $# -lt 1 ]; then + for config in ${configpath}/*; do hackconfig "${config##*/}"; done +else + for config in "${@}"; do hackconfig "${config}"; done +fi diff --git a/resources/scripts/helpers/build/config/grubupdate b/resources/scripts/helpers/build/config/grubupdate new file mode 100755 index 00000000..e9d9719c --- /dev/null +++ b/resources/scripts/helpers/build/config/grubupdate @@ -0,0 +1,72 @@ +#!/bin/bash + +# +# helper script: run "make oldconfig" on all coreboot config files +# +# Copyright (C) 2014, 2015, 2016 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 libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +payload="grub" +configpath="resources/libreboot/config/${payload}" + +hackconfig () { + board="${1}" + cbrevision="$(cat ${configpath}/${board}/cbrevision)" + vbootrevision="$(cat ${configpath}/${board}/vbootrevision)" +( + cd "coreboot/${cbrevision}/${cbrevision}/" + git checkout ${payload}_${board} + ( + cd "3rdparty/vboot/" + git checkout ${payload}_${board} + ) + + printf "Updating config for %s (%s payload)\n" "${board}" "${payload}" + sleep 2 + + if [ ! -d "../../../${configpath}/${board}/" ]; then + printf "build/config/grubupdate WARNING: config '%s' does not exist. Skipping.\n" "${board}" + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) + return + fi + + mv "../../../${configpath}/${board}/config" ".config" + make oldconfig + mv ".config" "../../../${configpath}/${board}/config" + + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) +) +} + +if [ $# -lt 1 ]; then + for config in ${configpath}/*; do hackconfig "${config##*/}"; done +else + for config in "${@}"; do hackconfig "${config}"; done +fi diff --git a/resources/scripts/helpers/build/config/seabiosmodify b/resources/scripts/helpers/build/config/seabiosmodify new file mode 100755 index 00000000..15f9ca48 --- /dev/null +++ b/resources/scripts/helpers/build/config/seabiosmodify @@ -0,0 +1,45 @@ +#!/bin/bash + +# +# helper script: update the seabios config +# +# 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/>. +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +( +cd "seabios/" + +for cfgtype in config config_vga; do + + printf "doing config %s\n" "${cfgtype}" + sleep 2 + + if [ -f "../resources/seabios/config/${cfgtype}" ]; then + cp "../resources/seabios/config/${cfgtype}" ".config" + fi + + make menuconfig + + mv ".config" "../resources/seabios/config/${cfgtype}" + +done +) diff --git a/resources/scripts/helpers/build/config/seabiosrommodify b/resources/scripts/helpers/build/config/seabiosrommodify new file mode 100755 index 00000000..df58928e --- /dev/null +++ b/resources/scripts/helpers/build/config/seabiosrommodify @@ -0,0 +1,72 @@ +#!/bin/bash + +# +# helper script: run "make menuconfig" on config(s) to modify them +# +# Copyright (C) 2014, 2015, 2016 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 libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +payload="seabios" +configpath="resources/libreboot/config/${payload}" + +hackconfig () { + board="${1}" + cbrevision="$(cat ${configpath}/${board}/cbrevision)" + vbootrevision="$(cat ${configpath}/${board}/vbootrevision)" +( + cd "coreboot/${cbrevision}/${cbrevision}/" + git checkout ${payload}_${board} + ( + cd "3rdparty/vboot/" + git checkout ${payload}_${board} + ) + + printf "Modifying config for %s (%s payload)\n" "${board}" "${payload}" + sleep 2 + + if [ ! -d "../../../${configpath}/${board}/" ]; then + printf "build/config/seabiosmodify WARNING: config '%s' does not exist. Skipping.\n" "${board}" + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) + return + fi + + mv "../../../${configpath}/${board}/config" ".config" + make menuconfig + mv ".config" "../../../${configpath}/${board}/config" + + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) +) +} + +if [ $# -lt 1 ]; then + for config in ${configpath}/*; do hackconfig "${config##*/}"; done +else + for config in "${@}"; do hackconfig "${config}"; done +fi diff --git a/resources/scripts/helpers/build/config/seabiosromreplace b/resources/scripts/helpers/build/config/seabiosromreplace new file mode 100755 index 00000000..75453553 --- /dev/null +++ b/resources/scripts/helpers/build/config/seabiosromreplace @@ -0,0 +1,63 @@ +#!/bin/bash + +# +# helper script: run "make menuconfig" on config(s) to replace them +# +# Copyright (C) 2014, 2015, 2016 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 libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +payload="seabios" +configpath="resources/libreboot/config/${payload}" + +hackconfig () { + board="${1}" + cbrevision="$(cat ${configpath}/${board}/cbrevision)" + vbootrevision="$(cat ${configpath}/${board}/vbootrevision)" +( + cd "coreboot/${cbrevision}/${cbrevision}/" + git checkout ${payload}_${board} + ( + cd "3rdparty/vboot/" + git checkout ${payload}_${board} + ) + + printf "Replacing or creating new config for %s (%s payload)\n" "${board}" "${payload}" + sleep 2 + + make menuconfig + + [ ! -d "../../../${configpath}/${board}/" ] && mkdir -p "../../../${configpath}/${board}/" + mv ".config" "../../../${configpath}/${board}/config" + + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) +) +} + +if [ $# -lt 1 ]; then + for config in ${configpath}/*; do hackconfig "${config##*/}"; done +else + for config in "${@}"; do hackconfig "${config}"; done +fi diff --git a/resources/scripts/helpers/build/config/seabiosromupdate b/resources/scripts/helpers/build/config/seabiosromupdate new file mode 100755 index 00000000..1dc4673e --- /dev/null +++ b/resources/scripts/helpers/build/config/seabiosromupdate @@ -0,0 +1,72 @@ +#!/bin/bash + +# +# helper script: run "make oldconfig" on all coreboot config files +# +# Copyright (C) 2014, 2015, 2016 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 libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +payload="seabios" +configpath="resources/libreboot/config/${payload}" + +hackconfig () { + board="${1}" + cbrevision="$(cat ${configpath}/${board}/cbrevision)" + vbootrevision="$(cat ${configpath}/${board}/vbootrevision)" +( + cd "coreboot/${cbrevision}/${cbrevision}/" + git checkout ${payload}_${board} + ( + cd "3rdparty/vboot/" + git checkout ${payload}_${board} + ) + + printf "Updating config for %s (%s payload)\n" "${board}" "${payload}" + sleep 2 + + if [ ! -d "../../../${configpath}/${board}/" ]; then + printf "build/config/seabiosupdate WARNING: config '%s' does not exist. Skipping.\n" "${board}" + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) + return + fi + + mv "../../../${configpath}/${board}/config" ".config" + make oldconfig + mv ".config" "../../../${configpath}/${board}/config" + + git checkout master + ( + cd "3rdparty/vboot/" + git checkout master + ) +) +} + +if [ $# -lt 1 ]; then + for config in ${configpath}/*; do hackconfig "${config##*/}"; done +else + for config in "${@}"; do hackconfig "${config}"; done +fi diff --git a/resources/scripts/helpers/build/config/seabiosupdate b/resources/scripts/helpers/build/config/seabiosupdate new file mode 100755 index 00000000..17b0204b --- /dev/null +++ b/resources/scripts/helpers/build/config/seabiosupdate @@ -0,0 +1,43 @@ +#!/bin/bash + +# +# helper script: update the seabios config +# +# 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/>. +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +( +cd seabios/ + +for cfgtype in config config_vga; do + + printf "doing config %s\n" "${cfgtype}" + sleep 2 + + if [ -f ../resources/seabios/config/${cfgtype} ]; then + cp ../resources/seabios/config/${cfgtype} .config + make oldconfig + mv .config ../resources/seabios/config/${cfgtype} + fi + +done +) diff --git a/resources/scripts/helpers/build/dependencies/parabola b/resources/scripts/helpers/build/dependencies/parabola new file mode 100755 index 00000000..44052418 --- /dev/null +++ b/resources/scripts/helpers/build/dependencies/parabola @@ -0,0 +1,110 @@ +#!/bin/bash + +# helper script: installs build dependencies for Parabola + +# this script is based on the script for Trisquel 7 +# +# Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org> +# Copyright (C) 2015 Klemens Nanni <klemens@posteo.de> +# +# 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 wget + +# For downloading source code +# ------------------------------------------------------------ + +printf "Source Code: In order to download the it, git is needed\n" +pacman -S --needed git + +# For building the documentation +# ------------------------------------------------------------ + +pacman -S --needed pandoc texi2html + +# For building source code: +# ------------------------------------------------------------ + +printf "Building Source Code: development packages\n" +pacman -S --needed base-devel libstdc++5 + +pacman -S arm-none-eabi-gcc + +pacman -S --needed libpciaccess + +[ "$(uname -i)" = x86_64 ] || [ "$(uname -m)" = x86_64 ] +arch=${?} + +# For cross-compiling i686 target on x86_64 host. +if [ "${arch}" -eq 0 ]; then + printf "Cross-Compiling: You are running on 64-bit architecture, however 32-bit libraries are needed\n" + pacman -Sl multilib &>/dev/null || (printf "You must enable the multilib repository in /etc/pacman.conf first\n"; exit 1) + pacman -S --needed gcc-multilib gcc-libs-multilib lib32-libltdl lib32-libpciaccess lib32-libstdc++5 lib32-glibc lib32-fakeroot +fi + +# Memtest86+ build dependencies +# ------------------------------------------------------------ + +# pacman -S --needed base-devel + +# i945-pwm build dependencies +# ------------------------------------------------------------ + +# pacman -S base-devel + +# Coreboot build dependencies (also requires build-essential and git) +# ------------------------------------------------------------ + +printf "Coreboot: Ncurses for menuconfig and a few other tools\n" +pacman -S ncurses doxygen iasl gdb flex bison +# pacman -S git base-devel + +# For cross-compiling i686 target on x86_64 host. +if [ "${arch}" -eq 0 ]; then + printf "Cross-Compiling: You are running on 64-bit architecture, however 32-bit libraries are needed\n" + pacman -S --needed lib32-ncurses +fi + +# GRUB2 build dependencies (also requires build-essential, bison and flex) +# pacman -S --needed base-devel bison flex + +printf "GRUB: Fonts, (crypto) filesystem support, automake, etc.\n" +pacman -S --needed autogen m4 autoconf help2man freetype2 automake fuse fuse-exfat xz gawk device-mapper libtool python +pacman -S --needed bdf-unifont # trying this, otherwise there was an error. I'll try AUR if this won't work. + +# BucTS build dependencies (external script) +# ------------------------------------------------------------ + +# pacman -S --needed base-devel + +# Flashrom build dependencies (also requires build-essential) +# ------------------------------------------------------------ + +printf "Flashrom: Your external programmer will be most probably using PCI bus, FTDI chips need additional libraries\n" +pacman -S --needed pciutils zlib libftdi libftdi-compat +# pacman -S --needed base-devel diff --git a/resources/scripts/helpers/build/dependencies/trisquel7 b/resources/scripts/helpers/build/dependencies/trisquel7 new file mode 100755 index 00000000..56184b61 --- /dev/null +++ b/resources/scripts/helpers/build/dependencies/trisquel7 @@ -0,0 +1,99 @@ +#!/bin/bash + +# for_trisquel7 script: installs build dependencies for Trisquel 7 +# +# 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 texi2html texinfo texlive + +# For building source code: +# ------------------------------------------------------------ + +apt-get -y install build-essential + +# 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 texi2html +fi + +# Memtest86+ build dependencies +# ------------------------------------------------------------ + +apt-get -y install build-essential + +# i945-pwm build dependencies +# ------------------------------------------------------------ + +apt-get -y install build-essential + +# 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 + +# 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 + +# For cross-compiling i686 target on x86_64 host. +[ "${arch}" -eq 0 ] && apt-get -y install lib32z1-dev diff --git a/resources/scripts/helpers/build/docs/.master b/resources/scripts/helpers/build/docs/.master new file mode 100755 index 00000000..4c861353 --- /dev/null +++ b/resources/scripts/helpers/build/docs/.master @@ -0,0 +1,275 @@ +#!/bin/bash -e +# +# Libreboot documentation build script + +# The function index() borrows from gendocs.sh, part of gnulib, the +# GNU Portability Library (https://www.gnu.org/software/gnulib/). The +# objective is to generate a html document which indexes the libreboot +# documentation in its various formats. +# +# index() does not assume a certain set of formats have been +# generated. It generates the index based on which files are located +# in $man_dir. + +# INITIALIZATION # +################## + +# Initialization for manual directory +[ -d docs/manual ] || mkdir docs/manual + +# Initialization for building manuals +pkgname="libreboot" +name=$(basename $1) # Always defined; users do not execute directly +constants="docs/constants.texi" +man_dir="docs/manual/" +texinfo_src="docs/libreboot.texi" +resources_dir="docs/resources" # for including in html tar.gz +css_path="" # TODO: add css? + +# Default variables +prefix="resources/" +preprefix="../" +make_cmd="makeinfo" +comp_cmd="gzip -f -9 -c" +c_ext=".gz" +meta_type="man" +type="reg" +is_html="no" +make_opts="" +use_install="" + +# Initialization for generating eps images +images_path="docs/resources/images" + +# Initialization for making index.html +template_dir="docs/templates/" +pkg_title="GNU Libreboot manual" +pkg_email="example@libreboot.org" # sample +pkg_name="libreboot" +cur_date=`date '+%B %d, %Y'` + +# In case users try to build more than one format at once. +if [ $# -gt 2 ]; then + echo "ERROR: Only one docs format can be built at once." + exit 1 +fi + +case "$2" in + "w") + meta_type="web";; + "") + :;; # This is the normal usage case + *) + echo "ERROR: Only one docs format can be built at once." + echo "If you are building html files for the libreboot website, use:" + echo "\$ ./build docs <html-type> w" + exit 1;; +esac + +### FUNCTIONS #### +################## + +set_constants() +{ + echo "@set docsdir $1" > $constants + echo "@set useinstall $2" >> $constants +} + +check_eps() +{ + printf "INFO: Checking if jpgs have been converted to eps... " + for i in $(find $images_path); do + tdir_name=$(dirname $i) + tfile_name=$(basename ${i,,}) + tfile_ext=${tfile_name##*.} + tfile_base=$(basename -s .jpg ${i,,}) + + if [ $tfile_ext = "jpg" ] && [ ! -e "${tdir_name}/${tfile_base}.eps" ]; then + printf "converting ${i} >>>\n ${tdir_name}/${tfile_base}.eps ...\n\n" + convert $i eps2:${tdir_name}/${tfile_base}.eps # using eps2 reduces file size + fi + done + printf "Done.\n" +} + +# FUNCTION COPIED FROM gendocs.sh +# Return size of $1 in something resembling kilobytes. +calcsize() +{ + size=`ls -ksl $1 | awk '{print $1}'` + echo $size +} + +# Concatenation function called by index +concat_index() +{ + if [ -e $man_dir$1 ]; then + if [ -d $man_dir$1 ]; then + echo "<li><a href=\"$1/index.html\">$2</a>$3</li>" >> "${man_dir}index.html" + else + echo "<li><a href=\"$1\">$2</a>$3</li>" >> "${man_dir}index.html" + fi + fi +} + +# Main index function +build_index() +{ + sed \ + -e "s!%%TITLE%%!$pkg_title!g" \ + -e "s!%%PACKAGE%%!$pkg_name!g" \ + -e "s!%%DATE%%!$cur_date!g" \ + ${template_dir}gendocs_template_header >"${man_dir}index.html" + + for i in $(ls $man_dir); do + [ -d $man_dir$i ] || size=`calcsize "${man_dir}${i}"` + case $i in + ${pkg_name}.dvi.gz) + dvi_gz_size=$size;; + ${pkg_name}_by-node.tar.gz) + html_node_tgz_size=$size;; + ${pkg_name}_by-section.tar.gz) + html_section_tgz_size=$size;; + ${pkg_name}_one-page.html) + html_mono_size=$size;; + ${pkg_name}_one-page.tar.gz) + html_mono_gz_size=$size;; + ${pkg_name}.info.gz) + info_gz_size=$size;; + ${pkg_name}.pdf) + pdf_size=$size;; + ${pkg_name}.pdf.gz) + pdf_gz_size=$size;; + ${pkg_name}.ps.gz) + ps_gz_size=$size;; + ${pkg_name}.txt) + plaintext_size=$size;; + ${pkg_name}.txt.gz) + plaintext_gz_size=$size;; + ${pkg_name}.texi.gz) + texinfo_gz_size=$size;; + *) + :;; + esac + done + + concat_index "${pkg_name}_one-page.html" "HTML (${html_mono_size}K bytes)" " - entirely on one web page." + concat_index "${pkg_name}_by-node" "HTML" " - with one web page per node." + concat_index "${pkg_name}_by-section" "HTML" " - with one web page per section." + concat_index "${pkg_name}_one-page.tar.gz" "HTML compressed (${html_mono_gz_size}K gzipped tar file)" " - entirely on one web page." + concat_index "${pkg_name}_by-node.tar.gz" "HTML compressed (${html_node_tgz_size}K gzipped tar file)" " - with one web page per node." + concat_index "${pkg_name}_by-section.tar.gz" "HTML compressed (${html_section_tgz_size}K gzipped tar file)" " - with one web page per section." + concat_index "${pkg_name}.info.gz" "Info document (${info_gz_size}K bytes gzipped)." + concat_index "${pkg_name}.txt" "ASCII text (${plaintext_size}K bytes)." + concat_index "${pkg_name}.txt.gz" "ASCII text compressed (${plaintext_gz_size}K bytes gzipped)." + concat_index "${pkg_name}.dvi.gz" "TeX dvi file (${dvi_gz_size}K bytes gzipped)." + concat_index "${pkg_name}.pdf" "PDF file (${pdf_size}K bytes)." + concat_index "${pkg_name}.pdf.gz" "PDF file compressed (${pdf_gz_size}K bytes gzipped)." + concat_index "${pkg_name}.ps.gz" "Postscript file compressed (${ps_gz_size}K bytes gzipped)." + concat_index "${pkg_name}.texi.gz" "Texinfo source (${texinfo_gz_size}K bytes gzipped)." + + sed -e "s!%%EMAIL%%!$pkg_email!g" ${template_dir}gendocs_template_footer >>"$man_dir/index.html" +} + +#### OPTIONS ##### +################## + +# options to makeinfo/texi2dvi and file names +case "$name" in + "dvi") + check_eps + make_opts="-q -c -e -o" + type="tex" + basefile="${pkgname}.dvi";; + "html") + type="dir" + is_html="yes" + make_opts="--html --no-warn --split=node --css-include=$css_path -o" + basefile="${pkgname}_by-node";; + "html-by-section") + type="dir" + is_html="yes" + make_opts="--html --no-warn --split=section --css-include=$css_path -o" + basefile="${pkgname}_by-section";; + "html-one-page") + is_html="yes" + make_opts="--html --no-warn --no-split --css-include=$css_path -o" + basefile="${pkgname}_one-page.html";; + "info") + make_opts="--no-warn --no-split -o" + basefile="${pkgname}.info";; + "pdf") + type="tex" + make_opts="-q -c -e -p -o" + basefile="${pkgname}.pdf";; + "plaintext") + make_opts="--no-warn --no-split --plaintext -o" + basefile="${pkgname}.txt";; + "postscript") + check_eps + make_opts="-q -c -e --ps -o" + type="tex" + basefile="${pkgname}.ps";; + "texinfo-gz") + basefile="${pkgname}.texi" + type="texi";; +esac + +# split html and pdf/postscript need special paths to resources +case "$type" in + "dir") + preprefix="../../";; + "tex") + preprefix="" + make_cmd="texi2dvi";; +esac + +# compress html using tar +if [ $is_html = "yes" ]; then + comp_cmd="tar czf" + c_ext=".tar.gz" +fi + +# set up special paths for web mode +if [ $meta_type = "web" ]; then + if [ $is_html = "yes" ]; then + echo "INFO: Using web mode for $name" + prefix="docs/" + use_install="install/" + else + echo "WARNING: Using web mode has no effect for non-html output." + fi +fi + +# write pathnames (prefixes) to file +set_constants "$preprefix$prefix" "$use_install" + +outfile="$man_dir$basefile" + +###### MAIN ###### +################## +if [ $type = "texi" ]; then + echo "Making compressed manual: $outfile$c_ext..." + gzip -f -9 -c $texinfo_src > $outfile$c_ext + +else # The normal case + echo "Writing manual: $outfile..." + $make_cmd $make_opts $outfile $texinfo_src + + # Don't compress anything if in web mode + if [ ! $meta_type = "web" ]; then + echo "Making compressed manual: ${outfile%\.html}$c_ext..." + # tar and gzip have different usages + if [ $is_html = "yes" ]; then + # Include resources in html tar archives, but not .eps + # and remove .html extension for html-one-page + $comp_cmd ${outfile%\.html}$c_ext $outfile $resources_dir --exclude=*eps + else + $comp_cmd $outfile > $outfile$c_ext + fi + echo "Building index..." + build_index # TODO: when building all, do this only once + fi +fi + +echo "Done." diff --git a/resources/scripts/helpers/build/docs/dvi b/resources/scripts/helpers/build/docs/dvi new file mode 100755 index 00000000..c6f6fe0b --- /dev/null +++ b/resources/scripts/helpers/build/docs/dvi @@ -0,0 +1,3 @@ +#!/bin/sh -e +./build docs .master $0 $@ + diff --git a/resources/scripts/helpers/build/docs/html b/resources/scripts/helpers/build/docs/html new file mode 100755 index 00000000..c6f6fe0b --- /dev/null +++ b/resources/scripts/helpers/build/docs/html @@ -0,0 +1,3 @@ +#!/bin/sh -e +./build docs .master $0 $@ + diff --git a/resources/scripts/helpers/build/docs/html-by-section b/resources/scripts/helpers/build/docs/html-by-section new file mode 100755 index 00000000..c6f6fe0b --- /dev/null +++ b/resources/scripts/helpers/build/docs/html-by-section @@ -0,0 +1,3 @@ +#!/bin/sh -e +./build docs .master $0 $@ + diff --git a/resources/scripts/helpers/build/docs/html-one-page b/resources/scripts/helpers/build/docs/html-one-page new file mode 100755 index 00000000..c6f6fe0b --- /dev/null +++ b/resources/scripts/helpers/build/docs/html-one-page @@ -0,0 +1,3 @@ +#!/bin/sh -e +./build docs .master $0 $@ + diff --git a/resources/scripts/helpers/build/docs/info b/resources/scripts/helpers/build/docs/info new file mode 100755 index 00000000..c6f6fe0b --- /dev/null +++ b/resources/scripts/helpers/build/docs/info @@ -0,0 +1,3 @@ +#!/bin/sh -e +./build docs .master $0 $@ + diff --git a/resources/scripts/helpers/build/docs/pdf b/resources/scripts/helpers/build/docs/pdf new file mode 100755 index 00000000..c6f6fe0b --- /dev/null +++ b/resources/scripts/helpers/build/docs/pdf @@ -0,0 +1,3 @@ +#!/bin/sh -e +./build docs .master $0 $@ + diff --git a/resources/scripts/helpers/build/docs/plaintext b/resources/scripts/helpers/build/docs/plaintext new file mode 100755 index 00000000..c6f6fe0b --- /dev/null +++ b/resources/scripts/helpers/build/docs/plaintext @@ -0,0 +1,3 @@ +#!/bin/sh -e +./build docs .master $0 $@ + diff --git a/resources/scripts/helpers/build/docs/postscript b/resources/scripts/helpers/build/docs/postscript new file mode 100755 index 00000000..c6f6fe0b --- /dev/null +++ b/resources/scripts/helpers/build/docs/postscript @@ -0,0 +1,3 @@ +#!/bin/sh -e +./build docs .master $0 $@ + diff --git a/resources/scripts/helpers/build/docs/texinfo-gz b/resources/scripts/helpers/build/docs/texinfo-gz new file mode 100755 index 00000000..c6f6fe0b --- /dev/null +++ b/resources/scripts/helpers/build/docs/texinfo-gz @@ -0,0 +1,3 @@ +#!/bin/sh -e +./build docs .master $0 $@ + diff --git a/resources/scripts/helpers/build/module/bucts b/resources/scripts/helpers/build/module/bucts new file mode 100755 index 00000000..152c3e30 --- /dev/null +++ b/resources/scripts/helpers/build/module/bucts @@ -0,0 +1,67 @@ +#!/bin/bash + +# helper script: builds bucts source code +# +# 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 working directory is the root +# of libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e +if [ -z ${NPROC+x} ]; then + cores="$(nproc)" +else + case ${NPROC} in + ''|*[!0-9]*) + printf "value '%s' for NPROC is invalid. non-numeric. Exiting.\n" "${NPROC}" + exit 1 + ;; + esac + cores="${NPROC}" +fi + +# Build BUC.TS utility (needed for flashing ROM images on X60/T60 while Lenovo BIOS is running) +# -------------------------------------------------------------------- + +printf "Building bucts\n" + +cd "bucts/" + +buildtype="unknown" +if (( $# != 1 )); then + buildtype="dynamic" +else + buildtype="static" +fi + +if [ "${buildtype}" = "static" ]; then + patch "Makefile" < "../resources/bucts/patch/staticlink.diff" +fi + +make clean +make -j${cores} + +if [ "${buildtype}" = "static" ]; then + patch "Makefile" -R < "../resources/bucts/patch/staticlink.diff" +fi + +# done. go back to main directory +cd "../" + +printf "\n\n" diff --git a/resources/scripts/helpers/build/module/coreboot b/resources/scripts/helpers/build/module/coreboot new file mode 100755 index 00000000..f934f003 --- /dev/null +++ b/resources/scripts/helpers/build/module/coreboot @@ -0,0 +1,207 @@ +#!/bin/bash + +# helper script: builds the dependencies that coreboot needs before building a ROM image +# +# 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 working directory is the root +# of git or release archive + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e +HOMEDIR=$(pwd) + +# Build utilities needed in coreboot directory +# -------------------------------------------------------------------- + +printf "Building the utilities in coreboot\n" + +# build coreboot utilities (in each revision) and +# create symlinks to the crossgcc archive +for payload in $HOMEDIR/coreboot/*; do + for board in "${payload}/"*; do + + # cbfstool, cbmem, nvramtool + for util in {cbfs,nvram}tool cbmem; do + if [ "${util}" = "cbfstool" ]; then + sed -i '/.*fmd_scanner.o.*-Wno-unused-function$/ s/$/ -Wno-sign-compare/' "${board}"/util/cbfstool/Makefile.inc + fi + make -BC "${board}/util/${util}" + done + # create symlink to crossgcc + ( + + ln -fs $HOMEDIR/crossgcc/util/crossgcc/ ${board}/util/crossgcc + ) + + done +done + +for payloads in $HOMEDIR/resources/libreboot/config/*; do + + if [ ! -d "${payloads}/" ]; then + continue + fi + + payload="${payloads##*/}" + + for boardconfig in $HOMEDIR/resources/libreboot/config/${payload}/*; do + + if [ ! -d "${boardconfig}/" ]; then + continue + fi + + boardname="${boardconfig##*/}" + cbrevision=$(cat "${boardconfig}/cbrevision") + vbootrevision=$(cat "${boardconfig}/vbootrevision") + + reused_coreboot_patches="$HOMEDIR/resources/libreboot/patch/coreboot/${cbrevision}/${payload}/${boardname}/reused.list" + reused_vboot_patches="$HOMEDIR/resources/libreboot/patch/vboot/${vbootrevision}/${payload}/${boardname}/reused.list" + for reused_patches in "${reused_coreboot_patches}" "${reused_vboot_patches}"; do + if [ -f "${reused_patches}" ]; then + for patch in $(cat "${reused_patches}"); do + if [ ! -f "./${patch}" ]; then + printf "%s listed in %s does not exist\n" "${patch}" "${reused_patches}" + exit 1 + fi + done + fi + done + + done +done + +# sanity check (check for invalid paths in the reused.list patch lists before proceeding) +# in ascending filename order, apply patches from a directory +apply_patches_from_directory() { + patch_directory="${1}" # directory containing the patch files + + if [ -d "${patch_directory}" ]; then + for patch in ${patch_directory}/*.patch; do + + if [ "${patch##*/}" = "*.patch" ]; then # oh so ugly + continue # ugly ugly ugly ugly ugly + fi # most hideous thing you've ever seen + + git am "${patch}" || continue + done + fi +} +# files listed in the file (if found) are absolute paths, relative to the root of the libreboot src directory +# the file lists patches patches that should be applied +apply_patches_from_file() { + patch_list="${1}" # file listing the paths to all the patches + libreboot_src_root="${2}" # path to the root of the libreboot_src directory + + if [ -f "${patch_list}" ]; then + for patchname in $(cat "${patch_list}"); do + git am "${libreboot_src_root}/${patchname}" || continue + done + fi +} + +create_branch() { + branchname="${1}" + git branch ${branchname} + git checkout ${branchname} + git checkout master +} + +# use git-init on everything +# this is so that we can then apply patche +# for these revisions of vboot and coreboot +for i in $HOMEDIR/coreboot/*; do + if [ ! -d "${i}/" ]; then + continue + fi + for revision in ${i}/*; do + if [ ! -d "${revision}/" ]; then + continue + fi + ( + cd "${revision}/" + rm -rf .git + git init + git add -A . + git commit -m "coreboot revision ${revision##*/}" + cd "3rdparty/vboot/" + rm -rf .git + git init + git add -A . + git commit -m "coreboot revision ${revision##*/}" + ) + done +done + +for payloads in $HOMEDIR/resources/libreboot/config/*; do + + if [ ! -d "${payloads}/" ]; then + continue + fi + + payload="${payloads##*/}" + + for boardconfig in $HOMEDIR/resources/libreboot/config/${payload}/*; do + + if [ ! -d "${boardconfig}/" ]; then + continue + fi + + boardname="${boardconfig##*/}" + cbrevision=$(cat "${boardconfig}/cbrevision") + vbootrevision=$(cat "${boardconfig}/vbootrevision") + branchname="${payload}_${boardname}" + + # the same vboot revision is always used for coreboot revision, + # so we don't need to wworry about checking for that here + + # patch that version + ( + + cd "$HOMEDIR/coreboot/${cbrevision}/${cbrevision}/" + create_branch ${branchname} + + git checkout ${branchname} + + # apply patches (coreboot, common to all systems using this revision) + apply_patches_from_directory "$HOMEDIR/resources/libreboot/patch/common/coreboot/${cbrevision}" + # apply patches re-used from other boards, before applying main patches (common patches for similar boards) + apply_patches_from_file "$HOMEDIR/resources/libreboot/patch/coreboot/${cbrevision}/${payload}/${boardname}/reused.list" ../../.. + # apply patches (coreboot, machine-specific for this revision) + apply_patches_from_directory "$HOMEDIR/resources/libreboot/patch/coreboot/${cbrevision}/${payload}/${boardname}" + + git checkout master + + cd "3rdparty/vboot/" + # reset to known revision (vboot) + create_branch ${branchname} + + git checkout ${branchname} + + # apply patches (vboot, common to all systems using this revision) + apply_patches_from_directory "$HOMEDIR/resources/libreboot/patch/common/vboot/${vbootrevision}" + # apply patches re-used from other boards, before applying main patches (common patches for similar boards) + apply_patches_from_file "$HOMEDIR/resources/libreboot/patch/vboot/${vbootrevision}/${payload}/${boardname}/reused.list" ../../../../.. + # apply patches (vboot, machine-specific for this revision) + apply_patches_from_directory "$HOMEDIR/resources/libreboot/patch/vboot/${vbootrevision}/${payload}/${boardname}" + + git checkout master + + ) + done +done diff --git a/resources/scripts/helpers/build/module/crossgcc b/resources/scripts/helpers/build/module/crossgcc new file mode 100755 index 00000000..a88427fe --- /dev/null +++ b/resources/scripts/helpers/build/module/crossgcc @@ -0,0 +1,45 @@ +#!/bin/bash + +# helper script: builds crossgcc, needed by coreboot's build system +# +# Copyright (C) 2016 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 + +if [ -z ${NPROC+x} ]; then + cores="$(nproc)" +else + case ${NPROC} in + ''|*[!0-9]*) + printf "value '%s' for NPROC is invalid. non-numeric. Exiting.\n" "${NPROC}" + exit 1 + ;; + esac + cores="${NPROC}" +fi + +( +cd "crossgcc/" +for architecture in i386 arm; do + make crossgcc-${architecture} CPUS=${cores} +done +) + diff --git a/resources/scripts/helpers/build/module/flashrom b/resources/scripts/helpers/build/module/flashrom new file mode 100755 index 00000000..7ed79fcd --- /dev/null +++ b/resources/scripts/helpers/build/module/flashrom @@ -0,0 +1,93 @@ +#!/bin/bash + +# helper script: builds flashrom source code +# +# 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 working directory is the root +# of git or release archive + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e +if [ -z ${NPROC+x} ]; then + cores="$(nproc)" +else + case ${NPROC} in + ''|*[!0-9]*) + printf "value '%s' for NPROC is invalid. non-numeric. Exiting.\n" "${NPROC}" + exit 1 + ;; + esac + cores="${NPROC}" +fi + +# Build "flashrom" (utility for flashing/dumping ROMs) +# -------------------------------------------------------------------- + +printf "Building flashrom\n" + +cd "flashrom/" + +make clean +if (( $# != 1 )); then + make -j${cores} +else + if [ "${1}" = "static" ]; then + make SHARED=0 CC='gcc -static' -j${cores} CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no + else + make -j${cores} CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no + fi +fi + +mv "flashrom" "flashrom_normal" + +# build patched binaries for MX25L1605D and SST25VF016B flash chips +# - these patches are needed for initial installation on an X60 or T60 +# - these patches are for people who have lenovo bios running +for patchname in "lenovobios_macronix" "lenovobios_sst" +do + # first remove the existing build + rm -f "flashrom_${patchname}" + + # backup the unpatched flashchips.c (it will be patched) + cp "flashchips.c" "flashchips.c_" + # patch flashchips.c + patch "flashchips.c" < "../resources/flashrom/patch/${patchname}.diff" + + make clean + if (( $# != 1 )); then + make -j${cores} CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no + else + if [ "${1}" = "static" ]; then + make SHARED=0 CC='gcc -static' -j${cores} CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no + else + make -j${cores} CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no + fi + fi + + # Rename the binary based on the patch name + mv "flashrom" "flashrom_${patchname}" + + # restore unpatched flashchips.c + rm -f "flashchips.c" + mv "flashchips.c_" "flashchips.c" +done + +mv "flashrom_normal" "flashrom" + +cd "../" diff --git a/resources/scripts/helpers/build/module/grub b/resources/scripts/helpers/build/module/grub new file mode 100755 index 00000000..c663777c --- /dev/null +++ b/resources/scripts/helpers/build/module/grub @@ -0,0 +1,57 @@ +#!/bin/bash + +# helper script: builds GRUB2 source code +# +# Copyright (C) 2014, 2015 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 +if [ -z ${NPROC+x} ]; then + cores="$(nproc)" +else + case ${NPROC} in + ''|*[!0-9]*) + printf "value '%s' for NPROC is invalid. non-numeric. Exiting.\n" "${NPROC}" + exit 1 + ;; + esac + cores="${NPROC}" +fi + +# Build GRUB2 as coreboot payload + +printf "Building GRUB\n" + +# use a subshell to not end up in grub/ in case of build issues +( +cd grub/ + +# clean up first +[ -d Makefile ] && make distclean + +# build +./autogen.sh +./configure --with-platform=coreboot +make -j${cores} +) + +# Also build SeaBIOS, which we use with GRUB to make SeaGRUB +./build module seabios diff --git a/resources/scripts/helpers/build/module/i945pwm b/resources/scripts/helpers/build/module/i945pwm new file mode 100755 index 00000000..730d8e69 --- /dev/null +++ b/resources/scripts/helpers/build/module/i945pwm @@ -0,0 +1,42 @@ +#!/bin/bash + +# helper script: builds i945-pwm source code +# +# 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 working directory is the root +# of libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +# Build i945-pwm utility +# -------------------------------------------------------------------- + +printf "Building i945-pwm\n" + +cd "resources/utilities/i945-pwm/" + +make clean +# build it +make + +# done. go back to main directory +cd "../../../" + +printf "\n\n" diff --git a/resources/scripts/helpers/build/module/ich9deblob b/resources/scripts/helpers/build/module/ich9deblob new file mode 100755 index 00000000..255e22bc --- /dev/null +++ b/resources/scripts/helpers/build/module/ich9deblob @@ -0,0 +1,44 @@ +#!/bin/bash + +# helper script: builds ich9deblob source code +# +# 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 working directory is the root +# of libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +# Build ich9deblob utility +# -------------------------------------------------------------------- + +printf "Building ich9deblob\n" + +cd "resources/utilities/ich9deblob/" + +# clean it first +make clean + +# build ich9deblob +make + +# done. go back to main directory +cd "../../../" + +printf "\n\n" diff --git a/resources/scripts/helpers/build/module/memtest86plus b/resources/scripts/helpers/build/module/memtest86plus new file mode 100755 index 00000000..db664457 --- /dev/null +++ b/resources/scripts/helpers/build/module/memtest86plus @@ -0,0 +1,33 @@ +#!/bin/bash + +# helper script: builds memtest86+ source code +# +# 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 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" + +make -BC memtest86plus diff --git a/resources/scripts/helpers/build/module/seabios b/resources/scripts/helpers/build/module/seabios new file mode 100755 index 00000000..2dd436c2 --- /dev/null +++ b/resources/scripts/helpers/build/module/seabios @@ -0,0 +1,61 @@ +#!/bin/bash + +# helper script: builds SeaBIOS source code +# +# Copyright (C) 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/>. +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +# Build SeaBIOS +# --------------------------------------------------------------------- + +printf "Building SeaBIOS\n" + +cd seabios/ + +cp ../resources/seabios/config/config .config + +# clean it first +[[ -f Makefile ]] && make clean + +# build SeaBIOS +make + +mv "out/bios.bin.elf" ../ + +printf "\n\n" + +rm -f .config + +make distclean + +cp ../resources/seabios/config/config_vga .config + +make +rm -f .config + +mv out/bios.bin.elf out/bios.bin.vga.elf +mv ../bios.bin.elf out/ + +# done. go back to main directory +cd ../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/release/roms b/resources/scripts/helpers/build/release/roms new file mode 100755 index 00000000..4c165ea0 --- /dev/null +++ b/resources/scripts/helpers/build/release/roms @@ -0,0 +1,105 @@ +#!/bin/bash + +# +# helper script: generate the ROM image release archives +# +# Copyright (C) 2015 Leah Rowe <info@minifree.org> +# Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net> +# +# 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 [ ! -d bin/ ]; then + printf "build/release/roms: no bin/ directory exists. (you haven't built any images)\n" + exit 1 +fi + +if [ -f "version" ]; then + # _src release archive is being used + version="$(cat version)" + versiondate="$(cat versiondate)" +else + # git repo is being used + version="$(git describe --tags HEAD)" + versiondate="$(git show -s --format=%ct)" +fi +versiondir="release/oldbuildsystem/${version}" +romdir="${versiondir}/rom" +distname="libreboot_${version}" + +printf 'Building ROM image release archives for...\n' + +cd "bin/" + +for payload in *; do + + [ ! -d "../${romdir}/${payload}/" ] && mkdir -p "../${romdir}/${payload}/" + + cd "${payload}/" + + for board in *; do + + archivename="${distname}_${payload}_${board}" + + printf '...%s' "${payload}/${board}" + + # Delete the old archive + rm -f "../../${romdir}/${payload}/${distname}_${board}.tar.xz" + + cp -R "${board}/" "${archivename}/" + + # this has to be done before generating + # the "version" file + if [ ! -f "version" ]; then + # generate ChangeLog and NEWS files + rm -f "ChangeLog" "NEWS" + git log > "${archivename}/ChangeLog" + cp "${archivename}/ChangeLog" "${archivename}/NEWS" + else + # building from release archive + cp "ChangeLog" "${archivename}/" + cp "NEWS" "${archivename}/" + fi + + if [ -f "../../RELEASE" ]; then + rm -f "${archivename}/ChangeLog" + rm -f "${archivename}/NEWS" + cp "../../RELEASE" "${archivename}/ChangeLog" + cp "../../RELEASE" "${archivename}/NEWS" + fi + + # Put the version string in the archive. + printf '%s\n' "${version}" >"${archivename}/version" + # Put the version date string in the archive + printf '%s\n' "${versiondate}" >"${archivename}/versiondate" + + # Create the compressed archive. + tar -c "${archivename}/" | xz -9e >"../../${romdir}/${payload}/${archivename}.tar.xz" + + rm -Rf "${archivename:?}/" + + printf ' OK\n' + + done + + cd "../" + +done + +cd "../" + +printf 'ROM image release archives are stored in %s/\n' "${romdir}" diff --git a/resources/scripts/helpers/build/release/sha512sums b/resources/scripts/helpers/build/release/sha512sums new file mode 100755 index 00000000..11967acb --- /dev/null +++ b/resources/scripts/helpers/build/release/sha512sums @@ -0,0 +1,53 @@ +#!/bin/bash + +# +# helper script: create sha512sum file for the current snapshot +# +# Copyright (C) 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 [ -f "version" ]; then + # _src release archive is being used + version="$(cat version)" + versiondate="$(cat versiondate)" +else + # git repo is being used + version="$(git describe --tags HEAD)" + versiondate="$(git show -s --format=%ct)" +fi +versiondir="release/oldbuildsystem/${version}" +sha512filename="SHA512SUMS" +sha512filepath="${versiondir}/${sha512filename}" + +if [ ! -d "${versiondir}/" ]; then + + printf "build/release/sha512sums: directory %s/ does not exist. You haven't generated any archives yet.\n" "${versiondir}" + exit 1 + +fi + +# delete the old file +rm -f "${sha512filepath}" + +# create sha512sum file +printf "Creating list of SHA512 sums in %s...\n" "${sha512filepath}" +(cd "${versiondir}/" && for file in $(find -type f); do sha512sum "${file}" >> "${sha512filename}"; done) +printf "...done.\n" + +printf "\n" diff --git a/resources/scripts/helpers/build/release/src b/resources/scripts/helpers/build/release/src new file mode 100755 index 00000000..0fde6899 --- /dev/null +++ b/resources/scripts/helpers/build/release/src @@ -0,0 +1,133 @@ +#!/bin/bash + +# +# helper script: generate the source release archive +# +# Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org> +# Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net> +# +# 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 the source release archive\n' + +if [ -f "version" ]; then + # _src release archive is being used + version="$(cat version)" + versiondate="$(cat versiondate)" +else + # git repo is being used + version="$(git describe --tags HEAD)" + versiondate="$(git show -s --format=%ct)" +fi +versiondir="release/oldbuildsystem/${version}" +distname="libreboot_${version}_src" +distdir="${versiondir}/${distname}" + +printf 'Deleting old source release archives\n' +rm -f "${distdir}.tar.xz" +rm -Rf "${distdir:?}/" + +mkdir -p "${distdir}/" + +printf 'Copying sources to %s/\n' "${distdir}" +for resource in *; do + if [ "${resource}" = "release" ]; then + continue + fi + cp -R "${resource}" "${distdir}/" +done + +# this has to be done before generating +# the "version" file +if [ ! -f "version" ]; then + # generate ChangeLog and NEWS files + rm -f "ChangeLog" "NEWS" + git log > "${distdir}/ChangeLog" + cp "${distdir}/ChangeLog" "${distdir}/NEWS" +else + # building from release archive + cp "ChangeLog" "${distdir}/" + cp "NEWS" "${distdir}/" +fi + +if [ -f "RELEASE" ]; then + rm -f "${distdir}/ChangeLog" + rm -f "${distdir}/NEWS" + cp "RELEASE" "${distdir}/ChangeLog" + cp "RELEASE" "${distdir}/NEWS" +fi + +# include version information +printf '%s\n' "${version}" >"${distdir}/version" +# include version date information +printf '%s\n' "${versiondate}" >"${distdir}/versiondate" + +printf 'Cleaning files in %s/\n' "${distdir}" + +# Clean old builds. +(cd "${distdir}/" && ./build clean all) +printf '\n' + +# Delete Git repositories and properties and Subversion administrative +# directories and properties. +rm -Rf "${distdir}/bucts/".git* +rm -Rf "${distdir}/flashrom/".git* +rm -Rf "${distdir}/grub/".git* +rm -Rf "${distdir}/depthcharge/".git* +rm -Rf "${distdir}/seabios/".git* + +rm -f "${distdir}"/*.vim + +# Delete useless files. +rm -Rf "${distdir}/TODO/" +rm -f "${distdir}/push" + +# Delete the deblob scripts. +# Since the source archive doesn't distribute the download scripts and already +# comes with a deblobbed coreboot, the deblobbing scripts aren't needed at all. +rm -Rf "${distdir}/resources/utilities/coreboot-libre/" + +# Download scripts not needed, because the modules already exist +# in the src release archive +rm -f "${distdir}/download" +rm -Rf "${distdir}/resources/scripts/helpers/download/" + +# Other patches aren't needed in the release, either +rm -Rf "${distdir}/resources/depthcharge/patch/" +rm -Rf "${distdir}/resources/grub/patch/" +rm -Rf "${distdir}/resources/memtest86plus/patch/" + +# ich9deblob: There are certain files in there that the user most likely does +# not want to share. +rm -f "${distdir}/resources/utilities/ich9deblob/"*.bin +rm -f "${distdir}/resources/utilities/ich9deblob/"*.rom +rm -f "${distdir}/resources/utilities/ich9deblob/mk"*.[ch] +rm -f "${distdir}/mk"*.[ch] +rm -f "${distdir}/"*.bin +rm -f "${distdir}/"*.rom + +# Remove any GRUB payload ELF executables that may exist +rm -f "${distdir}/resources/utilities/grub-assemble/grub_txtmode.elf" +rm -f "${distdir}/resources/utilities/grub-assemble/grub_vesafb.elf" + +printf 'Creating %s.tar.xz\n' "${distdir}" +(cd "${versiondir}/" && tar -c "${distname}/" | xz -9e >"${distname}.tar.xz") + +rm -Rf "${distdir:?}/" + +printf 'Source release archive is stored in %s/\n' "${versiondir}" diff --git a/resources/scripts/helpers/build/release/tobuild b/resources/scripts/helpers/build/release/tobuild new file mode 100755 index 00000000..bdf6ca77 --- /dev/null +++ b/resources/scripts/helpers/build/release/tobuild @@ -0,0 +1,109 @@ +#!/bin/bash + +# helper: prepare a small source archive for those utils +# that don't easily cross-compile. Then the tarball can be extracted +# on those systems with the target architecture, and compiled. +# +# 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 [ -f "version" ]; then + # _src release archive is being used + version="$(cat version)" + versiondate="$(cat versiondate)" +else + # git repo is being used + version="$(git describe --tags HEAD)" + versiondate="$(git show -s --format=%ct)" +fi +versiondir="release/oldbuildsystem/${version}" +distname="libreboot_${version}_tobuild" +distdir="${versiondir}/${distname}" + +printf "Creating source archive for flashrom and bucts\n" + +# delete the old data +rm -Rf "${distdir:?}/" +rm -f "${distdir}.tar.xz" + +# this is where they will go +mkdir -p "${distdir}/" + +# flashrom +cp -R "flashrom/" "${distdir}/" +rm -f "${distdir}/flashrom/flashrom_lenovobios_sst" +rm -f "${distdir}/flashrom/flashrom_lenovobios_macronix" +(cd "${distdir}/flashrom/" && make clean) +mkdir -p "${distdir}/resources/flashrom/" +cp -R "resources/flashrom/patch/" "${distdir}/resources/flashrom/" + +# bucts +cp -R "bucts/" "${distdir}/" +(cd "${distdir}/bucts/" && make clean) +mkdir -p "${distdir}/resources/bucts/" +cp -R "resources/bucts/patch/" "${distdir}/resources/bucts/" + +# the build script will be needed +cp build "${distdir}/" +# needed build scripts (helpers) +mkdir -p "${distdir}/resources/scripts/helpers/build/" +mkdir -p "${distdir}/resources/scripts/helpers/build/module/" +mkdir -p "${distdir}/resources/scripts/helpers/build/clean/" +cp "resources/scripts/helpers/build/clean/bucts" "${distdir}/resources/scripts/helpers/build/clean/" +cp "resources/scripts/helpers/build/clean/flashrom" "${distdir}/resources/scripts/helpers/build/clean/" +cp "resources/scripts/helpers/build/module/bucts" "${distdir}/resources/scripts/helpers/build/module/" +cp "resources/scripts/helpers/build/module/flashrom" "${distdir}/resources/scripts/helpers/build/module/" +cp "resources/scripts/misc/powertop.trisquel7" "${distdir}/" + +# this has to be done before generating +# the "version" file +if [ ! -f "version" ]; then + # generate ChangeLog and NEWS files + rm -f "ChangeLog" "NEWS" + git log > "${distdir}/ChangeLog" + cp "${distdir}/ChangeLog" "${distdir}/NEWS" +else + # building from release archive + cp "ChangeLog" "${distdir}/" + cp "NEWS" "${distdir}/" +fi + +if [ -f "RELEASE" ]; then + rm -f "${distdir}/ChangeLog" + rm -f "${distdir}/NEWS" + cp "RELEASE" "${distdir}/ChangeLog" + cp "RELEASE" "${distdir}/NEWS" +fi + +# include version information +printf '%s\n' "${version}" >"${distdir}/version" +# include version date information +printf '%s\n' "${versiondate}" >"${distdir}/versiondate" + +# that is all. now tar it up +(cd "${versiondir}/" && tar -c "${distname}/" | xz -9e >"${distname}.tar.xz") + +# and delete the directory +rm -Rf "${distdir:?}/" + +printf "\n" +printf "Tar archive created: %s\n" "${distdir}.tar.xz" +printf "NOTE: don't forget to add ARM binaries for flashrom.\n" +printf "NOTE: don't forget to add i386 binaries for flashrom/bucts.\n" +printf "The archive %s.tar.xz has been created with everything needed to build these utilities.\n\n" "${distname}" diff --git a/resources/scripts/helpers/build/release/util b/resources/scripts/helpers/build/release/util new file mode 100755 index 00000000..7dcfa28b --- /dev/null +++ b/resources/scripts/helpers/build/release/util @@ -0,0 +1,250 @@ +#!/bin/bash + +# +# helper script: generate the release archives +# +# Copyright (C) 2014, 2015, 2016 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 when running +# it is the root directory of the libreboot git repository clone. + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +arch="unknown" +if [ "$(uname -i)" = "i686" ] || [ "$(uname -m)" = "i686" ] + then + arch="i686" + echo "Running on i686. ok." + sleep 2 +elif [ "$(uname -i)" = "x86_64" ] || [ "$(uname -m)" = "x86_64" ] + then + arch="x86_64" + echo "Running on x86_64. ok." + sleep 2 +else + echo "This script must be run on an i686 or x86_64 host. x86_64 is recommended." + exit 1 +fi + +if [ -f "version" ]; then + # _src release archive is being used + version="$(cat version)" + versiondate="$(cat versiondate)" +else + # git repo is being used + version="$(git describe --tags HEAD)" + versiondate="$(git show -s --format=%ct)" +fi +versiondir="release/oldbuildsystem/${version}" +distname="libreboot_${version}_util" +distdir="${versiondir}/${distname}" + +printf "Creating utility archive (static executables)\n" + +# delete the old data +rm -Rf "${distdir:?}/" +rm -f "${distdir}.tar.xz" + +# this is where they will go +mkdir -p "${distdir}/" + +# this has to be done before generating +# the "version" file +if [ ! -f "version" ]; then + # generate ChangeLog and NEWS files + rm -f "ChangeLog" "NEWS" + git log > "${distdir}/ChangeLog" + cp "${distdir}/ChangeLog" "${distdir}/NEWS" +else + # building from release archive + cp "ChangeLog" "${distdir}/" + cp "NEWS" "${distdir}/" +fi + +if [ -f "RELEASE" ]; then + rm -f "${distdir}/ChangeLog" + rm -f "${distdir}/NEWS" + cp "RELEASE" "${distdir}/ChangeLog" + cp "RELEASE" "${distdir}/NEWS" +fi + +# include version information +printf '%s\n' "${version}" >"${distdir}/version" +# include version date information +printf '%s\n' "${versiondate}" >"${distdir}/versiondate" + +# -------------- +# BUC.TS related +# -------------- +# X60/T60: BUC.TS utility is needed to flash libreboot while Lenovo BIOS is running +# Include it statically compiled +cp -R "bucts" "bucts_/" +# make it statically compile +./build module bucts static +mkdir -p "${distdir}/bucts/${arch}/" +mv "bucts/bucts" "${distdir}/bucts/${arch}/" +rm -Rf "bucts/" +mv "bucts_/" "bucts/" + +# ---------------- +# Flashrom related +# ---------------- +# Flashrom is used to install libreboot on supported targets +# Include it statically compiled +cp -R "flashrom/" "flashrom_/" +# make it statically compile +./build module flashrom static +mkdir -p "${distdir}/flashrom/${arch}/" +mv "flashrom/flashrom" "${distdir}/flashrom/${arch}/" +mv "flashrom/flashrom_lenovobios_sst" "${distdir}/flashrom/${arch}/" +mv "flashrom/flashrom_lenovobios_macronix" "${distdir}/flashrom/${arch}/" +rm -Rf "flashrom/" +mv "flashrom_/" "flashrom/" + + # ---------------- +# cbfstool related +# ---------------- +# build cbfstool, compiled (statically linked) and include the binary + +mkdir -p "${distdir}/cbfstool/${arch}/" + +cd "crossgcc/util/" +cp -R "cbfstool" "cbfstool_/" +cd "cbfstool/" +sed -i '/.*fmd_scanner.o.*-Wno-unused-function$/ s/$/ -Wno-sign-compare/' Makefile.inc # build fix for latest flex version +make clean +make SHARED=0 CC='gcc -static' + +mv "cbfstool" "../../../${distdir}/cbfstool/${arch}/" + +if [ "${arch}" = "x86_64" ] + then + # Now build 32-bit binaries + make clean + make SHARED=0 CC='gcc -static -m32' + mkdir "../../../${distdir}/cbfstool/i686" + mv "cbfstool" "../../../${distdir}/cbfstool/i686/" +fi + +# cross-compile for ARM +make clean +make SHARED=0 CC='arm-linux-gnueabi-gcc -static' +mkdir "../../../${distdir}/cbfstool/armv7l/" +mv "cbfstool" "../../../${distdir}/cbfstool/armv7l/" + +cd ../ +rm -Rf "cbfstool/" +mv "cbfstool_/" "cbfstool/" +cd ../../ + + +# ---------------- +# ich9deblob related +# ---------------- +# build ich9deblob, compiled (statically linked) and include the binary + +mkdir -p "${distdir}/ich9deblob/${arch}" + +cd "resources/utilities/" +cp -R "ich9deblob" "ich9deblob_/" +cd "ich9deblob/" +make clean +make SHARED=0 CC='gcc -static' + +mv "ich9deblob" "../../../${distdir}/ich9deblob/${arch}/" +mv "ich9gen" "../../../${distdir}/ich9deblob/${arch}/" +mv "demefactory" "../../../${distdir}/ich9deblob/${arch}/" + +if [ "${arch}" = "x86_64" ] + then + # Now build 32-bit binaries + make clean + make SHARED=0 CC='gcc -static -m32' + mkdir "../../../${distdir}/ich9deblob/i686/" + mv "ich9deblob" "../../../${distdir}/ich9deblob/i686/" + mv "ich9gen" "../../../${distdir}/ich9deblob/i686/" + mv "demefactory" "../../../${distdir}/ich9deblob/i686/" +fi + +# cross-compile for ARM +make clean +make SHARED=0 CC='arm-linux-gnueabi-gcc -static' +mkdir "../../../${distdir}/ich9deblob/armv7l" +mv "ich9deblob" "../../../${distdir}/ich9deblob/armv7l/" +mv "ich9gen" "../../../${distdir}/ich9deblob/armv7l/" +mv "demefactory" "../../../${distdir}/ich9deblob/armv7l/" + +cd "../" +rm -Rf "ich9deblob/" +mv "ich9deblob_/" "ich9deblob/" +cd "../../" + +# ----------------- +# nvramtool related +# ----------------- +# build nvramtool, compiled (statically linked) and include the binary +cd "crossgcc/util/" +cp -R "nvramtool/" "nvramtool_/" +cd "nvramtool/" +make clean +make SHARED=0 CC='gcc -static' + +mkdir -p "../../../${distdir}/nvramtool/${arch}/" + +mv "nvramtool" "../../../${distdir}/nvramtool/${arch}/" + +if [ "${arch}" = "x86_64" ] + then + # Now build 32-bit binaries + make clean + make SHARED=0 CC='gcc -static -m32' + mkdir "../../../${distdir}/nvramtool/i686/" + mv "nvramtool" "../../../${distdir}/nvramtool/i686/" +fi + +cd "../" +rm -Rf "nvramtool/" +mv "nvramtool_/" "nvramtool/" +cd "../../" + +# ------------- +# Miscellaneous +# ------------- + +# Flashing script +cp "flash" "${distdir}/" + +# powertop script +cp "resources/scripts/misc/powertop.trisquel7" "${distdir}/" + +printf "\n\n" + +# ### Create the release tarballs +# ---------------------------------------------------------------------------------------------------------------------------- + +printf "Compressing %s/ into %s.tar.xz\n" "${distdir}" "${distdir}.tar.xz" +# create lzma compressed util archive +(cd "${versiondir}/" && tar -c "${distname}/" | xz -9e >"${distname}.tar.xz") + +printf "done\n\n" + +# ### Delete the uncompressed release directories +# ---------------------------------------------------------------------------------------------------------------------------- + +# The uncompressed archives are no longer needed +rm -Rf "${distdir:?}/" diff --git a/resources/scripts/helpers/build/roms/withdepthcharge b/resources/scripts/helpers/build/roms/withdepthcharge new file mode 100755 index 00000000..1df97a23 --- /dev/null +++ b/resources/scripts/helpers/build/roms/withdepthcharge @@ -0,0 +1,207 @@ +#!/bin/bash + +# helper script: build ROM images with depthcharge and put them in ./bin/ +# +# Copyright (C) 2014, 2015, 2016 Leah Rowe <info@minifree.org> +# Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr> +# +# 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 libreboot_src or libreboot git. + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e +if [ -z ${NPROC+x} ]; then + cores="$(nproc)" +else + case ${NPROC} in + ''|*[!0-9]*) + printf "value '%s' for NPROC is invalid. non-numeric. Exiting.\n" "${NPROC}" + exit 1 + ;; + esac + cores="${NPROC}" +fi + +printf "Building ROM images with the depthcharge payload\n" + +if [ ! -d "bin/" ] +then + mkdir "bin/" +fi + +if [ -f "version" ]; then + # _src release archive is being used + version="$(cat "version")" +else + # git repo is being used + version="$(git describe --tags HEAD)" # note: in libreboot, coreboot/.git doesn't exist, this uses libreboot .git +fi + +# Build libpayload +# ------------------------------------------------------------------------------ + +buildlibpayload() { + family="${1}" + board="${2}" + cbrevision="${3}" + vbootrevision="${4}" + + ( + cd "coreboot/${cbrevision}/${cbrevision}/" + git checkout depthcharge_${board} + + ( + cd "3rdparty/vboot/" + git checkout depthcharge_${board} + ) + + cd "payloads/libpayload/" + + make distclean + rm -Rf "install/" + + make KBUILD_DEFCONFIG="configs/config.$family" defconfig + make -j${cores} + make DESTDIR="install" install + + cd "../../" + git checkout master + cd "3rdparty/vboot/" + git checkout master + ) +} + +# Build depthcharge +# ------------------------------------------------------------------------------ + +builddepthcharge() { + board="${1}" + cbrevision="${2}" + vbootrevision="${3}" + + ( + ( + cd "coreboot/${cbrevision}/${cbrevision}/" + git checkout depthcharge_${board} + + cd "3rdparty/vboot/" + git checkout depthcharge_${board} + ) + + cd "depthcharge/" + + make distclean + rm -f "../coreboot/${cbrevision:?}/${cbrevision:?}/payload.elf" + + make BOARD="${board}" defconfig + make BOARD="${board}" LIBPAYLOAD_DIR="$(pwd)/../coreboot/${cbrevision}/${cbrevision}/payloads/libpayload/install/libpayload" VB_SOURCE="$(pwd)/../coreboot/${cbrevision}/${cbrevision}/3rdparty/vboot" -j${cores} depthcharge_unified + + cp "build/depthcharge.elf" "../coreboot/${cbrevision}/${cbrevision}/payload.elf" + + cd "../coreboot/${cbrevision}/${cbrevision}/" + git checkout master + + cd "3rdparty/vboot/" + git checkout master + ) +} + +# Build coreboot +# ------------------------------------------------------------------------------ + +buildcoreboot() { + board="${1}" + cbrevision="${2}" + vbootrevision="${3}" + + ( + cd "coreboot/${cbrevision}/${cbrevision}" + git checkout depthcharge_${board} + + ( + cd "3rdparty/vboot/" + git checkout depthcharge_${board} + ) + + make distclean + rm -f ".coreboot-version" + rm -f *.img + + printf 'libreboot-%s' "${version}" > "ro-frid" + printf 'libreboot-%s\n' "${version}" > ".coreboot-version" # needed for reproducible builds in coreboot + + make KBUILD_DEFCONFIG="$(pwd)/../../../resources/libreboot/config/depthcharge/${board}/config" defconfig + make -j${cores} + + cbfs_size=$( grep CONFIG_CBFS_SIZE ".config" | sed "s/.*[[:space:]]*=[[:space:]]*//g" ) + cbfs_size=$( printf "%d\n" "${cbfs_size}" ) + cbfs_size=$(( $cbfs_size / 1024 )) + + dd if="build/coreboot.rom" of="coreboot.img" bs=1024 count="${cbfs_size}" + + objcopy -I binary -O binary --pad-to=0x100 --gap-fill=0x00 "ro-frid" "ro-frid.img" + + # prepare directory for new images + rm -Rf "${board:?}/" + mkdir "${board}/" + # move the images into the newly created directory + mv "coreboot.img" "${board}/" + mv "ro-frid.img" "${board}/" + # copy the scripts too + cp "../../../resources/libreboot/install/depthcharge/cros-flash-replace" "${board}/" + cp "../../../resources/libreboot/install/depthcharge/${board}/layout.txt" "${board}/" + # delete the old images from ../bin + rm -Rf "../../../bin/depthcharge/${board}/" + # now put the new images in ./bin/depthcharge/ + [ ! -d "../../../bin/depthcharge/" ] && mkdir -p "../../../bin/depthcharge/" + mv "${board}/" "../../../bin/depthcharge/" + + # clean this up + rm -f "payload.elf" + rm -f *.img + + git checkout master + + cd "3rdparty/vboot/" + git checkout master + ) +} + +# Build ROM images for supported boards +buildrom() { + board="${1}" + cbrevision="$(cat resources/libreboot/config/depthcharge/${board}/cbrevision)" + vbootrevision="$(cat resources/libreboot/config/depthcharge/${board}/vbootrevision)" + + if [ -f "resources/libreboot/config/depthcharge/${board}/config" ]; then + family=$( echo ${board} |sed "s/_.*//g" ) + + buildlibpayload "${family}" "${board}" "${cbrevision}" "${vbootrevision}" + builddepthcharge "${board}" "${cbrevision}" "${vbootrevision}" + buildcoreboot "${board}" "${cbrevision}" "${vbootrevision}" + fi +} + +if [ $# -gt 0 ]; then + for board in "${@}"; do + buildrom "${board}" + done +else + for board in resources/libreboot/config/depthcharge/*; do + buildrom "${board##*/}" + done +fi diff --git a/resources/scripts/helpers/build/roms/withgrub b/resources/scripts/helpers/build/roms/withgrub new file mode 100755 index 00000000..be2fbc49 --- /dev/null +++ b/resources/scripts/helpers/build/roms/withgrub @@ -0,0 +1,125 @@ +#!/bin/bash + +# +# helper script: build ROM images with SeaGRUB and put them in ./bin/ +# +# 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 working directory is the root +# of git or release archive + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +printf "Building ROM images with the GRUB payload\n" + +# The GRUB files should be deleted first +rm -f "coreboot/grub"*.{elf,cfg} +rm -f "coreboot/"*/*/grub*.{elf,cfg} + +[ -d bin ] || mkdir "bin/" + +# Put GRUB payloads and config files +# in the coreboot directory, ready for next step +( +cd "coreboot/" +for romtype in txtmode vesafb; do + cd ../resources/utilities/grub-assemble + ./gen.sh ${romtype} + rm -f "../../../coreboot/grub_${romtype}.elf" + mv "grub_${romtype}.elf" "../../../coreboot/" + cd "../../../coreboot" + + # GRUB configuration files + for keylayout in ../resources/utilities/grub-assemble/keymap/original/*; do + keymap="${keylayout##*/}" + cat ../resources/grub/config/extra/{common,"${romtype}"}.cfg > "grub_${keymap}_${romtype}.cfg" + printf "keymap %s\n" "${keymap}" >> "grub_${keymap}_${romtype}.cfg" + cat ../resources/grub/config/menuentries/{common,"${romtype}"}.cfg >> "grub_${keymap}_${romtype}.cfg" + # grubtest.cfg should be able to switch back to grub.cfg + sed "s/grubtest.cfg/grub.cfg/" < "grub_${keymap}_${romtype}.cfg" > "grub_${keymap}_${romtype}_test.cfg" + done +done +) + +# Build ROM images for supported boards +buildrom() { + board="$1" + if [ -f "resources/libreboot/config/grub/${board}/config" ]; then + ./build roms withgrub_helper "${board}" + fi +} + +if [ $# -gt 0 ]; then + for board in "${@}"; do + buildrom "${board}" + done +else + for board in resources/libreboot/config/grub/*; do + buildrom "${board##*/}" + done +fi + +# Needed on i945 systems for the bucts/dd trick (documented) +# This enables the ROM to be flashed over the lenovo bios firmware +for i945board in "x60" "t60" +do + if [ -d "bin/grub/${i945board}/" ]; then + cd "bin/grub/${i945board}/" + for i945rom in * + do + dd if="${i945rom}" of=top64k.bin bs=1 skip=$[$(stat -c %s "${i945rom}") - 0x10000] count=64k + dd if=top64k.bin of="${i945rom}" bs=1 seek=$[$(stat -c %s "${i945rom}") - 0x20000] count=64k conv=notrunc + rm -f top64k.bin + done + cd "../../../" + fi +done + +# Build the deblobbed descriptor+gbe regions for GM45/ICH9M targets. +# Then put them in the ROM images. +if [ -d "bin/grub/" ]; then + cd "bin/grub/" + for board in "x200" "r400" "t400" "t500" + do + for romsize in "4m" "8m" "16m" + do + if [ -d "${board}_${romsize}b/" ]; then + cd "${board}_${romsize}b/" + if [ -f "../../../gm45macaddress" ]; then + ../../../resources/utilities/ich9deblob/ich9gen --macaddress $(cat ../../../gm45macaddress) + else + ../../../resources/utilities/ich9deblob/ich9gen + fi + for rom in *.rom + do + dd if="ich9fdgbe_${romsize}.bin" of="${rom}" bs=1 count=12k conv=notrunc + done + rm -f "ich9fd"*.bin "mk"*.[ch] + cd "../" + fi + done + done + cd ../../ +fi + +# The GRUB files are no longer needed +rm -f "coreboot/"*.{elf,cfg} +rm -f "coreboot/"*/*/*.{elf,cfg} + +printf "\n\n" diff --git a/resources/scripts/helpers/build/roms/withgrub_helper b/resources/scripts/helpers/build/roms/withgrub_helper new file mode 100755 index 00000000..d974eeca --- /dev/null +++ b/resources/scripts/helpers/build/roms/withgrub_helper @@ -0,0 +1,199 @@ +#!/bin/bash + +# helper script: create ROM images for a given system, with SeaGRUB +# +# 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 working directory is the root +# of git or release archive + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e +if [ -z ${NPROC+x} ]; then + cores="$(nproc)" +else + case ${NPROC} in + ''|*[!0-9]*) + printf "value '%s' for NPROC is invalid. non-numeric. Exiting.\n" "${NPROC}" + exit 1 + ;; + esac + cores="${NPROC}" +fi + +if (( $# != 1 )); then + printf "Usage: ./buildrom-withgrub boardname\n" + printf "Example: ./buildrom-withgrub x60\n" + printf "You need to specify exactly 1 argument\n" + exit 1 +fi + +boardtarget="${1}" + +if [ -f "version" ]; then + # release archive is being used + version="$(cat version)" +else + # git repo is being used + version="$(git describe --tags HEAD)" +fi + +printf "GRUB Helper script: build ROM images for '%s'\n" "${boardtarget}" + +( +cbrevision="$(cat resources/libreboot/config/grub/${boardtarget}/cbrevision)" +vbootrevision="$(cat resources/libreboot/config/grub/${boardtarget}/vbootrevision)" +branchname="grub_${boardtarget}" + +cd "coreboot/${cbrevision}/${cbrevision}/" +git checkout ${branchname} +( + cd "3rdparty/vboot/" + git checkout ${branchname} +) + +# Make sure to remove these first +rm -f *.{elf,cfg} + +printf 'libreboot-%s\n' "${version}" > ".coreboot-version" # needed for reproducible builds in coreboot + +# Build ROM images with text-mode and corebootfb modes. + +if [ "${boardtarget}" = "qemu_i440fx_piix4" ] || [ "${boardtarget}" = "qemu_q35_ich9" ] +then + # assume that the default config enable framebuffer mode, duplicate and patch for text-mode + # necessary, otherwise it will ask you to enter the Y/X resolution of the framebuffer at build time + cp "../../../resources/libreboot/config/grub/${boardtarget}/config" "config_vesafb" + sed 's/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/' < "config_vesafb" > "config_txtmode" +else + # assume that the default config enables text-mode, duplicate and patch for framebuffer mode + cp "../../../resources/libreboot/config/grub/${boardtarget}/config" "config_txtmode" + sed 's/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/' < "config_txtmode" > "config_vesafb" +fi + +for romtype in txtmode vesafb +do + if [ "${boardtarget}" = "kgpe-d16" ] || [ "${boardtarget}" = "ga-g41m-es2l" ] || [ "${boardtarget}" = "kcma-d8" ] || [ "${boardtarget}" = "d510mo" ]; then + if [ "${romtype}" = "vesafb" ]; then + printf "Only text-mode is reported to work on KGPE-D16, KCMA-D8, D510MO and ga-g41m-es2l\n" + printf "TODO: get tpearson to fix it\n" + continue + fi + fi + + # Build coreboot ROM image + make clean + mv "config_${romtype}" ".config" + cp "../../grub_${romtype}.elf" "grub.elf" + if [ "${boardtarget}" = "d510mo" ] || [ "${boardtarget}" = "ga-g41m-es2l" ]; then + # Do not use SeaGRUB + cp grub.elf payload.elf + make -j${cores} + mv "build/coreboot.rom" "${boardtarget}_${romtype}.rom" + + # We dont need seabios.elf anymore + rm -f "payload.elf" + else + # Use SeaGRUB + cp "../../../seabios/out/bios.bin.elf" "payload.elf" + make -j${cores} + + mv "build/coreboot.rom" "${boardtarget}_${romtype}.rom" + + # We dont need seabios.elf anymore + rm -f "payload.elf" + # Add the grub.elf to CBFS + ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add-payload -c lzma -f grub.elf -n img/grub2 + + # Set bootorder so that seabios loads grub by default + printf "/rom@img/grub2\n" > bootorder + ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f bootorder -n bootorder -t raw + rm -f bootorder + + # Add 0s delay to seabios, so that the user is not burdened by seeing + # that horrible interface that seabios has + ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add-int -i 0 -n etc/show-boot-menu || "already exists" + + # keyboard spinup timeout + ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" remove -n etc/ps2-keyboard-spinup || printf "does not exist" + ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add-int -i 3000 -n etc/ps2-keyboard-spinup || printf "already exists" + fi + + printf "%s\n" "${version}" > lbversion + ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f lbversion -n lbversion -t raw + rm -f "lbversion" + + # we dont need that grub.elf now + rm -f "grub.elf" + + # .config no longer needed + rm -f ".config" + + # Add the background image + if [ "$romtype" = "vesafb" ] + then + if [ "$1" = "macbook21" ] || [ "$1" = "x200_4mb" ] || [ "$1" = "x200_8mb" ] || [ "$1" = "x200_16mb" ] || [ "$1" = "r400_4mb" ] || [ "$1" = "r400_8mb" ] || [ "$1" = "r400_16mb" ] || [ "$1" = "t400_4mb" ] || [ "$1" = "t400_8mb" ] || [ "$1" = "t400_16mb" ] || [ "$1" = "t500_4mb" ] || [ "$1" = "t500_8mb" ] || [ "$1" = "t500_16mb" ] + then + ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f ../../../resources/grub/background/gnulove.jpg -n background.jpg -t raw + else + ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f ../../../resources/grub/background/background.jpg -n background.jpg -t raw + fi + fi + + # Add the correct GRUB configuration file for this image. + for keylayout in ../../../resources/utilities/grub-assemble/keymap/original/* + do + keymap="${keylayout##*/}" + + # copy the images based on the keymap + cp "${boardtarget}_${romtype}.rom" "${boardtarget}_${keymap}_${romtype}.rom" + + # Insert grub config into the image + ./util/cbfstool/cbfstool "${boardtarget}_${keymap}_${romtype}.rom" add -f ../../"grub_${keymap}_${romtype}.cfg" -n grub.cfg -t raw + # Insert grub test config into the image (for the user to test modifications to before modifying the main one) + ./util/cbfstool/cbfstool "${boardtarget}_${keymap}_${romtype}.rom" add -f ../../"grub_${keymap}_${romtype}_test.cfg" -n grubtest.cfg -t raw + done + + # This config-less ROM is no longer needed + rm -f "${boardtarget}_${romtype}.rom" +done + +# Clean up and prepare bin/ containing all ROM images + +# move ROM images into the newly created directory +rm -Rf "${boardtarget:?}/" +mkdir "${boardtarget}/" +mv "${boardtarget}"*.rom "${boardtarget}/" + +# delete old ROM images +rm -Rf "../../../bin/grub/${boardtarget}/" +# put new ROM images in ../bin/grub/ +[ -d "../../../bin/grub/" ] || mkdir -p "../../../bin/grub/" +mv "${boardtarget}/" "../../../bin/grub/" + +# version info file no longer needed +rm -f ".coreboot-version" + +git checkout master +( + cd "3rdparty/vboot/" + git checkout master +) +) + +printf "\n\n" diff --git a/resources/scripts/helpers/build/roms/withseabios b/resources/scripts/helpers/build/roms/withseabios new file mode 100755 index 00000000..5b69c452 --- /dev/null +++ b/resources/scripts/helpers/build/roms/withseabios @@ -0,0 +1,55 @@ +#!/bin/bash + +# +# helper script: build ROM images with SeaBIOS and put them in ./bin/seabios/ +# +# 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 working directory is the root +# of git or release archive + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +printf "Building ROM images with the SeaBIOS payload\n" + +[ -d bin ] || mkdir "bin/" + +# Build ROM images for supported boards +buildrom() { + board="$1" + if [ -f "resources/libreboot/config/seabios/${board}/config" ]; then + ./build roms withseabios_helper "${board}" + fi +} + +if [ $# -gt 0 ]; then + for board in "${@}"; do + buildrom "${board}" + done +else + for board in resources/libreboot/config/seabios/*; do + buildrom "${board##*/}" + done +fi + +# The SeaBIOS files are no longer needed +rm -f coreboot/*.{elf,cfg} +rm -f coreboot/*/*/*.{elf,cfg} + +printf "\n\n" diff --git a/resources/scripts/helpers/build/roms/withseabios_helper b/resources/scripts/helpers/build/roms/withseabios_helper new file mode 100755 index 00000000..56d03d65 --- /dev/null +++ b/resources/scripts/helpers/build/roms/withseabios_helper @@ -0,0 +1,136 @@ +#!/bin/bash + +# helper script: create ROM images for a given system, with SeaBIOS +# +# 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 working directory is the root +# of git or release archive + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e +if [ -z ${NPROC+x} ]; then + cores="$(nproc)" +else + case ${NPROC} in + ''|*[!0-9]*) + printf "value '%s' for NPROC is invalid. non-numeric. Exiting.\n" "${NPROC}" + exit 1 + ;; + esac + cores="${NPROC}" +fi + +if (( $# != 1 )); then + printf "Usage: ./buildrom-withseabios boardname\n" + printf "Example: ./buildrom-withseabios x60\n" + printf "You need to specify exactly 1 argument\n" + exit 1 +fi + +boardtarget="${1}" + +if [ -f "version" ]; then + # release archive is being used + version="$(cat version)" +else + # git repo is being used + version="$(git describe --tags HEAD)" +fi + +printf "SeaBIOS Helper script: build ROM images for '%s'\n" "${boardtarget}" + +( +cbrevision="$(cat resources/libreboot/config/seabios/${boardtarget}/cbrevision)" +vbootrevision="$(cat resources/libreboot/config/seabios/${boardtarget}/vbootrevision)" +branchname="seabios_${boardtarget}" + +cd "coreboot/${cbrevision}/${cbrevision}/" +git checkout ${branchname} +( + cd "3rdparty/vboot/" + git checkout ${branchname} +) + +# Make sure to remove these first +rm -f *{elf,cfg} + +printf 'libreboot-%s\n' "${version}" > ".coreboot-version" # needed for reproducible builds in coreboot + +# Build ROM images with text-mode and corebootfb modes. + +for romtype in txtmode vesafb +do + if [ "${boardtarget}" = "kgpe-d16" ] || [ "${boardtarget}" = "kcma-d8" ] || [ "${boardtarget}" = "d945gclf" ]; then + if [ "${romtype}" = "vesafb" ]; then + printf "Only text-mode is reported to work on KGPE-D16, KCMA-D8, d945gclf\n" + continue + fi + fi + + if [ "${boardtarget}" = "qemu_i440fx_piix4" ] || [ "${boardtarget}" = "qemu_q35_ich9" ] + then + # assume that the default config enable framebuffer mode, duplicate and patch for text-mode + # necessary, otherwise it will ask you to enter the Y/X resolution of the framebuffer at build time + cp "../../../resources/libreboot/config/seabios/${boardtarget}/config" "config_vesafb" + sed 's/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/' < "config_vesafb" > "config_txtmode" + else + # assume that the default config enables text-mode, duplicate and patch for framebuffer mode + cp "../../../resources/libreboot/config/seabios/${boardtarget}/config" "config_txtmode" + sed 's/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/' < "config_txtmode" > "config_vesafb" + fi + + # Build coreboot ROM image + make clean + cp "../../../seabios/out/bios.bin.vga.elf" "payload.elf" + mv "config_${romtype}" .config + make -j${cores} + rm -f "payload.elf" + mv "build/coreboot.rom" "${boardtarget}_${romtype}.rom" + + # Now add SeaVGABIOS (SeaBIOS wrapper for coreboot native video init) + ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f ../../../seabios/out/vgabios.bin -n vgaroms/vgabios.bin -t raw + + # .config no longer needed + rm -f ".config" +done + +# Clean up and prepare bin/ containing all ROM images + +# move ROM images into the newly created directory +rm -Rf "${boardtarget:?}/" +mkdir "${boardtarget}/" +mv "${boardtarget}"*.rom "${boardtarget}/" + +# delete old ROM images +rm -Rf "../../../bin/seabios/${boardtarget}/" +# put new ROM images in ../bin/grub/ +[ -d "../../../bin/seabios/" ] || mkdir -p "../../../bin/seabios/" +mv "${boardtarget}/" "../../../bin/seabios/" + +# version info file no longer needed +rm -f ".coreboot-version" + +git checkout master +( + cd "3rdparty/vboot/" + git checkout master +) +) + +printf "\n\n" diff --git a/resources/scripts/helpers/download/bucts b/resources/scripts/helpers/download/bucts new file mode 100755 index 00000000..e516ade8 --- /dev/null +++ b/resources/scripts/helpers/download/bucts @@ -0,0 +1,59 @@ +#!/bin/bash + +# helper script: downloads bucts and patches it +# +# 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/>. +# + +# This script assumes that the working directory is the +# root of libreboot_src or libreboot git. + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +# Get bucts and checkout last revision used + +# Remove the old version that may exist +# ------------------------------------------------------------------------------ + +printf "Downloading bucts\n" + +rm -Rf "bucts/" + +# Get bucts +# ------------------------------------------------------------------------------ + +# download it using git +git clone git://git.stuge.se/bucts.git + +# modifications are required +cd "bucts/" + +# Reset to the last commit that was tested +# ------------------------------------------------------------------------------ + +printf "Patching bucts to not require git for building\n" +git reset --hard dc27919d7a66a6e8685ce07c71aefa4f03ef7c07 + +# Apply patches +# ------------------------------------------------------------------------------ + +git am "../resources/bucts/patch/0001-Makefile-don-t-use-git.patch" + +# we're done +cd "../" + +printf "\n\n" diff --git a/resources/scripts/helpers/download/coreboot b/resources/scripts/helpers/download/coreboot new file mode 100755 index 00000000..daa3b649 --- /dev/null +++ b/resources/scripts/helpers/download/coreboot @@ -0,0 +1,153 @@ +#!/bin/bash + +# helper script: downloads coreboot and patches/deblobs it +# +# Copyright (C) 2014, 2015, 2016 Leah Rowe <info@minifree.org> +# Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr> +# +# 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 libreboot_src or libreboot git. + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +if [ -f "version" ]; then + # _src release archive is being used + version="libreboot-$(cat version)" +else + # git repo is being used + version="libreboot-$(git describe --tags HEAD)" +fi + +make_coreboot_src_directory() { + payload="${1}" + cbrevision="${2}" + vbootrevision="${3}" + firmwarepath="${4}" # libreboot_src/coreboot/ +( + cd "${firmwarepath}/" + # copy coreboot directory there + rm -Rf "${payload:?}/${cbrevision:?}/" + if [ ! -d "${payload}/" ]; then + mkdir -p "${payload}/" + fi + cp -R "coreboot/" "${payload}/${cbrevision}/" + + # We need to reset that revision of coreboot to the specified revision + cd "${payload}/${cbrevision}/" + git reset --hard ${cbrevision} + + if [ "${vbootrevision}" != "no_vboot_revision" ]; then + # reset vboot revision. in practise, we always use the same + # vboot revision on all boards that use a given coreboot revision + cd "3rdparty/vboot/" + git reset --hard ${vbootrevision} + fi +) +} + +printf "Downloading coreboot, patching coreboot and deblobbing coreboot\n" + +# This grabs current base used, and applies patches +# This is also used to run the deblob scripts. + +# Remove the old version that may exist +# ------------------------------------------------------------------------------ + +rm -Rf "coreboot/" + +mkdir "coreboot/" + +cd "coreboot/" + +# Get latest coreboot: +# ------------------------------------------------------------------------------ + +# download it using git +git clone https://review.coreboot.org/coreboot || git clone https://github.com/coreboot/coreboot.git + +# there are modifications required +cd "coreboot/" + +# Define a common version (based on the libreboot version) +# Most likely redundant, because the build system needs to update +# this every time when building a ROM image anyway +printf '%s\n' "${version}" >".coreboot-version" + +# vboot submodule is needed +# ------------------------------------------------------------------------------ + +git submodule update --init --checkout -- 3rdparty/vboot/ + +# Create branches, with patches in each branch +# Create separate coreboot source directories *for each board* +# ------------------------------------------------------------------------------ + +for payloads in ../../resources/libreboot/config/*; do + + if [ ! -d "${payloads}/" ]; then + continue + fi + + payload="${payloads##*/}" + + for boardconfig in ../../resources/libreboot/config/${payload}/*; do + + if [ ! -d "${boardconfig}/" ]; then + continue + fi + + cbrevision=$(cat "${boardconfig}/cbrevision") + vbootrevision=$(cat "${boardconfig}/vbootrevision") + + # the same vboot revision is always used for coreboot revision, + # so we don't need to wworry about checking for that here + + if [ -d "../${cbrevision}/${cbrevision}" ]; then + continue + # the directory already exists, no need to recreate it + fi + + make_coreboot_src_directory ${cbrevision} ${cbrevision} ${vbootrevision} .. + done +done + +# go back to _src/coreboot/ (containing all coreboot directories) +cd "../" +# delete the gitted one (not needed anymore) +rm -Rf "coreboot/" + +# Run coreboot-libre deblob scripts +# ------------------------------------------------------------------------------ + +printf "Deleting .git* in coreboot/ (history inside .git contains the blobs that were deleted)\n" +rm -Rf */*/.git* +rm -Rf */*/3rdparty/*/.git* + +# Delete crossgcc from non-crossgcc coreboot archives +# (the build system will create symlinks later when building the ROM images) +for payload in *; do + if [ "${payload##*/}" != "crossgcc" ]; then + rm -Rf ${payload:?}/*/util/crossgcc/ + fi +done +cd "../" + +printf "Deblobbing coreboot\n" +./resources/utilities/coreboot-libre/deblob + +printf "\n\n" diff --git a/resources/scripts/helpers/download/crossgcc b/resources/scripts/helpers/download/crossgcc new file mode 100755 index 00000000..6b77917c --- /dev/null +++ b/resources/scripts/helpers/download/crossgcc @@ -0,0 +1,55 @@ +#!/bin/bash + +# helper script: downloads crossgcc, for building coreboot +# +# Copyright (C) 2016 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 libreboot_src or libreboot git. + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +if [ -f "version" ]; then + # _src release archive is being used + version="libreboot-$(cat version)" +else + # git repo is being used + version="libreboot-$(git describe --tags HEAD)" +fi + +# coreboot revisios used for crossgcc +crossgccrevision="00aa45391ddb22b5ac24151d54615ca1d89eb745" +vbootrevision="d187cd3fc792f8bcefbee4587c83eafbd08441fc" + +rm -Rf "crossgcc/" +( + git clone https://review.coreboot.org/coreboot crossgcc || git clone https://github.com/coreboot/coreboot.git crossgcc + cd "crossgcc/" + git reset --hard ${crossgccrevision} + git submodule update --init --checkout -- 3rdparty/vboot/ + ( + cd 3rdparty/vboot/ + git reset --hard ${vbootrevision} + ) + rm -Rf .git* */*/.git* +) + +printf "Deblobbing coreboot\n" +./resources/utilities/coreboot-libre/deblob + + diff --git a/resources/scripts/helpers/download/depthcharge b/resources/scripts/helpers/download/depthcharge new file mode 100755 index 00000000..9827a346 --- /dev/null +++ b/resources/scripts/helpers/download/depthcharge @@ -0,0 +1,75 @@ +#!/bin/bash + +# helper script: downloads depthcharge and patches it +# +# Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr> +# +# 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 libreboot_src or libreboot git. + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +# Get depthcharge and patch it + +printf "Downloading depthcharge\n" + +rm -Rf "depthcharge/" + +# Get depthcharge +# ------------------------------------------------------------------------------ + +# download depthcharge from git +git clone https://chromium.googlesource.com/chromiumos/platform/depthcharge + +# enter the tree to patch it +cd "depthcharge/" + +# reset to the latest previously tested revision +git reset --hard 065ba14bc56c9044247fef6337d8f9e9a3055820 + +# Patch depthcharge +# ------------------------------------------------------------------------------ + +printf "arm: armv7-a march abi flag for ARMv7 hardware\n" +git am "../resources/depthcharge/patch/0001-arm-armv7-a-march-abi-flag-for-ARMv7-hardware.patch" + +printf "Coreboot image integration removal\n" +git am "../resources/depthcharge/patch/0002-Coreboot-image-integration-removal.patch" + +printf "DOTCONFIG location correction\n" +git am "../resources/depthcharge/patch/0003-DOTCONFIG-location-correction.patch" + +printf "Adaptation for a read-only boot path when no vboot handoff data is found\n" +git am "../resources/depthcharge/patch/0004-Adaptation-for-a-read-only-boot-path-when-no-vboot-h.patch" + +printf "vboot: Only initialize cparams once\n" +git am "../resources/depthcharge/patch/0005-vboot-Only-initialize-cparams-once.patch" + +printf "Proper firmware index report for read-only boot path\n" +git am "../resources/depthcharge/patch/0006-Proper-firmware-index-report-for-read-only-boot-path.patch" + +printf "fdt: nonvolatile-context-storage report to mkbp for EC NV storage\n" +git am "../resources/depthcharge/patch/0007-fdt-nonvolatile-context-storage-report-to-mkbp-for-E.patch" + +printf "vboot: Display callbacks for developer and recovery mode screens\n" +git am "../resources/depthcharge/patch/0008-vboot-Display-callbacks-for-developer-and-recovery-m.patch" + +# leave the tree +cd "../" + +printf "\n\n" diff --git a/resources/scripts/helpers/download/flashrom b/resources/scripts/helpers/download/flashrom new file mode 100755 index 00000000..e7a58949 --- /dev/null +++ b/resources/scripts/helpers/download/flashrom @@ -0,0 +1,65 @@ +#!/bin/bash + +# helper script: downloads flashrom and patches it +# +# 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/>. +# + +# This script assumes that the working directory is the +# root of libreboot_src or libreboot git. + +[ "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://github.com/stefanct/flashrom.git + +( +cd "flashrom/" + +# reset to known revision +git checkout 0.9.9 +git reset --hard + +# Apply patches +# ------------------------------------------------------------------------------ + +printf "Enabling whitelist for X200S, X200 Tablet, T400, T500 and R400\n" +git am "../resources/flashrom/patch/0001-New-laptops-whitelisted-ThinkPad-R400-and-ThinkPad-T.patch" + +printf "Enabling whitelist for Libiquity Taurinus X200\n" +git am "../resources/flashrom/patch/0002-Add-whitelist-for-Taurinus-X200-laptop.patch" + +# Remove redundant definitions for the flash chips that +# supported libreboot systems use. This removes the need +# for the user to run with the "-c" argument on these systems +printf "Patching flashchips.c to remove the redundant entries\n" +git am "../resources/flashrom/patch/0003-purged-chips.patch" +) + +printf "\n\n" diff --git a/resources/scripts/helpers/download/grub b/resources/scripts/helpers/download/grub new file mode 100755 index 00000000..d0d42817 --- /dev/null +++ b/resources/scripts/helpers/download/grub @@ -0,0 +1,71 @@ +#!/bin/bash + +# helper script: Downloads GRUB and patches it. +# +# Copyright (C) 2014, 2015, 2016 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 libreboot_src or libreboot git. + +[ "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 + +# modifications are required +cd "grub/" + +# reset to known revision +git reset --hard 7f2a856faec951b7ab816880bd26e1e10b17a596 + +# Apply patches +# ------------------------------------------------------------------------------ + +# Replace "GNU GRUB version" in GRUB screen with "FREE AS IN FREEDOM" +git am "../resources/grub/patch/0001-grub-core-normal-main.c-Display-FREE-AS-IN-FREEDOM-n.patch" + +# GRUB enhancement patches from grub.johnlane.ie (rebased in libreboot's GRUB, unofficially, on 30 November 2015) +git am "../resources/grub/patch/grub.johnlane.ie/0001-Cryptomount-support-LUKS-detached-header.patch" +git am "../resources/grub/patch/grub.johnlane.ie/0002-Cryptomount-support-key-files.patch" +git am "../resources/grub/patch/grub.johnlane.ie/0003-Cryptomount-luks-allow-multiple-passphrase-attempts.patch" +git am "../resources/grub/patch/grub.johnlane.ie/0004-Cryptomount-support-plain-dm-crypt.patch" +git am "../resources/grub/patch/grub.johnlane.ie/0005-Cryptomount-support-for-hyphens-in-UUID.patch" +# hotfix from kl3 (merged from autoboot) (ditto) +git am "../resources/grub/patch/grub.johnlane.ie/0006-grub-core-disk-cryptodisk.c-Point-to-const-char.patch" + +# Needed for reproducible builds in GRUB +git am "../resources/grub/patch/reproducible/0001-mkstandalone-add-argument-fixed-time-to-override-mti.patch" +git am "../resources/grub/patch/reproducible/0002-mkrescue-add-argument-fixed-time-to-get-reproducible.patch" +git am "../resources/grub/patch/reproducible/0003-Makefile-use-FIXED_TIMESTAMP-for-mkstandalone-if-set.patch" + +cd "../" + +# Also download SeaBIOS, which we use with GRUB, to implement SeaGRUB +./download seabios + +printf "\n\n" diff --git a/resources/scripts/helpers/download/memtest86plus b/resources/scripts/helpers/download/memtest86plus new file mode 100755 index 00000000..920d16fd --- /dev/null +++ b/resources/scripts/helpers/download/memtest86plus @@ -0,0 +1,71 @@ +#!/bin/bash + +# helper script: Downloads MemTest86+ and patches it +# +# Copyright (C) 2014, 2015 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/>. +# + +# This script assumes that the working directory is the +# root of libreboot_src or libreboot git. + +[ "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://www.memtest.org/download/5.01/memtest86+-5.01.tar.gz + +if [ "$(sha512sum memtest86+-5.01.tar.gz | cut -c1-128)" = "d872db35ef733ec8f49094251f2bf6b98cc80eb06d04044be3aecf28d534f24ba293a08b9979b112dbd07cf27368148939a33a32c7010fc9581a3a5b150c94d7" ]; then + printf "Valid checksum for memtest86plus\n" +else + rm -f "memtest86+-5.01.tar.gz" + printf "Invalid checksum for memtest86plus\n" + exit 1 +fi + +# extract it +tar -xzf "memtest86+-5.01.tar.gz" + +# delete the tar file (no longer needed) +rm -f "memtest86+-5.01.tar.gz" + +# make direcotory name consistent +mv "memtest86+-5.01/" "memtest86plus/" + +# Apply necessary patches +# ------------------------------------------------------------------------------ + +( +cd "memtest86plus/" +for patch in ../resources/memtest86plus/patch/*; do + patch < "${patch}" +done +) + +printf "\n\n" diff --git a/resources/scripts/helpers/download/seabios b/resources/scripts/helpers/download/seabios new file mode 100755 index 00000000..39036ebb --- /dev/null +++ b/resources/scripts/helpers/download/seabios @@ -0,0 +1,50 @@ +#!/bin/bash +# +# Copyright (C) 2015, 2016 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 libreboot_src or libreboot git. + +[ "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 -rf "seabios/" + +# Get latest SeaBIOS +# ------------------------------------------------------------------------------ + +# download it using git +git clone git://git.seabios.org/seabios.git seabios + +( +# modifications are required +cd "seabios/" + +# Reset to the last commit that was tested (we use stable releases for seabios) +# ------------------------------------------------------------------------------ + +git reset --hard rel-1.9.1 +) + + |