aboutsummaryrefslogtreecommitdiff
path: root/resources/scripts/helpers/build/module
diff options
context:
space:
mode:
Diffstat (limited to 'resources/scripts/helpers/build/module')
-rwxr-xr-xresources/scripts/helpers/build/module/bucts67
-rwxr-xr-xresources/scripts/helpers/build/module/coreboot207
-rwxr-xr-xresources/scripts/helpers/build/module/crossgcc45
-rwxr-xr-xresources/scripts/helpers/build/module/flashrom93
-rwxr-xr-xresources/scripts/helpers/build/module/grub57
-rwxr-xr-xresources/scripts/helpers/build/module/i945pwm42
-rwxr-xr-xresources/scripts/helpers/build/module/ich9deblob44
-rwxr-xr-xresources/scripts/helpers/build/module/memtest86plus33
-rwxr-xr-xresources/scripts/helpers/build/module/seabios61
9 files changed, 649 insertions, 0 deletions
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 ----------------------