diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2015-10-11 11:48:46 (EDT) |
---|---|---|
committer | Francis Rowe <info@gluglug.org.uk> | 2015-10-11 15:16:26 (EDT) |
commit | d8b597f33e75d04b84be7c9d7081a3b97821617d (patch) | |
tree | 8ad2d64ba4dff4cb6cfc1d9f7ecdc2c9cda8d19c /resources/scripts/helpers/build | |
parent | d6b6b1ea62f555f38152ab475d98c57f739f8b8d (diff) | |
download | libreboot-d8b597f33e75d04b84be7c9d7081a3b97821617d.zip libreboot-d8b597f33e75d04b84be7c9d7081a3b97821617d.tar.gz libreboot-d8b597f33e75d04b84be7c9d7081a3b97821617d.tar.bz2 |
Chromebook C201 (codename veyron_speedy) support
This introduces Libreboot support for the Asus Chromebook C201 (codename
veyron_speedy). At this point, this produces a standalone Libreboot image that
can be flashed to the RO Coreboot partition of the SPI flash, as well as the
Libreboot version that can be flash to the RO Firmware ID partition.
Libreboot on the Chromebook C201 uses the depthcharge bootloader, modified to
display text messages instead of ChromeOS bitmaps (that encourage the use of
ChromeOS).
For convenience, an installation script, chromebook-flash-replace, is provided
along with a description of the flash layout, to ease the replacement of the
Coreboot and RO Firmware ID partitions on the full SPI flash image.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'resources/scripts/helpers/build')
-rwxr-xr-x | resources/scripts/helpers/build/clean/depthcharge | 38 | ||||
-rwxr-xr-x | resources/scripts/helpers/build/roms/withdepthcharge | 146 |
2 files changed, 184 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 |