summaryrefslogtreecommitdiffstats
path: root/resources/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'resources/scripts')
-rwxr-xr-xresources/scripts/helpers/build/clean/depthcharge38
-rwxr-xr-xresources/scripts/helpers/build/roms/withdepthcharge146
-rwxr-xr-xresources/scripts/helpers/download/coreboot42
-rwxr-xr-xresources/scripts/helpers/download/depthcharge72
4 files changed, 298 insertions, 0 deletions
diff --git a/resources/scripts/helpers/build/clean/depthcharge b/resources/scripts/helpers/build/clean/depthcharge
new file mode 100755
index 0000000..9751d92
--- /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/roms/withdepthcharge b/resources/scripts/helpers/build/roms/withdepthcharge
new file mode 100755
index 0000000..9aa5003
--- /dev/null
+++ b/resources/scripts/helpers/build/roms/withdepthcharge
@@ -0,0 +1,146 @@
+#!/bin/bash
+
+# helper script: build ROM images with depthcharge and put them in ./bin/
+#
+# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# 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
+
+printf "Building ROM images with the depthcharge payload\n"
+
+if [ ! -d "bin/" ]
+then
+ mkdir "bin/"
+fi
+
+# Build libpayload
+# ------------------------------------------------------------------------------
+
+buildlibpayload() {
+ family="$1"
+
+ cd "coreboot/payloads/libpayload"
+
+ make distclean
+ rm -Rf "install/"
+
+ make KBUILD_DEFCONFIG="configs/config.$family" defconfig
+ make -j"$(nproc)"
+ make DESTDIR="install" install
+
+ cd "../../../"
+}
+
+# Build depthcharge
+# ------------------------------------------------------------------------------
+
+builddepthcharge() {
+ board="$1"
+
+ cd "depthcharge/"
+
+ make distclean
+ rm -f "../coreboot/depthcharge.elf"
+
+ make BOARD="$board" defconfig
+ make BOARD="$board" LIBPAYLOAD_DIR="$(pwd)/../coreboot/payloads/libpayload/install/libpayload" VB_SOURCE="$(pwd)/../coreboot/3rdparty/vboot" -j"$(nproc)" depthcharge_unified
+
+ cp "build/depthcharge.elf" "../coreboot/"
+
+ cd "../"
+}
+
+# Build coreboot
+# ------------------------------------------------------------------------------
+
+buildcoreboot() {
+ board="$1"
+
+ cd "coreboot/"
+
+ make distclean
+ rm -f "lbversion"
+ rm -f *.img
+
+ if [ -f "../version" ]; then
+ # _src release archive is being used
+ version="$(cat ../version)"
+ else
+ # git repo is being used
+ version="$(git describe --tags HEAD)"
+ fi
+ printf '%s\n' "${version}" > "lbversion"
+ printf 'libreboot-%s' "${version}" > "ro-frid"
+
+ make KBUILD_DEFCONFIG="$(pwd)/../resources/libreboot/config/depthcharge/${board}/config" defconfig
+ make -j"$(nproc)"
+
+ # Add version information to this image
+ ./util/cbfstool/cbfstool "build/coreboot.rom" add -f lbversion -n lbversion -t raw
+
+ 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/chromebook-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/"
+
+ cd "../"
+}
+
+# Build ROM images for supported boards
+buildrom() {
+ board="$1"
+ if [ -f "resources/libreboot/config/depthcharge/${board}/config" ]; then
+ family=$( echo ${board} |sed "s/_.*//g" )
+
+ buildlibpayload "$family"
+ builddepthcharge "$board"
+ buildcoreboot "$board"
+ 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/download/coreboot b/resources/scripts/helpers/download/coreboot
index 2e1059b..e166fba 100755
--- a/resources/scripts/helpers/download/coreboot
+++ b/resources/scripts/helpers/download/coreboot
@@ -49,6 +49,39 @@ git reset --hard a2bed346a1a45c822bc255e90a0bf6a6ae1d1d50
# vboot submodule is needed
git submodule update --init --checkout -- 3rdparty/vboot/
+# there are modifications required
+cd "3rdparty/vboot/"
+
+git reset --hard 82db93d5fc924860e4f1fb4cf24f29b5b335a480
+
+# Patch vboot
+# ------------------------------------------------------------------------------
+
+printf "firmware: Developer mode timeout delay shortening (down to 3 seconds)\n"
+git am "../../../resources/libreboot/patch/vboot/0001-firmware-Developer-mode-timeout-delay-shortening-dow.patch"
+
+printf "firmware: Text-based screen display in priority\n"
+git am "../../../resources/libreboot/patch/vboot/0002-firmware-Text-based-screen-display-in-priority.patch"
+
+printf "firmware: NV context pointer handoff to VbExDisplayScreen\n"
+git am "../../../resources/libreboot/patch/vboot/0003-firmware-NV-context-pointer-handoff-to-VbExDisplaySc.patch"
+
+printf "firmware: Hold key combination in developer mode\n"
+git am "../../../resources/libreboot/patch/vboot/0004-firmware-Hold-key-combination-in-developer-mode.patch"
+
+printf "firmware: Screen blank and wait at disabled USB boot warning\n"
+git am "../../../resources/libreboot/patch/vboot/0005-firmware-Screen-blank-and-wait-at-disabled-USB-boot-.patch"
+
+printf "firmware: Separate screen and wait at device information screen\n"
+git am "../../../resources/libreboot/patch/vboot/0006-firmware-Separate-screen-and-wait-at-device-informat.patch"
+
+printf "firmware: Localization keys removal\n"
+git am "../../../resources/libreboot/patch/vboot/0007-firmware-Localization-keys-removal.patch"
+
+# leave the vboot tree
+cd "../../"
+
+
# Get patches from review.coreboot.org
# ------------------------------------------------------------------------------
@@ -139,6 +172,15 @@ printf "ec/lenovo/h8: re-factor handling of power_management_beeps\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/31/10531/8 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0013-ec-lenovo-h8-re-factor-handling-of-power_management_.patch"
+# Chromebook:
+
+printf "armv7: Word-sized/half-word-sized memory operations for 32/16 bit read/write\n"
+# git fetch http://review.coreboot.org/coreboot refs/changes/98/11698/6 && git cherry-pick FETCH_HEAD
+git am "../resources/libreboot/patch/chromebook/0001-armv7-Word-sized-half-word-sized-memory-operations-f.patch"
+
+printf "chromeos: Allow disabling vboot firmware verification when ChromeOS is enabled\n"
+git am "../resources/libreboot/patch/chromebook/0002-chromeos-Allow-disabling-vboot-firmware-verification.patch"
+
# Run coreboot-libre deblob scripts
# ------------------------------------------------------------------------------
diff --git a/resources/scripts/helpers/download/depthcharge b/resources/scripts/helpers/download/depthcharge
new file mode 100755
index 0000000..1d1e769
--- /dev/null
+++ b/resources/scripts/helpers/download/depthcharge
@@ -0,0 +1,72 @@
+#!/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 3a5d54e31267578f48fb283fae56a405108f1498
+
+# 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 "Proper firmware index report for read-only boot path\n"
+git am "../resources/depthcharge/patch/0005-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/0006-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/0007-vboot-Display-callbacks-for-developer-and-recovery-m.patch"
+
+# leave the tree
+cd "../"
+
+printf "\n\n"