diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2016-12-23 14:20:24 +0100 |
---|---|---|
committer | Leah Rowe <info@minifree.org> | 2017-01-15 14:24:45 +0000 |
commit | 112003a55671ffa5285145280988dc1248b26b08 (patch) | |
tree | e103e0f21ac52c28056db6211758217a41b0b3fd /projects/libreboot-bootstrap | |
parent | 3d08effb91acf985bae9c4eb4386937ce7ed92a9 (diff) | |
download | librebootfr-112003a55671ffa5285145280988dc1248b26b08.tar.gz librebootfr-112003a55671ffa5285145280988dc1248b26b08.zip |
Paper build system initial import into Libreboot
This is the initial import of the Paper build system into Libreboot.
It was written as a flexible and painless replacement for the Libreboot
build system, allowing to support many different configurations.
It currently only supports the following CrOS devices:
* Chromebook 13 CB5-311 (nyan big)
* Chromebook 14 (nyan blaze)
* Chromebook 11 (HiSense) (veyron jerry)
* Chromebit CS10 (veyron mickey)
* Chromebook Flip C100PA (veyron minnie)
* Chromebook C201PA (veyron speedy)
The build system also supports building various tools and provides
various scripts to ease the installation on CrOS devices.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'projects/libreboot-bootstrap')
-rw-r--r-- | projects/libreboot-bootstrap/install/install | 1 | ||||
-rwxr-xr-x | projects/libreboot-bootstrap/install/libreboot-bootstrap | 182 | ||||
-rwxr-xr-x | projects/libreboot-bootstrap/libreboot-bootstrap | 36 |
3 files changed, 219 insertions, 0 deletions
diff --git a/projects/libreboot-bootstrap/install/install b/projects/libreboot-bootstrap/install/install new file mode 100644 index 00000000..1992866b --- /dev/null +++ b/projects/libreboot-bootstrap/install/install @@ -0,0 +1 @@ +libreboot-bootstrap:libreboot-bootstrap diff --git a/projects/libreboot-bootstrap/install/libreboot-bootstrap b/projects/libreboot-bootstrap/install/libreboot-bootstrap new file mode 100755 index 00000000..422fcd27 --- /dev/null +++ b/projects/libreboot-bootstrap/install/libreboot-bootstrap @@ -0,0 +1,182 @@ +#!/bin/bash + +# Copyright (C) 2016 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/>. + +BUILD_SYSTEM="libreboot" + +SOURCES="sources" + +TAR_XZ="tar.xz" +SHA256SUM="sha256sum" +ASC="asc" + +usage() { + printf "$executable [sources path] (extract path)\n" >&2 + + printf "\n When no extract path is provided, sources are extracted in the current\n" + printf " directory.\n" +} + +verify_sources() { + local sources_path=$1 + + local checksum_path + local signature_path + local archive + + if [ -z "$extract_path" ] + then + extract_path=$( pwd ) + fi + + printf "Verifying $BUILD_SYSTEM sources\n" + + archive=$( find $sources_path -name "$BUILD_SYSTEM-sources.$TAR_XZ" || true ) + if [ -z "$archive" ] + then + printf "Finding $BUILD_SYSTEM sources archive failed!\n" >&2 + usage + exit 1 + fi + + checksum_path="$archive.$SHA256SUM" + signature_path="$archive.$ASC" + + if [ -f "$checksum_path" ] + then + ( + cd "$( dirname "$archive" )" + sha256sum -c "$archive.$SHA256SUM" + ) + else + printf "Could not verify boostrap checksum!\n" >&2 + fi + + if [ -f "$signature_path" ] + then + gpg --armor --verify "$signature_path" "$archive" + else + printf "Could not verify boostrap signature!\n" >&2 + fi +} + +extract_sources() { + local sources_path=$1 + local extract_path=$2 + + local build_system_path + local archive + + if [ -z "$extract_path" ] + then + extract_path=$( pwd ) + fi + + build_system_path="$extract_path/$BUILD_SYSTEM" + + if [ -d "$build_system_path" ] + then + return + fi + + printf "Extracting $BUILD_SYSTEM sources from $sources_path to $extract_path\n" + + archive=$( find $sources_path -name "$BUILD_SYSTEM-sources.$TAR_XZ" || true ) + if [ -z "$archive" ] + then + printf "Finding $BUILD_SYSTEM sources archive failed!\n" >&2 + usage + exit 1 + fi + + tar -xf "$archive" -ps -C "$extract_path" +} + +copy_sources() { + local sources_path=$1 + local extract_path=$2 + + local build_system_path + local build_system_sources_path + local archives + local file + + if [ -z "$extract_path" ] + then + extract_path=$( pwd ) + fi + + build_system_path="$extract_path/$BUILD_SYSTEM" + build_system_sources_path="$build_system_path/$SOURCES" + + if ! [ -d "$build_system_path" ] + then + return + fi + + printf "Copying $BUILD_SYSTEM sources from $sources_path to $extract_path\n" + + mkdir -p "$build_system_path/$SOURCES" + + find "$sources_path" -type f -not -name "$BUILD_SYSTEM*" || true | while read file + do + cp "$file" "$build_system_sources_path" + done +} + +requirements() { + local requirement + local requirement_path + + for requirement in "$@" + do + requirement_path=$( which "$requirement" || true ) + + if [ -z "$requirement_path" ] + then + printf "Missing requirement: $requirement\n" >&2 + exit 1 + fi + done +} + +setup() { + root=$( realpath "$( dirname "$0" )" ) + executable=$( basename "$0" ) +} + +libreboot_bootstrap() { + local sources_path=$1 + local extract_path=$2 + + set -e + + setup "$@" + + if [ -z "$sources_path" ] + then + usage + exit 1 + fi + + requirements "tar" "sha256sum" "gpg" + + verify_sources "$sources_path" + extract_sources "$sources_path" "$extract_path" + copy_sources "$sources_path" "$extract_path" +} + +libreboot_bootstrap "$@" diff --git a/projects/libreboot-bootstrap/libreboot-bootstrap b/projects/libreboot-bootstrap/libreboot-bootstrap new file mode 100755 index 00000000..f8166d3e --- /dev/null +++ b/projects/libreboot-bootstrap/libreboot-bootstrap @@ -0,0 +1,36 @@ +#!/bin/bash + +# Copyright (C) 2016 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/>. + +install() { + project_install "$project" "$@" +} + +install_check() { + project_install_check "$project" "$@" +} + +release() { + project_release_install "$project" "$SOURCES" "$@" +} + +release_check() { + project_release_install_check "$project" "$SOURCES" "$@" +} + +clean() { + project_clean "$project" "$@" +} |