libreboot

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 112003a55671ffa5285145280988dc1248b26b08
parent 3d08effb91acf985bae9c4eb4386937ce7ed92a9
Author: Paul Kocialkowski <contact@paulk.fr>
Date:   Fri, 23 Dec 2016 14:20:24 +0100

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:
.gitignore | 9+++++++++
libreboot | 262+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
libs/common | 379+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
libs/git | 634+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
libs/project | 1471+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
libs/tool | 287+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/cbfstool/cbfstool | 108+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/cbfstool/configs/blobs | 2++
projects/cbfstool/configs/blobs-ignore | 2++
projects/cbfstool/configs/blobs-ignore-notes.txt | 2++
projects/cbfstool/configs/install | 2++
projects/cbfstool/configs/revision | 2++
projects/cbfstool/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch | 2++
projects/cbmem/cbmem | 107+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/cbmem/configs/blobs | 2++
projects/cbmem/configs/blobs-ignore | 2++
projects/cbmem/configs/blobs-ignore-notes.txt | 2++
projects/cbmem/configs/install | 1+
projects/cbmem/configs/revision | 2++
projects/cbmem/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch | 2++
projects/coreboot/configs/blobs | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/coreboot/configs/blobs-ignore | 449+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/coreboot/configs/blobs-ignore-notes.txt | 15+++++++++++++++
projects/coreboot/configs/depthcharge/nyan/arch | 1+
projects/coreboot/configs/depthcharge/nyan/big/config | 7+++++++
projects/coreboot/configs/depthcharge/nyan/blaze/config | 12++++++++++++
projects/coreboot/configs/depthcharge/nyan/ec | 1+
projects/coreboot/configs/depthcharge/nyan/targets | 2++
projects/coreboot/configs/depthcharge/targets | 2++
projects/coreboot/configs/depthcharge/veyron/arch | 1+
projects/coreboot/configs/depthcharge/veyron/jerry/config | 12++++++++++++
projects/coreboot/configs/depthcharge/veyron/jerry/ec | 1+
projects/coreboot/configs/depthcharge/veyron/mickey/config | 5+++++
projects/coreboot/configs/depthcharge/veyron/minnie/config | 7+++++++
projects/coreboot/configs/depthcharge/veyron/minnie/ec | 1+
projects/coreboot/configs/depthcharge/veyron/speedy/config | 7+++++++
projects/coreboot/configs/depthcharge/veyron/speedy/ec | 1+
projects/coreboot/configs/depthcharge/veyron/targets | 4++++
projects/coreboot/configs/install | 1+
projects/coreboot/configs/revision | 1+
projects/coreboot/configs/targets | 1+
projects/coreboot/coreboot | 135+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/coreboot/coreboot-helper | 38++++++++++++++++++++++++++++++++++++++
projects/coreboot/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch | 122+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/coreboot/patches/0002-libpayload-Update-ARM-CrOS-devices-configuration.patch | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/coreboot/patches/0003-libpayload-Get-current-tick-from-high-register-in-ge.patch | 32++++++++++++++++++++++++++++++++
projects/coreboot/patches/0004-libpayload-Enable-USB-HID-in-veyron-configuration.patch | 27+++++++++++++++++++++++++++
projects/cros-ec/configs/nyan/big/config | 1+
projects/cros-ec/configs/nyan/blaze/config | 1+
projects/cros-ec/configs/nyan/install | 2++
projects/cros-ec/configs/nyan/revision | 1+
projects/cros-ec/configs/nyan/targets | 2++
projects/cros-ec/configs/targets | 3+++
projects/cros-ec/configs/tools/install | 6++++++
projects/cros-ec/configs/tools/revision | 1+
projects/cros-ec/configs/veyron/install | 2++
projects/cros-ec/configs/veyron/jerry/config | 1+
projects/cros-ec/configs/veyron/minnie/config | 1+
projects/cros-ec/configs/veyron/revision | 1+
projects/cros-ec/configs/veyron/speedy/config | 1+
projects/cros-ec/configs/veyron/targets | 3+++
projects/cros-ec/cros-ec | 136+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/cros-ec/cros-ec-helper | 22++++++++++++++++++++++
projects/cros-ec/patches/nyan/0001-use-_DEFAULT_SOURCE-for-newer-glibc.patch | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/cros-ec/patches/nyan/0002-Enforce-compilation-without-system-headers.patch | 27+++++++++++++++++++++++++++
projects/cros-ec/patches/nyan/0003-Don-t-declare-functions-inline-that-aren-t-always-de.patch | 28++++++++++++++++++++++++++++
projects/cros-ec/patches/nyan/0004-cortex-m-Use-assembly-exception-handler-and-routine-.patch | 230+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/cros-ec/patches/veyron/0001-ec-fix-a-clang-warning-by-use-a-unused-variable.patch | 38++++++++++++++++++++++++++++++++++++++
projects/cros-ec/patches/veyron/0002-use-_DEFAULT_SOURCE-for-newer-glibc.patch | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/cros-ec/patches/veyron/0003-Enforce-compilation-without-system-headers.patch | 44++++++++++++++++++++++++++++++++++++++++++++
projects/cros-ec/patches/veyron/0004-Don-t-declare-functions-inline-that-aren-t-always-de.patch | 28++++++++++++++++++++++++++++
projects/cros-ec/patches/veyron/0005-Don-t-include-missing-and-unnecessary-math-header.patch | 29+++++++++++++++++++++++++++++
projects/cros-ec/patches/veyron/0006-cortex-m0-Use-assembly-exception-handlers-for-task-s.patch | 219+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/cros-scripts/cros-scripts | 36++++++++++++++++++++++++++++++++++++
projects/cros-scripts/install/cros-kernel-prepare | 155+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/cros-scripts/install/cros-medium-setup | 313+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/cros-scripts/install/install | 2++
projects/cros-tools/configs/projects | 7+++++++
projects/cros-tools/cros-tools | 44++++++++++++++++++++++++++++++++++++++++++++
projects/crossgcc/configs/blobs | 2++
projects/crossgcc/configs/blobs-ignore | 2++
projects/crossgcc/configs/blobs-ignore-notes.txt | 2++
projects/crossgcc/configs/install | 1+
projects/crossgcc/configs/revision | 2++
projects/crossgcc/configs/targets | 1+
projects/crossgcc/crossgcc | 209+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/crossgcc/crossgcc-helper | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/crossgcc/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch | 2++
projects/depthcharge/configs/install | 1+
projects/depthcharge/configs/nyan/arch | 1+
projects/depthcharge/configs/revision | 1+
projects/depthcharge/configs/targets | 2++
projects/depthcharge/configs/veyron/arch | 1+
projects/depthcharge/depthcharge | 108+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/depthcharge/depthcharge-helper | 26++++++++++++++++++++++++++
projects/depthcharge/patches/0001-fdt-nonvolatile-context-storage-report-to-mkbp-for-E.patch | 31+++++++++++++++++++++++++++++++
projects/depthcharge/patches/0002-Proper-firmware-index-report-for-read-only-boot-path.patch | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/depthcharge/patches/0003-vboot-Display-callbacks-for-all-screens.patch | 240+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/depthcharge/patches/0004-mmc-Initialize-clock-variable-in-mmc_recalculate_clo.patch | 30++++++++++++++++++++++++++++++
projects/flashmap/configs/install | 1+
projects/flashmap/configs/revision | 1+
projects/flashmap/flashmap | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/flashrom-cros/configs/install | 1+
projects/flashrom-cros/configs/revision | 1+
projects/flashrom-cros/flashrom-cros | 106+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/flashrom-cros/patches/0001-programmer.h-Define-ich_generation-after-enum-declar.patch | 37+++++++++++++++++++++++++++++++++++++
projects/flashrom/configs/install | 1+
projects/flashrom/configs/lenovobios/revision | 2++
projects/flashrom/configs/revision | 1+
projects/flashrom/configs/targets | 2++
projects/flashrom/flashrom | 115+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/flashrom/patches/0001-New-laptops-whitelisted-ThinkPad-R400-and-ThinkPad-T.patch | 28++++++++++++++++++++++++++++
projects/flashrom/patches/0002-Add-whitelist-for-Taurinus-X200-laptop.patch | 24++++++++++++++++++++++++
projects/flashrom/patches/0003-purged-chips.patch | 354+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/flashrom/patches/lenovobios/0001-Lenovobios-adaptation-for-Macronix-and-SST-chips.patch | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/hdctools/configs/install | 6++++++
projects/hdctools/configs/revision | 1+
projects/hdctools/hdctools | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/hdctools/patches/0001-Remove-Werror-flag.patch | 25+++++++++++++++++++++++++
projects/libpayload/configs/depthcharge/nyan/arch | 1+
projects/libpayload/configs/depthcharge/nyan/config | 1+
projects/libpayload/configs/depthcharge/targets | 2++
projects/libpayload/configs/depthcharge/veyron/arch | 1+
projects/libpayload/configs/depthcharge/veyron/config | 1+
projects/libpayload/configs/install | 1+
projects/libpayload/configs/targets | 1+
projects/libpayload/libpayload | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/libpayload/libpayload-helper | 27+++++++++++++++++++++++++++
projects/libreboot-all/configs/projects | 5+++++
projects/libreboot-all/libreboot-all | 44++++++++++++++++++++++++++++++++++++++++++++
projects/libreboot-bootstrap/install/install | 1+
projects/libreboot-bootstrap/install/libreboot-bootstrap | 182+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/libreboot-bootstrap/libreboot-bootstrap | 36++++++++++++++++++++++++++++++++++++
projects/libreboot-images/configs/projects | 6++++++
projects/libreboot-images/configs/projects-build | 2++
projects/libreboot-images/libreboot-images | 44++++++++++++++++++++++++++++++++++++++++++++
projects/libreboot-release/install/install | 1+
projects/libreboot-release/install/libreboot-release | 316+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/libreboot-release/libreboot-release | 38++++++++++++++++++++++++++++++++++++++
projects/libreboot-sources/libreboot-sources | 49+++++++++++++++++++++++++++++++++++++++++++++++++
projects/libreboot-tools/configs/projects | 4++++
projects/libreboot-tools/configs/projects-download | 5+++++
projects/libreboot-tools/configs/projects-update | 2++
projects/libreboot-tools/libreboot-tools | 44++++++++++++++++++++++++++++++++++++++++++++
projects/mosys/configs/install | 1+
projects/mosys/configs/revision | 1+
projects/mosys/mosys | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/mosys/patches/0001-Force-the-definition-of-build-tools.patch | 44++++++++++++++++++++++++++++++++++++++++++++
projects/nvramtool/configs/blobs | 2++
projects/nvramtool/configs/blobs-ignore | 2++
projects/nvramtool/configs/blobs-ignore-notes.txt | 2++
projects/nvramtool/configs/install | 1+
projects/nvramtool/configs/revision | 2++
projects/nvramtool/nvramtool | 107+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/nvramtool/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch | 2++
projects/vboot/configs/blobs | 22++++++++++++++++++++++
projects/vboot/configs/blobs-ignore | 33+++++++++++++++++++++++++++++++++
projects/vboot/configs/blobs-ignore-notes.txt | 5+++++
projects/vboot/configs/revision | 1+
projects/vboot/configs/targets | 2++
projects/vboot/configs/tools/install | 5+++++
projects/vboot/patches/0001-firmware-Developer-mode-timeout-delay-shortening-dow.patch | 34++++++++++++++++++++++++++++++++++
projects/vboot/patches/0002-firmware-Text-based-screen-display-in-priority.patch | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/vboot/patches/0003-firmware-Hold-key-combination-in-developer-mode.patch | 50++++++++++++++++++++++++++++++++++++++++++++++++++
projects/vboot/patches/0004-firmware-Screen-blank-and-wait-at-disabled-USB-boot-.patch | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/vboot/patches/0005-firmware-Separate-screen-and-wait-at-device-informat.patch | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/vboot/patches/0006-firmware-Localization-keys-removal.patch | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/vboot/patches/0007-firmware-Pass-VbDisplayInfo-information-structure-to.patch | 354+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
projects/vboot/vboot | 147+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/blobs-discover/blobs-discover | 184+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/blobs-discover/sources/deblob-check | 8812+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/release-external/release-external | 34++++++++++++++++++++++++++++++++++
tools/release-external/release-external-helper | 5+++++
173 files changed, 18613 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,9 @@ +/build/ +/install/ +/release/ +/sources/ +/libreboot.conf +.version +.revision +.tarfiles +.epoch diff --git a/libreboot b/libreboot @@ -0,0 +1,262 @@ +#!/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/>. + +libreboot_usage() { + local action + local target + + printf "$executable [action] [target] [arguments]\n" >&2 + + printf "\nGeneric project actions:\n" >&2 + + for action in $PROJECT_ACTIONS_GENERIC + do + printf " $action\n" >&2 + done + + printf "\nVirtual project actions:\n" >&2 + + printf " sources\n" + printf " produce\n" + printf " test\n" + + printf "\nProject targets:\n" >&2 + + ls -A "$root/$PROJECTS/" | while read target + do + if project_check "$target" + then + printf " $target\n" >&2 + fi + done + + printf "\nGeneric tool actions:\n" >&2 + + for action in $TOOL_ACTIONS_GENERIC + do + printf " $action\n" >&2 + done + + printf "\nTool targets:\n" >&2 + + ls -A "$root/$TOOLS/" | while read target + do + if tool_check "$target" + then + printf " $target\n" >&2 + fi + done + + printf "\nEnvironment variables:\n" >&2 + printf " PROJECTS_FORCE - Projects to always perform actions for\n" >&2 + printf " TOOLS_FORCE - Tools to always perform actions for\n" >&2 + printf " RELEASE_KEY - GPG key to use for release\n" >&2 + printf " TASKS - Number of simultaneous tasks to run\n" >&2 + printf " VERSION - Version string to use\n" >&2 + + printf "\nConfiguration files:\n" >&2 + printf " $BUILD_SYSTEM.conf - Environment variables configuration\n" >&2 +} + +libreboot_project() { + action=$1 + shift + project=$1 + shift + + case $action in + "sources") + ( + set +e + + project_action_arguments "extract" "$project" "$@" + if [ $? -eq 0 ] + then + return 0 + fi + + project_action_arguments "download" "$project" "$@" + if [ $? -eq 0 ] + then + return 0 + fi + ) + ;; + "produce") + for action in "build" "install" "release" + do + project_action_arguments "$action" "$project" "$@" + done + ;; + "test") + for action in $PROJECT_ACTIONS + do + project_action_arguments "$action" "$project" "$@" + done + ;; + *) + if ! project_function_check "$project" "$action" + then + libreboot_usage + exit 1 + fi + + if [ "$action" = "usage" ] + then + project_action "$action" "$project" "$@" + else + project_action_arguments "$action" "$project" "$@" + fi + ;; + esac +} + +libreboot_tool() { + action=$1 + shift + tool=$1 + shift + + case $action in + *) + if ! tool_function_check "$tool" "$action" + then + libreboot_usage + exit 1 + fi + + if [ "$action" = "usage" ] + then + tool_action "$action" "$tool" "$@" + else + tool_action_arguments_recursive "$action" "$tool" "$@" + fi + ;; + esac +} + +libreboot_setup() { + root=$( realpath "$( dirname "$0" )" ) + executable=$( basename "$0" ) + + local requirements="git" + local requirement_path + + libreboot_setup_include + libreboot_setup_variables + + for requirement in $requirements + do + requirement_path=$( which "$requirement" || true ) + + if [ -z "$requirement_path" ] + then + printf "Missing requirement: $requirement\n" >&2 + exit 1 + fi + done +} + +libreboot_setup_include() { + local libs_path="$root/libs" + local conf_path + + . "$libs_path/project" + . "$libs_path/tool" + . "$libs_path/common" + . "$libs_path/git" + + conf_path="$root/$BUILD_SYSTEM.conf" + + if [ -f "$conf_path" ] + then + . "$conf_path" + fi +} + +libreboot_setup_variables() { + local version_path="$root/$DOTVERSION" + local epoch_path="$root/$DOTEPOCH" + + if [ -z "$TASKS" ] + then + TASKS=1 + fi + + if [ -z "$VERSION" ] + then + if git_check "$root" + then + VERSION="$BUILD_SYSTEM-"$( git_describe "$root" 2> /dev/null || echo "git" ) + elif [ -f "$version_path" ] + then + VERSION=$( cat "$version_path" ) + else + VERSION=$BUILD_SYSTEM + fi + fi + + if [ -z "$SOURCE_DATE_EPOCH" ] + then + if git_check "$root" + then + SOURCE_DATE_EPOCH=$( git log -1 --format=%ct ) + elif [ -f "$epoch_path" ] + then + SOURCE_DATE_EPOCH=$( cat "$epoch_path" ) + else + SOURCE_DATE_EPOCH=$( date +%s ) + fi + fi + + if [ -z "$EDITOR" ] + then + EDITOR="nano" + fi +} + +libreboot() { + action=$1 + shift + target=$1 + shift + + set -e + + libreboot_setup "$@" + + if [ -z "$action" ] || [ -z "$target" ] + then + libreboot_usage + exit 1 + fi + + requirements "tar" "sed" "gpg" "sha256sum" + + if project_check "$target" + then + libreboot_project "$action" "$target" "$@" + elif tool_check "$target" + then + libreboot_tool "$action" "$target" "$@" + else + libreboot_usage + exit 1 + fi +} + +libreboot "$@" diff --git a/libs/common b/libs/common @@ -0,0 +1,379 @@ +#!/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" + +PROJECTS="projects" +SOURCES="sources" +BUILD="build" +INSTALL="install" +RELEASE="release" +SYSTEMS="systems" +IMAGES="images" +TOOLS="tools" +DOCS="docs" + +CONFIGS="configs" +PATCHES="patches" +TARGETS="targets" +REVISION="revision" +BLOBS="blobs" +BLOBS_IGNORE="blobs-ignore" +BLOBS_DISCOVER="blobs-discover" + +DOTEPOCH=".epoch" +DOTVERSION=".version" +DOTREVISION=".revision" +DOTTARFILES=".tarfiles" +TAR_XZ="tar.xz" +SHA256SUM="sha256sum" +ASC="asc" + +function_check() { + local function=$1 + + declare -f -F "$function" > /dev/null +} + +variable_check() { + local variable=$1 + + test ! -z "${!variable}" +} + +arguments_list() { + local argument + + for argument in "$@" + do + echo "$argument" + done +} + +path_wildcard_expand() { + local path=$@ + + # Evaluation fails with unescaped whitespaces. + path=$( echo "$path" | sed "s/ /\\\ /g" ) + + eval "arguments_list "$path"" +} + +file_checksum_create() { + local path=$1 + + local checksum_path="$path.$SHA256SUM" + local name=$( basename "$path" ) + local directory_path=$( dirname "$path" ) + + ( + cd "$directory_path" + sha256sum "$name" > "$checksum_path" + ) +} + +file_checksum_check() { + local path=$1 + + local checksum_path="$path.$SHA256SUM" + local name=$( basename "$path" ) + local directory_path=$( dirname "$path" ) + + if ! [ -f "$checksum_path" ] + then + printf "Could not verify file checksum!\n" >&2 + return 1 + fi + + ( + cd "$directory_path" + sha256sum -c "$checksum_path" + ) +} + +file_signature_create() { + local path=$1 + + local signature_path="$path.$ASC" + + if [ -z "$RELEASE_KEY" ] + then + return 0 + fi + + gpg --default-key "$RELEASE_KEY" --armor --output "$signature_path" --detach-sign --yes "$path" +} + +file_signature_check() { + local path=$1 + + local signature_path="$path.$ASC" + + if ! [ -f "$signature_path" ] + then + printf "Could not verify file signature!\n" >&2 + return 1 + fi + + gpg --armor --verify "$signature_path" "$path" +} + +file_verification_create() { + local path=$1 + + file_checksum_create "$path" + file_signature_create "$path" +} + +file_verification_check() { + local path=$1 + + file_checksum_check "$path" + file_signature_check "$path" +} + +file_exists_check() { + local path=$1 + + test -f "$path" +} + +directory_filled_check() { + local path=$1 + + if [ -z "$( ls -A "$path" 2> /dev/null )" ] + then + return 1 + else + return 0 + fi +} + +archive_files_create() { + local source_path=$1 + + local directory=$( basename "$source_path" ) + local tarfiles_path="$source_path/$DOTTARFILES" + local revision_path="$source_path/$DOTREVISION" + local version_path="$source_path/$DOTVERSION" + + if git_check "$source_path" + then + git_files "$source_path" | tr -d '\0' > "$tarfiles_path" + echo "$DOTTARFILES" | tr -d '\0' >> "$tarfiles_path" + elif ! [ -f "$tarfiles_path" ] + then + touch "$tarfiles_path" + + ( + cd "$source_path" + find + ) | LC_ALL=C sort | sed "s,^./,," | grep -vP "^\.$" > "$tarfiles_path" + else + # Preserve tarfiles if not in git. + return 0 + fi + + if [ -f "$revision_path" ] + then + echo "$DOTREVISION" | tr -d '\0' >> "$tarfiles_path" + fi + + if [ -f "$version_path" ] + then + echo "$DOTVERSION" | tr -d '\0' >> "$tarfiles_path" + fi + + if [ -f "$epoch_path" ] + then + echo "$DOTEPOCH" | tr -d '\0' >> "$tarfiles_path" + fi +} + +archive_files_date() { + local source_path=$1 + + local epoch_path="$source_path/$DOTEPOCH" + + if ! [ -z "$SOURCE_DATE_EPOCH" ] + then + ( + cd "$source_path" + find -exec touch --no-dereference --date="@$SOURCE_DATE_EPOCH" {} \; + ) + fi +} + +archive_create() { + local archive_path=$1 + local source_path=$2 + local directory=$3 + + local tarfiles_path="$source_path/$DOTTARFILES" + local directory_path=$( dirname "$archive_path" ) + + mkdir -p "$directory_path" + + if [ -z "$directory" ] + then + directory=$( basename "$source_path" ) + fi + + archive_files_create "$source_path" + archive_files_date "$source_path" + + ( + cd "$source_path" + tar -cJf "$archive_path" --no-recursion -T "$tarfiles_path" --transform="s,^,$directory/,S" --owner=root --group=root --numeric-owner + ) +} + +archive_extract() { + local archive_path=$1 + local destination_path=$2 + + if [ -z "$destination_path" ] + then + destination_path=$( dirname "$archive_path" ) + fi + + tar -xf "$archive_path" -ps -C "$destination_path" +} + +rootfs_files_create() { + local source_path=$1 + + local directory=$( basename "$source_path" ) + local tarfiles_path="$source_path/$DOTTARFILES" + + touch "$tarfiles_path" + + ( + cd "$source_path" + execute_root find + ) | LC_ALL=C sort | sed "s,^./,," | grep -vP "^$DOTTARFILES|^\.$" > "$tarfiles_path" +} + +rootfs_files_date() { + local source_path=$1 + + local epoch_path="$source_path/$DOTEPOCH" + + if ! [ -z "$SOURCE_DATE_EPOCH" ] + then + ( + cd "$source_path" + execute_root find -exec touch --no-dereference --date="@$SOURCE_DATE_EPOCH" {} \; + ) + fi +} + +rootfs_create() { + local rootfs_path=$1 + local source_path=$2 + local directory=$3 + + local tarfiles_path="$source_path/$DOTTARFILES" + local directory_path=$( dirname "$rootfs_path" ) + + mkdir -p "$directory_path" + + if [ -z "$directory" ] + then + directory=$( basename "$source_path" ) + fi + + rootfs_files_create "$source_path" + rootfs_files_date "$source_path" + + ( + cd "$source_path" + execute_root tar -cJf "$rootfs_path" --no-recursion -T "$tarfiles_path" --numeric-owner + ) + + execute_root chmod 644 "$rootfs_path" + execute_root chown $USER:$USER "$rootfs_path" +} + +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 +} + +requirements_root() { + local requirement + local requirement_path + + for requirement in "$@" + do + # We need to keep stdout output to show the command. + requirement_path=$( execute_root which "$requirement" || true ) + + if [ -z "$requirement_path" ] + then + printf "Missing requirement: $requirement\n" >&2 + exit 1 + fi + done +} + +arguments_concat() { + local delimiter=$1 + shift + + local concat + + for argument in "$@" + do + if ! [ -z "$concat" ] + then + concat="$concat""$delimiter""$argument" + else + concat="$argument" + fi + done + + echo "$concat" +} + +execute_root() { + local sudo=$( which sudo 2> /dev/null || true ) + local arguments + + printf "Running command as root: " >&2 + echo "$@" >&2 + + if ! [ -z "$sudo" ] + then + sudo "$@" + else + # Quote arguments for eval through su. + arguments=$( printf "%q " "$@" ) + su -c "$arguments" + fi +} diff --git a/libs/git b/libs/git @@ -0,0 +1,634 @@ +#!/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/>. + +DOTGIT=".git" +HEAD="HEAD" +ORIGIN_HEAD="origin/HEAD" +WILDDOTPATCH="*.patch" +GIT_NAME="Libreboot" +GIT_EMAIL="libreboot@libreboot.org" + +git_check() { + local repository_path=$1 + + directory_filled_check "$repository_path/$DOTGIT" +} + +git_clone() { + local repository_path=$1 + local url=$2 + + git clone "$url" "$repository_path" +} + +git_submodule_update() { + local repository_path=$1 + + ( + cd "$repository_path" + git submodule update --init + ) +} + +git_merge() { + local repository_path=$1 + local revision=$2 + + ( + cd "$repository_path" + git merge "$revision" + ) +} + +git_branch_create() { + local repository_path=$1 + local branch=$2 + local revision=$3 + + ( + cd "$repository_path" + git checkout -b "$branch" + + if ! [ -z "$revision" ] + then + git reset --hard "$revision" + fi + ) +} + +git_branch_delete() { + local repository_path=$1 + local branch=$2 + + ( + cd "$repository_path" + git branch -D "$branch" + ) +} + +git_branch_checkout() { + local repository_path=$1 + local branch=$2 + + ( + cd "$repository_path" + git checkout "$branch" > /dev/null + ) +} + +git_branch_check() { + local repository_path=$1 + local branch=$2 + + ( + cd "$repository_path" 2> /dev/null > /dev/null + if [ $? -ne 0 ] + then + return 1 + fi + + git rev-parse --verify "$branch" 2> /dev/null > /dev/null + if [ $? -ne 0 ] + then + return 1 + fi + ) +} + +git_fetch() { + local repository_path=$1 + + ( + cd "$repository_path" + git fetch origin + ) +} + +git_fetch_check() { + local repository_path=$1 + + ( + cd "$repository_path" 2> /dev/null > /dev/null + if [ $? -ne 0 ] + then + return 1 + fi + + local output=$( git fetch --dry-run origin 2>&1 ) + if ! [ -z "$output" ] + then + return 1 + fi + ) +} + +git_clean() { + local repository_path=$1 + + ( + cd "$repository_path" + git clean -df + ) +} + +git_remove() { + local repository_path=$1 + local path=$2 + + ( + cd "$repository_path" + git rm -rf "$path" + ) +} + +git_commit() { + local repository_path=$1 + local message=$2 + + ( + export GIT_COMMITTER_NAME=$GIT_NAME + export GIT_COMMITTER_EMAIL=$GIT_EMAIL + + cd "$repository_path" + git commit --author="$GIT_NAME <$GIT_EMAIL>" -m "$message" + ) +} + +git_patch() { + local repository_path=$1 + local branch=$2 + local patch=$3 + + ( + export GIT_COMMITTER_NAME=$GIT_NAME + export GIT_COMMITTER_EMAIL=$GIT_EMAIL + + cd "$repository_path" + git checkout "$branch" 2> /dev/null > /dev/null + git am "$patch" + ) +} + +git_revision() { + local repository_path=$1 + + ( + cd "$repository_path" + git rev-parse "$HEAD" + ) +} + +git_describe() { + local repository_path=$1 + + ( + cd "$repository_path" + git describe --tags + ) +} + +git_files() { + local repository_path=$1 + + ( + cd "$repository_path" + # Reproducible sorting. + git ls-files | LC_ALL=C sort -z + ) +} + +git_project_repository_path() { + local repository=$1 + + echo "$root/$SOURCES/$repository" +} + +git_project_check() { + local repository=$1 + + local repository_path=$( git_project_repository_path "$repository" ) + + git_check "$repository_path" +} + +git_project_patch_recursive() { + local project=$1 + local repository=$2 + local branch=$3 + local path=$4 + + local repository_path=$( git_project_repository_path "$repository" ) + local project_path=$( project_path "$project" ) + local patches_path="$project_path/$PATCHES/$path/$WILDDOTPATCH" + local patch_path + + if ! [ -z "$path" ] && [ "$path" != "." ] + then + git_project_patch_recursive "$project" "$repository" "$branch" "$( dirname "$path" )" + fi + + path_wildcard_expand "$patches_path" | while read patch_path + do + if ! [ -f "$patch_path" ] + then + continue + fi + + git_patch "$repository_path" "$branch" "$patch_path" + done +} + +git_project_clone() { + local repository=$1 + shift + local urls=$@ + + local repository_path=$( git_project_repository_path "$repository" ) + local directory_path=$( dirname "$repository_path" ) + local url + + mkdir -p "$directory_path" + + ( + set +e + + for url in $urls + do + git_clone "$repository_path" "$url" + + if [ $? -eq 0 ] + then + return 0 + fi + done + + return 1 + ) +} + +git_project_prepare() { + local project=$1 + shift + local repository=$1 + shift + + git_project_prepare_revision "$project" "$repository" "$@" + git_project_prepare_blobs "$project" "$repository" "$@" + git_project_prepare_patch "$project" "$repository" "$@" +} + +git_project_prepare_blobs() { + local project=$1 + shift + local repository=$1 + shift + + local repository_path=$( git_project_repository_path "$repository" ) + local blobs_path=$( project_blobs_path "$project" "$@" ) + local blob + + if [ -z "$blobs_path" ] + then + return + fi + + while read blob + do + git_remove "$repository_path" "$blob" + done < "$blobs_path" + + git_commit "$repository_path" "Removed blobs" +} + +git_project_prepare_patch() { + local project=$1 + shift + local repository=$1 + shift + + local project_path=$( project_path "$project" ) + local configs_path="$project_path/$CONFIGS" + local prepare_branch + local prepare_path + local branch=$project + local argument + local path + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + if [ -z "$path" ] + then + path="$argument" + else + path="$path/$argument" + fi + + branch="$branch-$argument" + fi + + local revision_path="$configs_path/$path/$REVISION" + + if ! [ -f "$revision_path" ] + then + continue + fi + + prepare_branch=$branch + prepare_path=$path + done + + if ! [ -z "$prepare_branch" ] + then + git_project_patch_recursive "$project" "$repository" "$prepare_branch" "$prepare_path" + fi +} + +git_project_prepare_revision() { + local project=$1 + shift + local repository=$1 + shift + + local repository_path=$( git_project_repository_path "$repository" ) + local project_path=$( project_path "$project" ) + local configs_path="$project_path/$CONFIGS" + local prepare_branch + local prepare_revision + local branch=$project + local argument + local path + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + if [ -z "$path" ] + then + path="$argument" + else + path="$path/$argument" + fi + + branch="$branch-$argument" + fi + + local revision_path="$configs_path/$path/$REVISION" + + if ! [ -f "$revision_path" ] + then + continue + fi + + prepare_branch=$branch + prepare_revision=$( cat "$revision_path" ) + done + + if ! [ -z "$prepare_branch" ] + then + git_branch_create "$repository_path" "$prepare_branch" "$prepare_revision" + fi +} + +git_project_prepare_check() { + local project=$1 + shift + local repository=$1 + shift + + local repository_path=$( git_project_repository_path "$repository" ) + local project_path=$( project_path "$project" ) + local configs_path="$project_path/$CONFIGS" + local prepare_branch + local branch=$project + local argument + local path + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + if [ -z "$path" ] + then + path="$argument" + else + path="$path/$argument" + fi + + branch="$branch-$argument" + fi + + local revision_path="$configs_path/$path/$REVISION" + + if ! [ -f "$revision_path" ] + then + continue + fi + + prepare_branch=$branch + done + + if ! [ -z "$prepare_branch" ] + then + git_branch_check "$repository_path" "$prepare_branch" + fi +} + +git_project_prepare_clean() { + local project=$1 + shift + local repository=$1 + shift + + local repository_path=$( git_project_repository_path "$repository" ) + local prepare_branch + local branch=$project + local argument + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + branch="$branch-$argument" + fi + + if ! git_branch_check "$repository_path" "$branch" + then + continue + fi + + prepare_branch=$branch + done + + if ! [ -z "$prepare_branch" ] + then + # Let's not worry about missing branches. + ( + set +e + + git_branch_delete "$repository_path" "$prepare_branch" + + if [ $? -ne 0 ] + then + return 0 + fi + ) + fi +} + +git_project_checkout() { + local project=$1 + shift + local repository=$1 + shift + + local repository_path=$( git_project_repository_path "$repository" ) + local checkout_branch + local branch=$project + local argument + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + branch="$branch-$argument" + fi + + if ! git_branch_check "$repository_path" "$branch" + then + continue + fi + + checkout_branch=$branch + done + + if ! [ -z "$checkout_branch" ] + then + git_branch_checkout "$repository_path" "$checkout_branch" + git_submodule_update "$repository_path" + fi +} + +git_project_update() { + local project=$1 + shift + local repository=$1 + shift + + local repository_path=$( git_project_repository_path "$repository" ) + + git_fetch "$repository_path" + git_branch_checkout "$repository_path" "$ORIGIN_HEAD" + + git_project_prepare_clean "$project" "$repository" "$@" + git_project_prepare "$project" "$repository" "$@" +} + +git_project_update_check() { + local project=$1 + shift + local repository=$1 + shift + + git_project_prepare_check "$project" "$repository" "$@" + + git_fetch_check "$repository_path" +} + +git_project_release() { + local project=$1 + shift + local repository=$1 + shift + local arguments=$@ + + local repository_path=$( git_project_repository_path "$repository" ) + local release_branch + local branch=$project + local argument + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + branch="$branch-$argument" + fi + + if ! git_branch_check "$repository_path" "$branch" + then + continue + fi + + release_branch=$branch + done + + if ! [ -z "$release_branch" ] + then + local archive_path="$root/$RELEASE/$SOURCES/$project/$release_branch.$TAR_XZ" + local sources_path="$root/$SOURCES/$repository" + + printf "Releasing sources archive for $project (with ${arguments:-no argument}) from "$repository" git\n" + + git_branch_checkout "$repository_path" "$release_branch" + git_submodule_update "$repository_path" + git_clean "$repository_path" + archive_create "$archive_path" "$sources_path" "$release_branch" + file_verification_create "$archive_path" + fi +} + +git_project_release_check() { + local project=$1 + shift + local repository=$1 + shift + + local repository_path=$( git_project_repository_path "$repository" ) + local release_branch + local branch=$project + local argument + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + branch="$branch-$argument" + fi + + if ! git_branch_check "$repository_path" "$branch" + then + continue + fi + + release_branch=$branch + done + + if ! [ -z "$release_branch" ] + then + local archive_path="$root/$RELEASE/$SOURCES/$project/$release_branch.$TAR_XZ" + + file_exists_check "$archive_path" + + if [ $? -ne 0 ] + then + return 1 + else + return 0 + fi + fi +} diff --git a/libs/project b/libs/project @@ -0,0 +1,1471 @@ +#!/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/>. + +PROJECT_ACTIONS_GENERIC="usage download extract update build install release clean" +PROJECT_ACTIONS_HELPERS="arguments" +PROJECT_FUNCTIONS=$( for action in $PROJECT_ACTIONS_GENERIC ; do echo "$action" "$action""_check" ; done ; echo "$PROJECT_ACTIONS_HELPERS" ) + +INSTALL_REGEX="\([^:]*\):\(.*\)" + +project_include() { + local project=$1 + + local project_path=$( project_path "$project" ) + + unset -f $PROJECT_FUNCTIONS + + . "$project_path/$project" + + project_helper_include "$project" +} + +project_helper_include() { + local project=$1 + + local project_path=$( project_path "$project" ) + local include="$project_path/$project-helper" + + if [ -f "$include" ] + then + . "$include" + fi +} + +project_check() { + local project=$1 + + local project_path=$( project_path "$project" ) + + if ! [ -f "$project_path/$project" ] + then + return 1 + fi + + return 0 +} + +project_function_check() { + local project=$1 + local function=$2 + + project_include "$project" + + if ! function_check "$function" + then + return 1 + fi + + return 0 +} + +project_action() { + local action=$1 + shift + local project=$1 + shift + local arguments=$@ + + ( + set +e + + if ! project_check "$project" + then + printf "Project $project check failed\n" >&2 + return 1 + fi + + project_action_check "$action" "$project" "$@" + + if [ $? -eq 0 ] + then + return 0 + fi + + project_include "$project" + + if ! function_check "$action" + then + return 0 + fi + + printf "Project $project $action (with ${arguments:-no argument})\n" >&2 + + ( + set -e + "$action" "$@" + ) + + if [ $? -ne 0 ] + then + printf "\nProject $project $action (with ${arguments:-no argument}) failed\n" >&2 + return 1 + else + printf "\nProject $project $action (with ${arguments:-no argument}) completed\n" >&2 + fi + ) +} + +project_action_check() { + local action=$1 + shift + local project=$1 + shift + + ( + set +e + + if ! project_check "$project" + then + printf "Project $project check failed\n" >&2 + return 1 + fi + + project_include "$project" + + if ! function_check "$action""_check" + then + return 1 + fi + + for project_force in $PROJECTS_FORCE + do + if [ "$project_force" = "$project" ] + then + return 1 + fi + done + + ( + set -e + "$action""_check" "$@" + ) + ) +} + +project_action_helper() { + local helper=$1 + shift + local project=$1 + shift + + ( + set +e + + if ! project_check "$project" + then + printf "Project $project check failed\n" >&2 + return 1 + fi + + project_include "$project" + + if ! function_check "$helper" + then + return 0 + fi + + ( + set -e + "$helper" "$@" + ) + ) +} + +project_action_arguments() { + local action=$1 + shift + local project=$1 + shift + + project_action_arguments_verify_recursive "$action" "$project" "$@" + project_action_arguments_recursive "$action" "$project" "$@" +} + +project_action_arguments_verify_recursive() { + local action=$1 + shift + local project=$1 + shift + + local action_helper_arguments + + # Store final argument. + local argument=${@:$#} + + local test + + if [ $# -gt 1 ] + then + # Set previous arguments. + set "${@:1:$#-1}" + elif [ $# -eq 1 ] + then + shift + else + return 0 + fi + + action_helper_arguments=$( project_action_helper "arguments" "$project" "$@" ) + + if ! [ -z "$action_helper_arguments" ] + then + test=$( echo "$action_helper_arguments" | grep -P "^$argument$" || true ) + + if [ -z "$test" ] + then + printf "Invalid argument $argument for project $project action $action\n" >&2 + return 1 + fi + fi + + project_action_arguments_verify_recursive "$action" "$project" "$@" +} + +project_action_arguments_recursive() { + local action=$1 + shift + local project=$1 + shift + + local action_helper_arguments + local argument + local ifs_save + + action_helper_arguments=$( project_action_helper "arguments" "$project" "$@" ) + + if [ $? -ne 0 ] || [ -z "$action_helper_arguments" ] + then + project_action "$action" "$project" "$@" + else + # This it to allow space characters in arguments. + ifs_save=$IFS + IFS=$'\n' + + for argument in $( echo "$action_helper_arguments" ) + do + ( + IFS=$ifs_save + + # Only a single argument at a time is returned by the helper. + project_action_arguments_recursive "$action" "$project" "$@" "$argument" + ) + done + + IFS=$ifs_save + fi +} + +project_action_projects() { + local action=$1 + shift + local project=$1 + shift + + local project_path=$( project_path "$project" ) + local project_projects_path="$project_path/$CONFIGS/$PROJECTS" + local project_projects_action_path="$project_path/$CONFIGS/$PROJECTS-$action" + local arguments + local path + + if [ -f "$project_projects_action_path" ] + then + path=$project_projects_action_path + else + path=$project_projects_path + fi + + # Multiple arguments can be read from the file. + while read arguments + do + eval "project_action_arguments "$action" $arguments" + done < "$path" +} + +project_path() { + local project=$1 + + local project_path="$root/$PROJECTS/$project" + + echo "$project_path" +} + +project_sources_path() { + local project=$1 + shift + local repository=$1 + shift + + local sources_path + local argument + local path + + # Check downloaded and extracted sources first, using "$project." + path="$root/$SOURCES/$project" + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + path="$path-$argument" + fi + + if ! directory_filled_check "$path" + then + continue + fi + + sources_path=$path + done + + if ! [ -z "$sources_path" ] + then + echo "$sources_path" + return + fi + + # Check downloaded sources then, using "$repository." + path="$root/$SOURCES/$repository" + + if directory_filled_check "$path" + then + echo "$path" + return + fi + + # Check project sources finally, using "$project." + path="$root/$PROJECTS/$project/$SOURCES" + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + path="$path/$argument" + fi + + if ! directory_filled_check "$path" + then + continue + fi + + sources_path=$path + done + + if ! [ -z "$sources_path" ] + then + echo "$sources_path" + return + fi +} + +project_sources_directory_filled_check() { + local project=$1 + shift + + local sources_path=$( project_sources_path "$project" "$@" ) + + test ! -z "$sources_path" +} + +project_sources_directory_filled_error() { + local project=$1 + shift + local arguments=$@ + + local sources_path=$( project_sources_path "$project" "$@" ) + + if ! [ -z "$sources_path" ] + then + printf "Sources directory for project $project (with ${arguments:-no argument}) already exists\n" >&2 + return 1 + else + return 0 + fi +} + +project_sources_directory_missing_empty_error() { + local project=$1 + shift + local arguments=$@ + + local sources_path=$( project_sources_path "$project" "$@" ) + + if [ -z "$sources_path" ] + then + printf "Sources directory for project $project (with ${arguments:-no argument}) missing or empty\n" >&2 + return 1 + else + return 0 + fi +} + +project_sources_archive() { + local project=$1 + shift + + local sources_archive + local argument + local path="$root/$SOURCES/$project" + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + path="$path-$argument" + fi + + local archive="$path.$TAR_XZ" + + if ! [ -f "$archive" ] + then + continue + fi + + sources_archive=$archive + done + + if ! [ -z "$sources_archive" ] + then + echo "$sources_archive" + fi +} + +project_sources_archive_extract() { + local project=$1 + shift + local arguments=$@ + + local archive=$( project_sources_archive "$project" "$@" ) + local destination=$( dirname "$archive" ) + + printf "Extracting source archive for $project (with ${arguments:-no argument})\n" + + file_verification_check "$archive" + archive_extract "$archive" "$destination" +} + +project_sources_archive_update() { + local project=$1 + shift + local arguments=$@ + + local repository=$project + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local archive=$( project_sources_archive "$project" "$@" ) + local destination=$( dirname "$archive" ) + + if [ -d "$sources_path" ] + then + rm -rf "$sources_path" + fi + + printf "Extracting source archive for $project (with ${arguments:-no argument})\n" + + file_verification_check "$archive" + archive_extract "$archive" "$destination" +} + +project_sources_archive_missing_error() { + local project=$1 + shift + local arguments=$@ + + local archive=$( project_sources_archive "$project" "$@" ) + if [ -z "$archive" ] || ! [ -f "$archive" ] + then + printf "Missing sources archive for $project (with ${arguments:-no argument})\n" >&2 + return 1 + else + return 0 + fi +} + +project_sources_archive_missing_check() { + local project=$1 + shift + + local archive=$( project_sources_archive "$project" "$@" ) + if [ -z "$archive" ] || ! [ -f "$archive" ] + then + return 0 + else + return 1 + fi +} + +project_blobs_path() { + local project=$1 + shift + + local project_path=$( project_path "$project" ) + local configs_path="$project_path/$CONFIGS" + local argument + local path + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + if [ -z "$path" ] + then + path="$argument" + else + path="$path/$argument" + fi + fi + + local blobs_path="$configs_path/$path/$BLOBS" + + if [ -f "$blobs_path" ] + then + echo "$blobs_path" + return + fi + done +} + +project_blobs_ignore_path() { + local project=$1 + shift + + local project_path=$( project_path "$project" ) + local configs_path="$project_path/$CONFIGS" + local argument + local path + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + if [ -z "$path" ] + then + path="$argument" + else + path="$path/$argument" + fi + fi + + blobs_ignore_path="$configs_path/$path/$BLOBS_IGNORE" + + if [ -f "$blobs_ignore_path" ] + then + echo "$blobs_ignore_path" + return + fi + done +} + +project_arguments_targets() { + local project=$1 + shift + + local project_path=$( project_path "$project" ) + local targets_path="$project_path/$CONFIGS" + local argument + + for argument in "$@" + do + targets_path="$targets_path/$argument" + done + + targets_path="$targets_path/$TARGETS" + + if [ -f "$targets_path" ] + then + cat "$targets_path" + fi +} + +project_usage_actions() { + local project=$1 + shift + + printf "\nGeneric actions:\n" + + for action in $PROJECT_ACTIONS_GENERIC + do + if function_check "$action" + then + printf " $action\n" + fi + done + + if [ $# -gt 0 ] + then + printf "\nSpecific actions:\n" + + for action in "$@" + do + printf " $action\n" + done + fi +} + +project_usage_arguments() { + local project=$1 + shift + + printf "\nArguments:\n" + + project_usage_arguments_recursive "$project" " " "$@" +} + +project_usage_arguments_recursive() { + local project=$1 + shift + local spacing=$1 + shift + + local action_helper_arguments + local argument + + action_helper_arguments=$( project_action_helper "arguments" "$project" "$@" ) + + if ! [ -z "$action_helper_arguments" ] + then + echo "$action_helper_arguments" | while read argument + do + printf "$spacing$argument\n" + project_usage_arguments_recursive "$project" " $spacing" "$@" "$argument" + done + fi +} + +project_download_git() { + local project=$1 + shift + local repository=$1 + shift + local urls=$1 + shift + + requirements "git" + + if ! git_project_check "$repository" + then + project_sources_directory_filled_error "$project" "$repository" "$@" + + git_project_clone "$repository" "$urls" + fi + + git_project_prepare "$project" "$repository" "$@" +} + +project_download_check_git() { + local project=$1 + shift + local repository=$1 + shift + + requirements "git" + + git_project_check "$repository" + git_project_prepare_check "$project" "$repository" "$@" +} + +project_extract() { + local project=$1 + shift + + local repository=$project + + if ! project_sources_directory_filled_check "$project" "$repository" "$@" + then + project_sources_archive_missing_error "$project" "$@" + project_sources_archive_extract "$project" "$@" + fi +} + +project_extract_check() { + local project=$1 + shift + + local repository=$project + + project_sources_directory_filled_check "$project" "$repository" "$@" +} + +project_update_git() { + local project=$1 + shift + local repository=$1 + shift + + requirements "git" + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + if git_project_check "$repository" + then + git_project_update "$project" "$repository" "$@" + else + if ! project_sources_archive_missing_check "$project" "$@" + then + project_sources_archive_update "$project" "$@" + fi + fi +} + +project_update_check_git() { + local project=$1 + shift + local repository=$1 + shift + + requirements "git" + + if git_project_check "$repository" + then + # Git repository should always be updated (even if upstream didn't progress). + # For instance, this is useful for testing new versions of patches without changing revision. + return 1 + else + project_sources_archive_missing_check "$project" "$@" + fi +} + +project_build_check() { + local project=$1 + shift + + local project_path=$( project_path "$project" ) + local build_path=$( project_build_path "$project" "$@" ) + local source_file_path + local argument + local rule + local path + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + if [ -z "$path" ] + then + path="$argument" + else + path="$path/$argument" + fi + fi + + configs_install_path="$project_path/$CONFIGS/$path/$INSTALL" + + if ! [ -f "$configs_install_path" ] + then + continue + fi + + while read rule + do + source=$( echo "$rule" | sed "s/$INSTALL_REGEX/\1/g" ) + source_path="$build_path/$source" + + # Source may contain a wildcard. + path_wildcard_expand "$source_path" | while read source_file_path + do + if ! [ -f "$source_file_path" ] && ! [ -d "$source_file_path" ] + then + false + fi + done + done < "$configs_install_path" + done +} + +project_build_path() { + local project=$1 + shift + + local build_path="$root/$BUILD/$project" + local argument + + for argument in "$@" + do + build_path="$build_path-$argument" + done + + echo "$build_path" +} + +project_build_directory_missing_empty_error() { + local project=$1 + shift + local arguments=$@ + + local build_path=$( project_build_path "$project" "$@" ) + + if ! directory_filled_check "$build_path" + then + printf "Build directory for project $project (with ${arguments:-no argument}) missing or empty\n" >&2 + return 1 + else + return 0 + fi +} + +project_install() { + local project=$1 + shift + + local project_path=$( project_path "$project" ) + local build_path=$( project_build_path "$project" "$@" ) + local install_path=$( project_install_path "$project" "$@" ) + local source_file_path + local argument + local rule + local path + + # Install built files first. + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + if [ -z "$path" ] + then + path="$argument" + else + path="$path/$argument" + fi + fi + + configs_install_path="$project_path/$CONFIGS/$path/$INSTALL" + + if ! [ -f "$configs_install_path" ] + then + continue + fi + + project_build_directory_missing_empty_error "$project" "$@" + + while read rule + do + source=$( echo "$rule" | sed "s/$INSTALL_REGEX/\1/g" ) + source_path="$build_path/$source" + + destination=$( echo "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) + destination_path="$install_path/$destination" + destination_directory_path=$( dirname "$destination_path" ) + + mkdir -p "$destination_directory_path" + + # Source may contain a wildcard. + path_wildcard_expand "$source_path" | while read source_file_path + do + cp -rT "$source_file_path" "$destination_path" + done + done < "$configs_install_path" + done + + path="" + + # Install install files then. + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + if [ -z "$path" ] + then + path="$argument" + else + path="$path/$argument" + fi + fi + + install_install_path="$project_path/$INSTALL/$path/$INSTALL" + + if ! [ -f "$install_install_path" ] + then + continue + fi + + while read rule + do + source=$( echo "$rule" | sed "s/$INSTALL_REGEX/\1/g" ) + source_path="$project_path/$INSTALL/$path/$source" + + destination=$( echo "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) + destination_path="$install_path/$destination" + destination_directory_path=$( dirname "$destination_path" ) + + mkdir -p "$destination_directory_path" + + # Source may contain a wildcard. + path_wildcard_expand "$source_path" | while read source_file_path + do + cp -rT "$source_file_path" "$destination_path" + done + done < "$install_install_path" + done +} + +project_install_check() { + local project=$1 + shift + + local project_path=$( project_path "$project" ) + local build_path=$( project_build_path "$project" "$@" ) + local install_path=$( project_install_path "$project" "$@" ) + local argument + local rule + local path + + # Install built files first. + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + if [ -z "$path" ] + then + path="$argument" + else + path="$path/$argument" + fi + fi + + configs_install_path="$project_path/$CONFIGS/$path/$INSTALL" + + if ! [ -f "$configs_install_path" ] + then + continue + fi + + project_build_directory_missing_empty_error "$project" "$@" + + while read rule + do + destination=$( echo "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) + destination_path="$install_path/$destination" + + if ! [ -f "$destination_path" ] && ! [ -d "$destination_path" ] + then + false + fi + done < "$configs_install_path" + done + + path="" + + # Install install files then. + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + if [ -z "$path" ] + then + path="$argument" + else + path="$path/$argument" + fi + fi + + install_install_path="$project_path/$INSTALL/$path/$INSTALL" + + if ! [ -f "$install_install_path" ] + then + continue + fi + + while read rule + do + destination=$( echo "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) + destination_path="$install_path/$destination" + + if ! [ -f "$destination_path" ] && ! [ -d "$destination_path" ] + then + false + fi + done < "$install_install_path" + done +} + +project_install_path() { + local project=$1 + shift + + local install_path="$root/$INSTALL/$project" + local argument + + for argument in "$@" + do + install_path="$install_path-$argument" + done + + echo "$install_path" +} + +project_install_directory_missing_empty_error() { + local project=$1 + shift + local arguments=$@ + + local install_path=$( project_install_path "$project" "$@" ) + + if ! directory_filled_check "$install_path" + then + printf "Install directory for project $project (with ${arguments:-no argument}) missing or empty\n" >&2 + return 1 + else + return 0 + fi +} + +project_release_path() { + local project=$1 + shift + local prefix=$1 + + local release_path="$root/$RELEASE/$prefix" + + # Special care for tools and systems, that depend on the host arch. + if [ "$prefix" = "$SYSTEMS" ] || [ "$prefix" = "$TOOLS" ] + then + local machine=$( uname -m ) + + release_path="$release_path/$machine/$project" + else + release_path="$release_path/$project" + fi + + echo "$release_path" +} + +project_release_archive_path() { + local project=$1 + shift + local prefix=$1 + shift + + local release_path=$( project_release_path "$project" "$prefix" ) + local argument + local path="$project" + + for argument in "$@" + do + path="$path-$argument" + done + + local archive_path="$release_path/$path.$TAR_XZ" + + echo "$archive_path" +} + +project_release_rootfs_path() { + local project=$1 + shift + local prefix=$1 + shift + + local release_path=$( project_release_path "$project" "$prefix" ) + local argument + local path="$project" + + for argument in "$@" + do + path="$path-$argument" + done + + local rootfs_path="$release_path/$path.$TAR_XZ" + + echo "$rootfs_path" +} + +project_release_sources_archive_path() { + local project=$1 + shift + + local sources_path="$root/$SOURCES/" + local release_path + local argument + local path="$project" + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + path="$path-$argument" + fi + + local directory_path="$sources_path/$path" + + if ! directory_filled_check "$directory_path" + then + continue + fi + + release_path=$path + done + + if ! [ -z "$release_path" ] + then + local archive_path="$root/$RELEASE/$SOURCES/$project/$release_path.$TAR_XZ" + + echo "$archive_path" + fi +} + +project_release_sources_archive_create() { + local project=$1 + shift + local arguments=$@ + + local repository=$project + local archive_path=$( project_release_sources_archive_path "$project" "$@" ) + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + + printf "Releasing sources archive for $project (with ${arguments:-no argument})\n" + + archive_create "$archive_path" "$sources_path" + file_verification_create "$archive_path" +} + +project_release_sources_archive_exists_check() { + local project=$1 + shift + + local archive_path=$( project_release_sources_archive_path "$project" "$@" ) + if [ -z "$archive_path" ] || ! [ -f "$archive_path" ] + then + return 1 + else + return 0 + fi +} + +project_release_sources_git() { + local project=$1 + shift + local repository=$1 + shift + + requirements "git" + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + if git_project_check "$repository" + then + if ! git_project_release_check "$project" "$repository" "$@" + then + git_project_release "$project" "$repository" "$@" + fi + else + if ! project_release_sources_archive_exists_check "$project" "$@" + then + project_release_sources_archive_create "$project" "$@" + fi + fi +} + +project_release_check_sources_git() { + local project=$1 + shift + local repository=$1 + shift + + requirements "git" + + if git_project_check "$repository" + then + git_project_release_check "$project" "$repository" "$@" + else + project_release_sources_archive_exists_check "$project" "$@" + fi +} + +project_release_install() { + local project=$1 + shift + local prefix=$1 + shift + + local install_path=$( project_install_path "$project" "$@" ) + local release_path=$( project_release_path "$project" "$prefix" ) + local directory_path + local path + + project_install_directory_missing_empty_error "$project" "$@" + + local files=$( cd "$install_path" && find -type f || true ) + local file + + echo "$files" | while read file + do + path="$release_path/$file" + directory_path=$( dirname "$path" ) + + mkdir -p "$directory_path" + + cp "$install_path/$file" "$path" + file_verification_create "$path" + done +} + +project_release_install_check() { + local project=$1 + shift + local prefix=$1 + shift + + local install_path=$( project_install_path "$project" "$@" ) + local release_path=$( project_release_path "$project" "$prefix" ) + local path + + project_install_directory_missing_empty_error "$project" "$@" + + local files=$( cd "$install_path" && find -type f || true ) + local file + + echo "$files" | while read file + do + path="$release_path/$file" + + file_exists_check "$path" + done +} + +project_release_install_archive() { + local project=$1 + shift + local prefix=$1 + shift + + project_install_directory_missing_empty_error "$project" "$@" + + if ! project_release_install_archive_exists_check "$project" "$prefix" "$@" + then + project_release_install_archive_create "$project" "$prefix" "$@" + fi +} + +project_release_install_archive_check() { + local project=$1 + shift + + project_release_install_archive_exists_check "$project" "$@" +} + +project_release_install_archive_create() { + local project=$1 + shift + local prefix=$1 + shift + local arguments=$@ + + local install_path=$( project_install_path "$project" "$@" ) + local archive_path=$( project_release_archive_path "$project" "$prefix" "$@" ) + + printf "Releasing $prefix archive for $project (with ${arguments:-no argument})\n" + + archive_create "$archive_path" "$install_path" + file_verification_create "$archive_path" +} + +project_release_install_archive_exists_check() { + local project=$1 + shift + local prefix=$1 + shift + + local archive_path=$( project_release_archive_path "$project" "$prefix" "$@" ) + + file_exists_check "$archive_path" +} + +project_release_install_rootfs() { + local project=$1 + shift + local prefix=$1 + shift + + project_install_directory_missing_empty_error "$project" "$@" + + if ! project_release_install_rootfs_exists_check "$project" "$prefix" "$@" + then + project_release_install_rootfs_create "$project" "$prefix" "$@" + fi +} + +project_release_install_rootfs_check() { + local project=$1 + shift + + project_release_install_rootfs_exists_check "$project" "$@" +} + +project_release_install_rootfs_create() { + local project=$1 + shift + local prefix=$1 + shift + local arguments=$@ + + local install_path=$( project_install_path "$project" "$@" ) + local rootfs_path=$( project_release_rootfs_path "$project" "$prefix" "$@" ) + + printf "Releasing $prefix rootfs for $project (with ${arguments:-no argument})\n" + + rootfs_create "$rootfs_path" "$install_path" + file_verification_create "$rootfs_path" +} + +project_release_install_rootfs_exists_check() { + local project=$1 + shift + local prefix=$1 + shift + + local rootfs_path=$( project_release_rootfs_path "$project" "$prefix" "$@" ) + + file_exists_check "$rootfs_path" +} + +project_clean() { + local project=$1 + shift + + project_clean_build "$project" "$@" + project_clean_install "$project" "$@" + project_clean_release "$project" "$@" +} + +project_clean_build() { + local project=$1 + shift + + local build_path=$( project_build_path "$project" "$@" ) + + rm -rf "$build_path" +} + +project_clean_install() { + local project=$1 + shift + + local install_path=$( project_install_path "$project" "$@" ) + + rm -rf "$install_path" +} + +project_clean_release() { + local project=$1 + shift + + local prefix + + for prefix in "$SOURCES" "$SYSTEMS" "$IMAGES" "$TOOLS" "$DOCS" + do + local release_path=$( project_release_path "$project" "$prefix" ) + + rm -rf "$release_path" + done +} + +project_clean_rootfs() { + local project=$1 + shift + + project_clean_build "$project" "$@" + project_clean_rootfs_install "$project" "$@" + project_clean_release "$project" "$@" + +} + +project_clean_rootfs_install() { + local project=$1 + shift + + local install_path=$( project_install_path "$project" "$@" ) + + execute_root rm -rf "$install_path" + +} + +project_file_path() { + local project=$1 + shift + local directory=$1 + shift + local file=$1 + shift + + local project_path=$( project_path "$project" ) + local path="$project_path/$directory" + local argument + local file_path + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + path="$path/$argument" + fi + + if ! [ -f "$path/$file" ] + then + continue + fi + + file_path="$path/$file" + done + + if [ -z "$file_path" ] + then + return 1 + fi + + echo "$file_path" +} + +project_file_test() { + local file_path=$( project_file_path "$@" ) + + test -f "$file_path" +} + +project_file_contents() { + local file_path=$( project_file_path "$@" ) + + cat "$file_path" +} + +project_file_contents_herit() { + local project=$1 + shift + local directory=$1 + shift + local file=$1 + shift + + local project_path=$( project_path "$project" ) + local path="$project_path/$directory" + local argument + local file_path + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + path="$path/$argument" + fi + + file_path="$path/$file" + + if ! [ -f "$file_path" ] + then + continue + fi + + cat "$file_path" + done +} diff --git a/libs/tool b/libs/tool @@ -0,0 +1,287 @@ +#!/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/>. + +TOOL_ACTIONS_GENERIC="usage update execute" +TOOL_ACTIONS_HELPERS="arguments" +TOOL_FUNCTIONS=$( for action in $TOOL_ACTIONS_GENERIC ; do echo "$action" "$action""_check" ; done ; echo "$TOOL_ACTIONS_HELPERS" ) + +tool_include() { + local tool=$1 + + local tool_path=$( tool_path "$tool" ) + + unset -f $TOOL_FUNCTIONS + + . "$tool_path/$tool" + + tool_helper_include "$tool" +} + +tool_helper_include() { + local tool=$1 + + local tool_path=$( tool_path "$tool" ) + local include="$tool_path/$tool-helper" + + if [ -f "$include" ] + then + . "$include" + fi +} + +tool_check() { + local tool=$1 + + local tool_path=$( tool_path "$tool" ) + + if ! [ -f "$tool_path/$tool" ] + then + return 1 + fi + + return 0 +} + +tool_function_check() { + local tool=$1 + local function=$2 + + tool_include "$tool" + + if ! function_check "$function" + then + return 1 + fi + + return 0 +} + +tool_action() { + local action=$1 + shift + local tool=$1 + shift + local arguments=$@ + + ( + set +e + + if ! tool_check "$tool" + then + printf "Tool $tool check failed\n" >&2 + return 1 + fi + + tool_action_check "$action" "$tool" "$@" + + if [ $? -eq 0 ] + then + return 0 + fi + + tool_include "$tool" + + if ! function_check "$action" + then + return 0 + fi + + printf "Tool $tool $action (with ${arguments:-no argument})\n" >&2 + + ( + set -e + "$action" "$@" + ) + + if [ $? -ne 0 ] + then + printf "\nTool $tool $action (with ${arguments:-no argument}) failed\n" >&2 + return 1 + else + printf "\nTool $tool $action (with ${arguments:-no argument}) completed\n" >&2 + fi + ) +} + +tool_action_check() { + local action=$1 + shift + local tool=$1 + shift + + ( + set +e + + if ! tool_check "$tool" + then + printf "Tool $tool check failed\n" >&2 + return 1 + fi + + tool_include "$tool" + + if ! function_check "$action""_check" + then + return 1 + fi + + for tool_force in $TOOLS_FORCE + do + if [ "$tool_force" = "$tool" ] + then + return 1 + fi + done + + ( + set -e + "$action""_check" "$@" + ) + ) +} + +tool_action_helper() { + local helper=$1 + shift + local tool=$1 + shift + + ( + set +e + + if ! tool_check "$tool" + then + printf "Tool $tool check failed\n" >&2 + return 1 + fi + + tool_include "$tool" + + if ! function_check "$helper" + then + return 0 + fi + + ( + set -e + "$helper" "$@" + ) + ) +} + +tool_action_arguments_recursive() { + local action=$1 + shift + local tool=$1 + shift + + local action_helper_arguments=$( tool_action_helper "arguments" "$tool" "$@" ) + local argument + + if [ $? -ne 0 ] || [ -z "$action_helper_arguments" ] + then + tool_action "$action" "$tool" "$@" + else + echo "$action_helper_arguments" | while read argument + do + tool_action_arguments_recursive "$action" "$tool" "$@" "$argument" + done + fi +} + +tool_path() { + local tool=$1 + + local tool_path="$root/$TOOLS/$tool" + + echo "$tool_path" +} + +tool_sources_path() { + local tool=$1 + shift + + local path="$root/$TOOLS/$tool/$SOURCES" + local argument + + for argument in "" "$@" + do + if ! [ -z "$argument" ] + then + path="$path/$argument" + fi + + if directory_filled_check "$path" + then + echo "$path" + return + fi + done +} + +tool_usage_actions() { + local tool=$1 + shift + + printf "\nGeneric actions:\n" + + for action in $TOOL_ACTIONS_GENERIC + do + if function_check "$action" + then + printf " $action\n" + fi + done + + if [ $# -gt 0 ] + then + printf "\nSpecific actions:\n" + + for action in "$@" + do + printf " $action\n" + done + fi +} + +tool_usage_arguments() { + local tool=$1 + shift + + printf "\nArguments:\n" + + tool_usage_arguments_recursive "$tool" " " "$@" +} + +tool_usage_arguments_recursive() { + local tool=$1 + shift + local spacing=$1 + shift + + local action_helper_arguments=$( tool_action_helper "arguments" "$tool" "$@" ) + local argument + + if ! [ -z "$action_helper_arguments" ] + then + echo "$action_helper_arguments" | while read argument + do + printf "$spacing$argument\n" + tool_usage_arguments_recursive "$tool" " $spacing" "$@" "$argument" + done + fi +} diff --git a/projects/cbfstool/cbfstool b/projects/cbfstool/cbfstool @@ -0,0 +1,108 @@ +#!/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/>. + +download() { + local repository="coreboot" + + git_project_prepare "$project" "$repository" "$@" +} + +download_check() { + local repository="coreboot" + + git_project_prepare_check "$project" "$repository" "$@" +} + +extract() { + local repository="coreboot" + + project_extract "$project" "$@" +} + +extract_check() { + local repository="coreboot" + + project_extract_check "$project" "$@" +} + +update() { + local repository="coreboot" + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository="coreboot" + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local repository="coreboot" + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + local coreboot_sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local sources_path="$coreboot_sources_path/util/cbfstool/" + local build_path=$( project_build_path "$project" "$@" ) + local build_util_path=$( dirname "$build_path" ) + + local vboot_sources_path=$( project_sources_path "vboot" "vboot" "devices" ) + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi + + project_action "checkout" "vboot" "devices" + + mkdir -p "$build_path" + + make -C "$sources_path" objutil="$build_util_path" VBOOT_SOURCE="$vboot_sources_path" -j$TASKS +} + +build_check() { + project_build_check "$project" "$@" +} + +install() { + project_install "$project" "$@" +} + +install_check() { + project_install_check "$project" "$@" +} + +release() { + local repository="coreboot" + + project_release_install_archive "$project" "$TOOLS" "$@" + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local repository="coreboot" + + project_release_install_archive_check "$project" "$TOOLS" "$@" + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/cbfstool/configs/blobs b/projects/cbfstool/configs/blobs @@ -0,0 +1 @@ +../../coreboot/configs/blobs+ \ No newline at end of file diff --git a/projects/cbfstool/configs/blobs-ignore b/projects/cbfstool/configs/blobs-ignore @@ -0,0 +1 @@ +../../coreboot/configs/blobs-ignore+ \ No newline at end of file diff --git a/projects/cbfstool/configs/blobs-ignore-notes.txt b/projects/cbfstool/configs/blobs-ignore-notes.txt @@ -0,0 +1 @@ +../../coreboot/configs/blobs-ignore-notes.txt+ \ No newline at end of file diff --git a/projects/cbfstool/configs/install b/projects/cbfstool/configs/install @@ -0,0 +1,2 @@ +cbfstool:cbfstool +fmaptool:fmaptool diff --git a/projects/cbfstool/configs/revision b/projects/cbfstool/configs/revision @@ -0,0 +1 @@ +../../coreboot/configs/revision+ \ No newline at end of file diff --git a/projects/cbfstool/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch b/projects/cbfstool/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch @@ -0,0 +1 @@ +../../coreboot/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch+ \ No newline at end of file diff --git a/projects/cbmem/cbmem b/projects/cbmem/cbmem @@ -0,0 +1,107 @@ +#!/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/>. + +download() { + local repository="coreboot" + + git_project_prepare "$project" "$repository" "$@" +} + +download_check() { + local repository="coreboot" + + git_project_prepare_check "$project" "$repository" "$@" +} + +extract() { + local repository="coreboot" + + project_extract "$project" "$@" +} + +extract_check() { + local repository="coreboot" + + project_extract_check "$project" "$@" +} + +update() { + local repository="coreboot" + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository="coreboot" + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local repository="coreboot" + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + local coreboot_sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local sources_path="$coreboot_sources_path/util/cbmem/" + local build_path=$( project_build_path "$project" "$@" ) + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi + + mkdir -p "$build_path" + + make -C "$sources_path" -j$TASKS + + cp "$sources_path/cbmem" "$build_path" + + make -C "$sources_path" "clean" +} + +build_check() { + project_build_check "$project" "$@" +} + +install() { + project_install "$project" "$@" +} + +install_check() { + project_install_check "$project" "$@" +} + +release() { + local repository="coreboot" + + project_release_install_archive "$project" "$TOOLS" "$@" + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local repository="coreboot" + + project_release_install_archive_check "$project" "$TOOLS" "$@" + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/cbmem/configs/blobs b/projects/cbmem/configs/blobs @@ -0,0 +1 @@ +../../coreboot/configs/blobs+ \ No newline at end of file diff --git a/projects/cbmem/configs/blobs-ignore b/projects/cbmem/configs/blobs-ignore @@ -0,0 +1 @@ +../../coreboot/configs/blobs-ignore+ \ No newline at end of file diff --git a/projects/cbmem/configs/blobs-ignore-notes.txt b/projects/cbmem/configs/blobs-ignore-notes.txt @@ -0,0 +1 @@ +../../coreboot/configs/blobs-ignore-notes.txt+ \ No newline at end of file diff --git a/projects/cbmem/configs/install b/projects/cbmem/configs/install @@ -0,0 +1 @@ +cbmem:cbmem diff --git a/projects/cbmem/configs/revision b/projects/cbmem/configs/revision @@ -0,0 +1 @@ +../../coreboot/configs/revision+ \ No newline at end of file diff --git a/projects/cbmem/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch b/projects/cbmem/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch @@ -0,0 +1 @@ +../../coreboot/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch+ \ No newline at end of file diff --git a/projects/coreboot/configs/blobs b/projects/coreboot/configs/blobs @@ -0,0 +1,54 @@ +src/cpu/dmp/vortex86ex/dmp_kbd_fw_part1.inc +src/vendorcode/amd/agesa/f10/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch01000085.c +src/vendorcode/amd/agesa/f10/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch01000086.c +src/vendorcode/amd/agesa/f10/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch01000098.c +src/vendorcode/amd/agesa/f10/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch010000b6.c +src/vendorcode/amd/agesa/f10/Proc/CPU/Family/0x10/RevD/F10MicrocodePatch010000c4.c +src/vendorcode/amd/agesa/f10/Proc/CPU/Family/0x10/RevD/F10MicrocodePatch010000c5.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch01000085.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch010000c6.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch010000c7.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch010000c8.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x10/RevD/F10MicrocodePatch010000c4.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x10/RevD/F10MicrocodePatch010000c5.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x10/RevE/F10MicrocodePatch010000bf.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x12/F12MicrocodePatch03000002.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x12/F12MicrocodePatch0300000e.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x12/F12MicrocodePatch0300000f.c +src/vendorcode/amd/agesa/f12/Proc/GNB/Nb/Family/LN/F12NbSmuFirmware.h +src/vendorcode/amd/agesa/f12/Proc/GNB/PCIe/Family/LN/F12PcieAlibSsdt.h +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch01000085.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch010000c6.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch010000c7.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch010000c8.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x10/RevD/F10MicrocodePatch010000c4.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x10/RevD/F10MicrocodePatch010000c5.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x10/RevE/F10MicrocodePatch010000bf.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14MicrocodePatch0500000B.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14MicrocodePatch0500001A.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14MicrocodePatch05000029.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14MicrocodePatch05000119.c +src/vendorcode/amd/agesa/f14/Proc/GNB/Nb/Family/0x14/F14NbSmuFirmware.h +src/vendorcode/amd/agesa/f14/Proc/GNB/PCIe/Family/0x14/F14PcieAlibSsdt.h +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch01000085.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch010000c6.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch010000c7.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x10/RevC/F10MicrocodePatch010000c8.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x10/RevD/F10MicrocodePatch010000c5.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x10/RevD/F10MicrocodePatch010000d9.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x10/RevE/F10MicrocodePatch010000bf.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x15/OR/F15OrMicrocodePatch06000425.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x15/OR/F15OrMicrocodePatch0600050D_Enc.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x15/OR/F15OrMicrocodePatch06000624_Enc.c +src/vendorcode/amd/agesa/f15tn/Proc/CPU/Family/0x15/TN/F15TnMicrocodePatch0600110F_Enc.c +src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbInitTN/GnbCacWeightsTN.h +src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbInitTN/GnbSmuFirmwareTN.h +src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbInitTN/PcieAlibSsdtTNFM2.h +src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbInitTN/PcieAlibSsdtTNFS1.h +src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbId7001MicrocodePatch.c +src/vendorcode/amd/agesa/f16kb/Proc/GNB/Modules/GnbInitKB/AlibSsdtKB.h +src/vendorcode/amd/agesa/f16kb/Proc/GNB/Modules/GnbInitKB/excel925.h +src/vendorcode/amd/agesa/f16kb/Proc/GNB/Modules/GnbInitKB/GnbSamuPatchKB.h +src/vendorcode/amd/agesa/f16kb/Proc/GNB/Modules/GnbInitKB/GnbSmuFirmwareKB.h +src/vendorcode/amd/cimx/rd890/HotplugFirmware.h +src/vendorcode/google/chromeos/build-snow.sh diff --git a/projects/coreboot/configs/blobs-ignore b/projects/coreboot/configs/blobs-ignore @@ -0,0 +1,449 @@ +Documentation/codeflow.svg +Documentation/CorebootBuildingGuide.tex +Documentation/hypertransport.svg +payloads/external/depthcharge/Kconfig +payloads/external/FILO/Kconfig +payloads/external/GRUB2/Kconfig +payloads/external/SeaBIOS/Kconfig +payloads/external/U-Boot/Kconfig +payloads/Kconfig +payloads/libpayload/curses/PDCurses-3.4/demos/worm.c +payloads/libpayload/curses/PDCurses-3.4/sdl1/deffont.h +payloads/libpayload/curses/PDCurses-3.4/sdl1/deficon.h +payloads/libpayload/curses/PDCurses-3.4/win32/pdckbd.c +payloads/libpayload/curses/PDCurses-3.4/x11/big_icon.xbm +payloads/libpayload/curses/PDCurses-3.4/x11/little_icon.xbm +payloads/libpayload/curses/pdcurses-backend/pdcdisp.c +payloads/libpayload/curses/PDCurses/demos/worm.c +payloads/libpayload/curses/PDCurses/sdl1/deffont.h +payloads/libpayload/curses/PDCurses/sdl1/deficon.h +payloads/libpayload/curses/PDCurses/win32/pdckbd.c +payloads/libpayload/curses/PDCurses/x11/big_icon.xbm +payloads/libpayload/curses/PDCurses/x11/little_icon.xbm +payloads/libpayload/curses/tinycurses.c +payloads/libpayload/drivers/keyboard.c +payloads/libpayload/drivers/usb/usbmsc.c +payloads/libpayload/tests/cbfs-x86-test.c +payloads/nvramcui/payload.sh +src/cpu/allwinner/a10/raminit.c +src/cpu/amd/family_10h-family_15h/init_cpus.c +src/cpu/amd/family_10h-family_15h/processor_name.c +src/cpu/amd/geode_gx2/Kconfig +src/cpu/amd/geode_lx/cpureginit.c +src/cpu/amd/geode_lx/Kconfig +src/cpu/amd/microcode/microcode.c +src/cpu/amd/model_10xxx/init_cpus.c +src/cpu/amd/model_10xxx/processor_name.c +src/cpu/amd/model_fxx/model_fxx_update_microcode.c +src/cpu/amd/model_fxx/powernow_acpi.c +src/cpu/intel/fsp_model_206ax/acpi.c +src/cpu/intel/fsp_model_406dx/acpi.c +src/cpu/intel/haswell/acpi.c +src/cpu/intel/microcode/microcode.c +src/cpu/intel/model_2065x/acpi.c +src/cpu/intel/model_206ax/acpi.c +src/cpu/Kconfig +src/cpu/samsung/exynos5250/update-bl1.sh +src/cpu/via/nano/update_ucode.c +src/device/dram/spd_cache.c +src/device/Kconfig +src/device/oprom/yabel/interrupt.c +src/drivers/aspeed/common/ast_dram_tables.h +src/drivers/aspeed/common/ast_tables.h +src/drivers/i2c/ww_ring/ww_ring_programs.c +src/drivers/intel/fsp1_1/car.c +src/drivers/intel/fsp1_1/fsp_gop.c +src/drivers/intel/fsp1_1/Kconfig +src/drivers/intel/fsp1_1/ramstage.c +src/drivers/intel/fsp2_0/graphics.c +src/drivers/intel/fsp2_0/Kconfig +src/drivers/pc80/mc146818rtc.c +src/drivers/pc80/rtc/mc146818rtc.c +src/drivers/pc80/vga/vga_palette.c +src/drivers/siemens/nc_fpga/nc_fpga.c +src/drivers/xgi/common/vb_setmode.c +src/drivers/xgi/common/vb_table.h +src/drivers/xgi/common/XGI_main.h +src/Kconfig +src/lib/coreboot_table.c +src/lib/jpeg.c +src/lib/tlcl_structures.h +src/lib/tpm2_tlcl.c +src/mainboard/adi/rcc-dff/Kconfig +src/mainboard/advansus/a785e-i/mptable.c +src/mainboard/amd/bettong/mptable.c +src/mainboard/amd/bimini_fam10/mptable.c +src/mainboard/amd/db-ft3b-lc/Memphis_MEM4G16D3EABG.spd.hex +src/mainboard/amd/dinar/buildOpts.c +src/mainboard/amd/dinar/Kconfig +src/mainboard/amd/gardenia/OemCustomize.c +src/mainboard/amd/inagua/Kconfig +src/mainboard/amd/lamar/Kconfig +src/mainboard/amd/olivehill/mptable.c +src/mainboard/amd/olivehillplus/mptable.c +src/mainboard/amd/parmer/mptable.c +src/mainboard/amd/persimmon/Kconfig +src/mainboard/amd/serengeti_cheetah_fam10/get_bus_conf.c +src/mainboard/amd/south_station/Kconfig +src/mainboard/amd/south_station/mptable.c +src/mainboard/amd/thatcher/mptable.c +src/mainboard/amd/torpedo/Kconfig +src/mainboard/amd/torpedo/mptable.c +src/mainboard/amd/union_station/Kconfig +src/mainboard/amd/union_station/mptable.c +src/mainboard/apple/macbookair4_2/early_southbridge.c +src/mainboard/asrock/e350m1/mptable.c +src/mainboard/asrock/imb-a180/mptable.c +src/mainboard/asus/f2a85-m/mptable.c +src/mainboard/asus/kfsn4-dre/get_bus_conf.c +src/mainboard/asus/m5a88-v/mptable.c +src/mainboard/avalue/eax-785e/mptable.c +src/mainboard/bap/ode_e20XX/BAP_Q7_1066.spd.hex +src/mainboard/bap/ode_e20XX/BAP_Q7_800.spd.hex +src/mainboard/bap/ode_e20XX/BAP_Q7.spd.hex +src/mainboard/bap/ode_e21XX/BAP_Q7_1066.spd.hex +src/mainboard/bap/ode_e21XX/BAP_Q7_1333.spd.hex +src/mainboard/bap/ode_e21XX/BAP_Q7_800.spd.hex +src/mainboard/bap/ode_e21XX/mptable.c +src/mainboard/digitallogic/adl855pc/irq_tables.c +src/mainboard/gigabyte/ga-b75m-d3h/romstage.c +src/mainboard/gigabyte/ga-b75m-d3v/romstage.c +src/mainboard/gizmosphere/gizmo2/Micron_MT41J128M16JT.spd.hex +src/mainboard/gizmosphere/gizmo/mptable.c +src/mainboard/google/auron_paine/spd/spd.c +src/mainboard/google/auron/spd/Elpida_EDJ4216EFBG.spd.hex +src/mainboard/google/auron/spd/empty.spd.hex +src/mainboard/google/auron/spd/Hynix_HMT425S6AFR6A.spd.hex +src/mainboard/google/auron/spd/Micron_4KTF25664HZ.spd.hex +src/mainboard/google/auron/spd/spd.c +src/mainboard/google/bolt/elpida_4Gb_1600_x16.spd.hex +src/mainboard/google/bolt/micron_4Gb_1600_1.35v_x16.spd.hex +src/mainboard/google/bolt/romstage.c +src/mainboard/google/bolt/samsung_4Gb_1600_1.35v_x16.spd.hex +src/mainboard/google/butterfly/hda_verb.c +src/mainboard/google/butterfly/mainboard.c +src/mainboard/google/chell/spd/empty.spd.hex +src/mainboard/google/chell/spd/hynix_dimm_H9CCNNN8GTMLAR.spd.hex +src/mainboard/google/chell/spd/hynix_dimm_H9CCNNNBJTMLAR.spd.hex +src/mainboard/google/chell/spd/hynix_dimm_H9CCNNNCLTMLAR.spd.hex +src/mainboard/google/chell/spd/samsung_dimm_K4E6E304EB-EGCF.spd.hex +src/mainboard/google/chell/spd/samsung_dimm_K4E6E304EE-EGCF.spd.hex +src/mainboard/google/chell/spd/samsung_dimm_K4E8E304EE-EGCF.spd.hex +src/mainboard/google/chell/spd/spd.c +src/mainboard/google/cyan/Kconfig +src/mainboard/google/cyan/spd/hynix_2GiB_dimm_H5TC4G63AFR-PBA.spd.hex +src/mainboard/google/cyan/spd/hynix_2GiB_dimm_HMT425S6CFR6A_H5TC4G63CFR.spd.hex +src/mainboard/google/cyan/spd/samsung_2GiB_dimm_K4B4G1646Q-HYK0.spd.hex +src/mainboard/google/cyan/spd/spd.c +src/mainboard/google/enguarde/spd/hynix_2GiB_dimm_H5TC4G63AFR-PBA.spd.hex +src/mainboard/google/enguarde/spd/samsung_1GiB_dimm_K4B2G1646Q-BYK0.spd.hex +src/mainboard/google/enguarde/spd/micron_1GiB_dimm_MT41K128M16JT-125.spd.hex +src/mainboard/google/enguarde/spd/samsung_2GiB_dimm_K4B4G1646Q-HYK0.spd.hex +src/mainboard/google/enguarde/spd/micron_2GiB_dimm_MT41K256M16HA-125.spd.hex +src/mainboard/google/enguarde/spd/hynix_1GiB_dimm_H5TC2G63FFR-PBA.spd.hex +src/mainboard/google/eve/spd/hynix_dimm_H9CCNNNBJTALAR.spd.hex +src/mainboard/google/eve/spd/hynix_dimm_H9CCNNNCLTMLAR.spd.hex +src/mainboard/google/eve/spd/samsung_dimm_K4E8E324EB.spd.hex +src/mainboard/google/eve/spd/empty.spd.hex +src/mainboard/google/eve/spd/samsung_dimm_K4E6E304EB.spd.hex +src/mainboard/google/eve/spd/samsung_dimm_K4EBE304EB.spd.hex +src/mainboard/google/eve/spd/hynix_dimm_H9CCNNN8GTALAR.spd.hex +src/mainboard/google/falco/Elpida_EDJ4216EFBG.spd.hex +src/mainboard/google/falco/Hynix_HMT425S6AFR6A.spd.hex +src/mainboard/google/falco/Micron_4KTF25664HZ.spd.hex +src/mainboard/google/falco/romstage.c +src/mainboard/google/falco/Samsung_M471B5674QH0.spd.hex +src/mainboard/google/glados/spd/empty.spd.hex +src/mainboard/google/glados/spd/hynix_dimm_H9CCNNN8JTBLAR.spd.hex +src/mainboard/google/glados/spd/hynix_dimm_H9CCNNNBLTALAR.spd.hex +src/mainboard/google/glados/spd/samsung_dimm_K4E6E304EE-EGCF.spd.hex +src/mainboard/google/glados/spd/spd.c +src/mainboard/google/guado/lan.c +src/mainboard/google/jecht/lan.c +src/mainboard/google/lars/spd/empty.spd.hex +src/mainboard/google/lars/spd/hynix_dimm_H9CCNNN8JTBLAR-NUD-1G-1866.spd.hex +src/mainboard/google/lars/spd/hynix_dimm_H9CCNNNBLTBLAR-NUD-2G-1866.spd.hex +src/mainboard/google/lars/spd/samsung_dimm_K4E6E304EB-EGCF-2G-1866.spd.hex +src/mainboard/google/lars/spd/samsung_dimm_K4E8E324EB-EGCF-1G-1866.spd.hex +src/mainboard/google/lars/spd/spd.c +src/mainboard/google/link/elpida_4Gb_1600_x16.spd.hex +src/mainboard/google/link/hda_verb.c +src/mainboard/google/link/i915.c +src/mainboard/google/link/micron_4Gb_1600_1.35v_x16.spd.hex +src/mainboard/google/link/romstage.c +src/mainboard/google/link/samsung_4Gb_1600_1.35v_x16.spd.hex +src/mainboard/google/ninja/lan.c +src/mainboard/google/ninja/romstage.c +src/mainboard/google/ninja/spd/hynix_1GiB_dimm_H5TC2G63FFR-PBA.spd.hex +src/mainboard/google/ninja/spd/hynix_2GiB_dimm_H5TC4G63AFR-PBA.spd.hex +src/mainboard/google/ninja/spd/hynix_2GiB_dimm_H5TC4G63CFR-PBA.spd.hex +src/mainboard/google/ninja/spd/micron_1GiB_dimm_MT41K128M16JT-125.spd.hex +src/mainboard/google/ninja/spd/micron_2GiB_dimm_MT41K256M16HA-125.spd.hex +src/mainboard/google/panther/lan.c +src/mainboard/google/peach_pit/mainboard.c +src/mainboard/google/peppy/Elpida_EDJ4216EFBG.spd.hex +src/mainboard/google/peppy/Hynix_HMT425S6AFR6A.spd.hex +src/mainboard/google/peppy/Micron_4KTF25664HZ.spd.hex +src/mainboard/google/peppy/romstage.c +src/mainboard/google/rambi/romstage.c +src/mainboard/google/rambi/spd/hynix_1GiB_dimm_H5TC2G63FFR-PBA.spd.hex +src/mainboard/google/rambi/spd/hynix_2GiB_dimm_H5TC4G63AFR-PBA.spd.hex +src/mainboard/google/rambi/spd/micron_1GiB_dimm_MT41K128M16JT-125.spd.hex +src/mainboard/google/rambi/spd/micron_2GiB_dimm_MT41K256M16HA-125.spd.hex +src/mainboard/google/rikku/lan.c +src/mainboard/google/rotor/dram_params.c +src/mainboard/google/samus/romstage.c +src/mainboard/google/samus/spd/elpida_16.spd.hex +src/mainboard/google/samus/spd/elpida_4.spd.hex +src/mainboard/google/samus/spd/elpida_8.spd.hex +src/mainboard/google/samus/spd/empty.spd.hex +src/mainboard/google/samus/spd/hynix_16.spd.hex +src/mainboard/google/samus/spd/hynix_4.spd.hex +src/mainboard/google/samus/spd/hynix_8.spd.hex +src/mainboard/google/samus/spd/samsung_4.spd.hex +src/mainboard/google/samus/spd/samsung_8.spd.hex +src/mainboard/google/samus/spd/spd.c +src/mainboard/google/slippy/Hynix_HMT425S6AFR6A.spd.hex +src/mainboard/google/slippy/Micron_4KTF25664HZ.spd.hex +src/mainboard/google/slippy/variants/peppy/spd/Micron_4KTF25664HZ.spd.hex +src/mainboard/google/slippy/variants/peppy/spd/Elpida_EDJ4216EFBG.spd.hex +src/mainboard/google/slippy/variants/peppy/spd/Hynix_HMT425S6AFR6A.spd.hex +src/mainboard/google/slippy/variants/falco/spd/Micron_4KTF25664HZ.spd.hex +src/mainboard/google/slippy/variants/falco/spd/Elpida_EDJ4216EFBG.spd.hex +src/mainboard/google/slippy/variants/falco/spd/Samsung_M471B5674QH0.spd.hex +src/mainboard/google/slippy/variants/falco/spd/Hynix_HMT425S6AFR6A.spd.hex +src/mainboard/google/slippy/variants/leon/spd/Micron_4KTF25664HZ.spd.hex +src/mainboard/google/slippy/variants/leon/spd/Hynix_HMT425S6AFR6A.spd.hex +src/mainboard/google/slippy/variants/leon/spd/Samsung_K4B4G1646Q.spd.hex +src/mainboard/google/slippy/variants/wolf/spd/Micron_4KTF25664HZ.spd.hex +src/mainboard/google/slippy/variants/wolf/spd/Samsung_K4B4G1646B.spd.hex +src/mainboard/google/slippy/variants/wolf/spd/Hynix_HMT425S6AFR6A.spd.hex +src/mainboard/google/slippy/romstage.c +src/mainboard/google/tidus/lan.c +src/mainboard/hp/abm/mptable.c +src/mainboard/hp/dl165_g6_fam10/get_bus_conf.c +src/mainboard/hp/pavilion_m6_1035dx/mptable.c +src/mainboard/ibase/mb899/cmos.layout +src/mainboard/ibase/mb899/superio_hwm.c +src/mainboard/intel/amenia/romstage.c +src/mainboard/intel/apollolake_rvp/romstage.c +src/mainboard/intel/cougar_canyon2/Kconfig +src/mainboard/intel/kblrvp/spd/hynix_dimm_H9CCNNNBJTMLAR.spd.hex +src/mainboard/intel/kblrvp/spd/empty.spd.hex +src/mainboard/intel/kblrvp/spd/rvp3.spd.hex +src/mainboard/intel/kunimitsu/spd/empty.spd.hex +src/mainboard/intel/kunimitsu/spd/hynix_dimm_H9CCNNN8JTALAR-NUD-1G-1866.spd.hex +src/mainboard/intel/kunimitsu/spd/hynix_dimm_H9CCNNN8JTBLAR-NUD-1G-1866.spd.hex +src/mainboard/intel/kunimitsu/spd/hynix_dimm_H9CCNNNBLTALAR-NUD-2G-1866.spd.hex +src/mainboard/intel/kunimitsu/spd/hynix_dimm_H9CCNNNBLTBLAR-NUD-2G-1866.spd.hex +src/mainboard/intel/kunimitsu/spd/mic_dimm_EDF8132A3MA-JD-F-1G-1866.spd.hex +src/mainboard/intel/kunimitsu/spd/samsung_dimm_K4E6E304EE-EGCF-2G-1866.spd.hex +src/mainboard/intel/kunimitsu/spd/samsung_dimm_K4E8E304EE-EGCE.spd.hex +src/mainboard/intel/kunimitsu/spd/samsung_dimm_K4E8E304EE-EGCF-1G-1866.spd.hex +src/mainboard/intel/kunimitsu/spd/spd.c +src/mainboard/intel/minnowmax/Kconfig +src/mainboard/intel/mohonpeak/Kconfig +src/mainboard/intel/sklrvp/spd/empty.spd.hex +src/mainboard/intel/sklrvp/spd/rvp3.spd.hex +src/mainboard/intel/sklrvp/spd/spd.c +src/mainboard/intel/strago/Kconfig +src/mainboard/intel/strago/spd/hynix_2GiB_dimm_H5TC4G63AFR-PBA.spd.hex +src/mainboard/intel/strago/spd/hynix_2GiB_dimm_HMT425S6CFR6A_H5TC4G63CFR.spd.hex +src/mainboard/intel/strago/spd/samsung_2GiB_dimm_K4B4G1646Q-HYK0.spd.hex +src/mainboard/intel/strago/spd/spd.c +src/mainboard/intel/wtm2/i915.c +src/mainboard/jetway/nf81-t56n-lf/Kconfig +src/mainboard/kontron/986lcd-m/cmos.layout +src/mainboard/kontron/986lcd-m/mainboard.c +src/mainboard/lenovo/g505s/mptable.c +src/mainboard/lippert/frontrunner-af/Kconfig +src/mainboard/lippert/frontrunner-af/mptable.c +src/mainboard/lippert/toucan-af/Kconfig +src/mainboard/lippert/toucan-af/mptable.c +src/mainboard/msi/ms7721/mptable.c +src/mainboard/msi/ms9652_fam10/get_bus_conf.c +src/mainboard/packardbell/ms2290/mainboard.c +src/mainboard/pcengines/apu1/Kconfig +src/mainboard/samsung/lumpy/romstage.c +src/mainboard/siemens/mc_bdx1/mainboard.c +src/mainboard/siemens/mc_tcu3/lcd_panel.c +src/mainboard/siemens/mc_tcu3/mainboard.c +src/mainboard/siemens/mc_tcu3/modhwinfo.c +src/mainboard/siemens/mc_tcu3/romstage.c +src/mainboard/siemens/sitemp_g1p1/cmos.layout +src/mainboard/supermicro/h8dmr_fam10/get_bus_conf.c +src/mainboard/supermicro/h8qgi/buildOpts.c +src/mainboard/supermicro/h8qme_fam10/get_bus_conf.c +src/mainboard/supermicro/h8scm/buildOpts.c +src/mainboard/tyan/s2912_fam10/get_bus_conf.c +src/mainboard/tyan/s4880/irq_tables.c +src/mainboard/tyan/s4882/irq_tables.c +src/mainboard/tyan/s8226/buildOpts.c +src/northbridge/amd/agesa/common/common.c +src/northbridge/amd/amdk8/acpi.c +src/northbridge/amd/amdk8/coherent_ht.c +src/northbridge/amd/amdk8/raminit_test.c +src/northbridge/amd/amdmct/mct_ddr3/mcttmrl.c +src/northbridge/amd/amdmct/mct/mctardk3.c +src/northbridge/amd/amdmct/mct/mctardk4.c +src/northbridge/amd/amdmct/mct/mcttmrl.c +src/northbridge/amd/gx2/pll_reset.c +src/northbridge/amd/pi/00630F01/Kconfig +src/northbridge/amd/pi/00660F01/Kconfig +src/northbridge/amd/pi/00730F01/Kconfig +src/northbridge/intel/fsp_rangeley/fsp/Kconfig +src/northbridge/intel/fsp_sandybridge/fsp/Kconfig +src/northbridge/intel/gm45/raminit_rcomp_calibration.c +src/northbridge/intel/gm45/raminit_read_write_training.c +src/northbridge/intel/haswell/Kconfig +src/northbridge/intel/haswell/raminit.c +src/northbridge/intel/i82830/vga.c +src/northbridge/intel/i945/raminit.c +src/northbridge/intel/nehalem/gma.c +src/northbridge/intel/nehalem/raminit.c +src/northbridge/intel/nehalem/raminit_tables.c +src/northbridge/intel/pineview/raminit.c +src/northbridge/intel/sandybridge/gma.c +src/northbridge/intel/sandybridge/Kconfig +src/northbridge/intel/sandybridge/raminit.c +src/northbridge/intel/sandybridge/raminit_mrc.c +src/northbridge/intel/sandybridge/raminit_patterns.h +src/northbridge/intel/x4x/raminit_ddr2.c +src/northbridge/via/cx700/raminit.c +src/northbridge/via/vx800/ide.c +src/northbridge/via/vx800/uma_ram_setting.c +src/northbridge/via/vx900/sata.c +src/soc/broadcom/cygnus/ddr_init.c +src/soc/broadcom/cygnus/ddr_init_table.c +src/soc/intel/apollolake/Kconfig +src/soc/intel/apollolake/nhlt.c +src/soc/intel/baytrail/acpi.c +src/soc/intel/baytrail/Kconfig +src/soc/intel/baytrail/romstage/raminit.c +src/soc/intel/braswell/acpi.c +src/soc/intel/braswell/gpio.c +src/soc/intel/braswell/Kconfig +src/soc/intel/broadwell/acpi.c +src/soc/intel/broadwell/Kconfig +src/soc/intel/broadwell/romstage/raminit.c +src/soc/intel/common/fsp_ramstage.c +src/soc/intel/common/mma.c +src/soc/intel/common/vbt.c +src/soc/intel/fsp_baytrail/acpi.c +src/soc/intel/fsp_baytrail/fsp/Kconfig +src/soc/intel/fsp_baytrail/Kconfig +src/soc/intel/fsp_broadwell_de/fsp/chipset_fsp_util.c +src/soc/intel/fsp_broadwell_de/fsp/Kconfig +src/soc/intel/quark/Kconfig +src/soc/intel/quark/romstage/romstage.c +src/soc/intel/sch/Kconfig +src/soc/intel/skylake/Kconfig +src/soc/intel/skylake/nhlt/dmic.c +src/soc/intel/skylake/nhlt/max98357.c +src/soc/intel/skylake/nhlt/nau88l25.c +src/soc/intel/skylake/nhlt/ssm4567.c +src/soc/nvidia/tegra210/Kconfig +src/soc/nvidia/tegra210/mtc.c +src/soc/qualcomm/ipq40xx/Kconfig +src/soc/qualcomm/ipq40xx/lcc.c +src/soc/qualcomm/ipq806x/Kconfig +src/soc/qualcomm/ipq806x/lcc.c +src/soc/samsung/exynos5250/clock.c +src/soc/samsung/exynos5420/clock.c +src/southbridge/amd/agesa/hudson/Kconfig +src/southbridge/amd/cimx/sb800/Kconfig +src/southbridge/amd/pi/hudson/Kconfig +src/southbridge/intel/bd82x6x/Kconfig +src/southbridge/intel/bd82x6x/lpc.c +src/southbridge/intel/common/firmware/Kconfig +src/southbridge/intel/i82801ix/dmi_setup.c +src/southbridge/intel/ibexpeak/Kconfig +src/southbridge/intel/lynxpoint/Kconfig +src/southbridge/intel/sch/Kconfig +src/southbridge/nvidia/ck804/early_setup_ss.h +src/southbridge/nvidia/mcp55/early_setup_ss.h +src/southbridge/sis/sis966/early_setup_ss.h +src/southbridge/sis/sis966/early_smbus.c +src/southbridge/sis/sis966/ide.c +src/southbridge/sis/sis966/sata.c +src/southbridge/sis/sis966/usb2.c +src/southbridge/sis/sis966/usb.c +src/superio/via/vt1211/vt1211.c +src/vendorcode/amd/agesa/f10/Proc/CPU/Family/0x10/cpuF10Dmi.c +src/vendorcode/amd/agesa/f10/Proc/CPU/Family/0x10/cpuF10WheaInitDataTables.c +src/vendorcode/amd/agesa/f10/Proc/Mem/Main/muc.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x10/cpuF10Dmi.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x10/cpuF10WheaInitDataTables.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x12/cpuF12Dmi.c +src/vendorcode/amd/agesa/f12/Proc/CPU/Family/0x12/cpuF12WheaInitDataTables.c +src/vendorcode/amd/agesa/f12/Proc/Fch/Hwm/Family/Hudson2/Hudson2HwmLateService.c +src/vendorcode/amd/agesa/f12/Proc/GNB/Gfx/Family/LN/F12GfxServices.c +src/vendorcode/amd/agesa/f12/Proc/Mem/Main/muc.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x10/cpuF10Dmi.c +src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x10/cpuF10WheaInitDataTables.c +src/vendorcode/amd/agesa/f14/Proc/Mem/Main/muc.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x10/cpuF10Dmi.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x10/cpuF10WheaInitDataTables.c +src/vendorcode/amd/agesa/f15/Proc/CPU/Family/0x15/cpuF15WheaInitDataTables.c +src/vendorcode/amd/agesa/f15/Proc/Mem/Main/muc.c +src/vendorcode/amd/agesa/f15/Proc/Mem/Ps/OR/mpor3.c +src/vendorcode/amd/agesa/f15/Proc/Mem/Tech/DDR3/mtlrdimm3.c +src/vendorcode/amd/agesa/f15tn/Proc/CPU/Family/0x15/cpuF15WheaInitDataTables.c +src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbInitTN/GfxIntegratedInfoTableTN.c +src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbInitTN/GfxLibTN.c +src/vendorcode/amd/agesa/f15tn/Proc/Mem/Main/muc.c +src/vendorcode/amd/agesa/f15tn/Proc/Mem/Ps/TN/mptn3.c +src/vendorcode/amd/agesa/f15tn/Proc/Mem/Tech/DDR3/mtlrdimm3.c +src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/cpuF16WheaInitDataTables.c +src/vendorcode/amd/agesa/f16kb/Proc/GNB/Modules/GnbGfxIntTableV3/GfxLibV3.c +src/vendorcode/amd/agesa/f16kb/Proc/GNB/Modules/GnbInitKB/GnbF1TableKB.c +src/vendorcode/amd/agesa/f16kb/Proc/Mem/Main/muc.c +src/vendorcode/amd/agesa/f16kb/Proc/Mem/Ps/KB/mpkb3.c +src/vendorcode/amd/cimx/sb800/SATA.c +src/vendorcode/amd/pi/Kconfig +src/vendorcode/google/chromeos/build-snow +util/amdtools/example_input/lspci-cb-48G-667MHz-18.2-20090909e +util/amdtools/example_input/lspci-prop-48G-667MHz-18.2 +util/autoport/readme.md +util/bimgtool/bimgtool.c +util/cbfstool/fmd_parser.c_shipped +util/cbfstool/fmd_scanner.c_shipped +util/cbfstool/linux_trampoline.c +util/cbfstool/lz4/lib/lz4.c +util/crossgcc/patches/binutils-2.25_riscv.patch +util/crossgcc/patches/gcc-5.2.0_riscv.patch +util/ifdtool/ifdtool.c +util/intelmetool/intelmetool.c +util/ipqheader/createxbl.py +util/kconfig/zconf.hash.c_shipped +util/kconfig/zconf.lex.c_shipped +util/kconfig/zconf.tab.c_shipped +util/mma/mma_automated_test.sh +util/mtkheader/gen-bl-img.py +util/nvidia/cbootimage/src/aes_ref.c +util/nvramtool/accessors/layout-bin.c +util/riscvtools/make-spike-elf.sh +util/rockchip/make_idb.py +util/romcc/do_tests.sh +util/romcc/test.sh +util/romcc/tests/include/linux_console.h +util/romcc/tests/linux_console.h +util/romcc/tests/linux_test5.c +util/romcc/tests/raminit_test6.c +util/romcc/tests/raminit_test7.c +util/romcc/tests/simple_test14.c +util/romcc/tests/simple_test30.c +util/romcc/tests/simple_test38.c +util/romcc/tests/simple_test39.c +util/romcc/tests/simple_test54.c +util/romcc/tests/simple_test59.c +util/romcc/tests/simple_test72.c +util/romcc/tests/simple_test73.c +util/sconfig/lex.yy.c_shipped +util/sconfig/sconfig.tab.c_shipped +util/superiotool/fintek.c +util/superiotool/ite.c +util/superiotool/nuvoton.c +util/superiotool/smsc.c +util/superiotool/winbond.c +util/xcompile/xcompile diff --git a/projects/coreboot/configs/blobs-ignore-notes.txt b/projects/coreboot/configs/blobs-ignore-notes.txt @@ -0,0 +1,15 @@ +.spd.hex files - serial presence detect. These are not blobs +see JEDEC standard or https://en.wikipedia.org/wiki/Serial_presence_detect +These are added to the nonblobs file + +src/northbridge/intel/nehalem/raminit_tables.c" +src/northbridge/intel/sandybridge/raminit_patterns.h +These are used by native raminit for the relevant platforms, and are not blobs + +"src/southbridge/nvidia/mcp55/early_setup_ss.h" \ +"src/southbridge/nvidia/ck804/early_setup_ss.h" \ +"src/southbridge/sis/sis966/early_setup_ss.h" +not blobs + +The text in this file is CC-BY-SA 4.0 or higher. All contributions to it must +be made under the same license. diff --git a/projects/coreboot/configs/depthcharge/nyan/arch b/projects/coreboot/configs/depthcharge/nyan/arch @@ -0,0 +1 @@ +arm diff --git a/projects/coreboot/configs/depthcharge/nyan/big/config b/projects/coreboot/configs/depthcharge/nyan/big/config @@ -0,0 +1,7 @@ +CONFIG_VENDOR_GOOGLE=y +CONFIG_BOARD_GOOGLE_NYAN_BIG=y +CONFIG_CHROMEOS=y +CONFIG_PAYLOAD_ELF=y +CONFIG_PAYLOAD_FILE="$(obj)/../depthcharge-nyan-big/depthcharge.elf" +CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_EXTERNAL=y +CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_FILE="$(obj)/../cros-ec-nyan-big/ec.RW.bin" diff --git a/projects/coreboot/configs/depthcharge/nyan/blaze/config b/projects/coreboot/configs/depthcharge/nyan/blaze/config @@ -0,0 +1,12 @@ +CONFIG_VENDOR_GOOGLE=y +CONFIG_BOARD_GOOGLE_NYAN_BLAZE=y +CONFIG_CHROMEOS=y +CONFIG_PAYLOAD_ELF=y +CONFIG_PAYLOAD_FILE="$(obj)/../depthcharge-nyan-blaze/depthcharge.elf" +CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_EXTERNAL=y +CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_FILE="$(obj)/../cros-ec-nyan-blaze/ec.RW.bin" +CONFIG_GBB_FLAG_ENABLE_ALTERNATE_OS=y +CONFIG_GBB_FLAG_FORCE_DEV_SWITCH_ON=y +CONFIG_GBB_FLAG_FORCE_DEV_BOOT_USB=y +CONFIG_GBB_FLAG_DISABLE_FW_ROLLBACK_CHECK=y +CONFIG_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC=y diff --git a/projects/coreboot/configs/depthcharge/nyan/ec b/projects/coreboot/configs/depthcharge/nyan/ec @@ -0,0 +1 @@ +cros-ec diff --git a/projects/coreboot/configs/depthcharge/nyan/targets b/projects/coreboot/configs/depthcharge/nyan/targets @@ -0,0 +1,2 @@ +big +blaze diff --git a/projects/coreboot/configs/depthcharge/targets b/projects/coreboot/configs/depthcharge/targets @@ -0,0 +1,2 @@ +nyan +veyron diff --git a/projects/coreboot/configs/depthcharge/veyron/arch b/projects/coreboot/configs/depthcharge/veyron/arch @@ -0,0 +1 @@ +arm diff --git a/projects/coreboot/configs/depthcharge/veyron/jerry/config b/projects/coreboot/configs/depthcharge/veyron/jerry/config @@ -0,0 +1,12 @@ +CONFIG_VENDOR_GOOGLE=y +CONFIG_BOARD_GOOGLE_VEYRON_JERRY=y +CONFIG_CHROMEOS=y +CONFIG_PAYLOAD_ELF=y +CONFIG_PAYLOAD_FILE="$(obj)/../depthcharge-veyron-jerry/depthcharge.elf" +CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_EXTERNAL=y +CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_FILE="$(obj)/../cros-ec-veyron-jerry/ec.RW.bin" +CONFIG_GBB_FLAG_ENABLE_ALTERNATE_OS=y +CONFIG_GBB_FLAG_FORCE_DEV_SWITCH_ON=y +CONFIG_GBB_FLAG_FORCE_DEV_BOOT_USB=y +CONFIG_GBB_FLAG_DISABLE_FW_ROLLBACK_CHECK=y +CONFIG_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC=y diff --git a/projects/coreboot/configs/depthcharge/veyron/jerry/ec b/projects/coreboot/configs/depthcharge/veyron/jerry/ec @@ -0,0 +1 @@ +cros-ec diff --git a/projects/coreboot/configs/depthcharge/veyron/mickey/config b/projects/coreboot/configs/depthcharge/veyron/mickey/config @@ -0,0 +1,5 @@ +CONFIG_VENDOR_GOOGLE=y +CONFIG_BOARD_GOOGLE_VEYRON_MICKEY=y +CONFIG_CHROMEOS=y +CONFIG_PAYLOAD_ELF=y +CONFIG_PAYLOAD_FILE="$(obj)/../depthcharge-veyron-mickey/depthcharge.elf" diff --git a/projects/coreboot/configs/depthcharge/veyron/minnie/config b/projects/coreboot/configs/depthcharge/veyron/minnie/config @@ -0,0 +1,7 @@ +CONFIG_VENDOR_GOOGLE=y +CONFIG_BOARD_GOOGLE_VEYRON_MINNIE=y +CONFIG_CHROMEOS=y +CONFIG_PAYLOAD_ELF=y +CONFIG_PAYLOAD_FILE="$(obj)/../depthcharge-veyron-minnie/depthcharge.elf" +CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_EXTERNAL=y +CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_FILE="$(obj)/../cros-ec-veyron-minnie/ec.RW.bin" diff --git a/projects/coreboot/configs/depthcharge/veyron/minnie/ec b/projects/coreboot/configs/depthcharge/veyron/minnie/ec @@ -0,0 +1 @@ +cros-ec diff --git a/projects/coreboot/configs/depthcharge/veyron/speedy/config b/projects/coreboot/configs/depthcharge/veyron/speedy/config @@ -0,0 +1,7 @@ +CONFIG_VENDOR_GOOGLE=y +CONFIG_BOARD_GOOGLE_VEYRON_SPEEDY=y +CONFIG_CHROMEOS=y +CONFIG_PAYLOAD_ELF=y +CONFIG_PAYLOAD_FILE="$(obj)/../depthcharge-veyron-speedy/depthcharge.elf" +CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_EXTERNAL=y +CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_FILE="$(obj)/../cros-ec-veyron-speedy/ec.RW.bin" diff --git a/projects/coreboot/configs/depthcharge/veyron/speedy/ec b/projects/coreboot/configs/depthcharge/veyron/speedy/ec @@ -0,0 +1 @@ +cros-ec diff --git a/projects/coreboot/configs/depthcharge/veyron/targets b/projects/coreboot/configs/depthcharge/veyron/targets @@ -0,0 +1,4 @@ +jerry +mickey +minnie +speedy diff --git a/projects/coreboot/configs/install b/projects/coreboot/configs/install @@ -0,0 +1 @@ +coreboot.rom:coreboot.rom diff --git a/projects/coreboot/configs/revision b/projects/coreboot/configs/revision @@ -0,0 +1 @@ +dcd2f17ff47cc1a4b26f253fb11a991cfe4ff6f5 diff --git a/projects/coreboot/configs/targets b/projects/coreboot/configs/targets @@ -0,0 +1 @@ +depthcharge diff --git a/projects/coreboot/coreboot b/projects/coreboot/coreboot @@ -0,0 +1,135 @@ +#!/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/>. + +arguments() { + project_arguments_targets "$project" "$@" +} + +usage() { + project_usage_actions "$project" + project_usage_arguments "$project" "$@" +} + +download() { + local repository=$project + + project_download_git "$project" "$repository" "https://review.coreboot.org/coreboot https://github.com/coreboot/coreboot.git" "$@" +} + +download_check() { + local repository=$project + + project_download_check_git "$project" "$repository" "$@" +} + +extract() { + project_extract "$project" "$@" +} + +extract_check() { + project_extract_check "$project" "$@" +} + +update() { + local repository=$project + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository=$project + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local payload=$1 + shift + + local repository=$project + + project_sources_directory_missing_empty_error "$project" "$repository" "$payload" "$@" + + local sources_path=$( project_sources_path "$project" "$repository" "$payload" "$@" ) + local build_path=$( project_build_path "$project" "$payload" "$@" ) + local config_path=$( coreboot_config_path "$payload" "$@" ) + + local arch=$( coreboot_arch "$payload" "$@" ) + + local crossgcc_build_path=$( project_build_path "crossgcc" "$arch" ) + local crossgcc_bin_path="$crossgcc_build_path/bin/" + local vboot_sources_path=$( project_sources_path "vboot" "vboot" "devices" ) + + project_action "build" "crossgcc" "$arch" + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$payload" "$@" + fi + + project_action "checkout" "vboot" "devices" + + project_action "build" "$payload" "$@" + + if coreboot_ec_check "$payload" "$@" + then + ec=$( coreboot_ec "$payload" "$@" ) + + project_action "build" "$ec" "$@" + fi + + rm -f "$sources_path/.xcompile" + + mkdir -p "$build_path" + + make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" BUILD_TIMELESS=1 KERNELVERSION="$VERSION" KBUILD_DEFCONFIG="$config_path" "defconfig" + make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" BUILD_TIMELESS=1 KERNELVERSION="$VERSION" VBOOT_SOURCE="$vboot_sources_path" -j$TASKS + + rm -f "$sources_path/.xcompile" +} + +build_check() { + project_build_check "$project" "$@" +} + +install() { + project_install "$project" "$@" +} + +install_check() { + project_install_check "$project" "$@" +} + +release() { + local repository=$project + + project_release_install_archive "$project" "$IMAGES" "$@" + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local repository=$project + + project_release_install_archive_check "$project" "$IMAGES" "$@" + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/coreboot/coreboot-helper b/projects/coreboot/coreboot-helper @@ -0,0 +1,38 @@ +#!/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/>. + +DEVICES="devices" +PAYLOADS="payloads" +CONFIG="config" +ARCH="arch" +EC="ec" + +coreboot_arch() { + project_file_contents "$project" "$CONFIGS" "$ARCH" "$@" +} + +coreboot_config_path() { + project_file_path "$project" "$CONFIGS" "$CONFIG" "$@" +} + +coreboot_ec_check() { + project_file_test "$project" "$CONFIGS" "$EC" "$@" +} + +coreboot_ec() { + project_file_contents "$project" "$CONFIGS" "$EC" "$@" +} diff --git a/projects/coreboot/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch b/projects/coreboot/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch @@ -0,0 +1,122 @@ +From 95248477726f4a866b04a760f68930bc5ebd55ff Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Wed, 20 Jul 2016 16:03:30 +0200 +Subject: [PATCH 1/4] Avoid using git submodules for 3rdparty + +This gets rid of git submodules entirely, to avoid the nuisance caused +by automatically checking them out. + +Change-Id: I54de09656bd2dd9c308bd6c8dce554945aa8e535 +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + .gitmodules | 20 -------------------- + 3rdparty/arm-trusted-firmware | 1 - + 3rdparty/blobs | 1 - + 3rdparty/chromeec | 1 - + 3rdparty/libgfxinit | 1 - + 3rdparty/libhwbase | 1 - + 3rdparty/vboot | 1 - + Makefile.inc | 11 ----------- + 8 files changed, 37 deletions(-) + delete mode 160000 3rdparty/arm-trusted-firmware + delete mode 160000 3rdparty/blobs + delete mode 160000 3rdparty/chromeec + delete mode 160000 3rdparty/libgfxinit + delete mode 160000 3rdparty/libhwbase + delete mode 160000 3rdparty/vboot + +diff --git a/.gitmodules b/.gitmodules +index c3270e6..3a617c7 100644 +--- a/.gitmodules ++++ b/.gitmodules +@@ -1,23 +1,3 @@ +-[submodule "3rdparty/blobs"] +- path = 3rdparty/blobs +- url = ../blobs.git +- update = none +- ignore = dirty + [submodule "util/nvidia-cbootimage"] + path = util/nvidia/cbootimage + url = ../nvidia-cbootimage.git +-[submodule "vboot"] +- path = 3rdparty/vboot +- url = ../vboot.git +-[submodule "arm-trusted-firmware"] +- path = 3rdparty/arm-trusted-firmware +- url = ../arm-trusted-firmware.git +-[submodule "3rdparty/chromeec"] +- path = 3rdparty/chromeec +- url = ../chrome-ec.git +-[submodule "libhwbase"] +- path = 3rdparty/libhwbase +- url = ../libhwbase.git +-[submodule "libgfxinit"] +- path = 3rdparty/libgfxinit +- url = ../libgfxinit.git +diff --git a/3rdparty/arm-trusted-firmware b/3rdparty/arm-trusted-firmware +deleted file mode 160000 +index bfd9251..0000000 +--- a/3rdparty/arm-trusted-firmware ++++ /dev/null +@@ -1 +0,0 @@ +-Subproject commit bfd925139fdbc2e87979849907b34843aa326994 +diff --git a/3rdparty/blobs b/3rdparty/blobs +deleted file mode 160000 +index 8090bdd..0000000 +--- a/3rdparty/blobs ++++ /dev/null +@@ -1 +0,0 @@ +-Subproject commit 8090bdd59853599e469b7503ea473ca12e8c681b +diff --git a/3rdparty/chromeec b/3rdparty/chromeec +deleted file mode 160000 +index ea1a869..0000000 +--- a/3rdparty/chromeec ++++ /dev/null +@@ -1 +0,0 @@ +-Subproject commit ea1a8699e96425806abdd532d04da254ae093f6e +diff --git a/3rdparty/libgfxinit b/3rdparty/libgfxinit +deleted file mode 160000 +index 88a7f17..0000000 +--- a/3rdparty/libgfxinit ++++ /dev/null +@@ -1 +0,0 @@ +-Subproject commit 88a7f17b7d7a4f8a4d25ef6b87c71236b0862f5d +diff --git a/3rdparty/libhwbase b/3rdparty/libhwbase +deleted file mode 160000 +index aab715f..0000000 +--- a/3rdparty/libhwbase ++++ /dev/null +@@ -1 +0,0 @@ +-Subproject commit aab715f166bf1b54cfbd6982e8df49248ea544d8 +diff --git a/3rdparty/vboot b/3rdparty/vboot +deleted file mode 160000 +index adfafba..0000000 +--- a/3rdparty/vboot ++++ /dev/null +@@ -1 +0,0 @@ +-Subproject commit adfafba793684ed92965dfbd86b3fb3463975d8c +diff --git a/Makefile.inc b/Makefile.inc +index c5ce30f..919a5d4 100644 +--- a/Makefile.inc ++++ b/Makefile.inc +@@ -183,17 +183,6 @@ ifeq ($(CONFIG_COVERAGE),y) + ramstage-c-ccopts += -fprofile-arcs -ftest-coverage + endif + +-ifneq ($(UPDATED_SUBMODULES),1) +-# try to fetch non-optional submodules if the source is under git +-forgetthis:=$(if $(GIT),$(shell git submodule update --init)) +-ifeq ($(CONFIG_USE_BLOBS),y) +-# this is necessary because 3rdparty/blobs is update=none, and so is ignored +-# unless explicitly requested and enabled through --checkout +-forgetthis:=$(if $(GIT),$(shell git submodule update --init --checkout 3rdparty/blobs)) +-endif +-export UPDATED_SUBMODULES:=1 +-endif +- + ramstage-c-deps:=$$(OPTION_TABLE_H) + romstage-c-deps:=$$(OPTION_TABLE_H) + libverstage-c-deps:=$$(OPTION_TABLE_H) +-- +2.10.2 + diff --git a/projects/coreboot/patches/0002-libpayload-Update-ARM-CrOS-devices-configuration.patch b/projects/coreboot/patches/0002-libpayload-Update-ARM-CrOS-devices-configuration.patch @@ -0,0 +1,56 @@ +From fc26e7861ec756614e27a82895b60724a8173757 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 19 Dec 2016 18:03:23 +0100 +Subject: [PATCH 2/4] libpayload: Update ARM CrOS devices configuration + +This updates the configuration for ARM CrOS devices (nyans and veyrons) +by using the CHROMEOS Kconfig option, thus reducing the number of +options to select. It also brings proper serial console support. + +Change-Id: Iffc84c44a1d339c5bb575fbaffc40bc2d56bb6cf +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + payloads/libpayload/configs/config.nyan | 10 +++------- + payloads/libpayload/configs/config.veyron | 10 +++------- + 2 files changed, 6 insertions(+), 14 deletions(-) + +diff --git a/payloads/libpayload/configs/config.nyan b/payloads/libpayload/configs/config.nyan +index 6e593e5..caad2b6 100644 +--- a/payloads/libpayload/configs/config.nyan ++++ b/payloads/libpayload/configs/config.nyan +@@ -1,10 +1,6 @@ +-CONFIG_LP_GPL=y ++CONFIG_LP_CHROMEOS=y + CONFIG_LP_ARCH_ARM=y +-# CONFIG_LP_CURSES is not set +-CONFIG_LP_SKIP_CONSOLE_INIT=y +-CONFIG_LP_COREBOOT_VIDEO_CONSOLE=y +-# CONFIG_LP_STORAGE is not set ++CONFIG_LP_8250_SERIAL_CONSOLE=y + CONFIG_LP_TIMER_TEGRA_1US=y +-# CONFIG_LP_USB_OHCI is not set +-# CONFIG_LP_USB_XHCI is not set ++CONFIG_LP_USB_EHCI=y + CONFIG_LP_USB_EHCI_HOSTPC_ROOT_HUB_TT=y +diff --git a/payloads/libpayload/configs/config.veyron b/payloads/libpayload/configs/config.veyron +index 793907f..e80535c 100644 +--- a/payloads/libpayload/configs/config.veyron ++++ b/payloads/libpayload/configs/config.veyron +@@ -1,11 +1,7 @@ +-CONFIG_LP_GPL=y ++CONFIG_LP_CHROMEOS=y + CONFIG_LP_ARCH_ARM=y +-# CONFIG_LP_CURSES is not set +-CONFIG_LP_SKIP_CONSOLE_INIT=y +-CONFIG_LP_COREBOOT_VIDEO_CONSOLE=y +-# CONFIG_LP_STORAGE is not set +-CONFIG_LP_TIMER_RK=y +-CONFIG_LP_USB=y ++CONFIG_LP_8250_SERIAL_CONSOLE=y ++CONFIG_LP_TIMER_RK3288=y + CONFIG_LP_USB_EHCI=y + CONFIG_LP_USB_DWC2=y + # CONFIG_LP_USB_HID is not set +-- +2.10.2 + diff --git a/projects/coreboot/patches/0003-libpayload-Get-current-tick-from-high-register-in-ge.patch b/projects/coreboot/patches/0003-libpayload-Get-current-tick-from-high-register-in-ge.patch @@ -0,0 +1,32 @@ +From 03a830aad1cdf4325781aa60566bebcf5aa57238 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 19 Dec 2016 19:22:39 +0100 +Subject: [PATCH 3/4] libpayload: Get current tick from high register in + generic timer + +This fixes the generic timer driver to get the current tick from the +high register, so that comparison with the high count value (obtained +previously from the same register) has a chance to succeed. + +Change-Id: I5ce02bfa15a91ad34641b8e24813a5b7ca790ec3 +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + payloads/libpayload/drivers/timer/generic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/payloads/libpayload/drivers/timer/generic.c b/payloads/libpayload/drivers/timer/generic.c +index 4c06618..ac26f40 100644 +--- a/payloads/libpayload/drivers/timer/generic.c ++++ b/payloads/libpayload/drivers/timer/generic.c +@@ -53,7 +53,7 @@ uint64_t timer_raw_value(void) + do { + count_h = readl(phys_to_virt(CONFIG_LP_TIMER_GENERIC_HIGH_REG)); + count_l = readl(phys_to_virt(CONFIG_LP_TIMER_GENERIC_REG)); +- cur_tick = readl(phys_to_virt(CONFIG_LP_TIMER_GENERIC_REG)); ++ cur_tick = readl(phys_to_virt(CONFIG_LP_TIMER_GENERIC_HIGH_REG)); + } while (cur_tick != count_h); + + return (cur_tick << 32) + count_l; +-- +2.10.2 + diff --git a/projects/coreboot/patches/0004-libpayload-Enable-USB-HID-in-veyron-configuration.patch b/projects/coreboot/patches/0004-libpayload-Enable-USB-HID-in-veyron-configuration.patch @@ -0,0 +1,27 @@ +From 552b999c7b32363cbc51722f33a0de189baf27fe Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 19 Dec 2016 20:23:44 +0100 +Subject: [PATCH 4/4] libpayload: Enable USB HID in veyron configuration + +This enables USB HID support in the veyron config, since it seems to +work correctly and is needed for interaction with depthcharge on devices +without an embedded keyboard (such as veyron_jerry). + +Change-Id: Icae829e3a132005df17bcb6f7e6f8a190912576d +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + payloads/libpayload/configs/config.veyron | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/payloads/libpayload/configs/config.veyron b/payloads/libpayload/configs/config.veyron +index e80535c..b643e92 100644 +--- a/payloads/libpayload/configs/config.veyron ++++ b/payloads/libpayload/configs/config.veyron +@@ -4,4 +4,3 @@ CONFIG_LP_8250_SERIAL_CONSOLE=y + CONFIG_LP_TIMER_RK3288=y + CONFIG_LP_USB_EHCI=y + CONFIG_LP_USB_DWC2=y +-# CONFIG_LP_USB_HID is not set +-- +2.10.2 + diff --git a/projects/cros-ec/configs/nyan/big/config b/projects/cros-ec/configs/nyan/big/config @@ -0,0 +1 @@ +big diff --git a/projects/cros-ec/configs/nyan/blaze/config b/projects/cros-ec/configs/nyan/blaze/config @@ -0,0 +1 @@ +blaze diff --git a/projects/cros-ec/configs/nyan/install b/projects/cros-ec/configs/nyan/install @@ -0,0 +1,2 @@ +ec.bin:ec.bin +ec.RW.bin:ec.RW.bin diff --git a/projects/cros-ec/configs/nyan/revision b/projects/cros-ec/configs/nyan/revision @@ -0,0 +1 @@ +3c5457348e08d8606a8398cc9265cb144ec4baf6 diff --git a/projects/cros-ec/configs/nyan/targets b/projects/cros-ec/configs/nyan/targets @@ -0,0 +1,2 @@ +big +blaze diff --git a/projects/cros-ec/configs/targets b/projects/cros-ec/configs/targets @@ -0,0 +1,3 @@ +nyan +tools +veyron diff --git a/projects/cros-ec/configs/tools/install b/projects/cros-ec/configs/tools/install @@ -0,0 +1,6 @@ +util/ectool:ectool +util/ec_uartd:ec_uartd +util/iteflash:iteflash +util/lbcc:lbcc +util/lbplay:lbplay +util/stm32mon:stm32mon diff --git a/projects/cros-ec/configs/tools/revision b/projects/cros-ec/configs/tools/revision @@ -0,0 +1 @@ +origin/release-R56-9000.B diff --git a/projects/cros-ec/configs/veyron/install b/projects/cros-ec/configs/veyron/install @@ -0,0 +1,2 @@ +ec.bin:ec.bin +ec.RW.bin:ec.RW.bin diff --git a/projects/cros-ec/configs/veyron/jerry/config b/projects/cros-ec/configs/veyron/jerry/config @@ -0,0 +1 @@ +jerry diff --git a/projects/cros-ec/configs/veyron/minnie/config b/projects/cros-ec/configs/veyron/minnie/config @@ -0,0 +1 @@ +minnie diff --git a/projects/cros-ec/configs/veyron/revision b/projects/cros-ec/configs/veyron/revision @@ -0,0 +1 @@ +242f6bd3e6f3b2d0b0e2b764c34fbab2db051189 diff --git a/projects/cros-ec/configs/veyron/speedy/config b/projects/cros-ec/configs/veyron/speedy/config @@ -0,0 +1 @@ +speedy diff --git a/projects/cros-ec/configs/veyron/targets b/projects/cros-ec/configs/veyron/targets @@ -0,0 +1,3 @@ +jerry +minnie +speedy diff --git a/projects/cros-ec/cros-ec b/projects/cros-ec/cros-ec @@ -0,0 +1,136 @@ +#!/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/>. + +arguments() { + project_arguments_targets "$project" "$@" +} + +usage() { + project_usage_actions "$project" + project_usage_arguments "$project" "$@" +} + +download() { + local repository=$project + + project_download_git "$project" "$repository" "https://chromium.googlesource.com/chromiumos/platform/ec https://review.coreboot.org/chrome-ec.git https://github.com/coreboot/chrome-ec.git" "$@" +} + +download_check() { + local repository=$project + + project_download_check_git "$project" "$repository" "$@" +} + +extract() { + project_extract "$project" "$@" +} + +extract_check() { + project_extract_check "$project" "$@" +} + +update() { + local repository=$project + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository=$project + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local target=$1 + + local repository=$project + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local build_path=$( project_build_path "$project" "$@" ) + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi + + mkdir -p "$build_path" + + if [ "$target" = "tools" ] + then + make -C "$sources_path" out="$build_path" HOST_CROSS_COMPILE= -j$TASKS "utils" + else + local arch="arm" + + local config=$( cros_ec_config "$@" ) + + local crossgcc_bin_prefix=$( project_action "prefix" "crossgcc" "$arch" ) + + project_action "build" "crossgcc" "$arch" + + make -C "$sources_path" out="$build_path" CROSS_COMPILE="$crossgcc_bin_prefix" HOST_CROSS_COMPILE= BOARD="$config" -j$TASKS + fi +} + +build_check() { + project_build_check "$project" "$@" +} + +install() { + project_install "$project" "$@" +} + +install_check() { + project_install_check "$project" "$@" +} + +release() { + local target=$1 + + local repository=$project + + if [ "$target" = "tools" ] + then + project_release_install_archive "$project" "$TOOLS" "$@" + else + project_release_install_archive "$project" "$IMAGES" "$@" + fi + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local target=$1 + + local repository=$project + + if [ "$target" = "tools" ] + then + project_release_install_archive_check "$project" "$TOOLS" "$@" + else + project_release_install_archive_check "$project" "$IMAGES" "$@" + fi + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/cros-ec/cros-ec-helper b/projects/cros-ec/cros-ec-helper @@ -0,0 +1,22 @@ +#!/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/>. + +CONFIG="config" + +cros_ec_config() { + project_file_contents "$project" "$CONFIGS" "$CONFIG" "$@" +} diff --git a/projects/cros-ec/patches/nyan/0001-use-_DEFAULT_SOURCE-for-newer-glibc.patch b/projects/cros-ec/patches/nyan/0001-use-_DEFAULT_SOURCE-for-newer-glibc.patch @@ -0,0 +1,53 @@ +From b98bd2808f4185970781bd4dcca141cbda9b03c6 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@chromium.org> +Date: Mon, 7 Dec 2015 21:46:13 -0500 +Subject: [PATCH 1/4] use _DEFAULT_SOURCE for newer glibc + +Newer versions of glibc have moved to _DEFAULT_SOURCE and away from +_BSD_SOURCE. Trying to use the BSD define by itself leads to warnings +which causes build failures. + +BRANCH=none +BUG=None +TEST=precq still works + +Signed-off-by: Mike Frysinger <vapier@chromium.org> +Change-Id: Ice24b84dc6a540695fc7b76e8f22a4c85c301976 +Reviewed-on: https://chromium-review.googlesource.com/316730 +Reviewed-by: Bill Richardson <wfrichar@chromium.org> +--- + util/ec_uartd.c | 3 ++- + util/stm32mon.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/util/ec_uartd.c b/util/ec_uartd.c +index fbf4a5e..bfd0642 100644 +--- a/util/ec_uartd.c ++++ b/util/ec_uartd.c +@@ -11,7 +11,8 @@ + */ + + /* Force header files to define grantpt(), posix_openpt(), cfmakeraw() */ +-#define _BSD_SOURCE ++#define _DEFAULT_SOURCE /* Newer glibc */ ++#define _BSD_SOURCE /* Older glibc */ + #define _XOPEN_SOURCE 600 + /* Force header file to declare ptsname_r(), etc. */ + #ifndef _GNU_SOURCE +diff --git a/util/stm32mon.c b/util/stm32mon.c +index 2e73bcf..f65cd64 100644 +--- a/util/stm32mon.c ++++ b/util/stm32mon.c +@@ -6,7 +6,8 @@ + */ + + /* use cfmakeraw() */ +-#define _BSD_SOURCE ++#define _DEFAULT_SOURCE /* Newer glibc */ ++#define _BSD_SOURCE /* Older glibc */ + + #include <arpa/inet.h> + #include <errno.h> +-- +2.9.0 + diff --git a/projects/cros-ec/patches/nyan/0002-Enforce-compilation-without-system-headers.patch b/projects/cros-ec/patches/nyan/0002-Enforce-compilation-without-system-headers.patch @@ -0,0 +1,27 @@ +From fd77232c8e9789f5556fc6cc3c694924c1546a41 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Wed, 20 Jul 2016 16:26:32 +0200 +Subject: [PATCH 2/4] Enforce compilation without system headers + +This is based on commit bc404c94b4ab1e6a62e607fd7ef034aa31d6388e +(Enforce compilation without system headers) +--- + Makefile.toolchain | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.toolchain b/Makefile.toolchain +index dd0ebb2..47991e1 100644 +--- a/Makefile.toolchain ++++ b/Makefile.toolchain +@@ -19,7 +19,7 @@ BUILDCC?=gcc + HOSTCC?=$(HOST_CROSS_COMPILE)gcc + + CFLAGS_WARN=-Wall -Werror -Wundef -Wstrict-prototypes -Wno-trigraphs \ +- -fno-strict-aliasing -fno-common \ ++ -fno-strict-aliasing -fno-common -ffreestanding -fno-builtin \ + -Werror-implicit-function-declaration -Wno-format-security \ + -fno-delete-null-pointer-checks -Wdeclaration-after-statement \ + -Wno-pointer-sign -fno-strict-overflow -fconserve-stack +-- +2.9.0 + diff --git a/projects/cros-ec/patches/nyan/0003-Don-t-declare-functions-inline-that-aren-t-always-de.patch b/projects/cros-ec/patches/nyan/0003-Don-t-declare-functions-inline-that-aren-t-always-de.patch @@ -0,0 +1,28 @@ +From 9d747549141e710c324968636522e57fe4ba9445 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Wed, 20 Jul 2016 16:27:05 +0200 +Subject: [PATCH 3/4] Don't declare functions inline that aren't always defined + as such + +This is based on commit 960cf45b3ffe88e842c27145e7e646d63a89c371 +(Don't declare functions inline that aren't always defined as such) +--- + include/task.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/task.h b/include/task.h +index 00368fb..52827e9 100644 +--- a/include/task.h ++++ b/include/task.h +@@ -47,7 +47,7 @@ void interrupt_enable(void); + /** + * Return true if we are in interrupt context. + */ +-inline int in_interrupt_context(void); ++int in_interrupt_context(void); + + /** + * Set a task event. +-- +2.9.0 + diff --git a/projects/cros-ec/patches/nyan/0004-cortex-m-Use-assembly-exception-handler-and-routine-.patch b/projects/cros-ec/patches/nyan/0004-cortex-m-Use-assembly-exception-handler-and-routine-.patch @@ -0,0 +1,230 @@ +From f7d7b22a9e711783c99be55b2c1c437a6808f24d Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Sat, 23 Jul 2016 15:51:58 +0200 +Subject: [PATCH 4/4] cortex-m: Use assembly exception handler and routine for + task switching + +The way Cortex processors handle exceptions allows writing exception +routines directly in C, as return from exception is handled by providing +a special value for the link register. + +However, it is not safe to do this when doing context switching. In +particular, C handlers may push some general-purpose registers that +are used by the handler and pop them later, even when context switch +has happened in the meantime. While the processor will restore {r0-r3} +from the stack when returning from an exception, the C handler code +may push, use and pop another register, clobbering the value resulting +from the context switch. + +For this reason, it is safer to have assembly routines for exception +handlers that do context switching. + +BUG=chromium:631514 +BRANCH=None +TEST=Build and run big EC with a recent GCC version + +Change-Id: Ia356321021731e6e372af152c962d8f01c065da5 +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + core/cortex-m/switch.S | 90 +++++++++++++++++++++++++++++++++++--------------- + core/cortex-m/task.c | 28 ++++------------ + 2 files changed, 69 insertions(+), 49 deletions(-) + +diff --git a/core/cortex-m/switch.S b/core/cortex-m/switch.S +index 92c7e51..80a99c8 100644 +--- a/core/cortex-m/switch.S ++++ b/core/cortex-m/switch.S +@@ -13,6 +13,48 @@ + .code 16 + + /** ++ * Start the task scheduling. r0 is a pointer to task_stack_ready, which is ++ * set to 1 after the task stack is set up. ++ */ ++.global __task_start ++.thumb_func ++__task_start: ++ ldr r2,=scratchpad @ area used as dummy thread stack for the first switch ++#ifdef CONFIG_FPU ++ mov r3, #6 @ use : priv. mode / thread stack / floating point on ++#else ++ mov r3, #2 @ use : priv. mode / thread stack / no floating point ++#endif ++ add r2, #17*4 @ put the pointer at the top of the stack ++ mov r1, #0 @ __Schedule parameter : re-schedule nothing ++ msr psp, r2 @ setup a thread stack up to the first context switch ++ mov r2, #1 ++ isb @ ensure the write is done ++ msr control, r3 ++ mov r3, r0 ++ mov r0, #0 @ __Schedule parameter : de-schedule nothing ++ isb @ ensure the write is done ++ str r2, [r3] @ Task scheduling is now active ++ bl __schedule @ execute the task with the highest priority ++ /* we should never return here */ ++ mov r0, #1 @ set to EC_ERROR_UNKNOWN ++ bx lr ++ ++/** ++ * SVC exception handler ++ */ ++.global svc_handler ++.thumb_func ++svc_handler: ++ push {lr} @ save link register ++ bl __svc_handler @ call svc handler helper ++ ldr r3,=current_task @ load the current task's address ++ ldr r1, [r3] @ load the current task ++ cmp r0, r1 @ compare with previous task returned by helper ++ beq svc_handler_return @ return if they are the same ++ /* continue to __switchto to switch to the new task */ ++ ++/** + * Task context switching + * + * Change the task scheduled after returning from the exception. +@@ -30,8 +72,6 @@ + * r0, r1, r2, r3, r12, lr, pc, psr, r4, r5, r6, r7, r8, r9, r10, r11 + * exception frame <|> additional registers + */ +-.global __switchto +-.thumb_func + __switchto: + mrs r3, psp @ get the task stack where the context has been saved + ldr r2, [r1] @ get the new scheduled task stack pointer +@@ -39,33 +79,29 @@ __switchto: + ldmia r2!, {r4-r11} @ restore r4-r11 for the next task context + str r3, [r0] @ save the task stack pointer in its context + msr psp, r2 @ set the process stack pointer to exception context +- bx lr @ return from exception ++ ++svc_handler_return: ++ pop {pc} @ return from exception or return to caller + + /** +- * Start the task scheduling. r0 is a pointer to task_stack_ready, which is +- * set to 1 after the task stack is set up. ++ * Resched task if needed: ++ * Continue iff a rescheduling event happened or profiling is active, ++ * and we are not called from another exception. + */ +-.global __task_start ++.global task_resched_if_needed + .thumb_func +-__task_start: +- ldr r2,=scratchpad @ area used as dummy thread stack for the first switch +-#ifdef CONFIG_FPU +- mov r3, #6 @ use : priv. mode / thread stack / floating point on +-#else +- mov r3, #2 @ use : priv. mode / thread stack / no floating point +-#endif +- add r2, #17*4 @ put the pointer at the top of the stack +- mov r1, #0 @ __Schedule parameter : re-schedule nothing +- msr psp, r2 @ setup a thread stack up to the first context switch +- mov r2, #1 +- isb @ ensure the write is done +- msr control, r3 +- mov r3, r0 +- mov r0, #0 @ __Schedule parameter : de-schedule nothing +- isb @ ensure the write is done +- str r2, [r3] @ Task scheduling is now active +- bl __schedule @ execute the task with the highest priority +- /* we should never return here */ +- mov r0, #1 @ set to EC_ERROR_UNKNOWN +- bx lr ++task_resched_if_needed: ++ push {lr} @ save link register ++ ldr r3,=need_resched_or_profiling @ load need's address ++ ldr r1, [r3] @ load need ++ cbz r1, task_resched_if_needed_return @ return if there is no need ++ and r0, #0xf @ called from another exception ++ cmp r0, #1 @ check bit ++ beq task_resched_if_needed_return @ return if called from exception ++ movs r1, #0 @ desched nothing ++ movs r0, #0 @ resched nothing ++ bl svc_handler @ re-schedule the highest priority ++ @ task + ++task_resched_if_needed_return: ++ pop {pc} @ return to caller +diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c +index bfb3a9b..9935a28 100644 +--- a/core/cortex-m/task.c ++++ b/core/cortex-m/task.c +@@ -57,7 +57,6 @@ static uint32_t task_switches; /* Number of times active task changed */ + static uint32_t irq_dist[CONFIG_IRQ_COUNT]; /* Distribution of IRQ calls */ + #endif + +-extern void __switchto(task_ *from, task_ *to); + extern int __task_start(int *task_stack_ready); + + #ifndef CONFIG_LOW_POWER_IDLE +@@ -124,7 +123,7 @@ uint32_t scratchpad[17+18]; + uint32_t scratchpad[17]; + #endif + +-static task_ *current_task = (task_ *)scratchpad; ++task_ *current_task = (task_ *)scratchpad; + + /* + * Should IRQs chain to svc_handler()? This should be set if either of the +@@ -137,7 +136,7 @@ static task_ *current_task = (task_ *)scratchpad; + * task unblocking. After checking for a task switch, svc_handler() will clear + * the flag (unless profiling is also enabled; then the flag remains set). + */ +-static int need_resched_or_profiling; ++int need_resched_or_profiling; + + /* + * Bitmap of all tasks ready to be run. +@@ -197,7 +196,7 @@ int task_start_called(void) + /** + * Scheduling system call + */ +-void svc_handler(int desched, task_id_t resched) ++task_ *__svc_handler(int desched, task_id_t resched) + { + task_ *current, *next; + #ifdef CONFIG_TASK_PROFILING +@@ -264,16 +263,13 @@ void svc_handler(int desched, task_id_t resched) + need_resched_or_profiling = 0; + #endif + +- /* Nothing to do */ +- if (next == current) +- return; +- + /* Switch to new task */ + #ifdef CONFIG_TASK_PROFILING +- task_switches++; ++ if (next != current) ++ task_switches++; + #endif + current_task = next; +- __switchto(current, next); ++ return current; + } + + void __schedule(int desched, int resched) +@@ -313,18 +309,6 @@ void task_start_irq_handler(void *excep_return) + } + #endif + +-void task_resched_if_needed(void *excep_return) +-{ +- /* +- * Continue iff a rescheduling event happened or profiling is active, +- * and we are not called from another exception. +- */ +- if (!need_resched_or_profiling || (((uint32_t)excep_return & 0xf) == 1)) +- return; +- +- svc_handler(0, 0); +-} +- + static uint32_t __wait_evt(int timeout_us, task_id_t resched) + { + task_ *tsk = current_task; +-- +2.9.0 + diff --git a/projects/cros-ec/patches/veyron/0001-ec-fix-a-clang-warning-by-use-a-unused-variable.patch b/projects/cros-ec/patches/veyron/0001-ec-fix-a-clang-warning-by-use-a-unused-variable.patch @@ -0,0 +1,38 @@ +From 35987639080ef4293bffbc1ce21de4d8a35b41db Mon Sep 17 00:00:00 2001 +From: Yunlian Jiang <yunlian@google.com> +Date: Mon, 20 Apr 2015 09:38:56 -0700 +Subject: [PATCH 1/6] ec: fix a clang warning by use a unused variable. + +This uses the variable 'usage' in an error message to fix a clang +warning. + +BUG=chromium:475960 +TEST=CC=x86_64-cros-linux-gnu-clang emerge-falco ec-devutils +BRANCH=none +Signed-off-by: yunlian@chromium.org + +Change-Id: Ic5703636040805661c7b81b83fc182e127ceab8c +Reviewed-on: https://chromium-review.googlesource.com/266404 +Reviewed-by: Vincent Palatin <vpalatin@chromium.org> +Tested-by: Yunlian Jiang <yunlian@chromium.org> +Commit-Queue: Yunlian Jiang <yunlian@chromium.org> +--- + util/lbcc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/lbcc.c b/util/lbcc.c +index b34b21e..953f422 100644 +--- a/util/lbcc.c ++++ b/util/lbcc.c +@@ -630,7 +630,7 @@ int main(int argc, char *argv[]) + } + + if (errorcnt) { +- fprintf(stderr, "\nUsage: %s [options] ...\n\n", progname); ++ fprintf(stderr, usage, progname); + exit(1); + } + +-- +2.9.0 + diff --git a/projects/cros-ec/patches/veyron/0002-use-_DEFAULT_SOURCE-for-newer-glibc.patch b/projects/cros-ec/patches/veyron/0002-use-_DEFAULT_SOURCE-for-newer-glibc.patch @@ -0,0 +1,53 @@ +From d2f946caf27adf4518cb657da39e296366d0b53f Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@chromium.org> +Date: Mon, 7 Dec 2015 21:46:13 -0500 +Subject: [PATCH 2/6] use _DEFAULT_SOURCE for newer glibc + +Newer versions of glibc have moved to _DEFAULT_SOURCE and away from +_BSD_SOURCE. Trying to use the BSD define by itself leads to warnings +which causes build failures. + +BRANCH=none +BUG=None +TEST=precq still works + +Signed-off-by: Mike Frysinger <vapier@chromium.org> +Change-Id: Ice24b84dc6a540695fc7b76e8f22a4c85c301976 +Reviewed-on: https://chromium-review.googlesource.com/316730 +Reviewed-by: Bill Richardson <wfrichar@chromium.org> +--- + util/ec_uartd.c | 3 ++- + util/stm32mon.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/util/ec_uartd.c b/util/ec_uartd.c +index 82823c4..678932e 100644 +--- a/util/ec_uartd.c ++++ b/util/ec_uartd.c +@@ -11,7 +11,8 @@ + */ + + /* Force header files to define grantpt(), posix_openpt(), cfmakeraw() */ +-#define _BSD_SOURCE ++#define _DEFAULT_SOURCE /* Newer glibc */ ++#define _BSD_SOURCE /* Older glibc */ + #define _XOPEN_SOURCE 600 + /* Force header file to declare ptsname_r(), etc. */ + #ifndef _GNU_SOURCE +diff --git a/util/stm32mon.c b/util/stm32mon.c +index 2de9400..ed1a7ee 100644 +--- a/util/stm32mon.c ++++ b/util/stm32mon.c +@@ -13,7 +13,8 @@ + */ + + /* use cfmakeraw() */ +-#define _BSD_SOURCE ++#define _DEFAULT_SOURCE /* Newer glibc */ ++#define _BSD_SOURCE /* Older glibc */ + + #include <arpa/inet.h> + #include <errno.h> +-- +2.9.0 + diff --git a/projects/cros-ec/patches/veyron/0003-Enforce-compilation-without-system-headers.patch b/projects/cros-ec/patches/veyron/0003-Enforce-compilation-without-system-headers.patch @@ -0,0 +1,44 @@ +From 63bb6f6effbaae9864366588464a7b9354c9a623 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Wed, 20 Jul 2016 16:26:32 +0200 +Subject: [PATCH 3/6] Enforce compilation without system headers + +This is based on commit bc404c94b4ab1e6a62e607fd7ef034aa31d6388e +(Enforce compilation without system headers) +--- + Makefile | 5 +++-- + Makefile.toolchain | 2 +- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index 01581fb..195ea44 100644 +--- a/Makefile ++++ b/Makefile +@@ -99,8 +99,9 @@ _rw_size_str:=$(shell echo "CONFIG_FW_RW_SIZE" | $(CPP) $(CPPFLAGS) -P \ + _rw_size:=$(shell echo "$$(($(_rw_size_str)))") + + # Get RSA key size from board defines +-_rsa_size:=$(shell echo "CONFIG_RSA_KEY_SIZE" | $(CPP) $(CPPFLAGS) -P \ +- -Ichip/$(CHIP) -Iboard/$(BOARD) -imacros include/rsa.h) ++_rsa_size:=$(shell echo "CONFIG_RSA_KEY_SIZE" | $(CPP) $(CPPFLAGS) \ ++ $(CFLAGS_WARN) -P -Ichip/$(CHIP) -Iboard/$(BOARD) \ ++ -imacros include/rsa.h) + $(eval RSA_KEY_SIZE=$(_rsa_size)) + + $(eval BOARD_$(UC_BOARD)=y) +diff --git a/Makefile.toolchain b/Makefile.toolchain +index 43f390c..898129c 100644 +--- a/Makefile.toolchain ++++ b/Makefile.toolchain +@@ -19,7 +19,7 @@ BUILDCC?=gcc + HOSTCC?=$(HOST_CROSS_COMPILE)gcc + + CFLAGS_WARN=-Wall -Werror -Wundef -Wstrict-prototypes -Wno-trigraphs \ +- -fno-strict-aliasing -fno-common \ ++ -fno-strict-aliasing -fno-common -ffreestanding -fno-builtin \ + -Werror-implicit-function-declaration -Wno-format-security \ + -fno-delete-null-pointer-checks -Wdeclaration-after-statement \ + -Wno-pointer-sign -fno-strict-overflow -fconserve-stack +-- +2.9.0 + diff --git a/projects/cros-ec/patches/veyron/0004-Don-t-declare-functions-inline-that-aren-t-always-de.patch b/projects/cros-ec/patches/veyron/0004-Don-t-declare-functions-inline-that-aren-t-always-de.patch @@ -0,0 +1,28 @@ +From 3515f1d744cbcdb37471e898277aa6b1ddd3d0ee Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Wed, 20 Jul 2016 16:27:05 +0200 +Subject: [PATCH 4/6] Don't declare functions inline that aren't always defined + as such + +This is based on commit 960cf45b3ffe88e842c27145e7e646d63a89c371 +(Don't declare functions inline that aren't always defined as such) +--- + include/task.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/task.h b/include/task.h +index cb96281..85d5b00 100644 +--- a/include/task.h ++++ b/include/task.h +@@ -47,7 +47,7 @@ void interrupt_enable(void); + /** + * Return true if we are in interrupt context. + */ +-inline int in_interrupt_context(void); ++int in_interrupt_context(void); + + /** + * Set a task event. +-- +2.9.0 + diff --git a/projects/cros-ec/patches/veyron/0005-Don-t-include-missing-and-unnecessary-math-header.patch b/projects/cros-ec/patches/veyron/0005-Don-t-include-missing-and-unnecessary-math-header.patch @@ -0,0 +1,29 @@ +From 913b2f1265bd7f3ebe6cf4cba92c20c5a423a6c3 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Tue, 2 Aug 2016 12:05:55 +0200 +Subject: [PATCH 5/6] Don't include missing and unnecessary math header + +This removes the inclusion of an unnecessary math header that is neither +found nor necessary for non-cortex-m ECs. + +Change-Id: I56a04178dadedb76f841504fa645e2d43900d25f +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + common/math_util.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/common/math_util.c b/common/math_util.c +index 120d13d..34a267d 100644 +--- a/common/math_util.c ++++ b/common/math_util.c +@@ -6,7 +6,6 @@ + /* Common math functions. */ + + #include "common.h" +-#include "math.h" + #include "math_util.h" + #include "util.h" + +-- +2.9.0 + diff --git a/projects/cros-ec/patches/veyron/0006-cortex-m0-Use-assembly-exception-handlers-for-task-s.patch b/projects/cros-ec/patches/veyron/0006-cortex-m0-Use-assembly-exception-handlers-for-task-s.patch @@ -0,0 +1,219 @@ +From 9dd7ae82d3f3fa9dae31a442365e233a0b44cce3 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Sat, 23 Jul 2016 14:17:32 +0200 +Subject: [PATCH 6/6] cortex-m0: Use assembly exception handlers for task + switching + +The way Cortex processors handle exceptions allows writing exception +routines directly in C, as return from exception is handled by providing +a special value for the link register. + +However, it is not safe to do this when doing context switching. In +particular, C handlers may push some general-purpose registers that +are used by the handler and pop them later, even when context switch +has happened in the meantime. While the processor will restore {r0-r3} +from the stack when returning from an exception, the C handler code +may push, use and pop another register, such as r4. + +It turns out that GCC 4.8 would generally only use r3 in svc_handler and +pendsv_handler, but newer versions tend to use r4, thus clobbering r4 +that was restored from the context switch and leading up to a fault +when r4 is used by the task code. + +An occurrence of this behaviour takes place with GCC > 4.8 in __wait_evt, +where "me" is stored in r4, which gets clobbered after an exception +triggers pendsv_handler. The exception handler uses r4 internally, does +a context switch and then restores the previous value of r4, which is +not restored by the processor's internal, thus clobbering r4. +This ends up with the following assertion failure: +'tskid < TASK_ID_COUNT' in timer_cancel() at common/timer.c:137 + +For this reason, it is safer to have assembly routines for exception +handlers that do context switching. + +BUG=chromium:631514 +BRANCH=None +TEST=Build and run speedy EC with a recent GCC version + +Change-Id: Ib068bc12ce2204aee3e0f563efcb94f15aa87013 +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + core/cortex-m0/switch.S | 81 ++++++++++++++++++++++++++++++++++--------------- + core/cortex-m0/task.c | 27 +---------------- + 2 files changed, 58 insertions(+), 50 deletions(-) + +diff --git a/core/cortex-m0/switch.S b/core/cortex-m0/switch.S +index 95ea29e..d4b47cd 100644 +--- a/core/cortex-m0/switch.S ++++ b/core/cortex-m0/switch.S +@@ -7,12 +7,52 @@ + + #include "config.h" + ++#define CPU_SCB_ICSR 0xe000ed04 ++ + .text + + .syntax unified + .code 16 + + /** ++ * Start the task scheduling. r0 is a pointer to task_stack_ready, which is ++ * set to 1 after the task stack is set up. ++ */ ++.global __task_start ++.thumb_func ++__task_start: ++ ldr r2,=scratchpad @ area used as dummy thread stack for the first switch ++ movs r3, #2 @ use : priv. mode / thread stack / no floating point ++ adds r2, #17*4 @ put the pointer at the top of the stack ++ movs r1, #0 @ __Schedule parameter : re-schedule nothing ++ msr psp, r2 @ setup a thread stack up to the first context switch ++ movs r2, #1 ++ isb @ ensure the write is done ++ msr control, r3 ++ movs r3, r0 ++ movs r0, #0 @ __Schedule parameter : de-schedule nothing ++ isb @ ensure the write is done ++ str r2, [r3] @ Task scheduling is now active ++ bl __schedule @ execute the task with the highest priority ++ /* we should never return here */ ++ movs r0, #1 @ set to EC_ERROR_UNKNOWN ++ bx lr ++ ++/** ++ * SVC exception handler ++ */ ++.global svc_handler ++.thumb_func ++svc_handler: ++ push {lr} @ save link register ++ bl __svc_handler @ call svc handler helper ++ ldr r3,=current_task @ load the current task's address ++ ldr r1, [r3] @ load the current task ++ cmp r0, r1 @ compare with previous task returned by helper ++ beq svc_handler_return @ return if they are the same ++ /* continue to __switchto to switch to the new task */ ++ ++/** + * Task context switching + * + * Change the task scheduled after returning from the exception. +@@ -30,8 +70,6 @@ + * r8, r9, r10, r11, r4, r5, r6, r7, r0, r1, r2, r3, r12, lr, pc, psr + * additional registers <|> exception frame + */ +-.global __switchto +-.thumb_func + __switchto: + mrs r2, psp @ get the task stack where the context has been saved + mov r3, sp +@@ -53,29 +91,24 @@ __switchto: + mov r11, r7 + ldmia r2!, {r4-r7} @ restore r4-r7 for the next task context + msr psp, r2 @ set the process stack pointer to exception context +- bx lr @ return from exception ++ ++svc_handler_return: ++ pop {pc} @ return from exception or return to caller + + /** +- * Start the task scheduling. r0 is a pointer to task_stack_ready, which is +- * set to 1 after the task stack is set up. ++ * PendSVC exception handler + */ +-.global __task_start ++.global pendsv_handler + .thumb_func +-__task_start: +- ldr r2,=scratchpad @ area used as dummy thread stack for the first switch +- movs r3, #2 @ use : priv. mode / thread stack / no floating point +- adds r2, #17*4 @ put the pointer at the top of the stack +- movs r1, #0 @ __Schedule parameter : re-schedule nothing +- msr psp, r2 @ setup a thread stack up to the first context switch +- movs r2, #1 +- isb @ ensure the write is done +- msr control, r3 +- movs r3, r0 +- movs r0, #0 @ __Schedule parameter : de-schedule nothing +- isb @ ensure the write is done +- str r2, [r3] @ Task scheduling is now active +- bl __schedule @ execute the task with the highest priority +- /* we should never return here */ +- movs r0, #1 @ set to EC_ERROR_UNKNOWN +- bx lr +- ++pendsv_handler: ++ push {lr} @ save link register ++ ldr r0, =#CPU_SCB_ICSR @ load CPU_SCB_ICSR's address ++ movs r1, #1 @ prepare left shift (1 << 27) ++ lsls r1, #27 @ shift the bit ++ str r1, [r0] @ clear pending flag ++ cpsid i @ ensure we have priority 0 during re-scheduling ++ movs r1, #0 @ desched nothing ++ movs r0, #0 @ resched nothing ++ bl svc_handler @ re-schedule the highest priority task ++ cpsie i @ leave priority 0 ++ pop {pc} @ return from exception +diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c +index e51621b..f96ccf8 100644 +--- a/core/cortex-m0/task.c ++++ b/core/cortex-m0/task.c +@@ -57,7 +57,6 @@ static uint32_t task_switches; /* Number of times active task changed */ + static uint32_t irq_dist[CONFIG_IRQ_COUNT]; /* Distribution of IRQ calls */ + #endif + +-extern void __switchto(task_ *from, task_ *to); + extern int __task_start(int *task_stack_ready); + + #ifndef CONFIG_LOW_POWER_IDLE +@@ -120,7 +119,7 @@ uint8_t task_stacks[0 + /* Reserve space to discard context on first context switch. */ + uint32_t scratchpad[17]; + +-static task_ *current_task = (task_ *)scratchpad; ++task_ *current_task = (task_ *)scratchpad; + + /* + * Bitmap of all tasks ready to be run. +@@ -242,18 +241,6 @@ task_ *__svc_handler(int desched, task_id_t resched) + return current; + } + +-void svc_handler(int desched, task_id_t resched) +-{ +- /* +- * The layout of the this routine (and the __svc_handler companion one) +- * ensures that we are getting the right tail call optimization from +- * the compiler. +- */ +- task_ *prev = __svc_handler(desched, resched); +- if (current_task != prev) +- __switchto(prev, current_task); +-} +- + void __schedule(int desched, int resched) + { + register int p0 asm("r0") = desched; +@@ -262,18 +249,6 @@ void __schedule(int desched, int resched) + asm("svc 0" : : "r"(p0), "r"(p1)); + } + +-void pendsv_handler(void) +-{ +- /* Clear pending flag */ +- CPU_SCB_ICSR = (1 << 27); +- +- /* ensure we have priority 0 during re-scheduling */ +- __asm__ __volatile__("cpsid i"); +- /* re-schedule the highest priority task */ +- svc_handler(0, 0); +- __asm__ __volatile__("cpsie i"); +-} +- + #ifdef CONFIG_TASK_PROFILING + void task_start_irq_handler(void *excep_return) + { +-- +2.9.0 + diff --git a/projects/cros-scripts/cros-scripts b/projects/cros-scripts/cros-scripts @@ -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_archive "$project" "$TOOLS" +} + +release_check() { + project_release_install_archive_check "$project" "$TOOLS" +} + +clean() { + project_clean "$project" +} diff --git a/projects/cros-scripts/install/cros-kernel-prepare b/projects/cros-scripts/install/cros-kernel-prepare @@ -0,0 +1,155 @@ +#!/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/>. + +ARCH="arch" +CMDLINE="cmdline" +BOOTLOADER="bootloader" +KERNEL_ITS="kernel.its" +KERNEL_FIT="kernel.fit" +KERNEL_IMAGE="kernel.img" + +usage() { + printf "$executable [action] [kernel files|kernel image] [medium]\n" >&2 + + printf "\nActions:\n" >&2 + printf " pack - Pack kernel files to a medium-specific image\n" >&2 + printf " sign - Sign kernel image\n" >&2 + printf " verify - Very kernel image signatures\n" >&2 + + printf "\nMedium:\n" >&2 + printf " usb - External USB storage\n" >&2 + printf " mmc - External SD card storage\n" >&2 + printf " emmc - Internal storage\n" >&2 + + printf "\nEnvironment variables:\n" >&2 + printf " VBOOT_KEYS_PATH - Path to the vboot keys\n" >&2 + printf " VBOOT_TOOLS_PATH - Path to vboot tools\n" >&2 +} + +pack() { + local kernel_files_path=$1 + local medium=$2 + + local arch_path="$kernel_files_path/$ARCH" + local arch=$( cat "$arch_path" ) + local cmdline_path="$kernel_files_path/$CMDLINE-$medium" + local bootloader_path="$kernel_files_path/$BOOTLOADER" + local kernel_its_path="$kernel_files_path/$KERNEL_ITS" + local kernel_fit_path="$kernel_files_path/$KERNEL_FIT" + local kernel_image_path="$kernel_files_path/$KERNEL_IMAGE" + + mkimage -f "$kernel_its_path" "$kernel_fit_path" + futility vbutil_kernel --pack "$kernel_image_path" --version 1 --arch "$arch" --keyblock "$VBOOT_KEYS_PATH/kernel.keyblock" --signprivate "$VBOOT_KEYS_PATH/kernel_data_key.vbprivk" --config "$cmdline_path" --vmlinuz "$kernel_fit_path" --bootloader "$bootloader_path" + + printf "\nPacked kernel image $kernel_image_path\n" +} + +sign() { + local kernel_image_path=$1 + + futility vbutil_kernel --repack "$kernel_image_path" --version 1 --keyblock "$VBOOT_KEYS_PATH/kernel.keyblock" --signprivate "$VBOOT_KEYS_PATH/kernel_data_key.vbprivk" --oldblob "$kernel_image_path" + + printf "\nSigned kernel image $kernel_image_path\n" +} + +verify() { + local kernel_image_path=$1 + + futility vbutil_kernel --verify "$kernel_image_path" --signpubkey "$VBOOT_KEYS_PATH/kernel_subkey.vbpubk" + + printf "\nVerified kernel image $kernel_image_path\n" +} + +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" ) + + if ! [ -z "$VBOOT_TOOLS_PATH" ] + then + PATH="$PATH:$VBOOT_TOOLS_PATH" + fi + + if [ -z "$VBOOT_KEYS_PATH" ] + then + if ! [ -z "$VBOOT_TOOLS_PATH" ] && [ -d "$VBOOT_TOOLS_PATH/devkeys" ] + then + VBOOT_KEYS_PATH="$VBOOT_TOOLS_PATH/devkeys" + else + VBOOT_KEYS_PATH="/usr/share/vboot/devkeys" + fi + fi +} + +cros_media_setup() { + local action=$1 + local kernel_files_path=$2 + local kernel_image_path=$2 + local medium=$3 + + set -e + + setup "$@" + + if [ -z "$action" ] || [ -z "$kernel_files_path" ] || [ -z "$kernel_image_path" ] + then + usage + exit 1 + fi + + case $action in + "pack") + if [ -z "$medium" ] + then + usage + exit 1 + fi + + requirements "mkimage" "futility" + pack "$kernel_files_path" "$medium" + ;; + "sign") + requirements "futility" + sign "$kernel_image_path" + ;; + "verify") + requirements "futility" + verify "$kernel_image_path" + ;; + *) + usage + exit 1 + ;; + esac +} + +cros_media_setup "$@" diff --git a/projects/cros-scripts/install/cros-medium-setup b/projects/cros-scripts/install/cros-medium-setup @@ -0,0 +1,313 @@ +#!/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/>. + +SYS_BLOCK_PATH="/sys/class/block" +DEV_PATH="/dev" +DEVICE="device" +VENDOR="vendor" +MODEL="model" +NAME="name" +KERNEL_IMAGE="kernel.img" +KERNEL_MODULES="modules/lib" +KERNEL_PARTITION_INDEX=1 +ROOTFS_PARTITION_INDEX=2 + +# Size in blocks (512 kiB) +GPT_SIZE=34 +KERNEL_SIZE=16384 + +usage() { + printf "$executable [action] [storage] [rootfs tarball|kernel files]\n" >&2 + + printf "\nActions:\n" >&2 + printf " partitions - Setup partitions on storage\n" >&2 + printf " rootfs - Install rootfs tarball to storage\n" >&2 + printf " kernel - Install kernel files to storage\n" >&2 + + usage_storage + + printf "\nEnvironment variables:\n" >&2 + printf " KERNEL_PATH - Path to the kernel image\n" >&2 + printf " VBOOT_TOOLS_PATH - Path to vboot tools\n" >&2 +} + +usage_storage() { + printf "\nStorage:\n" >&2 + + local nodes=$( ls "$SYS_BLOCK_PATH" ) + local node_path + local name + + for node in $nodes + do + node_path="$DEV_PATH/$node" + if ! [ -b "$node_path" ] + then + continue + fi + + name=$( storage_name "$node_path" ) + if [ -z "$name" ] + then + continue + fi + + printf " $node_path - $name\n" >&2 + done +} + +storage_affect_confirm() { + local storage_path=$1 + + local name=$( storage_name "$storage_path" ) + local confirm + + printf "This is going to affect the following storage:\n" + printf " $storage_path - $name\n" + printf "Press enter to confirm: " + + read confirm +} + +storage_name() { + local storage_path=$1 + + local node=$( basename "$storage_path" ) + local vendor_path="$SYS_BLOCK_PATH/$node/$DEVICE/$VENDOR" + local model_path="$SYS_BLOCK_PATH/$node/$DEVICE/$MODEL" + local name_path="$SYS_BLOCK_PATH/$node/$DEVICE/$NAME" + local vendor + local name + + if [ -f "$model_path" ] + then + name=$( cat "$model_path" ) + elif [ -f "$name_path" ] + then + name=$( cat "$name_path" ) + else + return 0 + fi + + name=$( echo "$name" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" ) + + if [ -f "$vendor_path" ] + then + vendor=$( cat "$vendor_path" ) + vendor=$( echo "$vendor" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" ) + + name="$vendor $name" + fi + + echo "$name" +} + +storage_partition_path() { + local storage_path=$1 + local index=$2 + + storage_partition_path="$storage_path$index" + + if ! [ -b "$storage_partition_path" ] + then + storage_partition_path="$storage_path""p$index" + fi + + if ! [ -b "$storage_partition_path" ] + then + return 1 + fi + + echo "$storage_partition_path" +} + +storage_partition_mount_path() { + local storage_partition_path=$1 + + local storage_partition_mount_path=$( udisksctl info -b "$storage_partition_path" | grep "MountPoints" | sed "s/.*MountPoints:[[:space:]]*\(.*\)/\1/g" ) + + echo "$storage_partition_mount_path" +} + +partitions() { + local storage_path=$1 + + local storage_rootfs_path + local partitions + local start + + storage_affect_confirm "$storage_path" + + partitions=$( mount | grep -P "^$storage_path" | sed "s/^\([^[:space:]]*\).*/\1/g" ) + + for partition in $partitions + do + # Partition may already be unmounted. + udisksctl unmount -b "$partition" || true + done + + ( echo "g" ; echo "w" ) | fdisk "$storage_path" + + cgpt create "$storage_path" + + start=$GPT_SIZE + size=$KERNEL_SIZE + cgpt add -b "$start" -s "$size" -P 1 -S 1 -t kernel -l kernel "$storage_path" + + start=$(( $start + $size )) + size=$( cgpt show "$storage_path" | grep "Sec GPT table" | sed "s/[[:space:]]*\([0-9]*\).*/\1/g" ) + size=$(( $size - $start )) + cgpt add -b "$start" -s "$size" -t rootfs -l rootfs "$storage_path" + + blockdev --rereadpt "$storage_path" || partprobe "$storage_path" + + storage_rootfs_path=$( storage_partition_path "$storage_path" "$ROOTFS_PARTITION_INDEX" ) + + mkfs.ext4 -F "$storage_rootfs_path" + + printf "\nSetup partitions on storage $storage_path\n" +} + +rootfs() { + local storage_path=$1 + local rootfs_tarball_path=$2 + + local storage_rootfs_path=$( storage_partition_path "$storage_path" "$ROOTFS_PARTITION_INDEX" ) + local storage_rootfs_mount_path + + storage_affect_confirm "$storage_path" + + # Partition may already be mounted. + udisksctl mount -b "$storage_rootfs_path" || true + + storage_rootfs_mount_path=$( storage_partition_mount_path "$storage_rootfs_path" ) + + tar -xf "$rootfs_tarball_path" -ps -C "$storage_rootfs_mount_path" + + udisksctl unmount -b "$storage_rootfs_path" + + printf "\nInstalled rootfs on storage $storage_path\n" +} + +kernel() { + local storage_path=$1 + local kernel_files_path=$2 + + local storage_kernel_path=$( storage_partition_path "$storage_path" "$KERNEL_PARTITION_INDEX" ) + local storage_rootfs_path=$( storage_partition_path "$storage_path" "$ROOTFS_PARTITION_INDEX" ) + local kernel_image_path="$kernel_files_path/$KERNEL_IMAGE" + local kernel_modules_path="$kernel_files_path/$KERNEL_MODULES" + local storage_rootfs_mount_path + + storage_affect_confirm "$storage_path" + + cat "$kernel_image_path" > "$storage_kernel_path" + sync + + # Partition may already be mounted. + udisksctl mount -b "$storage_rootfs_path" || true + + storage_rootfs_mount_path=$( storage_partition_mount_path "$storage_rootfs_path" ) + + rsync -a --keep-dirlinks "$kernel_modules_path" "$storage_rootfs_mount_path/" + sync + + udisksctl unmount -b "$storage_rootfs_path" + + printf "\nInstalled kernel on storage $storage_path\n" +} + +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" ) + + if [ -z "$KERNEL_PATH" ] + then + KERNEL_PATH=$root + fi + + if ! [ -z "$VBOOT_TOOLS_PATH" ] + then + PATH="$PATH:$VBOOT_TOOLS_PATH" + fi +} + +cros_medium_setup() { + local action=$1 + local storage_path=$2 + local rootfs_tarball_path=$3 + local kernel_files_path=$3 + + set -e + + setup "$@" + + if [ -z "$action" ] || [ -z "$storage_path" ] + then + usage + exit 1 + fi + + case $action in + "partitions") + requirements "udisksctl" "fdisk" "cgpt" "mkfs.ext4" + partitions "$storage_path" + ;; + "rootfs") + if [ -z "$rootfs_tarball_path" ] + then + usage + exit 1 + fi + + requirements "udisksctl" "tar" + rootfs "$storage_path" "$rootfs_tarball_path" + ;; + "kernel") + if [ -z "$kernel_files_path" ] + then + usage + exit 1 + fi + + requirements "udisksctl" "rsync" + kernel "$storage_path" "$kernel_files_path" + ;; + *) + usage + exit 1 + ;; + esac +} + +cros_medium_setup "$@" diff --git a/projects/cros-scripts/install/install b/projects/cros-scripts/install/install @@ -0,0 +1,2 @@ +cros-kernel-prepare:cros-kernel-prepare +cros-medium-setup:cros-medium-setup diff --git a/projects/cros-tools/configs/projects b/projects/cros-tools/configs/projects @@ -0,0 +1,7 @@ +cros-scripts +cros-ec tools +flashrom-cros +hdctools +vboot tools +flashmap +mosys diff --git a/projects/cros-tools/cros-tools b/projects/cros-tools/cros-tools @@ -0,0 +1,44 @@ +#!/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/>. + +download() { + project_action_projects "$action" "$project" "$@" +} + +extract() { + project_action_projects "$action" "$project" "$@" +} + +update() { + project_action_projects "$action" "$project" "$@" +} + +build() { + project_action_projects "$action" "$project" "$@" +} + +install() { + project_action_projects "$action" "$project" "$@" +} + +release() { + project_action_projects "$action" "$project" "$@" +} + +clean() { + project_action_projects "$action" "$project" "$@" +} diff --git a/projects/crossgcc/configs/blobs b/projects/crossgcc/configs/blobs @@ -0,0 +1 @@ +../../coreboot/configs/blobs+ \ No newline at end of file diff --git a/projects/crossgcc/configs/blobs-ignore b/projects/crossgcc/configs/blobs-ignore @@ -0,0 +1 @@ +../../coreboot/configs/blobs-ignore+ \ No newline at end of file diff --git a/projects/crossgcc/configs/blobs-ignore-notes.txt b/projects/crossgcc/configs/blobs-ignore-notes.txt @@ -0,0 +1 @@ +../../coreboot/configs/blobs-ignore-notes.txt+ \ No newline at end of file diff --git a/projects/crossgcc/configs/install b/projects/crossgcc/configs/install @@ -0,0 +1 @@ +*:. diff --git a/projects/crossgcc/configs/revision b/projects/crossgcc/configs/revision @@ -0,0 +1 @@ +../../coreboot/configs/revision+ \ No newline at end of file diff --git a/projects/crossgcc/configs/targets b/projects/crossgcc/configs/targets @@ -0,0 +1 @@ +arm diff --git a/projects/crossgcc/crossgcc b/projects/crossgcc/crossgcc @@ -0,0 +1,209 @@ +#!/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/>. + +arguments() { + project_arguments_targets "$project" "$@" +} + +usage() { + project_usage_actions "$project" "prefix" + project_usage_arguments "$project" "$@" +} + +download() { + local repository="coreboot" + + git_project_prepare "$project" "$repository" "$@" +} + +download_check() { + local repository="coreboot" + + git_project_prepare_check "$project" "$repository" "$@" +} + +extract() { + local arguments=$@ + + local repository="coreboot" + local tarball + + project_extract "$project" "$@" + + crossgcc_tarballs "$@" | while read tarball + do + local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" ) + local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" ) + local tarball_install_directory_path=$( dirname "$tarball_install_path" ) + + if [ -f "$tarball_sources_path" ] && ! [ -f "$tarball_install_path" ] + then + printf "Copying source archive $tarball for $project (with ${arguments:-no argument})\n" + + mkdir -p "$tarball_install_directory_path" + + file_verification_check "$tarball_sources_path" + cp "$tarball_sources_path" "$tarball_install_path" + fi + done +} + +extract_check() { + local repository="coreboot" + local tarball + + project_extract_check "$project" "$@" + + crossgcc_tarballs "$@" | while read tarball + do + local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" ) + + test ! -f "$tarball_install_path" + done +} + +update() { + local arguments=$@ + + local repository="coreboot" + local tarball + + project_update_git $project $repository $arguments + + crossgcc_tarballs "$@" | while read tarball + do + local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" ) + local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" ) + local tarball_install_directory_path=$( dirname "$tarball_install_path" ) + + if [ -f $tarball_sources_path ] + then + printf "Copying source archive $tarball for $project (with ${arguments:-no argument})\n" + + mkdir -p "$tarball_install_directory_path" + + file_verification_check "$tarball_sources_path" + cp "$tarball_sources_path" "$tarball_install_path" + fi + done +} + +update_check() { + local repository="coreboot" + local tarball + + project_update_check_git "$project" "$repository" "$@" + + crossgcc_tarballs "$@" | while read tarball + do + local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" "$@" ) + + test ! -f "$tarball_sources_path" + done +} + +prefix() { + local arch=$1 + + local build_path=$( project_build_path "$project" "$@" ) + + case $arch in + "arm") + echo "$build_path/bin/arm-eabi-" + ;; + esac +} + +build() { + local arch=$1 + + local repository="coreboot" + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local build_path=$( project_build_path "$project" "$@" ) + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi + + mkdir -p "$build_path" + + make -C "$sources_path" CPUS="$TASKS" DEST="$build_path" "crossgcc-$arch" +} + +build_check() { + project_build_check "$project" "$@" +} + +install() { + project_install "$project" "$@" +} + +install_check() { + project_install_check "$project" "$@" +} + +release() { + local arguments=$@ + + local repository="coreboot" + local tarball + + project_release_install_archive "$project" "$TOOLS" "$@" + + project_release_sources_git "$project" "$repository" "$@" + + crossgcc_tarballs "$@" | while read tarball + do + local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" ) + local tarball_release_path=$( crossgcc_tarball_release_path "$tarball" "$@" ) + local release_path=$( project_release_path "$project" "$SOURCES" "$@" ) + + mkdir -p "$release_path" + + if [ -f "$tarball_install_path" ] && ! [ -f "$tarball_release_path" ] + then + printf "Releasing source archive $tarball for $project (with ${arguments:-no argument})\n" + + cp "$tarball_install_path" "$tarball_release_path" + file_verification_create "$tarball_release_path" + fi + done +} + +release_check() { + local repository="coreboot" + local tarball + + project_release_install_archive_check "$project" "$TOOLS" "$@" + + project_release_check_sources_git "$project" "$repository" "$@" + + crossgcc_tarballs "$@" | while read tarball + do + local tarball_release_path=$( crossgcc_tarball_release_path "$tarball" "$@" ) + + test -f "$tarball_release_path" + done +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/crossgcc/crossgcc-helper b/projects/crossgcc/crossgcc-helper @@ -0,0 +1,53 @@ +#!/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/>. + +crossgcc_tarballs() { + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local install_path="$sources_path/util/crossgcc/tarballs/" + local tarballs=$( ls "$sources_path/util/crossgcc/sum" | sed "s/.cksum$//" ) + + echo "$tarballs" +} + +crossgcc_tarball_sources_path() { + local tarball=$1 + + local tarball_sources_path="$root/$SOURCES/$tarball" + + echo "$tarball_sources_path" +} + +crossgcc_tarball_install_path() { + local tarball=$1 + shift + + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local install_path="$sources_path/util/crossgcc/tarballs/" + local tarball_install_path="$install_path/$tarball" + + echo "$tarball_install_path" +} + +crossgcc_tarball_release_path() { + local tarball=$1 + shift + + local release_path=$( project_release_path "$project" "$SOURCES" "$@" ) + local tarball_release_path="$release_path/$tarball" + + echo "$tarball_release_path" +} diff --git a/projects/crossgcc/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch b/projects/crossgcc/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch @@ -0,0 +1 @@ +../../coreboot/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch+ \ No newline at end of file diff --git a/projects/depthcharge/configs/install b/projects/depthcharge/configs/install @@ -0,0 +1 @@ +depthcharge.elf:depthcharge.elf diff --git a/projects/depthcharge/configs/nyan/arch b/projects/depthcharge/configs/nyan/arch @@ -0,0 +1 @@ +arm diff --git a/projects/depthcharge/configs/revision b/projects/depthcharge/configs/revision @@ -0,0 +1 @@ +91fab799a3e9f9da4e7569ca341f819319d091b0 diff --git a/projects/depthcharge/configs/targets b/projects/depthcharge/configs/targets @@ -0,0 +1,2 @@ +nyan +veyron diff --git a/projects/depthcharge/configs/veyron/arch b/projects/depthcharge/configs/veyron/arch @@ -0,0 +1 @@ +arm diff --git a/projects/depthcharge/depthcharge b/projects/depthcharge/depthcharge @@ -0,0 +1,108 @@ +#!/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/>. + +arguments() { + project_arguments_targets "$project" "$@" +} + +usage() { + project_usage_actions "$project" + project_usage_arguments "$project" "$@" +} + +download() { + local repository=$project + + project_download_git "$project" "$repository" "https://chromium.googlesource.com/chromiumos/platform/depthcharge https://review.coreboot.org/depthcharge.git https://github.com/coreboot/depthcharge.git" "$@" +} + +download_check() { + local repository=$project + + project_download_check_git "$project" "$repository" "$@" +} + +extract() { + project_extract "$project" "$@" +} + +extract_check() { + project_extract_check "$project" "$@" +} + +update() { + local repository=$project + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository=$project + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local repository=$project + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + if git_project_check $repository + then + git_project_checkout "$project" "$repository" "$@" + fi + + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local build_path=$( project_build_path "$project" "$@" ) + + local libpayload_build_path=$( project_build_path "libpayload" "$project" "$@" ) + local libpayload_build_install_path="$libpayload_build_path/install" + local vboot_sources_path=$( project_sources_path "vboot" "vboot" "devices" ) + + local arch=$( depthcharge_arch "$@" ) + local device=$( depthcharge_device "$@" ) + + project_action "build" "crossgcc" "$arch" + project_action "build" "libpayload" "$project" "$@" + + project_action "checkout" "vboot" "devices" + + mkdir -p "$build_path" + + make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" BOARD="$device" "defconfig" + make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" LIBPAYLOAD_DIR="$libpayload_build_install_path/libpayload" VB_SOURCE="$vboot_sources_path" -j$TASKS "depthcharge" +} + +build_check() { + project_build_check "$project" "$@" +} + +release() { + local repository=$project + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local repository=$project + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/depthcharge/depthcharge-helper b/projects/depthcharge/depthcharge-helper @@ -0,0 +1,26 @@ +#!/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/>. + +ARCH="arch" + +depthcharge_arch() { + project_file_contents "$project" "$CONFIGS" "$ARCH" "$@" +} + +depthcharge_device() { + arguments_concat "_" "$@" +} diff --git a/projects/depthcharge/patches/0001-fdt-nonvolatile-context-storage-report-to-mkbp-for-E.patch b/projects/depthcharge/patches/0001-fdt-nonvolatile-context-storage-report-to-mkbp-for-E.patch @@ -0,0 +1,31 @@ +From 3003a569ad63a35922984a8c7d1f079cc5cbd960 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 10 Aug 2015 20:30:14 +0200 +Subject: [PATCH 1/4] fdt: nonvolatile-context-storage report to mkbp for EC NV + storage + +This allows old versions of crossystem to detect that it should use mosys to +access NV storage in case it is stored on the EC. + +Change-Id: I78ed64c2002727432def0e132f572a1c5173fa5e +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + src/vboot/crossystem/fdt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/vboot/crossystem/fdt.c b/src/vboot/crossystem/fdt.c +index c0b10c0..5cba178 100644 +--- a/src/vboot/crossystem/fdt.c ++++ b/src/vboot/crossystem/fdt.c +@@ -51,7 +51,7 @@ static int install_crossystem_data(DeviceTreeFixup *fixup, DeviceTree *tree) + dt_add_string_prop(node, "nonvolatile-context-storage","nvram"); + } else if (CONFIG_NV_STORAGE_CROS_EC) { + dt_add_string_prop(node, +- "nonvolatile-context-storage", "cros-ec"); ++ "nonvolatile-context-storage", "mkbp"); + } else if (CONFIG_NV_STORAGE_DISK) { + dt_add_string_prop(node, "nonvolatile-context-storage", "disk"); + dt_add_u32_prop(node, "nonvolatile-context-lba", +-- +2.10.2 + diff --git a/projects/depthcharge/patches/0002-Proper-firmware-index-report-for-read-only-boot-path.patch b/projects/depthcharge/patches/0002-Proper-firmware-index-report-for-read-only-boot-path.patch @@ -0,0 +1,71 @@ +From fc2f65e964fb9636db35749579c47dde15599f57 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 10 Aug 2015 20:24:50 +0200 +Subject: [PATCH 2/4] Proper firmware index report for read-only boot path + +When booting from a read-only boot path, the active firmware to report is RO. +This is detected with the lack of a vboot handoff pointer. + +Change-Id: I3b1b5823b4dde7bc4185abe2e29f5d056ef9f09c +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + src/vboot/crossystem/fdt.c | 2 +- + src/vboot/firmware_id.c | 6 +++++- + src/vboot/firmware_id.h | 1 + + 3 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/vboot/crossystem/fdt.c b/src/vboot/crossystem/fdt.c +index 5cba178..45cad88 100644 +--- a/src/vboot/crossystem/fdt.c ++++ b/src/vboot/crossystem/fdt.c +@@ -68,7 +68,7 @@ static int install_crossystem_data(DeviceTreeFixup *fixup, DeviceTree *tree) + nvstorage_flash_get_blob_size()); + } + +- int fw_index = vdat->firmware_index; ++ int fw_index = get_active_fw_index(vdat); + const char *fwid; + int fwid_size; + +diff --git a/src/vboot/firmware_id.c b/src/vboot/firmware_id.c +index 82acf91..d625251 100644 +--- a/src/vboot/firmware_id.c ++++ b/src/vboot/firmware_id.c +@@ -31,6 +31,7 @@ static struct fwid { + } fw_fmap_ops[] = { + {VDAT_RW_A, "RW_FWID_A", NULL, 0, "RW A: ID NOT FOUND"}, + {VDAT_RW_B, "RW_FWID_B", NULL, 0, "RW B: ID NOT FOUND"}, ++ {VDAT_RO, "RO_FRID", NULL, 0, "RO: ID NOT FOUND"}, + {VDAT_RECOVERY, "RO_FRID", NULL, 0, "RO: ID NOT FOUND"}, + }; + +@@ -125,10 +126,13 @@ static VbSharedDataHeader *get_vdat(void) + return NULL; + } + +-static inline int get_active_fw_index(VbSharedDataHeader *vdat) ++int get_active_fw_index(VbSharedDataHeader *vdat) + { + int fw_index = VDAT_UNKNOWN; + ++ if (lib_sysinfo.vboot_handoff == NULL) ++ return VDAT_RO; ++ + if (vdat) + fw_index = vdat->firmware_index; + +diff --git a/src/vboot/firmware_id.h b/src/vboot/firmware_id.h +index 181b2a1..71be302 100644 +--- a/src/vboot/firmware_id.h ++++ b/src/vboot/firmware_id.h +@@ -44,6 +44,7 @@ int get_rwb_fw_size(void); + * Get firmware details for currently active fw type. It looks up vdat, + * identifies fw_index and returns appropriate id and size for that index. + */ ++int get_active_fw_index(VbSharedDataHeader *vdat); + const char *get_active_fw_id(void); + int get_active_fw_size(void); + +-- +2.10.2 + diff --git a/projects/depthcharge/patches/0003-vboot-Display-callbacks-for-all-screens.patch b/projects/depthcharge/patches/0003-vboot-Display-callbacks-for-all-screens.patch @@ -0,0 +1,240 @@ +From 1e634ac65fbdd43f35046e08b302d162e5d964d4 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Tue, 11 Aug 2015 11:22:54 +0200 +Subject: [PATCH 3/4] vboot: Display callbacks for all screens + +We don't want to use bitmaps stored in GBB since they recommend the use of non- +free software (Chrome OS), so this implements a text-based interface instead. + +Change-Id: I4927846b385b9fdbb8d90b8dc1cd159472363baa +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + src/vboot/callbacks/display.c | 182 ++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 166 insertions(+), 16 deletions(-) + +diff --git a/src/vboot/callbacks/display.c b/src/vboot/callbacks/display.c +index bae8043..b4e9958 100644 +--- a/src/vboot/callbacks/display.c ++++ b/src/vboot/callbacks/display.c +@@ -20,6 +20,7 @@ + #include <sysinfo.h> + #include <vboot_api.h> + #include <vboot_struct.h> ++#include <vboot_nvstorage.h> + + #include "base/cleanup_funcs.h" + #include "drivers/video/coreboot_fb.h" +@@ -81,13 +82,15 @@ void print_on_center(const char *msg) + print_string(msg); + } + +-VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale) ++VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale, ++ VbDisplayInfo *info) + { +- const char *msg = NULL; +- +- if (vboot_draw_screen(screen_type, locale) == CBGFX_SUCCESS) +- return VBERROR_SUCCESS; +- ++ unsigned int rows, cols; ++ const char *fw_id; ++ int fw_index; ++ void *blob = NULL; ++ int size = 0; ++ char *msg; + /* + * Show the debug messages for development. It is a backup method + * when GBB does not contain a full set of bitmaps. +@@ -98,31 +101,178 @@ VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale) + video_console_clear(); + break; + case VB_SCREEN_DEVELOPER_WARNING: +- msg = "developer mode warning"; ++ video_console_clear(); ++ video_console_set_cursor(0, 0); ++ ++ if (info == NULL) ++ return VBERROR_SUCCESS; ++ ++ print_string( ++ "Welcome to developer mode!\n\n" ++ "Useful key combinations:\n" ++ "- Ctrl + H: Hold developer mode\n" ++ "- Ctrl + D: Boot from default medium\n"); ++ ++ if (info->allow_usb) ++ print_string("- Ctrl + U: Boot from external medium\n"); ++ ++ if (info->allow_legacy) ++ print_string("- Ctrl + L: Boot from legacy payload\n"); ++ ++ print_string( ++ "- Ctrl + I: Show device information\n" ++ "- Space: Disable developer mode\n\n" ++ "This screen is shown for 3 seconds (if not held)." ++ "\n\n"); ++ ++ if (!info->signed_only) ++ print_string( ++ "Warning: this device will boot kernels" ++ " without verifying their signature!" ++ "\n"); ++ ++ if (info->allow_usb) ++ print_string( ++ "Warning: this device will boot from " ++ "external media!\n"); ++ ++ if (info->allow_legacy) ++ print_string( ++ "Warning: this device will boot legacy " ++ "payloads!\n"); ++ ++ if (!info->signed_only || info->allow_usb || ++ info->allow_legacy) ++ print_string("\n"); ++ ++ print_string("Default boot medium: "); ++ ++ if (info->use_legacy) ++ print_string("legacy payload"); ++ else if (info->use_usb) ++ print_string("external"); ++ else ++ print_string("internal"); ++ ++ print_string("\n"); ++ ++ find_common_params(&blob, &size); ++ ++ if (blob != NULL) { ++ VbSharedDataHeader *vdat = (VbSharedDataHeader *) blob; ++ fw_index = get_active_fw_index(vdat); ++ fw_id = get_fw_id(fw_index); ++ ++ if (fw_id == NULL) ++ fw_id = "NOT FOUND"; ++ ++ print_string("Active firmware id: "); ++ print_string(fw_id); ++ ++ switch (fw_index) { ++ case VDAT_RW_A: ++ print_string(" (RW A)\n"); ++ break; ++ case VDAT_RW_B: ++ print_string(" (RW A)\n"); ++ break; ++ case VDAT_RO: ++ print_string(" (RO)\n"); ++ break; ++ default: ++ print_string(" (UNKNOWN)\n"); ++ break; ++ } ++ } + break; + case VB_SCREEN_DEVELOPER_EGG: +- msg = "easter egg"; ++ video_console_clear(); ++ print_on_center("Free as in Freedom!"); + break; + case VB_SCREEN_RECOVERY_REMOVE: +- msg = "remove inserted devices"; ++ video_console_clear(); ++ print_on_center( ++ "Please remove any external media before accessing " ++ "recovery screen."); + break; + case VB_SCREEN_RECOVERY_INSERT: +- msg = "insert recovery image"; +- break; + case VB_SCREEN_RECOVERY_NO_GOOD: +- msg = "insert image invalid"; ++ video_console_clear(); ++ print_string( ++ "Welcome to recovery mode!\n\n" ++ "Useful key combinations:\n" ++ "- Ctrl + D: Enable developer mode (if possible)\n\n"); ++ ++ if (screen_type == VB_SCREEN_RECOVERY_NO_GOOD) ++ print_on_center( ++ "Invalid recovery media, please instert a " ++ "valid one."); ++ else ++ print_on_center( ++ "Please insert an external recovery media."); ++ break; ++ case VB_SCREEN_RECOVERY_TO_DEV: ++ video_console_clear(); ++ video_get_rows_cols(&rows, &cols); ++ ++ video_console_set_cursor(0, 0); ++ ++ print_string( ++ "Enabling developer mode will allow booting unsigned " ++ "kernels and booting from external media (when enabled " ++ "with crossystem).\n\n" ++ "Developer mode can be disabled via the developer mode " ++ "screen."); ++ ++ msg = "Developer mode will be enabled."; ++ video_console_set_cursor((cols - strlen(msg)) / 2, rows / 2); ++ print_string(msg); ++ ++ msg = "Press enter to confirm or escape to go back."; ++ video_console_set_cursor((cols - strlen(msg)) / 2, ++ rows / 2 + 2); ++ print_string(msg); ++ break; ++ case VB_SCREEN_DEVELOPER_TO_NORM: ++ video_console_clear(); ++ video_get_rows_cols(&rows, &cols); ++ ++ video_console_set_cursor(0, 0); ++ ++ print_string( ++ "Disabling developer mode will restrict boot to signed " ++ "kernels stored on internal memory only.\n\n" ++ "Developer mode can be enabled again via the recovery " ++ "mode screen."); ++ ++ msg = "Developer mode will be disabled."; ++ video_console_set_cursor((cols - strlen(msg)) / 2, rows / 2); ++ print_string(msg); ++ ++ msg = "Press enter to confirm or escape to go back."; ++ video_console_set_cursor((cols - strlen(msg)) / 2, ++ rows / 2 + 2); ++ print_string(msg); + break; + case VB_SCREEN_WAIT: +- msg = "wait for ec update"; ++ video_console_clear(); ++ print_on_center("Waiting for EC update..."); ++ break; ++ case VB_SCREEN_TO_NORM_CONFIRMED: ++ video_console_clear(); ++ print_on_center("Disabling developer mode."); ++ break; ++ case VB_SCREEN_OS_BROKEN: ++ video_console_clear(); ++ print_on_center( ++ "Something went wrong and the device cannot boot.\n" ++ "Press Escape + Refresh + Power to access recovery."); + break; + default: + printf("Not a valid screen type: %d.\n", screen_type); + return VBERROR_INVALID_SCREEN_INDEX; + } + +- if (msg) +- print_on_center(msg); +- + return VBERROR_SUCCESS; + } + +-- +2.10.2 + diff --git a/projects/depthcharge/patches/0004-mmc-Initialize-clock-variable-in-mmc_recalculate_clo.patch b/projects/depthcharge/patches/0004-mmc-Initialize-clock-variable-in-mmc_recalculate_clo.patch @@ -0,0 +1,30 @@ +From 925042a09afb9529b112eff2e4d56bf979ff32ec Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 19 Dec 2016 14:54:40 +0100 +Subject: [PATCH 4/4] mmc: Initialize clock variable in mmc_recalculate_clock + +Initializing the variable before it is used (and set to a proper value) +avoids triggering a maybe uninitialized compiler warning. + +Change-Id: I0f78e534919e892e23fbe6d38bba6e68c408b0c4 +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + src/drivers/storage/mmc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/drivers/storage/mmc.c b/src/drivers/storage/mmc.c +index b877548..54306a1 100644 +--- a/src/drivers/storage/mmc.c ++++ b/src/drivers/storage/mmc.c +@@ -509,7 +509,7 @@ static void mmc_set_clock(MmcCtrlr *ctrlr, uint32_t clock) + + static void mmc_recalculate_clock(MmcMedia *media) + { +- uint32_t clock; ++ uint32_t clock = 0; + + if (IS_SD(media)) { + if (media->caps & MMC_MODE_HS) +-- +2.10.2 + diff --git a/projects/flashmap/configs/install b/projects/flashmap/configs/install @@ -0,0 +1 @@ +lib/libfmap.a:libfmap.a diff --git a/projects/flashmap/configs/revision b/projects/flashmap/configs/revision @@ -0,0 +1 @@ +origin/release-R56-9000.B diff --git a/projects/flashmap/flashmap b/projects/flashmap/flashmap @@ -0,0 +1,94 @@ +#!/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/>. + +download() { + local repository=$project + + project_download_git "$project" "$repository" "https://chromium.googlesource.com/chromiumos/third_party/flashmap" "$@" +} + +download_check() { + local repository=$project + + project_download_check_git "$project" "$repository" "$@" +} + +extract() { + local repository=$project + + project_extract "$project" "$@" +} + +extract_check() { + local repository=$project + + project_extract_check "$project" "$@" +} + +update() { + local repository=$project + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository=$project + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local repository=$project + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local build_path=$( project_build_path "$project" "$@" ) + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi + + mkdir -p "$build_path" + + make -C "$sources_path" -j$TASKS + + cp -r "$sources_path/lib" "$build_path" + + make -C "$sources_path" "clean" +} + +build_check() { + project_build_check "$project" "$@" +} + +release() { + local repository=$project + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local repository=$project + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/flashrom-cros/configs/install b/projects/flashrom-cros/configs/install @@ -0,0 +1 @@ +flashrom:flashrom diff --git a/projects/flashrom-cros/configs/revision b/projects/flashrom-cros/configs/revision @@ -0,0 +1 @@ +origin/release-R56-9000.B diff --git a/projects/flashrom-cros/flashrom-cros b/projects/flashrom-cros/flashrom-cros @@ -0,0 +1,106 @@ +#!/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/>. + +download() { + local repository=$project + + project_download_git "$project" "$repository" "https://chromium.googlesource.com/chromiumos/third_party/flashrom" "$@" +} + +download_check() { + local repository=$project + + project_download_check_git "$project" "$repository" "$@" +} + +extract() { + local repository=$project + + project_extract "$project" "$@" +} + +extract_check() { + local repository=$project + + project_extract_check "$project" "$@" +} + +update() { + local repository=$project + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository=$project + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local repository=$project + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi + + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local build_path=$( project_build_path "$project" "$@" ) + + mkdir -p "$build_path" + + make -C "$sources_path" CONFIG_SATAMV="no" NOWARNERROR="yes" NEED_PCI="yes" CONFIG_LINUX_SPI="yes" CONFIG_LINUX_I2C="yes" -j$TASKS + + cp "$sources_path/flashrom" "$build_path" + + make -C "$sources_path" CONFIG_SATAMV="no" NOWARNERROR="yes" NEED_PCI="yes" CONFIG_LINUX_SPI="yes" CONFIG_LINUX_I2C="yes" "clean" +} + +build_check() { + project_build_check "$project" "$@" +} + +install() { + project_install "$project" "$@" +} + +install_check() { + project_install_check "$project" "$@" +} + +release() { + local repository=$project + + project_release_install_archive "$project" "$TOOLS" "$@" + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local repository=$project + + project_release_install_archive_check "$project" "$TOOLS" "$@" + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/flashrom-cros/patches/0001-programmer.h-Define-ich_generation-after-enum-declar.patch b/projects/flashrom-cros/patches/0001-programmer.h-Define-ich_generation-after-enum-declar.patch @@ -0,0 +1,37 @@ +From f721cdd46196a99dbcc41f0f7ecaf2ee17a147fe Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Wed, 2 Nov 2016 19:16:50 +0100 +Subject: [PATCH] programmer.h: Define ich_generation after enum declaration + +This moves the ich_generation definition after the declaration of its +associated enum. + +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + programmer.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/programmer.h b/programmer.h +index 191fb1e..86a695a 100644 +--- a/programmer.h ++++ b/programmer.h +@@ -275,7 +275,6 @@ int board_flash_enable(const char *vendor, const char *part); + /* chipset_enable.c */ + int chipset_flash_enable(void); + int get_target_bus_from_chipset(enum chipbustype *target_bus); +-enum ich_chipset ich_generation; + + /* processor_enable.c */ + int processor_flash_enable(void); +@@ -603,6 +602,8 @@ enum ich_chipset { + }; + + #if CONFIG_INTERNAL == 1 ++enum ich_chipset ich_generation; ++ + extern uint32_t ichspi_bbar; + int ich_init_spi(struct pci_dev *dev, uint32_t base, void *rcrb, + enum ich_chipset ich_generation); +-- +2.10.2 + diff --git a/projects/flashrom/configs/install b/projects/flashrom/configs/install @@ -0,0 +1 @@ +flashrom:flashrom diff --git a/projects/flashrom/configs/lenovobios/revision b/projects/flashrom/configs/lenovobios/revision @@ -0,0 +1 @@ +../revision+ \ No newline at end of file diff --git a/projects/flashrom/configs/revision b/projects/flashrom/configs/revision @@ -0,0 +1 @@ +0.9.9 diff --git a/projects/flashrom/configs/targets b/projects/flashrom/configs/targets @@ -0,0 +1,2 @@ +generic +lenovobios diff --git a/projects/flashrom/flashrom b/projects/flashrom/flashrom @@ -0,0 +1,115 @@ +#!/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/>. + +arguments() { + project_arguments_targets "$project" "$@" +} + +usage() { + project_usage_actions "$project" + project_usage_arguments "$project" "$@" +} + +download() { + local repository=$project + + project_download_git "$project" "$repository" "https://github.com/stefanct/flashrom.git" "$@" +} + +download_check() { + local repository=$project + + project_download_check_git "$project" "$repository" "$@" +} + +extract() { + local repository=$project + + project_extract "$project" "$@" +} + +extract_check() { + local repository=$project + + project_extract_check "$project" "$@" +} + +update() { + local repository=$project + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository=$project + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local repository=$project + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi + + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local build_path=$( project_build_path "$project" "$@" ) + + mkdir -p "$build_path" + + make -C "$sources_path" -j$TASKS + + cp "$sources_path/flashrom" "$build_path" + + make -C "$sources_path" "clean" +} + +build_check() { + project_build_check "$project" "$@" +} + +install() { + project_install "$project" "$@" +} + +install_check() { + project_install_check "$project" "$@" +} + +release() { + local repository=$project + + project_release_install_archive "$project" "$TOOLS" "$@" + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local repository=$project + + project_release_install_archive_check "$project" "$TOOLS" "$@" + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/flashrom/patches/0001-New-laptops-whitelisted-ThinkPad-R400-and-ThinkPad-T.patch b/projects/flashrom/patches/0001-New-laptops-whitelisted-ThinkPad-R400-and-ThinkPad-T.patch @@ -0,0 +1,28 @@ +From 52a0b55c77635dc026793e66d516e3aed335706a Mon Sep 17 00:00:00 2001 +From: Leah Rowe <info@minifree.org> +Date: Fri, 11 Mar 2016 06:35:03 +0000 +Subject: [PATCH 1/1] New laptops whitelisted: ThinkPad R400 and ThinkPad T500 + +Support for these laptops was merged in coreboot a while ago, so it makes sense +for flashrom to whitelist them. +--- + board_enable.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/board_enable.c b/board_enable.c +index 7b152d1..1d56203 100644 +--- a/board_enable.c ++++ b/board_enable.c +@@ -2427,7 +2427,9 @@ const struct board_match board_matches[] = { + {0x8086, 0x7190, 0, 0, 0x8086, 0x7110, 0, 0, "^SE440BX-2$", NULL, NULL, P3, "Intel", "SE440BX-2", 0, NT, intel_piix4_gpo27_lower}, + {0x1022, 0x7468, 0, 0, 0x1022, 0x7460, 0, 0, NULL, "iwill", "dk8_htx", P3, "IWILL", "DK8-HTX", 0, OK, w83627hf_gpio24_raise_2e}, + {0x8086, 0x27A0, 0x8086, 0x27a0, 0x8086, 0x27b8, 0x8086, 0x27b8, NULL, "kontron", "986lcd-m", P3, "Kontron", "986LCD-M", 0, OK, board_kontron_986lcd_m}, ++ {0x8086, 0x2917, 0x17AA, 0x20F5, 0x8086, 0x2930, 0x17AA, 0x20F9, "^ThinkPad R400", NULL, NULL, P2, "IBM/Lenovo", "ThinkPad R400", 0, OK, p2_whitelist_laptop}, + {0x8086, 0x2917, 0x17AA, 0x20F5, 0x8086, 0x2930, 0x17AA, 0x20F9, "^ThinkPad T400", NULL, NULL, P2, "IBM/Lenovo", "ThinkPad T400", 0, OK, p2_whitelist_laptop}, ++ {0x8086, 0x2917, 0x17AA, 0x20F5, 0x8086, 0x2930, 0x17AA, 0x20F9, "^ThinkPad T500", NULL, NULL, P2, "IBM/Lenovo", "ThinkPad T500", 0, OK, p2_whitelist_laptop}, + {0x8086, 0x1E22, 0x17AA, 0x21F6, 0x8086, 0x1E55, 0x17AA, 0x21F6, "^ThinkPad T530", NULL, NULL, P2, "IBM/Lenovo", "ThinkPad T530", 0, OK, p2_whitelist_laptop}, + {0x8086, 0x27a0, 0x17aa, 0x2015, 0x8086, 0x27b9, 0x17aa, 0x2009, "^ThinkPad T60", NULL, NULL, P2, "IBM/Lenovo", "ThinkPad T60", 0, OK, p2_whitelist_laptop}, + {0x8086, 0x27a0, 0x17aa, 0x2017, 0x8086, 0x27b9, 0x17aa, 0x2009, "^ThinkPad T60", NULL, NULL, P2, "IBM/Lenovo", "ThinkPad T60(s)", 0, OK, p2_whitelist_laptop}, +-- +1.9.1 + diff --git a/projects/flashrom/patches/0002-Add-whitelist-for-Taurinus-X200-laptop.patch b/projects/flashrom/patches/0002-Add-whitelist-for-Taurinus-X200-laptop.patch @@ -0,0 +1,24 @@ +From b1828512abf58911cfb829cb6a98d4e8dbefadc2 Mon Sep 17 00:00:00 2001 +From: Leah Rowe <info@minifree.org> +Date: Fri, 11 Mar 2016 06:38:39 +0000 +Subject: [PATCH 1/1] Add whitelist for Taurinus X200 laptop + +--- + board_enable.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/board_enable.c b/board_enable.c +index 1d56203..a71061c 100644 +--- a/board_enable.c ++++ b/board_enable.c +@@ -2437,6 +2437,7 @@ const struct board_match board_matches[] = { + {0x8086, 0x3B07, 0x17AA, 0x2166, 0x8086, 0x3B30, 0x17AA, 0x2167, "^Lenovo X201", NULL, NULL, P2, "IBM/Lenovo", "ThinkPad X201", 0, OK, p2_whitelist_laptop}, + {0x8086, 0x1E22, 0x17AA, 0x21FA, 0x8086, 0x1E55, 0x17AA, 0x21FA, "^ThinkPad X230", NULL, NULL, P2, "IBM/Lenovo", "ThinkPad X230", 0, OK, p2_whitelist_laptop}, + {0x8086, 0x27A0, 0x17AA, 0x2017, 0x8086, 0x27B9, 0x17AA, 0x2009, "^ThinkPad X60", NULL, NULL, P2, "IBM/Lenovo", "ThinkPad X60(s)", 0, OK, p2_whitelist_laptop}, ++ {0x8086, 0x2917, 0x17AA, 0x20F5, 0x8086, 0x2930, 0x17AA, 0x20F9, "^Taurinus X200", "Libiquity", "Taurinus X200", P2, "Libiquity", "ThinkPad X200", 0, OK, p2_whitelist_laptop}, + {0x8086, 0x2411, 0x8086, 0x2411, 0x8086, 0x7125, 0x0e11, 0xb165, NULL, NULL, NULL, P3, "Mitac", "6513WU", 0, OK, board_mitac_6513wu}, + {0x8086, 0x8186, 0x8086, 0x8186, 0x8086, 0x8800, 0, 0, "^MSC Vertriebs GmbH$", NULL, NULL, P2, "MSC", "Q7-TCTC", 0, OK, p2_not_a_laptop}, + {0x8086, 0x7190, 0, 0, 0x8086, 0x7110, 0, 0, "^MS-6163 (i440BX)$", NULL, NULL, P3, "MSI", "MS-6163 (MS-6163 Pro)", 0, OK, intel_piix4_gpo14_raise}, +-- +1.9.1 + diff --git a/projects/flashrom/patches/0003-purged-chips.patch b/projects/flashrom/patches/0003-purged-chips.patch @@ -0,0 +1,354 @@ +From 260f0e096b385c9f53e9a28e79293131a11122a6 Mon Sep 17 00:00:00 2001 +From: Leah Rowe <info@minifree.org> +Date: Fri, 11 Mar 2016 06:50:50 +0000 +Subject: [PATCH 1/1] purged chips + +--- + flashchips.c | 303 ----------------------------------------------------------- + 1 file changed, 303 deletions(-) + +diff --git a/flashchips.c b/flashchips.c +index 0fc1b7a..5c94304 100644 +--- a/flashchips.c ++++ b/flashchips.c +@@ -7451,80 +7451,6 @@ const struct flashchip flashchips[] = { + + { + .vendor = "Macronix", +- .name = "MX25L1605", +- .bustype = BUS_SPI, +- .manufacture_id = MACRONIX_ID, +- .model_id = MACRONIX_MX25L1605, +- .total_size = 2048, +- .page_size = 256, +- .feature_bits = FEATURE_WRSR_WREN, +- .tested = TEST_OK_PREW, +- .probe = probe_spi_rdid, +- .probe_timing = TIMING_ZERO, +- .block_erasers = +- { +- { +- .eraseblocks = { {64 * 1024, 32} }, +- .block_erase = spi_block_erase_20, +- }, { +- .eraseblocks = { {64 * 1024, 32} }, +- .block_erase = spi_block_erase_d8, +- }, { +- .eraseblocks = { {2 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_60, +- }, { +- .eraseblocks = { {2 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_c7, +- }, +- }, +- .printlock = spi_prettyprint_status_register_bp2_srwd, /* bit6: error flag */ +- .unlock = spi_disable_blockprotect, +- .write = spi_chip_write_256, +- .read = spi_chip_read, /* Fast read (0x0B) supported */ +- .voltage = {2700, 3600}, +- }, +- +- { +- .vendor = "Macronix", +- .name = "MX25L1605A/MX25L1606E/MX25L1608E", +- .bustype = BUS_SPI, +- .manufacture_id = MACRONIX_ID, +- .model_id = MACRONIX_MX25L1605, +- .total_size = 2048, +- .page_size = 256, +- /* OTP: 64B total; enter 0xB1, exit 0xC1 (MX25L1606E and MX25L1608E only) */ +- .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, +- .tested = TEST_OK_PREW, +- .probe = probe_spi_rdid, +- .probe_timing = TIMING_ZERO, +- .block_erasers = +- { +- { +- .eraseblocks = { {4 * 1024, 512} }, +- .block_erase = spi_block_erase_20, +- }, { +- .eraseblocks = { {64 * 1024, 32} }, +- .block_erase = spi_block_erase_52, +- }, { +- .eraseblocks = { {64 * 1024, 32} }, +- .block_erase = spi_block_erase_d8, +- }, { +- .eraseblocks = { {2 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_60, +- }, { +- .eraseblocks = { {2 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_c7, +- }, +- }, +- .printlock = spi_prettyprint_status_register_bp3_srwd, /* MX25L1605A bp2 only */ +- .unlock = spi_disable_blockprotect_bp3_srwd, +- .write = spi_chip_write_256, +- .read = spi_chip_read, /* Fast read (0x0B) supported (MX25L1608E supports dual-I/O read) */ +- .voltage = {2700, 3600}, +- }, +- +- { +- .vendor = "Macronix", + .name = "MX25L1605D/MX25L1608D/MX25L1673E", + .bustype = BUS_SPI, + .manufacture_id = MACRONIX_ID, +@@ -7632,41 +7558,6 @@ const struct flashchip flashchips[] = { + + { + .vendor = "Macronix", +- .name = "MX25L3205(A)", +- .bustype = BUS_SPI, +- .manufacture_id = MACRONIX_ID, +- .model_id = MACRONIX_MX25L3205, +- .total_size = 4096, +- .page_size = 256, +- .feature_bits = FEATURE_WRSR_WREN, +- .tested = TEST_OK_PREW, +- .probe = probe_spi_rdid, +- .probe_timing = TIMING_ZERO, +- .block_erasers = +- { +- { +- .eraseblocks = { {64 * 1024, 64} }, +- .block_erase = spi_block_erase_20, +- }, { +- .eraseblocks = { {64 * 1024, 64} }, +- .block_erase = spi_block_erase_d8, +- }, { +- .eraseblocks = { {4 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_60, +- }, { +- .eraseblocks = { {4 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_c7, +- }, +- }, +- .printlock = spi_prettyprint_status_register_bp2_srwd, /* bit6: error flag */ +- .unlock = spi_disable_blockprotect, +- .write = spi_chip_write_256, +- .read = spi_chip_read, /* Fast read (0x0B) supported */ +- .voltage = {2700, 3600}, +- }, +- +- { +- .vendor = "Macronix", + .name = "MX25L3205D/MX25L3208D", + .bustype = BUS_SPI, + .manufacture_id = MACRONIX_ID, +@@ -7703,84 +7594,6 @@ const struct flashchip flashchips[] = { + + { + .vendor = "Macronix", +- .name = "MX25L3206E/MX25L3208E", +- .bustype = BUS_SPI, +- .manufacture_id = MACRONIX_ID, +- .model_id = MACRONIX_MX25L3205, +- .total_size = 4096, +- .page_size = 256, +- /* OTP: 64B total; enter 0xB1, exit 0xC1 */ +- .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, +- .tested = TEST_OK_PREW, +- .probe = probe_spi_rdid, +- .probe_timing = TIMING_ZERO, +- .block_erasers = +- { +- { +- .eraseblocks = { {4 * 1024, 1024} }, +- .block_erase = spi_block_erase_20, +- }, { +- .eraseblocks = { {64 * 1024, 64} }, +- .block_erase = spi_block_erase_d8, +- }, { +- .eraseblocks = { {64 * 1024, 64} }, +- .block_erase = spi_block_erase_52, +- }, { +- .eraseblocks = { {4 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_60, +- }, { +- .eraseblocks = { {4 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_c7, +- }, +- }, +- .printlock = spi_prettyprint_status_register_bp3_srwd, +- .unlock = spi_disable_blockprotect_bp3_srwd, +- .write = spi_chip_write_256, +- .read = spi_chip_read, /* Fast read (0x0B) and dual I/O supported */ +- .voltage = {2700, 3600}, +- }, +- +- { +- .vendor = "Macronix", +- .name = "MX25L3273E", +- .bustype = BUS_SPI, +- .manufacture_id = MACRONIX_ID, +- .model_id = MACRONIX_MX25L3205, +- .total_size = 4096, +- .page_size = 256, +- /* OTP: 64B total; enter 0xB1, exit 0xC1 */ +- .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, +- .tested = TEST_OK_PREW, +- .probe = probe_spi_rdid, +- .probe_timing = TIMING_ZERO, +- .block_erasers = +- { +- { +- .eraseblocks = { {4 * 1024, 1024} }, +- .block_erase = spi_block_erase_20, +- }, { +- .eraseblocks = { {32 * 1024, 128} }, +- .block_erase = spi_block_erase_52, +- }, { +- .eraseblocks = { {64 * 1024, 64} }, +- .block_erase = spi_block_erase_d8, +- }, { +- .eraseblocks = { {4 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_60, +- }, { +- .eraseblocks = { {4 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_c7, +- }, +- }, +- .printlock = spi_prettyprint_status_register_bp3_srwd, +- .unlock = spi_disable_blockprotect_bp3_srwd, +- .write = spi_chip_write_256, +- .read = spi_chip_read, /* Fast read (0x0B) and dual I/O supported */ +- .voltage = {2700, 3600}, +- }, +- +- { +- .vendor = "Macronix", + .name = "MX25L3235D", + .bustype = BUS_SPI, + .manufacture_id = MACRONIX_ID, +@@ -7817,42 +7630,6 @@ const struct flashchip flashchips[] = { + + { + .vendor = "Macronix", +- .name = "MX25L6405", +- .bustype = BUS_SPI, +- .manufacture_id = MACRONIX_ID, +- .model_id = MACRONIX_MX25L6405, +- .total_size = 8192, +- .page_size = 256, +- /* Has an additional 512B EEPROM sector */ +- .feature_bits = FEATURE_WRSR_WREN, +- .tested = TEST_OK_PREW, +- .probe = probe_spi_rdid, +- .probe_timing = TIMING_ZERO, +- .block_erasers = +- { +- { +- .eraseblocks = { {64 * 1024, 128} }, +- .block_erase = spi_block_erase_20, +- }, { +- .eraseblocks = { {64 * 1024, 128} }, +- .block_erase = spi_block_erase_d8, +- }, { +- .eraseblocks = { {8 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_60, +- }, { +- .eraseblocks = { {8 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_c7, +- } +- }, +- .printlock = spi_prettyprint_status_register_bp3_srwd, /* bit6: error flag */ +- .unlock = spi_disable_blockprotect_bp3_srwd, +- .write = spi_chip_write_256, +- .read = spi_chip_read, /* Fast read (0x0B) supported */ +- .voltage = {2700, 3600}, +- }, +- +- { +- .vendor = "Macronix", + .name = "MX25L6405D", + .bustype = BUS_SPI, + .manufacture_id = MACRONIX_ID, +@@ -7889,86 +7666,6 @@ const struct flashchip flashchips[] = { + + { + .vendor = "Macronix", +- .name = "MX25L6406E/MX25L6408E", +- .bustype = BUS_SPI, +- .manufacture_id = MACRONIX_ID, +- .model_id = MACRONIX_MX25L6405, +- .total_size = 8192, +- .page_size = 256, +- /* MX25L6406E supports SFDP */ +- /* OTP: 06E 64B total; enter 0xB1, exit 0xC1 */ +- .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, +- .tested = TEST_OK_PREW, +- .probe = probe_spi_rdid, +- .probe_timing = TIMING_ZERO, +- .block_erasers = +- { +- { +- .eraseblocks = { {4 * 1024, 2048} }, +- .block_erase = spi_block_erase_20, +- }, { +- .eraseblocks = { {64 * 1024, 128} }, +- .block_erase = spi_block_erase_52, +- }, { +- .eraseblocks = { {64 * 1024, 128} }, +- .block_erase = spi_block_erase_d8, +- }, { +- .eraseblocks = { {8 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_60, +- }, { +- .eraseblocks = { {8 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_c7, +- } +- }, +- .printlock = spi_prettyprint_status_register_bp3_srwd, +- .unlock = spi_disable_blockprotect_bp3_srwd, +- .write = spi_chip_write_256, +- .read = spi_chip_read, /* Fast read (0x0B), dual I/O read supported */ +- .voltage = {2700, 3600}, +- }, +- +- { +- .vendor = "Macronix", +- .name = "MX25L6436E/MX25L6445E/MX25L6465E/MX25L6473E", +- .bustype = BUS_SPI, +- .manufacture_id = MACRONIX_ID, +- .model_id = MACRONIX_MX25L6405, +- .total_size = 8192, +- .page_size = 256, +- /* supports SFDP */ +- /* OTP: 512B total; enter 0xB1, exit 0xC1 */ +- .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, +- .tested = TEST_OK_PREW, +- .probe = probe_spi_rdid, +- .probe_timing = TIMING_ZERO, +- .block_erasers = +- { +- { +- .eraseblocks = { {4 * 1024, 2048} }, +- .block_erase = spi_block_erase_20, +- }, { +- .eraseblocks = { {32 * 1024, 256} }, +- .block_erase = spi_block_erase_52, +- }, { +- .eraseblocks = { {64 * 1024, 128} }, +- .block_erase = spi_block_erase_d8, +- }, { +- .eraseblocks = { {8 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_60, +- }, { +- .eraseblocks = { {8 * 1024 * 1024, 1} }, +- .block_erase = spi_block_erase_c7, +- } +- }, +- .printlock = spi_prettyprint_status_register_bp3_srwd, /* bit6 is quad enable */ +- .unlock = spi_disable_blockprotect_bp3_srwd, +- .write = spi_chip_write_256, +- .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ +- .voltage = {2700, 3600}, +- }, +- +- { +- .vendor = "Macronix", + .name = "MX25L12805D", + .bustype = BUS_SPI, + .manufacture_id = MACRONIX_ID, +-- +1.9.1 + diff --git a/projects/flashrom/patches/lenovobios/0001-Lenovobios-adaptation-for-Macronix-and-SST-chips.patch b/projects/flashrom/patches/lenovobios/0001-Lenovobios-adaptation-for-Macronix-and-SST-chips.patch @@ -0,0 +1,65 @@ +From aa2dd05f61f6ca91212d7f6d4055486af6e01436 Mon Sep 17 00:00:00 2001 +From: Leah Rowe <info@minifree.org> +Date: Fri, 5 Aug 2016 22:40:49 +0200 +Subject: [PATCH] Lenovobios adaptation for Macronix and SST chips + +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + flashchips.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/flashchips.c b/flashchips.c +index e5ea181..f3a017c 100644 +--- a/flashchips.c ++++ b/flashchips.c +@@ -7454,12 +7454,12 @@ const struct flashchip flashchips[] = { + .name = "MX25L1605D/MX25L1608D/MX25L1673E", + .bustype = BUS_SPI, + .manufacture_id = MACRONIX_ID, +- .model_id = MACRONIX_MX25L1605, ++ .model_id = 0x14, + .total_size = 2048, + .page_size = 256, + .feature_bits = FEATURE_WRSR_WREN, + .tested = TEST_OK_PREW, +- .probe = probe_spi_rdid, ++ .probe = probe_spi_res1, + .probe_timing = TIMING_ZERO, + .block_erasers = + { +@@ -9857,7 +9857,7 @@ const struct flashchip flashchips[] = { + }, + .printlock = spi_prettyprint_status_register_bp2_srwd, + .unlock = spi_disable_blockprotect, +- .write = spi_chip_write_256, ++ .write = spi_chip_write_1, + .read = spi_chip_read, /* Fast read (0x0B), dual I/O supported */ + .voltage = {2700, 3600}, + }, +@@ -12150,12 +12150,12 @@ const struct flashchip flashchips[] = { + .name = "SST25VF016B", + .bustype = BUS_SPI, + .manufacture_id = SST_ID, +- .model_id = SST_SST25VF016B, ++ .model_id = 0x41, + .total_size = 2048, + .page_size = 256, + .feature_bits = FEATURE_WRSR_EITHER, + .tested = TEST_OK_PREW, +- .probe = probe_spi_rdid, ++ .probe = probe_spi_res2, + .probe_timing = TIMING_ZERO, + .block_erasers = + { +@@ -12178,7 +12178,7 @@ const struct flashchip flashchips[] = { + }, + .printlock = spi_prettyprint_status_register_sst25vf016, + .unlock = spi_disable_blockprotect, +- .write = spi_aai_write, ++ .write = spi_chip_write_1, + .read = spi_chip_read, + .voltage = {2700, 3600}, + }, +-- +2.9.0 + diff --git a/projects/hdctools/configs/install b/projects/hdctools/configs/install @@ -0,0 +1,6 @@ +lib/libftdigpio.so:libftdigpio.so +lib/libftdii2c.so:libftdii2c.so +lib/libftdiuart.so:libftdiuart.so +servo:servo +src/toad/toad:toad +usbkm232:usbkm232 diff --git a/projects/hdctools/configs/revision b/projects/hdctools/configs/revision @@ -0,0 +1 @@ +origin/release-R56-9000.B diff --git a/projects/hdctools/hdctools b/projects/hdctools/hdctools @@ -0,0 +1,100 @@ +#!/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/>. + +download() { + local repository=$project + + project_download_git "$project" "$repository" "https://chromium.googlesource.com/chromiumos/third_party/hdctools" "$@" +} + +download_check() { + local repository=$project + + project_download_check_git "$project" "$repository" "$@" +} + +extract() { + local repository=$project + + project_extract "$project" "$@" +} + +extract_check() { + local repository=$project + + project_extract_check "$project" "$@" +} + +update() { + local repository=$project + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository=$project + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local repository=$project + + requirements "tidy" + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local build_path=$( project_build_path "$project" "$@" ) + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi + + mkdir -p "$build_path" + + make -C "$sources_path" HDCTOOLS_BUILD_DIR="$build_path" -j$TASKS +} + +build_check() { + project_build_check "$project" "$@" +} + +install() { + project_install "$project" "$@" +} + +install_check() { + project_install_check "$project" "$@" +} + +release() { + local repository=$project + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local repository=$project + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/hdctools/patches/0001-Remove-Werror-flag.patch b/projects/hdctools/patches/0001-Remove-Werror-flag.patch @@ -0,0 +1,25 @@ +From 05fde50f4991623525edb6b15340011af53cd31e Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Sun, 20 Nov 2016 15:08:39 +0100 +Subject: [PATCH] Remove Werror flag + +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + defs/c-Linux.mk | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/defs/c-Linux.mk b/defs/c-Linux.mk +index c2c3129..4f1bbee 100644 +--- a/defs/c-Linux.mk ++++ b/defs/c-Linux.mk +@@ -34,7 +34,6 @@ HOSTOS_CWARN = \ + -Wdeclaration-after-statement \ + -Wdisabled-optimization \ + -Wempty-body \ +- -Werror \ + -Wextra \ + -Wfloat-equal \ + -Wformat \ +-- +2.10.2 + diff --git a/projects/libpayload/configs/depthcharge/nyan/arch b/projects/libpayload/configs/depthcharge/nyan/arch @@ -0,0 +1 @@ +arm diff --git a/projects/libpayload/configs/depthcharge/nyan/config b/projects/libpayload/configs/depthcharge/nyan/config @@ -0,0 +1 @@ +config.nyan diff --git a/projects/libpayload/configs/depthcharge/targets b/projects/libpayload/configs/depthcharge/targets @@ -0,0 +1,2 @@ +nyan +veyron diff --git a/projects/libpayload/configs/depthcharge/veyron/arch b/projects/libpayload/configs/depthcharge/veyron/arch @@ -0,0 +1 @@ +arm diff --git a/projects/libpayload/configs/depthcharge/veyron/config b/projects/libpayload/configs/depthcharge/veyron/config @@ -0,0 +1 @@ +config.veyron diff --git a/projects/libpayload/configs/install b/projects/libpayload/configs/install @@ -0,0 +1 @@ +install/libpayload/*:. diff --git a/projects/libpayload/configs/targets b/projects/libpayload/configs/targets @@ -0,0 +1 @@ +depthcharge diff --git a/projects/libpayload/libpayload b/projects/libpayload/libpayload @@ -0,0 +1,69 @@ +#!/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/>. + +arguments() { + project_arguments_targets "$project" "$@" +} + +usage() { + project_usage_actions "$project" + project_usage_arguments "$project" "$@" +} + +build() { + local repository="coreboot" + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + if git_project_check $repository + then + git_project_checkout "$repository" "$repository" "$@" + fi + + local coreboot_sources_path=$( project_sources_path "$repository" "$repository" "$@" ) + local sources_path="$coreboot_sources_path/payloads/libpayload/" + local build_path=$( project_build_path "$project" "$@" ) + local build_install_path="$build_path/install" + + local config=$( libpayload_config "$@" ) + local config_path="configs/$config" + + local arch=$( libpayload_arch "$@" ) + + local crossgcc_build_path=$( project_build_path "crossgcc" "$arch" ) + local crossgcc_bin_path="$crossgcc_build_path/bin/" + + project_action "build" "crossgcc" "$arch" + + rm -f "$sources_path/.xcompile" + + mkdir -p "$build_path" + + make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" KBUILD_DEFCONFIG="$config_path" "defconfig" + make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" -j$TASKS + make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" DESTDIR="$build_install_path" "install" + + rm -f "$sources_path/.xcompile" +} + +build_check() { + project_build_check "$project" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/libpayload/libpayload-helper b/projects/libpayload/libpayload-helper @@ -0,0 +1,27 @@ +#!/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/>. + +CONFIG="config" +ARCH="arch" + +libpayload_arch() { + project_file_contents "$project" "$CONFIGS" "$ARCH" "$@" +} + +libpayload_config() { + project_file_contents "$project" "$CONFIGS" "$CONFIG" "$@" +} diff --git a/projects/libreboot-all/configs/projects b/projects/libreboot-all/configs/projects @@ -0,0 +1,5 @@ +libreboot-tools +libreboot-images +libreboot-sources +libreboot-release +libreboot-bootstrap diff --git a/projects/libreboot-all/libreboot-all b/projects/libreboot-all/libreboot-all @@ -0,0 +1,44 @@ +#!/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/>. + +download() { + project_action_projects "$action" "$project" "$@" +} + +extract() { + project_action_projects "$action" "$project" "$@" +} + +update() { + project_action_projects "$action" "$project" "$@" +} + +build() { + project_action_projects "$action" "$project" "$@" +} + +install() { + project_action_projects "$action" "$project" "$@" +} + +release() { + project_action_projects "$action" "$project" "$@" +} + +clean() { + project_action_projects "$action" "$project" "$@" +} diff --git a/projects/libreboot-bootstrap/install/install 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 @@ -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 @@ -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" "$@" +} diff --git a/projects/libreboot-images/configs/projects b/projects/libreboot-images/configs/projects @@ -0,0 +1,6 @@ +coreboot +crossgcc +vboot devices +libpayload +depthcharge +cros-ec diff --git a/projects/libreboot-images/configs/projects-build b/projects/libreboot-images/configs/projects-build @@ -0,0 +1,2 @@ +coreboot +cros-ec diff --git a/projects/libreboot-images/libreboot-images b/projects/libreboot-images/libreboot-images @@ -0,0 +1,44 @@ +#!/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/>. + +download() { + project_action_projects "$action" "$project" "$@" +} + +extract() { + project_action_projects "$action" "$project" "$@" +} + +update() { + project_action_projects "$action" "$project" "$@" +} + +build() { + project_action_projects "$action" "$project" "$@" +} + +install() { + project_action_projects "$action" "$project" "$@" +} + +release() { + project_action_projects "$action" "$project" "$@" +} + +clean() { + project_action_projects "$action" "$project" "$@" +} diff --git a/projects/libreboot-release/install/install b/projects/libreboot-release/install/install @@ -0,0 +1 @@ +libreboot-release:libreboot-release diff --git a/projects/libreboot-release/install/libreboot-release b/projects/libreboot-release/install/libreboot-release @@ -0,0 +1,316 @@ +#!/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="paper" + +SOURCES="sources" +SYSTEMS="systems" +IMAGES="images" +TOOLS="tools" + +TAR_XZ="tar.xz" +SHA256SUM="sha256sum" +ASC="asc" + +usage() { + printf "$executable [action] [projects...]\n" >&2 + + printf "\nActions:\n" >&2 + printf " download - Download project files\n" >&2 + printf " sources - Download project sources\n" >&2 + printf " verify - Verify project files\n" >&2 + printf " extract - Extract project files\n" >&2 + printf " prepare - Download, verify and extract project files\n" >&2 + + printf "\nEnvironment variables:\n" >&2 + printf " MACHINE - Machine architecture to use\n" >&2 + printf " DOWNLOAD_URL - Base URL to download files from\n" >&2 +} + +download() { + local project=$1 + + local ifs_save + local prefix + local directory + local path + local url + + printf "Downloading $project\n" + + for prefix in "$SYSTEMS/$MACHINE" "$IMAGES" "$TOOLS/$MACHINE" + do + ifs_save=$IFS + IFS=$'-' + + directory="" + + for part in $project + do + if [ -z "$directory" ] + then + directory="$part" + else + directory="$directory-$part" + fi + + path="$root/$prefix/$directory/$project.$TAR_XZ" + url="$DOWNLOAD_URL/$prefix/$directory/$project.$TAR_XZ" + + if wget --quiet --spider "$url" + then + mkdir -p "$( dirname "$path" )" + wget -O "$path" "$url" + wget -O "$path.$SHA256SUM" "$url.$SHA256SUM" + wget -O "$path.$ASC" "$url.$ASC" + + return 0 + fi + done + + IFS=$ifs_save + done + + printf "Could not download $project from $DOWNLOAD_URL\n" >&2 + return 1 +} + +sources() { + local project=$1 + + local url="$DOWNLOAD_URL/$SOURCES/$project/$project.$TAR_XZ" + local path="$root/$SOURCES/$project/$project.$TAR_XZ" + + printf "Downloading $project sources\n" + + if wget --quiet --spider "$url" + then + mkdir -p "$root/$project" + wget -O "$path" "$url" + wget -O "$path.$SHA256SUM" "$url.$SHA256SUM" + wget -O "$path.$ASC" "$url.$ASC" + else + printf "Could not download $project sources from $DOWNLOAD_URL\n" >&2 + return 1 + fi + +} + +verify() { + local project=$1 + + local checksum_path + local signature_path + local ifs_save + local prefix + local directory + local path + + printf "Verifying $project\n" + + for prefix in "$SYSTEMS/$MACHINE" "$IMAGES" "$TOOLS/$MACHINE" + do + ifs_save=$IFS + IFS=$'-' + + directory="" + + for part in $project + do + if [ -z "$directory" ] + then + directory="$part" + else + directory="$directory-$part" + fi + + path="$root/$prefix/$directory/$project.$TAR_XZ" + + if ! [ -f "$path" ] + then + continue + fi + + checksum_path="$path.$SHA256SUM" + signature_path="$path.$ASC" + + if [ -f "$checksum_path" ] + then + ( + cd "$( dirname "$path" )" + sha256sum -c "$project.$TAR_XZ.$SHA256SUM" + ) + else + printf "Could not verify $project checksum!\n" >&2 + fi + + if [ -f "$signature_path" ] + then + gpg --armor --verify "$signature_path" "$path" + else + printf "Could not verify $project signature!\n" >&2 + fi + + return 0 + done + + IFS=$ifs_save + done + + printf "Could not verify $project\n" >&2 + return 1 +} + +extract() { + local project=$1 + + local extract_path + local ifs_save + local prefix + local directory + local path + + printf "Extracting $project\n" + + for prefix in "$SYSTEMS/$MACHINE" "$IMAGES" "$TOOLS/$MACHINE" + do + ifs_save=$IFS + IFS=$'-' + + directory="" + + for part in $project + do + if [ -z "$directory" ] + then + directory="$part" + else + directory="$directory-$part" + fi + + path="$root/$prefix/$directory/$project.$TAR_XZ" + + if ! [ -f "$path" ] + then + continue + fi + + if [ "$prefix" = "$SYSTEMS/$MACHINE" ] + then + printf "Skiping $project extract\n" + return 0 + fi + + extract_path=$( dirname "$path" ) + + tar -xf "$path" -ps -C "$extract_path" + + return 0 + done + + IFS=$ifs_save + done + + printf "Could not extract $project\n" >&2 + return 1 +} + +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" ) + + if [ -z "$MACHINE" ] + then + MACHINE=$( uname -m ) + fi + + if [ -z "$DOWNLOAD_URL" ] + then + printf "Missing download URL\n" >&2 + exit 1 + fi +} + +libreboot_release() { + local action=$1 + shift + + set -e + + setup "$@" + + if [ -z "$action" ] + then + usage + exit 1 + fi + + requirements "tar" "sha256sum" "gpg" + + case $action in + "download") + for project in "$@" + do + download "$project" + done + ;; + "sources") + for project in "$@" + do + sources "$project" + done + ;; + "verify") + for project in "$@" + do + verify "$project" + done + ;; + "extract") + for project in "$@" + do + extract "$project" + done + ;; + "prepare") + for project in "$@" + do + download "$project" + verify "$project" + extract "$project" + done + ;; + esac +} + +libreboot_release "$@" diff --git a/projects/libreboot-release/libreboot-release b/projects/libreboot-release/libreboot-release @@ -0,0 +1,38 @@ +#!/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() { + local install_path=$( project_install_path "$project" "$@" ) + + 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" "$@" +} diff --git a/projects/libreboot-sources/libreboot-sources b/projects/libreboot-sources/libreboot-sources @@ -0,0 +1,49 @@ +#!/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/>. + +update() { + local repository_path=$root + + git_fetch "$repository_path" + git_merge "$repository_path" "$ORIGIN_HEAD" +} + +release() { + local archive_path=$( project_release_archive_path "$project" "$SOURCES" "$@" ) + local sources_path=$root + + echo "$VERSION" > "$sources_path/$DOTVERSION" + echo "$SOURCE_DATE_EPOCH" > "$sources_path/$DOTEPOCH" + + if git_check "$sources_path" + then + git_revision "$sources_path" > "$sources_path/$DOTREVISION" + fi + + archive_create "$archive_path" "$sources_path" "$BUILD_SYSTEM" + file_verification_create "$archive_path" +} + +release_check() { + local archive_path=$( project_release_archive_path "$project" "$SOURCES" "$@" ) + + file_exists_check "$archive_path" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/libreboot-tools/configs/projects b/projects/libreboot-tools/configs/projects @@ -0,0 +1,4 @@ +cbfstool +cbmem +nvramtool +cros-tools diff --git a/projects/libreboot-tools/configs/projects-download b/projects/libreboot-tools/configs/projects-download @@ -0,0 +1,5 @@ +coreboot +cbfstool +cbmem +nvramtool +cros-tools diff --git a/projects/libreboot-tools/configs/projects-update b/projects/libreboot-tools/configs/projects-update @@ -0,0 +1 @@ +projects-download+ \ No newline at end of file diff --git a/projects/libreboot-tools/libreboot-tools b/projects/libreboot-tools/libreboot-tools @@ -0,0 +1,44 @@ +#!/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/>. + +download() { + project_action_projects "$action" "$project" "$@" +} + +extract() { + project_action_projects "$action" "$project" "$@" +} + +update() { + project_action_projects "$action" "$project" "$@" +} + +build() { + project_action_projects "$action" "$project" "$@" +} + +install() { + project_action_projects "$action" "$project" "$@" +} + +release() { + project_action_projects "$action" "$project" "$@" +} + +clean() { + project_action_projects "$action" "$project" "$@" +} diff --git a/projects/mosys/configs/install b/projects/mosys/configs/install @@ -0,0 +1 @@ +mosys:mosys diff --git a/projects/mosys/configs/revision b/projects/mosys/configs/revision @@ -0,0 +1 @@ +origin/release-R56-9000.B diff --git a/projects/mosys/mosys b/projects/mosys/mosys @@ -0,0 +1,111 @@ +#!/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/>. + +download() { + local repository=$project + + project_download_git "$project" "$repository" "https://chromium.googlesource.com/chromiumos/platform/mosys" "$@" +} + +download_check() { + local repository=$project + + project_download_check_git "$project" "$repository" "$@" +} + +extract() { + local repository=$project + + project_extract "$project" "$@" +} + +extract_check() { + local repository=$project + + project_extract_check "$project" "$@" +} + +update() { + local repository=$project + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository=$project + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local repository=$project + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local build_path=$( project_build_path "$project" "$@" ) + + local flashmap_build_path=$( project_build_path "flashmap" "$@" ) + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi + + project_action "build" "flashmap" "$@" + + mkdir -p "$build_path" + + make -C "$sources_path" objtree="$build_path" "defconfig" + make -C "$sources_path" objtree="$build_path" EXTRA_CFLAGS="-I $flashmap_build_path/lib" FMAP_LINKOPT="-I $flashmap_build_path/lib -L $flashmap_build_path/lib -lfmap" -j$TASKS + + cp "$sources_path/mosys" "$build_path" + + make -C "$sources_path" "clean" +} + +build_check() { + project_build_check "$project" "$@" +} + +install() { + project_install "$project" "$@" +} + +install_check() { + project_install_check "$project" "$@" +} + +release() { + local repository=$project + + project_release_install_archive "$project" "$TOOLS" "$@" + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local repository=$project + + project_release_install_archive_check "$project" "$TOOLS" "$@" + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/mosys/patches/0001-Force-the-definition-of-build-tools.patch b/projects/mosys/patches/0001-Force-the-definition-of-build-tools.patch @@ -0,0 +1,44 @@ +From f8aa6a0eeaa6ae3fd4dfe2d60118a47a3867c906 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Wed, 10 Feb 2016 20:44:09 +0100 +Subject: [PATCH] Force the definition of build tools + +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + Makefile | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/Makefile b/Makefile +index c4cd006..5244242 100644 +--- a/Makefile ++++ b/Makefile +@@ -264,16 +264,16 @@ include $(srctree)/scripts/Kbuild.include + + # Make variables (CC, etc...) + +-AR ?= $(CROSS_COMPILE)ar +-AS ?= $(CROSS_COMPILE)as +-CC ?= $(CROSS_COMPILE)gcc +-CPP ?= $(CC) -E +-LD ?= $(CROSS_COMPILE)ld +-NM ?= $(CROSS_COMPILE)nm +-STRIP ?= $(CROSS_COMPILE)strip +-OBJCOPY ?= $(CROSS_COMPILE)objcopy +-OBJDUMP ?= $(CROSS_COMPILE)objdump +-INSTALL ?= install ++AR := $(CROSS_COMPILE)ar ++AS := $(CROSS_COMPILE)as ++CC := $(CROSS_COMPILE)gcc ++CPP := $(CC) -E ++LD := $(CROSS_COMPILE)ld ++NM := $(CROSS_COMPILE)nm ++STRIP := $(CROSS_COMPILE)strip ++OBJCOPY := $(CROSS_COMPILE)objcopy ++OBJDUMP := $(CROSS_COMPILE)objdump ++INSTALL := install + AWK = awk + DEPMOD = /sbin/depmod + CHECK = sparse +-- +1.9.1 + diff --git a/projects/nvramtool/configs/blobs b/projects/nvramtool/configs/blobs @@ -0,0 +1 @@ +../../coreboot/configs/blobs+ \ No newline at end of file diff --git a/projects/nvramtool/configs/blobs-ignore b/projects/nvramtool/configs/blobs-ignore @@ -0,0 +1 @@ +../../coreboot/configs/blobs-ignore+ \ No newline at end of file diff --git a/projects/nvramtool/configs/blobs-ignore-notes.txt b/projects/nvramtool/configs/blobs-ignore-notes.txt @@ -0,0 +1 @@ +../../coreboot/configs/blobs-ignore-notes.txt+ \ No newline at end of file diff --git a/projects/nvramtool/configs/install b/projects/nvramtool/configs/install @@ -0,0 +1 @@ +nvramtool:nvramtool diff --git a/projects/nvramtool/configs/revision b/projects/nvramtool/configs/revision @@ -0,0 +1 @@ +../../coreboot/configs/revision+ \ No newline at end of file diff --git a/projects/nvramtool/nvramtool b/projects/nvramtool/nvramtool @@ -0,0 +1,107 @@ +#!/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/>. + +download() { + local repository="coreboot" + + git_project_prepare "$project" "$repository" "$@" +} + +download_check() { + local repository="coreboot" + + git_project_prepare_check "$project" "$repository" "$@" +} + +extract() { + local repository="coreboot" + + project_extract "$project" "$@" +} + +extract_check() { + local repository="coreboot" + + project_extract_check "$project" "$@" +} + +update() { + local repository="coreboot" + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository="coreboot" + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local repository="coreboot" + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + local coreboot_sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local sources_path="$coreboot_sources_path/util/nvramtool/" + local build_path=$( project_build_path "$project" "$@" ) + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi + + mkdir -p "$build_path" + + make -C "$sources_path" -j$TASKS + + cp "$sources_path/nvramtool" "$build_path" + + make -C "$sources_path" "clean" +} + +build_check() { + project_build_check "$project" "$@" +} + +install() { + project_install "$project" "$@" +} + +install_check() { + project_install_check "$project" "$@" +} + +release() { + local repository="coreboot" + + project_release_install_archive "$project" "$TOOLS" "$@" + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local repository="coreboot" + + project_release_install_archive_check "$project" "$TOOLS" "$@" + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/nvramtool/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch b/projects/nvramtool/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch @@ -0,0 +1 @@ +../../coreboot/patches/0001-Avoid-using-git-submodules-for-3rdparty.patch+ \ No newline at end of file diff --git a/projects/vboot/configs/blobs b/projects/vboot/configs/blobs @@ -0,0 +1,22 @@ +tests/devkeys/firmware_bmpfv.bin +tests/devkeys-pkc/firmware_bmpfv.bin +tests/futility/data/bios_link_mp.bin +tests/futility/data/bios_mario_mp.bin +tests/futility/data/bios_peppy_mp.bin +tests/futility/data/bios_zgb_mp.bin +tests/futility/data/dingdong.signed +tests/futility/data/dingdong.unsigned +tests/futility/data/fw_gbb.bin +tests/futility/data/fw_vblock.bin +tests/futility/data/hoho.signed +tests/futility/data/hoho.unsigned +tests/futility/data/kern_preamble.bin +tests/futility/data/minimuffin.signed +tests/futility/data/minimuffin.unsigned +tests/futility/data/rec_kernel_part.bin +tests/futility/data/vmlinuz-amd64.bin +tests/futility/data/vmlinuz-arm.bin +tests/futility/data/zinger_mp_image.bin +tests/futility/data/zinger.signed +tests/futility/data/zinger.unsigned +tests/preamble_tests diff --git a/projects/vboot/configs/blobs-ignore b/projects/vboot/configs/blobs-ignore @@ -0,0 +1,33 @@ +bdb/sha.c +bdb/bdb_create.c +cgpt/cgpt_wrapper.c +firmware/lib/tpm_lite/include/tlcl_structures.h +firmware/lib/cgptlib/crc32.c +firmware/lib/cryptolib/padding.c +firmware/2lib/2sha512.c +firmware/2lib/2sha256.c +firmware/bdb/secrets.c +futility/cmd_gbb_utility.c +scripts/image_signing/tag_image.sh +scripts/image_signing/strip_boot_from_image.sh +scripts/image_signing/make_dev_ssd.sh +scripts/image_signing/tofactory.sh +scripts/image_signing/sign_official_build.sh +scripts/image_signing/sign_nv_cbootimage.sh +tests/rsa_padding_test.h +tests/bdb_sprw_test.c +tests/crc32_test.c +tests/vb2_api_tests.c +tests/sha_test_vectors.h +tests/gen_preamble_testdata.sh +tests/load_kernel_tests.sh +tests/vb21_host_misc_tests.c +tests/run_vbutil_kernel_arg_tests.sh +tests/cgptlib_test.c +tests/vb2_sha_tests.c +tests/futility/test_file_types.c +tests/futility/test_file_types.sh +tests/futility/test_dump_fmap.sh +tests/testcases/padding_test_vectors.inc +utility/bmpblk_font.c +utility/vbutil_what_keys diff --git a/projects/vboot/configs/blobs-ignore-notes.txt b/projects/vboot/configs/blobs-ignore-notes.txt @@ -0,0 +1,5 @@ +./3rdparty/vboot/tests/testcases/padding_test_vectors.inc +It's not a blob, see tests/rsa_padding_test.h for explanation. + +The text in this file is CC-BY-SA 4.0 or higher. All contributions to it must +be made under the same license. diff --git a/projects/vboot/configs/revision b/projects/vboot/configs/revision @@ -0,0 +1 @@ +origin/release-R56-9000.B diff --git a/projects/vboot/configs/targets b/projects/vboot/configs/targets @@ -0,0 +1,2 @@ +devices +tools diff --git a/projects/vboot/configs/tools/install b/projects/vboot/configs/tools/install @@ -0,0 +1,5 @@ +cgpt/cgpt:cgpt +futility/futility:futility +utility/crossystem:crossystem +utility/tpmc:tpmc +devkeys:devkeys diff --git a/projects/vboot/patches/0001-firmware-Developer-mode-timeout-delay-shortening-dow.patch b/projects/vboot/patches/0001-firmware-Developer-mode-timeout-delay-shortening-dow.patch @@ -0,0 +1,34 @@ +From 0e8e89b19a4e47802ed6ea64a35da77665cc3d3f Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 10 Aug 2015 20:33:23 +0200 +Subject: [PATCH 1/7] firmware: Developer mode timeout delay shortening (down + to 3 seconds) + +A timeout delay of 3 seconds, with no bip, is much more appreciable for users. + +Change-Id: If4bc879f350a4a0297395077e4f55e89f4fa764d +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + firmware/lib/vboot_audio.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/firmware/lib/vboot_audio.c b/firmware/lib/vboot_audio.c +index 8f31171..7e92dc7 100644 +--- a/firmware/lib/vboot_audio.c ++++ b/firmware/lib/vboot_audio.c +@@ -30,11 +30,7 @@ + #define MAX_CUSTOM_DELAY 300000 + + /* These are visible externally only to make testing easier */ +-VbDevMusicNote default_notes_[] = { {20000, 0}, /* 20 seconds */ +- {250, 400}, /* two beeps */ +- {250, 0}, +- {250, 400}, +- {9250, 0} }; /* total 30 seconds */ ++VbDevMusicNote default_notes_[] = { {3000, 0} }; /* three seconds */ + uint32_t default_count_ = sizeof(default_notes_) / sizeof(VbDevMusicNote); + + VbDevMusicNote short_notes_[] = { {2000, 0} }; /* two seconds */ +-- +2.10.2 + diff --git a/projects/vboot/patches/0002-firmware-Text-based-screen-display-in-priority.patch b/projects/vboot/patches/0002-firmware-Text-based-screen-display-in-priority.patch @@ -0,0 +1,61 @@ +From 5f402b9d365dbc17ea68803aeb9a95da01708b9f Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 10 Aug 2015 22:44:50 +0200 +Subject: [PATCH 2/7] firmware: Text-based screen display in priority + +This allows showing text-based screen displays before looking at the GBB bitmaps +since those encourage the use of non-free software (Chrome OS) and don't display +enough information to the user. + +Change-Id: I1dc454cd5de1cf096a15957832a8114d4f758eac +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + firmware/lib/vboot_display.c | 17 ++++++----------- + 1 file changed, 6 insertions(+), 11 deletions(-) + +diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c +index 1abed92..50a2e54 100644 +--- a/firmware/lib/vboot_display.c ++++ b/firmware/lib/vboot_display.c +@@ -335,20 +335,18 @@ static VbError_t VbDisplayScreenLegacy(VbCommonParams *cparams, uint32_t screen, + /* If the screen is blank, turn off the backlight; else turn it on. */ + VbExDisplayBacklight(VB_SCREEN_BLANK == screen ? 0 : 1); + +- /* Look in the GBB first */ +- if (VBERROR_SUCCESS == VbDisplayScreenFromGBB(cparams, screen, +- vncptr, locale)) ++ /* Display default first */ ++ if (VBERROR_SUCCESS == VbExDisplayScreen(screen, locale)) + return VBERROR_SUCCESS; + +- /* If screen wasn't in the GBB bitmaps, fall back to a default */ +- return VbExDisplayScreen(screen, locale); ++ /* If default doesn't have anything to show, fall back to GBB bitmaps */ ++ return VbDisplayScreenFromGBB(cparams, screen, vncptr, locale); + } + + VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen, + int force, VbNvContext *vncptr) + { + uint32_t locale; +- GoogleBinaryBlockHeader *gbb = cparams->gbb; + VbError_t rv; + + /* If requested screen is the same as the current one, we're done. */ +@@ -358,11 +356,8 @@ VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen, + /* Read the locale last saved */ + VbNvGet(vncptr, VBNV_LOCALIZATION_INDEX, &locale); + +- if (gbb->bmpfv_size == 0) +- rv = VbExDisplayScreen(screen, locale); +- else +- rv = VbDisplayScreenLegacy(cparams, screen, force, vncptr, +- locale); ++ rv = VbDisplayScreenLegacy(cparams, screen, force, vncptr, ++ locale); + + if (rv == VBERROR_SUCCESS) + /* Keep track of the currently displayed screen */ +-- +2.10.2 + diff --git a/projects/vboot/patches/0003-firmware-Hold-key-combination-in-developer-mode.patch b/projects/vboot/patches/0003-firmware-Hold-key-combination-in-developer-mode.patch @@ -0,0 +1,50 @@ +From 78297c1fa4a158047e7bfa8bf0b3435fe498811d Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 10 Aug 2015 22:59:50 +0200 +Subject: [PATCH 3/7] firmware: Hold key combination in developer mode + +This binds the Ctrl + H key combination to hold the developer mode screen. + +Change-Id: Ia76080eacd2e5e78b35b83d0f3783bfa5137794a +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + firmware/lib/vboot_api_kernel.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c +index e465fc3..2e31f08 100644 +--- a/firmware/lib/vboot_api_kernel.c ++++ b/firmware/lib/vboot_api_kernel.c +@@ -308,6 +308,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + uint32_t use_legacy = 0; + uint32_t default_boot = 0; + uint32_t ctrl_d_pressed = 0; ++ uint32_t hold = 0; + + VbAudioContext *audio = 0; + +@@ -473,6 +474,12 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + ctrl_d_pressed = 1; + goto fallout; + break; ++ case 0x08: ++ /* Ctrl+H = hold */ ++ VBDEBUG(("VbBootDeveloper() - " ++ "hold developer mode screen\n")); ++ hold = 1; ++ break; + case 0x0c: + VBDEBUG(("VbBootDeveloper() - " + "user pressed Ctrl+L; Try legacy boot\n")); +@@ -523,7 +530,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + VbCheckDisplayKey(cparams, key, &vnc); + break; + } +- } while(VbAudioLooping(audio)); ++ } while(hold || VbAudioLooping(audio)); + + fallout: + +-- +2.10.2 + diff --git a/projects/vboot/patches/0004-firmware-Screen-blank-and-wait-at-disabled-USB-boot-.patch b/projects/vboot/patches/0004-firmware-Screen-blank-and-wait-at-disabled-USB-boot-.patch @@ -0,0 +1,56 @@ +From 4560df9f84e342ef51cf071dccd01e3fb5838a37 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 10 Aug 2015 23:13:49 +0200 +Subject: [PATCH 4/7] firmware: Screen blank and wait at disabled USB boot + warning + +This blanks the screen before showing the disabled USB boot warning. +It also waits for the user to press any key to come back to the developer mode +screen. + +Change-Id: Ic23f1e0f8d269242a9b7af6941806951016e6eb4 +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + firmware/lib/vboot_api_kernel.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c +index 2e31f08..5cf45ec 100644 +--- a/firmware/lib/vboot_api_kernel.c ++++ b/firmware/lib/vboot_api_kernel.c +@@ -376,6 +376,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + } + } + ++developer_mode_screen: + /* Show the dev mode warning screen */ + VbDisplayScreen(cparams, VB_SCREEN_DEVELOPER_WARNING, 0, &vnc); + +@@ -498,14 +499,23 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + if (!allow_usb) { + VBDEBUG(("VbBootDeveloper() - " + "USB booting is disabled\n")); ++ ++ VbDisplayScreen(cparams, VB_SCREEN_BLANK, 1, ++ &vnc); ++ + VbExDisplayDebugInfo( + "WARNING: Booting from external media " + "(USB/SD) has not been enabled. Refer " + "to the developer-mode documentation " +- "for details.\n"); ++ "for details.\n\n" ++ "Press any key to continue.\n\n"); + VbExBeep(120, 400); + VbExSleepMs(120); + VbExBeep(120, 400); ++ ++ while (!VbExKeyboardRead()) ; ++ ++ goto developer_mode_screen; + } else { + /* + * Clear the screen to show we get the Ctrl+U +-- +2.10.2 + diff --git a/projects/vboot/patches/0005-firmware-Separate-screen-and-wait-at-device-informat.patch b/projects/vboot/patches/0005-firmware-Separate-screen-and-wait-at-device-informat.patch @@ -0,0 +1,80 @@ +From 457f2227845335bed16b190499278a887eca3939 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 10 Aug 2015 23:53:48 +0200 +Subject: [PATCH 5/7] firmware: Separate screen and wait at device information + screen + +This blanks the screen (instead of redrawing it) at device information and +waits for the user to press any key to come back to the developer mode screen. + +Change-Id: I16364e69ce5bbaba5689f9f7af29c593ddea8558 +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + firmware/lib/vboot_api_kernel.c | 12 ++++++++++++ + firmware/lib/vboot_display.c | 13 ++++++++----- + 2 files changed, 20 insertions(+), 5 deletions(-) + +diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c +index 5cf45ec..53ef5c7 100644 +--- a/firmware/lib/vboot_api_kernel.c ++++ b/firmware/lib/vboot_api_kernel.c +@@ -481,6 +481,18 @@ developer_mode_screen: + "hold developer mode screen\n")); + hold = 1; + break; ++ case 0x09: ++ /* Ctrl+I = device information */ ++ VBDEBUG(("VbBootDeveloper() - " ++ "device info\n")); ++ ++ hold = 1; ++ VbDisplayDebugInfo(cparams, &vnc); ++ ++ while (!VbExKeyboardRead()) ; ++ ++ goto developer_mode_screen; ++ break; + case 0x0c: + VBDEBUG(("VbBootDeveloper() - " + "user pressed Ctrl+L; Try legacy boot\n")); +diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c +index 50a2e54..6d8ed92 100644 +--- a/firmware/lib/vboot_display.c ++++ b/firmware/lib/vboot_display.c +@@ -544,7 +544,7 @@ const char *RecoveryReasonString(uint8_t code) + return "We have no idea what this means"; + } + +-#define DEBUG_INFO_SIZE 512 ++#define DEBUG_INFO_SIZE 768 + + VbError_t VbDisplayDebugInfo(VbCommonParams *cparams, VbNvContext *vncptr) + { +@@ -559,8 +559,8 @@ VbError_t VbDisplayDebugInfo(VbCommonParams *cparams, VbNvContext *vncptr) + VbError_t ret; + uint32_t i; + +- /* Redisplay current screen to overwrite any previous debug output */ +- VbDisplayScreen(cparams, disp_current_screen, 1, vncptr); ++ /* Blank screen */ ++ VbDisplayScreen(cparams, VB_SCREEN_BLANK, 1, vncptr); + + /* Add hardware ID */ + VbRegionReadHWID(cparams, hwid, sizeof(hwid)); +@@ -669,8 +669,11 @@ VbError_t VbDisplayDebugInfo(VbCommonParams *cparams, VbNvContext *vncptr) + used += StrnAppend(buf + used, sha1sum, DEBUG_INFO_SIZE - used); + } + +- /* Make sure we finish with a newline */ +- used += StrnAppend(buf + used, "\n", DEBUG_INFO_SIZE - used); ++ /* Make sure we finish with newlines */ ++ used += StrnAppend(buf + used, "\n\n", DEBUG_INFO_SIZE - used); ++ ++ used += StrnAppend(buf + used, "Press any key to continue\n\n", ++ DEBUG_INFO_SIZE - used); + + /* TODO: add more interesting data: + * - Information on current disks */ +-- +2.10.2 + diff --git a/projects/vboot/patches/0006-firmware-Localization-keys-removal.patch b/projects/vboot/patches/0006-firmware-Localization-keys-removal.patch @@ -0,0 +1,54 @@ +From 95a6212c5eef956289ab6a70ba0debb89508ce99 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Tue, 11 Aug 2015 00:07:18 +0200 +Subject: [PATCH 6/7] firmware: Localization keys removal + +Since we're using a text-based interface, binding the arrow keys to localization +changes has no effect and only makes the screen flicker. + +Change-Id: I92dfe63d9d0826217653e29d3f26fb0ab29071f1 +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + firmware/lib/vboot_api_kernel.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c +index 53ef5c7..e03e042 100644 +--- a/firmware/lib/vboot_api_kernel.c ++++ b/firmware/lib/vboot_api_kernel.c +@@ -273,7 +273,6 @@ int VbUserConfirms(VbCommonParams *cparams, uint32_t confirm_flags) + return 1; + } + } +- VbCheckDisplayKey(cparams, key, &vnc); + } + VbExSleepMs(CONFIRM_KEY_DELAY); + } +@@ -549,7 +548,6 @@ developer_mode_screen: + break; + default: + VBDEBUG(("VbBootDeveloper() - pressed key %d\n", key)); +- VbCheckDisplayKey(cparams, key, &vnc); + break; + } + } while(hold || VbAudioLooping(audio)); +@@ -613,7 +611,6 @@ VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p) + VbDisplayScreen(cparams, VB_SCREEN_OS_BROKEN, 0, &vnc); + VBDEBUG(("VbBootRecovery() waiting for manual recovery\n")); + while (1) { +- VbCheckDisplayKey(cparams, VbExKeyboardRead(), &vnc); + if (VbWantShutdown(cparams->gbb->flags)) + return VBERROR_SHUTDOWN_REQUESTED; + VbExSleepMs(REC_KEY_DELAY); +@@ -711,8 +708,6 @@ VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p) + i = 4; + break; + } +- } else { +- VbCheckDisplayKey(cparams, key, &vnc); + } + if (VbWantShutdown(cparams->gbb->flags)) + return VBERROR_SHUTDOWN_REQUESTED; +-- +2.10.2 + diff --git a/projects/vboot/patches/0007-firmware-Pass-VbDisplayInfo-information-structure-to.patch b/projects/vboot/patches/0007-firmware-Pass-VbDisplayInfo-information-structure-to.patch @@ -0,0 +1,354 @@ +From aecef39cda6a70c99bf0caff0452e47ad43a68d8 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Sun, 10 Jul 2016 23:43:16 +0200 +Subject: [PATCH 7/7] firmware: Pass VbDisplayInfo information structure to + VbExDisplayScreen + +This provides VbExDisplayScreen with an information structure +(VbDisplayInfo) that contains various context information for display. + +Change-Id: Id9e07bb418f64e9286f07da11314cd63f925e301 +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + firmware/include/vboot_api.h | 12 +++++++++- + firmware/lib/include/vboot_display.h | 2 +- + firmware/lib/vboot_api_kernel.c | 44 ++++++++++++++++++++++++------------ + firmware/lib/vboot_display.c | 15 ++++++------ + firmware/stub/vboot_api_stub.c | 3 ++- + tests/vboot_api_devmode_tests.c | 3 ++- + tests/vboot_api_kernel2_tests.c | 2 +- + tests/vboot_api_kernel3_tests.c | 2 +- + 8 files changed, 55 insertions(+), 28 deletions(-) + +diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h +index 950c1e2..ba53101 100644 +--- a/firmware/include/vboot_api.h ++++ b/firmware/include/vboot_api.h +@@ -697,6 +697,15 @@ enum VbScreenType_t { + VB_SCREEN_OS_BROKEN = 0x208, + }; + ++/* Information on display context */ ++typedef struct VbDisplayInfo { ++ uint32_t allow_usb; ++ uint32_t allow_legacy; ++ uint32_t use_usb; ++ uint32_t use_legacy; ++ uint32_t signed_only; ++} VbDisplayInfo; ++ + /** + * Initialize and clear the display. Set width and height to the screen + * dimensions in pixels. +@@ -725,7 +734,8 @@ VbError_t VbExDisplaySetDimension(uint32_t width, uint32_t height); + * to be simple ASCII text such as "NO GOOD" or "INSERT"; these screens should + * only be seen during development. + */ +-VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale); ++VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale, ++ VbDisplayInfo *info); + + /** + * Write an image to the display, with the upper left corner at the specified +diff --git a/firmware/lib/include/vboot_display.h b/firmware/lib/include/vboot_display.h +index 0ab93f0..0574580 100644 +--- a/firmware/lib/include/vboot_display.h ++++ b/firmware/lib/include/vboot_display.h +@@ -15,7 +15,7 @@ + VbError_t VbDisplayScreenFromGBB(VbCommonParams *cparams, uint32_t screen, + VbNvContext *vncptr, uint32_t locale); + VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen, int force, +- VbNvContext *vncptr); ++ VbNvContext *vncptr, VbDisplayInfo *info); + VbError_t VbDisplayDebugInfo(VbCommonParams *cparams, VbNvContext *vncptr); + VbError_t VbCheckDisplayKey(VbCommonParams *cparams, uint32_t key, + VbNvContext *vncptr); +diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c +index e03e042..7dcc754 100644 +--- a/firmware/lib/vboot_api_kernel.c ++++ b/firmware/lib/vboot_api_kernel.c +@@ -300,11 +300,13 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + VbSharedDataHeader *shared = + (VbSharedDataHeader *)cparams->shared_data_blob; + ++ VbDisplayInfo info; + uint32_t allow_usb = 0; + uint32_t allow_legacy = 0; + uint32_t disable_dev_boot = 0; + uint32_t use_usb = 0; + uint32_t use_legacy = 0; ++ uint32_t signed_only = 0; + uint32_t default_boot = 0; + uint32_t ctrl_d_pressed = 0; + uint32_t hold = 0; +@@ -350,10 +352,22 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + } + } + ++ VbNvGet(&vnc, VBNV_DEV_BOOT_SIGNED_ONLY, &signed_only); ++ ++ if (fwmp.flags & FWMP_DEV_ENABLE_OFFICIAL_ONLY) ++ signed_only = 1; ++ ++ info.allow_usb = allow_usb; ++ info.allow_legacy = allow_legacy; ++ info.use_usb = use_usb; ++ info.use_legacy = use_legacy; ++ info.signed_only = signed_only; ++ + /* If dev mode is disabled, only allow TONORM */ + while (disable_dev_boot) { + VBDEBUG(("%s() - dev_disable_boot is set.\n", __func__)); +- VbDisplayScreen(cparams, VB_SCREEN_DEVELOPER_TO_NORM, 0, &vnc); ++ VbDisplayScreen(cparams, VB_SCREEN_DEVELOPER_TO_NORM, 0, &vnc, ++ NULL); + VbExDisplayDebugInfo(dev_disable_msg); + + /* Ignore space in VbUserConfirms()... */ +@@ -363,7 +377,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + VbNvSet(&vnc, VBNV_DISABLE_DEV_REQUEST, 1); + VbDisplayScreen(cparams, + VB_SCREEN_TO_NORM_CONFIRMED, +- 0, &vnc); ++ 0, &vnc, NULL); + VbExSleepMs(5000); + return VBERROR_REBOOT_REQUIRED; + case -1: +@@ -377,7 +391,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p) + + developer_mode_screen: + /* Show the dev mode warning screen */ +- VbDisplayScreen(cparams, VB_SCREEN_DEVELOPER_WARNING, 0, &vnc); ++ VbDisplayScreen(cparams, VB_SCREEN_DEVELOPER_WARNING, 0, &vnc, &info); + + /* Get audio/delay context */ + audio = VbAudioOpen(cparams); +@@ -425,7 +439,7 @@ developer_mode_screen: + } + VbDisplayScreen(cparams, + VB_SCREEN_DEVELOPER_TO_NORM, +- 0, &vnc); ++ 0, &vnc, NULL); + /* Ignore space in VbUserConfirms()... */ + switch (VbUserConfirms(cparams, 0)) { + case 1: +@@ -436,7 +450,7 @@ developer_mode_screen: + VbDisplayScreen( + cparams, + VB_SCREEN_TO_NORM_CONFIRMED, +- 0, &vnc); ++ 0, &vnc, NULL); + VbExSleepMs(5000); + return VBERROR_REBOOT_REQUIRED; + case -1: +@@ -450,7 +464,7 @@ developer_mode_screen: + VbDisplayScreen( + cparams, + VB_SCREEN_DEVELOPER_WARNING, +- 0, &vnc); ++ 0, &vnc, &info); + /* Start new countdown */ + audio = VbAudioOpen(cparams); + } +@@ -512,7 +526,7 @@ developer_mode_screen: + "USB booting is disabled\n")); + + VbDisplayScreen(cparams, VB_SCREEN_BLANK, 1, +- &vnc); ++ &vnc, NULL); + + VbExDisplayDebugInfo( + "WARNING: Booting from external media " +@@ -533,7 +547,7 @@ developer_mode_screen: + * key press. + */ + VbDisplayScreen(cparams, VB_SCREEN_BLANK, 0, +- &vnc); ++ &vnc, NULL); + if (VBERROR_SUCCESS == VbTryUsb(cparams, p)) { + VbAudioClose(audio); + return VBERROR_SUCCESS; +@@ -542,7 +556,7 @@ developer_mode_screen: + VbDisplayScreen( + cparams, + VB_SCREEN_DEVELOPER_WARNING, +- 0, &vnc); ++ 0, &vnc, &info); + } + } + break; +@@ -608,7 +622,7 @@ VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p) + shared->recovery_reason)); + VbSetRecoverySubcode(shared->recovery_reason); + VbNvCommit(); +- VbDisplayScreen(cparams, VB_SCREEN_OS_BROKEN, 0, &vnc); ++ VbDisplayScreen(cparams, VB_SCREEN_OS_BROKEN, 0, &vnc, NULL); + VBDEBUG(("VbBootRecovery() waiting for manual recovery\n")); + while (1) { + if (VbWantShutdown(cparams->gbb->flags)) +@@ -637,7 +651,7 @@ VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p) + VbDisplayScreen(cparams, VBERROR_NO_DISK_FOUND == retval ? + VB_SCREEN_RECOVERY_INSERT : + VB_SCREEN_RECOVERY_NO_GOOD, +- 0, &vnc); ++ 0, &vnc, NULL); + + /* + * Scan keyboard more frequently than media, since x86 +@@ -677,7 +691,7 @@ VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p) + /* Ask the user to confirm entering dev-mode */ + VbDisplayScreen(cparams, + VB_SCREEN_RECOVERY_TO_DEV, +- 0, &vnc); ++ 0, &vnc, NULL); + /* SPACE means no... */ + uint32_t vbc_flags = + VB_CONFIRM_SPACE_MEANS_NO | +@@ -839,7 +853,7 @@ static VbError_t EcUpdateImage(int devidx, VbCommonParams *cparams, + return VBERROR_VGA_OPROM_MISMATCH; + } + +- VbDisplayScreen(cparams, VB_SCREEN_WAIT, 0, &vnc); ++ VbDisplayScreen(cparams, VB_SCREEN_WAIT, 0, &vnc, NULL); + } + + rv = VbExEcUpdateImage(devidx, select, expected, expected_size); +@@ -1250,13 +1264,13 @@ VbError_t VbSelectAndLoadKernel(VbCommonParams *cparams, + p.boot_flags |= BOOT_FLAG_RECOVERY; + retval = VbBootRecovery(cparams, &p); + VbExEcEnteringMode(0, VB_EC_RECOVERY); +- VbDisplayScreen(cparams, VB_SCREEN_BLANK, 0, &vnc); ++ VbDisplayScreen(cparams, VB_SCREEN_BLANK, 0, &vnc, NULL); + + } else if (p.boot_flags & BOOT_FLAG_DEVELOPER) { + /* Developer boot */ + retval = VbBootDeveloper(cparams, &p); + VbExEcEnteringMode(0, VB_EC_DEVELOPER); +- VbDisplayScreen(cparams, VB_SCREEN_BLANK, 0, &vnc); ++ VbDisplayScreen(cparams, VB_SCREEN_BLANK, 0, &vnc, NULL); + + } else { + /* Normal boot */ +diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c +index 6d8ed92..84b7961 100644 +--- a/firmware/lib/vboot_display.c ++++ b/firmware/lib/vboot_display.c +@@ -321,7 +321,7 @@ VbError_t VbDisplayScreenFromGBB(VbCommonParams *cparams, uint32_t screen, + */ + static VbError_t VbDisplayScreenLegacy(VbCommonParams *cparams, uint32_t screen, + int force, VbNvContext *vncptr, +- uint32_t locale) ++ uint32_t locale, VbDisplayInfo *info) + { + VbError_t retval; + +@@ -336,7 +336,7 @@ static VbError_t VbDisplayScreenLegacy(VbCommonParams *cparams, uint32_t screen, + VbExDisplayBacklight(VB_SCREEN_BLANK == screen ? 0 : 1); + + /* Display default first */ +- if (VBERROR_SUCCESS == VbExDisplayScreen(screen, locale)) ++ if (VBERROR_SUCCESS == VbExDisplayScreen(screen, locale, info)) + return VBERROR_SUCCESS; + + /* If default doesn't have anything to show, fall back to GBB bitmaps */ +@@ -344,7 +344,7 @@ static VbError_t VbDisplayScreenLegacy(VbCommonParams *cparams, uint32_t screen, + } + + VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen, +- int force, VbNvContext *vncptr) ++ int force, VbNvContext *vncptr, VbDisplayInfo *info) + { + uint32_t locale; + VbError_t rv; +@@ -357,7 +357,7 @@ VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen, + VbNvGet(vncptr, VBNV_LOCALIZATION_INDEX, &locale); + + rv = VbDisplayScreenLegacy(cparams, screen, force, vncptr, +- locale); ++ locale, info); + + if (rv == VBERROR_SUCCESS) + /* Keep track of the currently displayed screen */ +@@ -560,7 +560,7 @@ VbError_t VbDisplayDebugInfo(VbCommonParams *cparams, VbNvContext *vncptr) + uint32_t i; + + /* Blank screen */ +- VbDisplayScreen(cparams, VB_SCREEN_BLANK, 1, vncptr); ++ VbDisplayScreen(cparams, VB_SCREEN_BLANK, 1, vncptr, NULL); + + /* Add hardware ID */ + VbRegionReadHWID(cparams, hwid, sizeof(hwid)); +@@ -725,13 +725,14 @@ VbError_t VbCheckDisplayKey(VbCommonParams *cparams, uint32_t key, + #endif + + /* Force redraw of current screen */ +- return VbDisplayScreen(cparams, disp_current_screen, 1, vncptr); ++ return VbDisplayScreen(cparams, disp_current_screen, 1, vncptr, ++ NULL); + } + + if (0 == memcmp(MagicBuffer, MAGIC_WORD, MAGIC_WORD_LEN)) { + if (VBEASTEREGG) + (void)VbDisplayScreen(cparams, disp_current_screen, +- 1, vncptr); ++ 1, vncptr, NULL); + } + + return VBERROR_SUCCESS; +diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c +index 717c0f8..c086195 100644 +--- a/firmware/stub/vboot_api_stub.c ++++ b/firmware/stub/vboot_api_stub.c +@@ -41,7 +41,8 @@ VbError_t VbExDisplaySetDimension(uint32_t width, uint32_t height) + return VBERROR_SUCCESS; + } + +-VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale) ++VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale, ++ VbDisplayInfo *info) + { + return VBERROR_SUCCESS; + } +diff --git a/tests/vboot_api_devmode_tests.c b/tests/vboot_api_devmode_tests.c +index abd8e85..6e8afbd 100644 +--- a/tests/vboot_api_devmode_tests.c ++++ b/tests/vboot_api_devmode_tests.c +@@ -265,7 +265,8 @@ VbError_t VbExBeep(uint32_t msec, uint32_t frequency) { + return beep_return; + } + +-VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale) { ++VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale, ++ VbDisplayInfo *info) { + switch(screen_type) { + case VB_SCREEN_BLANK: + VBDEBUG(("VbExDisplayScreen(BLANK)\n")); +diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c +index 433933b..d44fc1e 100644 +--- a/tests/vboot_api_kernel2_tests.c ++++ b/tests/vboot_api_kernel2_tests.c +@@ -185,7 +185,7 @@ uint32_t VbTryLoadKernel(VbCommonParams *cparams, LoadKernelParams *p, + } + + VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen, int force, +- VbNvContext *vncptr) ++ VbNvContext *vncptr, VbDisplayInfo *info) + { + if (screens_count < ARRAY_SIZE(screens_displayed)) + screens_displayed[screens_count++] = screen; +diff --git a/tests/vboot_api_kernel3_tests.c b/tests/vboot_api_kernel3_tests.c +index 3eddb73..0403c71 100644 +--- a/tests/vboot_api_kernel3_tests.c ++++ b/tests/vboot_api_kernel3_tests.c +@@ -195,7 +195,7 @@ VbError_t VbExEcUpdateImage(int devidx, enum VbSelectFirmware_t select, + } + + VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen, int force, +- VbNvContext *vncptr) ++ VbNvContext *vncptr, VbDisplayInfo *info) + { + if (screens_count < ARRAY_SIZE(screens_displayed)) + screens_displayed[screens_count++] = screen; +-- +2.10.2 + diff --git a/projects/vboot/vboot b/projects/vboot/vboot @@ -0,0 +1,147 @@ +#!/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/>. + +arguments() { + project_arguments_targets "$project" "$@" +} + +usage() { + project_usage_actions "$project" "checkout" + project_usage_arguments "$project" "$@" +} + +download() { + local repository=$project + + project_download_git "$project" "$repository" "https://chromium.googlesource.com/chromiumos/platform/vboot_reference https://review.coreboot.org/vboot.git https://github.com/coreboot/vboot.git" "$@" +} + +download_check() { + project_download_check_git "$project" "$repository" "$@" +} + +extract() { + project_extract "$project" "$@" +} + +extract_check() { + project_extract_check "$project" "$@" +} + +update() { + local repository=$project + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository=$project + + project_update_check_git "$project" "$repository" "$@" +} + +checkout() { + local repository=$project + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi +} + +build() { + local target=$1 + + local repository=$project + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + fi + + if [ "$target" = "tools" ] + then + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local build_path=$( project_build_path "$project" "$@" ) + + mkdir -p "$build_path" + + make -C "$sources_path" BUILD="$build_path" -j$TASKS "host_stuff" + make -C "$sources_path" BUILD="$build_path" -j$TASKS "host_stuff" + + cp -r "$sources_path/tests/devkeys" "$build_path" + fi +} + +build_check() { + local target=$1 + + if [ "$target" = "tools" ] + then + project_build_check "$project" "$@" + fi +} + +install() { + local target=$1 + + if [ "$target" = "tools" ] + then + project_install "$project" "$@" + fi +} + +install_check() { + local target=$1 + + if [ "$target" = "tools" ] + then + project_install_check "$project" "$@" + fi +} + +release() { + local target=$1 + + local repository=$project + + if [ "$target" = "tools" ] + then + project_release_install_archive "$project" "$TOOLS" "$@" + fi + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local target=$1 + + local repository=$project + + if [ "$target" = "tools" ] + then + project_release_install_archive_check "$project" "$TOOLS" "$@" + fi + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/tools/blobs-discover/blobs-discover b/tools/blobs-discover/blobs-discover @@ -0,0 +1,184 @@ +#!/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/>. + +arguments() { + local project=$1 + + if [ -z "$project" ] + then + ls -A "$root/$PROJECTS/" | while read project + do + echo "$project" + done + else + shift + project_action_helper "arguments" "$project" "$@" + fi +} + +usage() { + tool_usage_actions "$tool" "verify" + tool_usage_arguments "$tool" "$@" +} + +update() { + local sources_path=$( tool_sources_path "$tool" ) + local deblob_check_path="$sources_path/deblob-check" + + wget "https://www.fsfla.org/svn/fsfla/software/linux-libre/scripts/deblob-check" -O "$deblob_check_path" + perl -0777 -i -pe "s/ blobna \(\) \{[^\}]*\}/ blobna () \{\n true\n \}/" "$deblob_check_path" + perl -0777 -i -pe "s/ blobname \(\) \{[^\}]*\}/ blobname () \{\n true\n \}/" "$deblob_check_path" + chmod a+x "$deblob_check_path" +} + +verify() { + local project=$1 + shift + + local project_path=$( project_path "$project" ) + local project_sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local project_blobs_path=$( project_blobs_path "$project" ) + local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" ) + local project_blobs_discover_path + + local ifs_save + local file + local choice + + requirements "sort" + + if ! [ -z "$project_blobs_path" ] + then + project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" + else + project_blobs_discover_path="$project_path/$CONFIGS/$BLOBS_DISCOVER" + fi + + file_exists_check "$project_blobs_discover_path" + + # This it to allow space characters in arguments. + ifs_save=$IFS + IFS=$'\n' + + for file in $( cat "$project_blobs_discover_path" ) + do + ( + IFS=$ifs_save + + printf "\nDiscovered blob: $file\n" + + $EDITOR "$project_sources_path/$file" + + printf "Type \"blob\" to keep or press enter to discard: " + read choice + + if [ "$choice" = "blob" ] + then + echo "$file" >> "$project_blobs_path" + else + echo "$file" >> "$project_blobs_ignore_path" + fi + + sed "\|^$file$|d" -i "$project_blobs_discover_path" + ) < /dev/tty + done + + IFS=$ifs_save + + rm "$project_blobs_discover_path" + + sort -o "$project_blobs_path" "$project_blobs_path" + sort -o "$project_blobs_ignore_path" "$project_blobs_ignore_path" +} + +execute() { + local project=$1 + shift + + local repository=$project + local repository_path=$( git_project_repository_path "$repository" ) + + # This assumes that the repository is the project, which is not always the case. + project_sources_directory_missing_empty_error "$project" "$repository" + + local sources_path=$( tool_sources_path "$tool" ) + local project_path=$( project_path "$project" ) + local project_sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local project_blobs_path=$( project_blobs_path "$project" ) + local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" ) + local project_blobs_directory_path + + if ! [ -z "$project_blobs_path" ] + then + project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" + else + project_blobs_discover_path="$project_path/$CONFIGS/$BLOBS_DISCOVER" + fi + + local deblob_check_path="$sources_path/deblob-check" + + if git_project_check "$repository" + then + git_project_checkout "$project" "$repository" "$@" + git_clean "$repository_path" + fi + + printf "\nDiscovering new blobs, this may take a while...\n" + + files=$( cd "$project_sources_path" ; find * -type f | grep -vP "\.git/|\.tar|\.patch" ) + + touch "$project_blobs_discover_path" + + echo "$files" | while read file + do + if ! [ -z "$project_blobs_ignore_path" ] + then + match=$( grep "$file" "$project_blobs_ignore_path" || true) + if [ ! -z "$match" ] + then + continue + fi + fi + + match=$( cd "$project_sources_path" ; "$deblob_check_path" "$file" || true ) + if ! [ -z "$match" ] + then + echo "$match" >> "$project_blobs_discover_path" + fi + done + + printf "\nDiscovered blobs were stored in $project_blobs_discover_path\n" +} + +execute_check() { + local project=$1 + shift + + local project_path=$( project_path "$project" ) + local project_blobs_path=$( project_blobs_path "$project" ) + local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" ) + local project_blobs_discover_path + + if ! [ -z "$project_blobs_path" ] + then + project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" + else + project_blobs_discover_path="$project_path/$CONFIGS/$BLOBS_DISCOVER" + fi + + file_exists_check "$project_blobs_discover_path" +} diff --git a/tools/blobs-discover/sources/deblob-check b/tools/blobs-discover/sources/deblob-check @@ -0,0 +1,8812 @@ +#! /bin/sh + +# deblob-check version 2016-11-29 +# Inspired in gNewSense's find-firmware script. +# Written by Alexandre Oliva <lxoliva@fsfla.org> + +# Check http://www.fsfla.org/svn/fsfla/software/linux-libre for newer +# versions. + +# Copyright 2008-2016 Alexandre Oliva <lxoliva@fsfla.org> +# +# This program is part of GNU Linux-libre, a GNU project that +# publishes scripts to clean up Linux so as to make it suitable for +# use in the GNU Project and in Free System Distributions. +# +# 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + + +# usage: deblob-check [-S] [-v] [-v] [-s S] [--reverse-patch] \ +# [--use-...|--gen-flex] [-lDdBbCcXxPpFftVh?H] \ +# *.tar* patch-* [-i prefix/] *.patch *.diff... + +# Look for and report too-long undocumented sequences of numbers +# (generally blobs in disguise) in source files, as well as requests +# for loading non-Free firmware. + +# The order of command line flags is significant. Flags given out of +# the order above won't be handled correctly, sorry. + +# -s --sensitivity: Specifies the number of consecutive integral or +# character constants that trigger the blob detector. +# Must be followed by a blank and a number. + +# --reverse-patch: Test the removed parts of a patch, rather than +# the added ones. + +# --use-awk: Choose the internal GNU awk script for the bulk of the +# work. This is the default option, if GNU awk is found. +# The awk interpreter is named gawk, unless AWK is set. + +# --use-sed: Choose the internal GNU sed script for the bulk of the +# work. This is the default option, if GNU awk is not +# found. + +# --use-python: Choose the internal python script. This is not +# recommended, because the regular expressions we use +# invoke exponential behavior in the python engine. + +# --use-perl: Choose the internal perl script. This is not +# recommended, because our regular expressions exceed +# some limits hard-coded into perl. + +# --save-script-input: Save the input that would have been fed to +# any of the engines above. + +# --gen-flex: Generate a flex input file with all known blob and +# false positive patterns. It would have been a fast +# regular expression processor if only the flex program +# completed in reasonable time. + + +# The default sensitivity is 32 constants. + +# The sensitivity, if present, must be the first option. The action +# selection, if present, must be the first argument, except for the +# sensitivity and verbosity. + +# The default can be overridden with one of: + +# -l --list-blobs: list files that contain sequences that match the +# blob detector test and that are not known to be false +# positives. This is the default option. + +# -d --deblob --mark-blobs: print the processed input, replacing +# sequences that match the blob detector test and that +# are NOT known to be false positives with +# /*(DEBLOBBED)*/. + +# -D --cat: print the processed input, as it would have been fed to +# the blob detector script. Use -S to save the sed +# script used to process it, and search for `sedcat:' in +# comments to locate the relevant adaptation points. + +# -b --print-marked-blobs: like -d, but print only the matching +# sequences. + +# -B --print-blobs: like -b, but do not deblob the sequences. + +# -c --print-marked-blobs-with-context: like -b, but try to maximize +# the context around the blobs. This maximization will +# sometimes disregard known false positives, if they +# happen to be contained within the extended match. +# This is probably an indication that the false positive +# matching rule could be improved. + +# -C --print-blobs-with-context: like -B, but try to maximize the +# context around the blobs. + +# -X --print-all-matches: print all blobs, be they known false +# positives or actual blobs. + +# -x --list-all-matches: list files that contain sequences that appear +# to be blobs, be they known false positives or not. + +# -p --mark-false-positives: print the processed input, replacing +# sequences that match the blob detector test, even those +# known to be false positives, with /*(DEBLOBBED)*/. + +# -P --list-false-positives: list files that contain false positives. + +# -f --print-marked-false-positives: like -p, but print only the +# matching sequences. + +# -F --print-false-positives: like -f, but do not deblob the sequences. + +# -t --test: run (very minimal) self-test. + +# -V --version: print a version number + +# -h -? -H --help: print short or long help message + + +# debugging options: + +# -S --save-scripts: save scripts and temporary files. + +# -v --verbose: increase verbosity level, for internal debugging. May +# be given at most twice. + + +# file options: + +# --: Don't process command-line options any further. All following +# arguments are taken as filenames. + +# -i --implied-prefix --prefix: prepend the given prefix to each filename +# listed after this option, when configuring false positives +# and negatives. + +# *.tar*: iterate over all files in the named tar file. + +# *.patch, patch-*, *.diff: Look for blobs in the [ +] parts of the +# *patch, unless --reverse-patch is given, in which case +# the [ -] parts will be used. + +# Anything else is assumed to be a source file. + +# *.gz | *.bz2 | *.xz | *.lz: Decompress automatically. + + +# The exit status is only significant for the --list options: it will +# be true if nothing was found, and false otherwise. + +: # Mark the end of the help message. + +# TODO: + +# - Improve handling of command-line arguments, so as to not make the +# order relevant. + +# - Add an option for the user to feed their own false positive +# patterns. + +# - Add support to recognize known blobs (or other non-Free +# signatures, really), to speed up the scanning of files containing +# blobs, and to avoid attempts to disguise blobs. + +# - Factor out the code in the various print_* and list_* parts of the +# sed script, at least in the shell sources. Make sure they're all +# included and expanded in a saved --cat script though. + +# - Add support for file name tagging in patterns, such that blobs or +# false positives are recognized only when handling the specific +# filename, be it stand-alone, as part of a patch or a tarball. This +# should help avoid recognition of actual blobs as false positives +# just because there's a symbol with a different name elsewhere. + +# It is convenient that the patterns provided by the user to +# recognize file names can be empty (for backward compatibility), but +# this should ideally be phased out in favor of more precise matches. +# It's important that files can be recognized with leading tarball or +# patch names, that the filename used within the tarball contain +# leading garbage, and even that a partial pathname be recognizable +# (say recognize drivers/net/whatever.c when the input file is named +# ../net/whatever.c). + +# Rather than using regular expressions to recognize multiple files +# it's convenient (but not quite essential) that filename patterns be +# specifiable as regular expressions, rather than simple filenames, +# but there are other ways around this. + +# Maintaining begin/end markers in a stack-like fashion as part of +# the processed stream, and using the names in them as (optional) part +# of the recognition patterns, would enable us to do it. + +# Introducing annotations next to the false positives (and recognized +# blobs) as an early part of the process may speed things up and +# enable fast processing, but how to introduce the annotations quickly +# in the first place? Given patterns such as + +# \(\(file1\)\(.*\)\(pat1\)\|\(file2\)\(.*\)\(pat2\)\|...\) + +# how do we get sed to introduce a marker that contains file2 right +# before or right after pat2, without turning a big efficient regexp +# into a slowish sequence of s/// commands? + +# - Re-check and narrow false-positive patterns to make sure they +# apply only to the relevant content. + +# - Scripting abilities, so as to be able to automate the removal of +# source files or of blobs from source files in a tarball without +# having to extract the entire tarball (as in tar --update/--delete) +# would be nice. Carrying over removed files automatically into +# patches would also be great, and this sort of script would be +# perfect to document what has been done to a tarball plus a set of +# patches. Something like deblob.script: +# +# tarball linux-2.6.24.tar.bz2 +# delete net/wireloss/freedom.c drivers/me/crazy.c +# deblob include/linux/slab-blob-kfree.h +# deconfig drivers/char/drm DRM_IS_BAD +# +# patch patch-2.6.25-rc7.bz2 +# delete arch/power/over/you.c + +# such that the deletes from an earlier file would carry over into the +# subsequent ones, and new tarballs and patch files would be generated +# with the libre- prefix in their basename, and the xdeltas between +# the original files and the modified files would be minimal, and +# redundant with this script and the input script while at that. + +# - Improve documentation of the code. + +# - Write a decent testsuite. + +# - Insert your idea here. :-) + +# Yeah, lots of stuff to do. Want to help? + +# This makes it much faster, and mostly immune to non-ASCII stuff, as +# long as a 8-bit-safe sed is used. Probably a safe assumption these +# days. +LC_ALL=C; export LC_ALL +LANGUAGE=C; export LANGUAGE + +rm="rm -f" + +for echo in 'echo' 'printf %s\n'; do + case `$echo '\nx'` in + '\nx') break;; + esac +done +case `$echo '\nx'` in +'\nx') ;; *) echo Cannot find out what echo to use >&2; exit 1;; +esac + +for echo_n in "echo -n" "printf %s"; do + case `$echo_n '\na'; $echo_n '\nb'` in + '\na\nb') break;; + esac +done +case `$echo_n a; $echo_n b` in +'ab') ;; *) echo Cannot find out an echo -n equivalent to use >&2; exit 1;; +esac + +case $1 in +--save-scripts | -S) + shift + rm="echo preserving" + ;; +esac + +# Choose verbosity level for sed script debugging and performance +# analysis. +case $1 in +--verbose | -v) + shift + case $1 in + --verbose | -v) + shift + v="i\\ +: +p +i\\ +" + vp="2" + ;; + *) + v="P;i\\ +" + vp="1" + ;; + esac + ;; +*) + v="# " + vp="0" + ;; +esac + +sens=31 # 32 - 1 +case $1 in +--sensitivity | -s) + sens=$2; + shift 2 || exit 1 + + if test "$sens" -gt 0 2>/dev/null; then + : + else + echo invalid sensitivity: $sens >&2 + exit 1 + fi + + sens=`expr $sens - 1` + ;; +esac + +reverse_patch=false +case $1 in +--reverse-patch) + reverse_patch=: + shift; + ;; +esac + +prefix=/ +case $1 in +--implied-prefix | --prefix| -i) + prefix=$2 + case $prefix in + /*/) ;; + */) prefix=/$prefix ;; + /*) prefix=$prefix/ ;; + *) prefix=/$prefix/ ;; + esac + shift 2 || exit 1 + ;; +esac + +test_mode=false + +name=deblob-check + +set_eqscript_main () { + $set_main_cmd "$@" +} + +set_eqscript_cmd () { + set_eqscript_main "list_blob" +} + +set_sed_cmd () { + set_sed_main " +i\\ +$file\\ +/*(DEBLOB-\\ +ERROR)*/ +q 1" +} + +set_flex_cmd () { + set_flex_main +} + +set_save_script_input_cmd () { + set_save_script_input_main +} + +set_cmd=set_eqscript_cmd +if (${PYTHON-python} --version) > /dev/null 2>&1; then + # Python will exhibit exponential behavior processing some regular + # expressions, but we may have already fixed them all. (see + # http://swtch.com/~rsc/regexp/regexp1.html for details) + set_main_cmd=set_python_main +elif (${AWK-gawk} --re-interval --version) > /dev/null 2>&1; then + # GNU awk works fine, but it requires --re-interval to accept regexp + # ranges, which we rely on to match blobs. We could expand the blob + # on our own, but, yuck. + set_main_cmd=set_awk_main +elif (${PERL-false} --version) > /dev/null 2>&1; then + # Don't choose perl by default. Besides the potential for + # exponential behavior, we exceed some internal recursion limits. + set_main_cmd=set_perl_main +else + # Sed takes GBs of RAM to compile all the huge regexps in the sed + # script we generate with all known false positives and blobs in + # Linux. However, it is somewhat faster than GNU awk and even + # python for long runs. + # Try it: deblob-check --use-sed linux-2.6.32.tar.bz2 + set_cmd=set_sed_cmd +fi + +case $1 in +--use-python) + shift; + set_cmd=set_eqscript_cmd; + set_main_cmd=set_python_main; + ;; + +--use-perl) + shift; + set_cmd=set_eqscript_cmd; + set_main_cmd=set_perl_main; + ;; + +--use-awk) + shift; + set_cmd=set_eqscript_cmd; + set_main_cmd=set_awk_main; + ;; + +--use-sed) + shift; + set_cmd=set_sed_cmd; + ;; + +--gen-flex) + shift; + set_cmd=set_flex_cmd; + ;; + +--save-script-input) + shift; + set_cmd=set_save_script_input_cmd; + ;; +esac + +case $1 in +--version | -V) + ${SED-sed} -e '/^# '$name' version /,/^# Written by/ { s/^# //; p; }; d' < $0 + exit 0 + ;; + +-\? | -h) + ${SED-sed} -n -e '/^# usage:/,/# -h/ { /^# -/,/^$/{s/^# \(-.*\):.*/\1/p; d; }; s/^\(# \?\)\?//p; }' < $0 && + echo + echo "run \`$name --help | more' for full usage" + exit 0 + ;; + +--help | -H) + ${SED-sed} -n -e '/^# '$name' version /,/^[^#]/ s/^\(# \?\)\?//p' < $0 + exit 0 + ;; + +--test | -t) + test_mode=: + ;; + +--mark-false-positives | -p) + shift; + set_sed_cmd () { + set_sed_main "b list_both" "p" "b list_matches" + } + set_eqscript_cmd () { + set_eqscript_main "replace_blob = print_blob = without_falsepos" + } + ;; + +--print-marked-false-positives | -f) + shift; + set_sed_cmd () { + set_sed_main "b print_marked_matches" "" "b print_marked_matches" + } + set_eqscript_cmd () { + set_eqscript_main "replace_falsepos = print_falsepos" + } + ;; + +--print-false-positives | -F) + shift; + set_sed_cmd () { + set_sed_main "b print_matches" "" "b print_matches" + } + set_eqscript_cmd () { + set_eqscript_main "print_falsepos" + } + ;; + +--deblob | --mark-blobs | -d) + shift; + set_sed_cmd () { + set_sed_main "b list_blobs" "p" "p" + } + set_eqscript_cmd () { + set_eqscript_main "replace_blob = print_blob = print_falsepos = print_nomatch" + } + ;; + +--cat | -D) + shift; + set_sed_cmd () { + set_sed_main \ + "# sedcat: Actual blob detected, but there may be false positives." \ + "# sedcat: No blob whatsoever found." \ + "# sedcat: False positives found." \ + "p +d +# sedcat: Just print stuff, remove this line to run the actual script." + } + set_eqscript_cmd () { + set_eqscript_main "print_blob = print_falsepos = print_nomatch" + } + ;; + +--print-marked-blobs | -b) + shift; + set_sed_cmd () { + set_sed_main "b print_marked_blobs" + } + set_eqscript_cmd () { + set_eqscript_main "replace_blob = print_blob" + } + ;; + +--print-blobs | -B) + shift; + set_sed_cmd () { + set_sed_main "b print_blobs" + } + set_eqscript_cmd () { + set_eqscript_main "print_blob" + } + ;; + +--print-marked-blobs-with-context | -c) + shift; + set_sed_cmd () { + set_sed_main "b print_marked_cblobs" + } + set_eqscript_cmd () { + set_eqscript_main "with_context = replace_blob = print_blob" + } + ;; + +--print-blobs-with-context | -C) + shift; + set_sed_cmd () { + set_sed_main "b print_cblobs" + } + set_eqscript_cmd () { + set_eqscript_main "with_context = print_blob" + } + ;; + +--list-false-positives | -P) + shift; + set_sed_cmd () { + set_sed_main "" "" " +i\\ +$file\\ +/*(DEBLOB-\\ +ERROR)*/ +q 1" + } + set_eqscript_cmd () { + set_eqscript_main "list_falsepos" + } + ;; + +--list-all-matches | -x) + shift; + set_sed_cmd () { + set_sed_main " +i\\ +$file\\ +/*(DEBLOB-\\ +ERROR)*/ +q 1" "" " +i\\ +$file\\ +/*(DEBLOB-\\ +ERROR)*/ +q 1" + } + set_eqscript_cmd () { + set_eqscript_main "list_blob = list_falsepos" + } + ;; + +--print-all-matches | -X) + shift; + set_sed_cmd () { + set_sed_main "b print_both" "" "b print_matches" + } + set_eqscript_cmd () { + set_eqscript_main "print_blob = print_falsepos" + } + ;; + +*) + case $1 in + --list-blobs | -l) shift;; + esac + case $1 in + -- | --implied-prefix | --prefix | -i) ;; + -*) + if test ! -f "$1"; then + echo "$name: \`$1' given too late or out of the proper sequence." >&2 + echo "$name: The order of arguments is significant, see the usage." >&2 + exit 1 + fi + ;; + esac + ;; + +esac + +case $1 in +--) + sawdashdash=t + shift;; +esac + +if $test_mode; then + allpass=: + for tool in awk perl python sed; do + echo testing $tool... + + targs="-s 4 -i /deblob-check-testsuite/ --use-$tool" + + pass=: + + + # Exercise some nasty inputs to see that we + # recognize them as blobs with full context. + test="positive context" + for string in \ + "1,2,3,4" \ + "= { +1, 0x2, 03, L'\x4' +}" \ + "= +{ + '\\x1', '\\002' + , + { + { \"\\x3\", }, + \"\\004\" + }, +};" \ + ".long 1,2 + .long \$3,\$4" \ + "#define X { 1, 2, \\ + 3, 4, /* comment */ \\ + }" \ + "= { +/* + * multi-line + * comment + */ + { + 0x4c00c000, 0x00000000, 0x00060000, 0x00000000, + }, +}" \ + "= { +blob( +) +accept( +) +1, 2, 3, 4 +}" \ + ; do + case `echo "$string" | $0 $targs -C` in + "::: - ::: +$string") ;; + *) echo "failed $test test for: +$string" >&2 + pass=false;; + esac + done + + # Make sure we do not recognize these as blobs. + test=negative + for string in \ + "#define X { 1, 2 } +#define Y { 3, 4 }" \ + " 0x00, 0x00, 0x00 " \ + "accept(1, 2, 3, +4, 5, 6)" \ + ; do + case `echo "$string" | $0 $targs` in + "") ;; + *) echo "failed $test test for: +$string" >&2 + pass=false;; + esac + done + + # Make sure we print only the lines with blobs. + test="only blob" + odd=: + for string in \ + "= { +1, 0x2, 03, L'\x4' +}" \ + "1, 0x2, 03, L'\x4'" \ +\ + "= +{ + '\\x1', '\\002' + , + { + { \"\\x3\", }, + \"\\004\" + }, +};" \ + " '\\x1', '\\002' + , + { + { \"\\x3\", }, + \"\\004\"" \ +\ + ".long 1,2 + .long \$3,\$4" \ + ".long 1,2 + .long \$3,\$4" \ +\ + "#define X { 1, 2, \\ + 3, 4, /* comment */ \\ + }" \ + "#define X { 1, 2, \\ + 3, 4, /* comment */ \\" \ +\ + "= { +/* + * multi-line + * comment + */ + { + 0x4c00c000, 0x00000000, 0x00060000, 0x00000000, + }, +}" \ + " 0x4c00c000, 0x00000000, 0x00060000, 0x00000000," \ +\ + "MODULE_FIRMWARE(x); +MODULE_FIRMWARE(y); +1, 2, 3, 4; 5, 6, 7, 8; +9, 10, 11" \ + "MODULE_FIRMWARE(x); +MODULE_FIRMWARE(y); +::: - ::: +1, 2, 3, 4; 5, 6, 7, 8;" \ +\ + "= { +blob() +accept() +1, 2, 3, 4 +}" \ + "blob() +::: - ::: +1, 2, 3, 4" \ +\ + "a blobeol y +x" \ + "a blobeol y +x" \ +\ + ; do + if $odd; then + input=$string odd=false + continue + fi + case `echo "$input" | $0 $targs -B` in + "::: - ::: +$string") ;; + *) + echo "failed $test test for: +$input" >&2 + pass=false + ;; + esac + odd=: + done + $odd || { echo "internal testsuite failure in $test" >&2; } + + # Make sure we deblob only the blobs. + test="deblobs" + odd=: + for string in \ + "= { 1, 0x2, 03, L'\x4' }" \ + "= { /*(DEBLOBBED)*/' }" \ +\ + "= +{ + '\\x1', '\\002' + , + { + { \"\\x3\", }, + \"\\004\" + }, +};" \ + " '\\x/*(DEBLOBBED)*/\"" \ +\ + ".long 1,2 + .long \$3,\$4" \ + ".long /*(DEBLOBBED)*/" \ +\ + "#define X { 1, 2, \\ + 3, 4, /* comment */ \\ + }" \ + "#define X { /*(DEBLOBBED)*/, /* comment */ \\" \ +\ + "= { +/* + * multi-line + * comment + */ + { + 0x4c00c000, 0x00000000, 0x00060000, 0x00000000, + }, +}" \ + " /*(DEBLOBBED)*/," \ +\ + "MODULE_FIRMWARE(x); +MODULE_FIRMWARE(y); +1, 2, 3, 4; 5, 6; 7, 8, 9, 10; +9, 10, 11" \ + "/*(DEBLOBBED)*/ +::: - ::: +/*(DEBLOBBED)*/; 5, 6; /*(DEBLOBBED)*/;" \ +\ + "= { +accept() blob() x blob( +) y +}" \ + "accept() /*(DEBLOBBED)*/ x /*(DEBLOBBED)*/ y" \ +\ + "= { +accept() blob() x blob( +w) y +}" \ + "accept() /*(DEBLOBBED)*/ x /*(DEBLOBBED)*/ y" \ +\ + "a blobeol y +x" \ + "a /*(DEBLOBBED)*/x" \ +\ + ; do + if $odd; then + input=$string odd=false + continue + fi + case `echo "$input" | $0 $targs -b` in + "::: - ::: +$string") ;; + *) + echo "failed $test test for: +$input" >&2 + pass=false + ;; + esac + odd=: + done + $odd || { echo "internal testsuite failure in $test" >&2; } + + # How did we do? + if $pass; then + echo success for $tool + else + allpass=$pass + fi + done + $allpass + exit +fi + +# Call addx as needed to set up more patterns to be recognized as +# false positives. Takes the input filename in $1. + +set_except () { + blob "$blobseq" + # We leave out the initial and final letters of request_firmware so + # that deblobbing turns them into r/*DEBLOBBED*/e, a syntax error. + blobna 'equest_firmwar' + blobna 'equest_ihex_firmwar' + # Catch request_firmare misdeblobbed by the above. + blobname 'r[/][*][(]DEBLOBBED[)][*][/]e' + blobna 'MODULE_FIRMWARE[ ]*[(][^\n;]*[)][ ]*[;]\([ \n]*MODULE_FIRMWARE[ ]*[(][^\n;]*[)][ ]*[;]\)*' + blobna 'DEFAULT_FIRMWARE' + blobna '\([.]\|->\)firmware[ \n]*=[^=]' + blobna 'mod_firmware_load' # sound/ + blobname '[.]\(fw\|bin[0-9]*\|hex\|frm\|co[dx]\|dat\|elf\|xlx\|rfb\|ucode\|img\|sbcf\|ctx\(prog\|vals\)\|z77\|wfw\|inp\|dlmem\|cld\|tftf\)[\\]\?["]' + # Catch misdeblobbed fw extension. + blobname '["][^" \t\n]*[/][*][(]DEBLOBBED[)][*][/][^"\\]' + # Ideally we'd whitelist URLs that don't recommend non-Free + # Software, but there are just too many URLs in Linux, and most are + # fine, so we just blacklist when we find undesirable URLs. + # Please report if you find any inappropriate URL in Linux-libre + # deblobbed documentation, sources or run-time log messages. + # blobna '\(f\|ht\)tp:[/]\([/]\+[^/ \n ]\+\)\+' + + case $prefix$1 in + */*linux*.tar* | */*kernel*.tar* | */*linux-*.*/*) + # false alarms, contain source + # drivers/net/wan/wanxlfw.inc_shipped -> wanxlfw.S + accept 'static[ ]u8[ ]firmware\[\]=[{][\n]0x60,\(0x00,\)*0x16,\(0x00,\)*\([\n]\(0x[0-9A-F][0-9A-F],\)*\)*[\n]0x23,0xFC,0x00,0x00,0x00,0x01,0xFF,0xF9,0x00,0xD4,0x61,0x00,0x06,0x74,0x33,0xFC,\([\n]\(0x[0-9A-F][0-9A-F],\)*\)*0x00[\n][}][;]' + # drivers/usb/serial/xircom_pgs_fw.h -> xircom_pgs.S + initnc 'static[ ]const[ ]struct[ ]ezusb_hex_record[ ]xircom_pgs_firmware\[\][ ]=' + # drivers/usb/serial/keyspan_pda_fw_h -> keyspan_pda.S + initnc 'static[ ]const[ ]struct[ ]ezusb_hex_record[ ]keyspan_pda_firmware\[\][ ]=' + # arch/m68k/ifpsp060/*.sa -> src/*.s + accept '[ ]\.long[ ]0x60ff0000,0x02360000,0x60ff0000,0x16260000[\n]'"$sepx$blobpat*" + accept '[ ]\.long[ ]0x60ff0000,0x17400000,0x60ff0000,0x15f40000[\n]'"$sepx$blobpat*" + # arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped -> spu_save.c + initnc 'static[ ]unsigned[ ]int[ ]spu_save_code\[\][ ][ ]__attribute__[(][(]__aligned__[(]128[)][)][)][ ]=' + # arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped -> spu_restore.c + initnc 'static[ ]unsigned[ ]int[ ]spu_restore_code\[\][ ][ ]__attribute__[(][(]__aligned__[(]128[)][)][)][ ]=' + # drivers/net/ixp2000/ixp2400_tx.ucode -> ixp2400_tx.uc + initnc '[ ]\.initial_reg_values[ ]=[ ][(]struct[ ]ixp2000_reg_value[ ]\[\][)][ ][{]' drivers/net/ixp2000/ixp2400_tx.ucode + # drivers/net/ixp2000/ixp2400_rx.ucode -> ixp2400_rx.uc + initnc '[ ]\.initial_reg_values[ ]=[ ][(]struct[ ]ixp2000_reg_value[ ]\[\][)][ ][{]' drivers/net/ixp2000/ixp2400_rx.ucode + + + # checked: + + accept '[ ][$]3[ ]=[ ][{][{]pge[ ]=[ ][{][{]ste[ ]=[ ][{]\(\([0-9][0-9a-fx{},\n ]*\|\(pge\|ste\)[ ]=\|<repeats[ ][0-9]\+[ ]times>\)[{},\n ]*\)*<repeats[ ]11[ ]times>[}]$' + accept '__clz_tab:[\n][ ]\.byte[ ]0\(,[0-5]\)\+'"$sepx$blobpat*" arch/sparc/lib/divdi3.S + accept 'PITBL:[\n][ ][ ]\.long[ ][ ]0xC0040000,0xC90FDAA2,'"$blobpat*" arch/sparc/lib/divdi3.S + accept '\(0x[0F][0F],\)\+\\[\n]\(\(0x[0F][0F],\)\+\\[\n]\)*\(0x[0F][0F],\)\+0x00' arch/m68k/mac/mac_penguin.S + accept '\.lowcase:[\n][ ]\.byte[ ]0x00\(,0x0[1-7]\)\+'"$sepx$blobpat*"'$' arch/s390/kernel/head.S + accept '_zb_findmap:[\n][ ][ ][ ][ ][ ][ ][ ][ ][ ]\.byte[ ][ ]0\(,[123],0\)\+,4'"$sepx$blobpat*"'$' arch/s390/kernel/bitmap.S + accept '_sb_findmap:[\n][ ][ ][ ][ ][ ][ ][ ][ ][ ]\.byte[ ][ ]8\(,0,[123]\)\+,0'"$sepx$blobpat*"'$' arch/s390/kernel/bitmap.S + accept '[ ]\.section[ ]__ex_table,["]a["]'"$sepx$blobpat*" arch/powerpc/lib/copyuser_64.S + accept '[ ]memcpy[(]src,[ ]["]\\x01\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00["].*PROGxxxx' arch/powerpc/platforms/iseries/mf.c + initnc 'static[ ]const[ ]unsigned[ ]int[ ]cpu_745x\[2\]\[16\][ ]=' arch/ppc/platforms/ev64260.c + initnc 'const[ ]unsigned[ ]char[ ]__flsm1_tab\[256\][ ]=' arch/alpha/lib/fls.c + accept '#define[ ]_MAP_0_32_ASCII_SEG7_NON_PRINTABLE[ ]\\[\n][ ]\(0,\)\+$' 'drivers/input/misc/map_to_7segment\.h\|include/linux/map_to_7segment\.h' + initc '[ ]static[ ]int[ ][ ][ ][ ][ ][ ]init_values_b\[\][ ]=' sound/oss/ad1848.c + initnc 'static[ ]unsigned[ ]char[ ]atkbd_set2_keycode\[512\][ ]=' drivers/input/keyboard/atkbd.c + accept 'desc_config1:[\n][ ]\.byte[ ]0x09,[ ]0x02'"$sepx$blobpat*" 'drivers/usb/serial/\(keyspan_pda\|xircom_pgs\).S' + accept 'string_mfg:[\n]\?\([;]\?[ ]\.byte[^\n]*[\n]\)\+string_mfg_end:' 'drivers/usb/serial/\(keyspan_pda\|xircom_pgs\).S' + accept 'string_product:[\n]\?\([;]\?[ ]\.byte[^\n]*[\n]\)\+string_product_end:' 'drivers/usb/serial/\(keyspan_pda\|xircom_pgs\).S' + accept '[ ][ ][ ][/][*][ ]\(SQCIF\|QSIF\|QCIF\|SIF\|CIF\|VGA\)[ ][*][/][\n][ ][ ][ ][{][\n][ ][ ][ ][ ][ ][ ][{]'"$blobpat*" drivers/media/video/pwc/pwc-nala.h + accept 'P[13]\([\n]#[^\n]*\)*[\n]*\([\n][0-9 ]*\)\+' drivers/video/logo/*.ppm + accept 'for[ ]i[ ]in[ ][ 0-9\\\n]*[\n]do' 'Documentation/specialix\.txt|Documentation/serial/specialix\.txt' + accept '[ ][ ][ ][ ][ ][ ][ ][ ][ ]:[ ][ ][ ]3600000[ ][ ][ ]3400000[ ][ ][ ]3200000[ ][ ][ ]3000000[ ][ ][ ]2800000[ ]' Documentation/cpu-freq/cpufreq-stats.txt + accept '00[ ]00[\n]64[ ]01[\n]8e[ ]0b[\n][\n][0-9a-f \n]*fe[ ]fe' 'Documentation/scsi/\(sym\|ncr\)53c8xx_2.txt' + accept '0f[ ]00[ ]08[ ]08[ ]64[ ]00[ ]0a[ ]00[ ]-[ ]id[ ]0[\n]'"$blobpat*" 'Documentation/scsi/\(sym\|ncr\)53c8xx_2.txt' + accept 'default[ ]nvram[ ]data:'"$sepx$blobpat*" 'Documentation/scsi/\(sym\|ncr\)53c8xx_2.txt' + accept '0x0458[ ][ ][ ][ ][ ]0x7025[\n]'"$blobpat*" Documentation/video4linux/sn9c102.txt + accept '0x102c[ ][ ][ ][ ][ ]0x6151[\n]'"$blobpat*" Documentation/video4linux/et61x251.txt + accept '0x041e[ ][ ][ ][ ][ ]0x4017[\n]'"$blobpat*" Documentation/video4linux/zc0301.txt + accept '[ ][ ][(]gdb[)][ ]x[/]100x[ ][$]25[\n][ ][ ]0x507d2434:[ ][ ][ ][ ][ ]0x507d2434[ ][ ][ ][ ][ ][ ]0x00000000[ ][ ][ ][ ][ ][ ]0x08048000[ ][ ][ ][ ][ ][ ]0x080a4f8c'"$sepx$blobpat*" Documentation/uml/UserModeLinux-HOWTO.txt + accept '[ ][ ][ ][ ][ ][ ]1[ ][ ]0[ ][ ]0[ ][ ]0[ ][ ]0x308'"$sepx$blobpat*" Documentation/isdn/README.inc + accept 'domain<N>[ ]<cpumask>[ ]1[ ]2[ ]3[ ]4[ ]5[ ]6[ ]7[ ]8[ ]9[ ]10[ ]11[ ]12[ ]13[ ]14[ ]15[ ]16[ ]17[ ]18[ ]19[ ]20[ ]21[ ]22[ ]23[ ]24[ ]25[ ]26[ ]27[ ]28[ ]29[ ]30[ ]31[ ]32[ ]33[ ]34[ ]35[ ]36$' Documentation/sched-stats.txt + accept '[ * ]*0[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]1[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]2[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]3[\n][ * ]*0[ ]1[ ]2[ ]3[ ]4[ ]5[ ]6[ ]7[ ]8[ ]9[ ]0[ ]1[ ]2[ ]3[ ]4[ ]5[ ]6[ ]7[ ]8[ ]9[ ]0[ ]1[ ]2[ ]3[ ]4[ ]5[ ]6[ ]7[ ]8[ ]9[ ]0[ ]1' 'net/\(netfilter\|ipv4\)/ipvs/ip_vs_sync.c|net/sctp/sm_make_chunk.c|include/linux/scpt.h' + accept '[ ][*][ ][ ]1[ ]1[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]1[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0[ ]0' arch/x86/lguest/boot.c + ocomment '[ ][/][*][ ]Configure[ ]the[ ]PCI[ ]bus[ ]bursts[ ]and[ ]FIFO[ ]thresholds.' drivers/net/fealnx.c + ocomment '[/][*][ ]the[ ]original[ ]LUT[ ]values[ ]from[ ]Alex[ ]van[ ]Kaam[ ]<darkside@chello\.nl>' drivers/hwmon/via686a.c + initc 'static[ ]const[ ]unsigned[ ]char[ ]init\[\][ ]=[ ][{][^;]*MODE=0[ ][;].*SAA_7114_NTSC_HSYNC_START' drivers/media/video/saa7114.c + + defsnc 'static[ ]struct[ ]cipher_testvec[ ]\(aes\|anubis\|bf\|camellia\|cts_mode\|des3_ede\|cast6\|salsa20_stream\|serpent\|tf\|tnepres\|xeta\|x\?tea\)\(_\(cbc\|ctr\(_rfc3686\)\?\|xts\)\)\?_\(enc\|dec\)_tv_template\[\][ ]=' 'crypto/\(tcrypt\|testmgr\).h' + defsnc 'static[ ]struct[ ]comp_testvec[ ]\(deflate\|lzo\)_\(de\)\?comp_tv_template\[\][ ]=' 'crypto/\(tcrypt\|testmgr\).h' + defsnc 'static[ ]struct[ ]hash_testvec[ ]\(aes_xcbc128\|crc32c\|hmac_sha2\(24\|56\)\|\(sha\|wp\)\(256\|384\|512\)\)_tv_template\[\][ ]=' 'crypto/\(tcrypt\|testmgr\).h' + # initnc '[ ]*\.\(digest\|entries\|input\|key\|output\|plaintext\|result\)[ \n ]*=[ ][{"]' 'crypto/\(tcrypt\|testmgr\).h' + + defsnc 'static[ ]\(const[ ]\)\?RegInitializer[ ]initData\[\][ ]__initdata[ ]=' 'drivers/ide/ali14xx\.c\|drivers/ide/legacy/ali14xx\.c' + defsnc 'static[ ]const[ ]u8[ ]setup\[\][ ]=' 'drivers/ide/delkin_cb\.c\|drivers/ide/pci/delkin_cb\.c' + defsnc 'static[ ]u8[ ]cvs_time_value\[\]\[XFER_UDMA_6[ ]-[ ]XFER_UDMA_0[ ][+][ ]1\][ ]=' 'drivers/ide/sis5513\.c\|drivers/ide/pci/sis5513\.c' + defsnc 'static[ ]u8[ ]\(act\|ini\|rco\)_time_value\[\]\[8\][ ]=' 'drivers/ide/sis5513\.c\|drivers/ide/pci/sis5513\.c' + defsnc 'static[ ]const[ ]u8[ ]speedtab[ ]\[3\]\[12\][ ]=' 'drivers/ide/umc8672\.c\|drivers/ide/legacy/umc8672\.c' + defsnc 'static[ ]const[ ]s8[ ]\(b43\(legacy\)\?\|bcm43xx\)_tssi2dbm_[bg]_table\[\][ ]=' net/wireless/b43/phy.c + defsnc 'static[ ]const[ ]char[ ]zr360[56]0_dht\[0x1a4\][ ]=' 'drivers/media/video/zr36060\.c\|drivers/media/video/zoran/zr36060\.c' + defsnc 'static[ ]const[ ]char[ ]zr360[56]0_dqt\[0x86\][ ]=' 'drivers/media/video/zr36060\.c\|drivers/media/video/zoran/zr36060\.c' + defsnc 'static[ ]u8[ ]tas3004_treble_table\[\][ ]=' sound/aoa/codecs/tas-basstreble.h + + # This file contains firmwares that we deblob with high + # sensitivity, so make sure the sequences of numbers that are not + # blobs are not deblobbed. FIXME: we should have patterns to + # recognize the blobs instead. + defsnc '[ ]static[ ]const[ ]u32[ ]test_pat\[4\]\[6\][ ]=' drivers/net/tg3.c + accept "[ ][}]\\(,\\?[ ]mem_tbl_5\\(70x\\|705\\|755\\|906\\)\\[\\][ ]=[ ][{]$sepx$blobpat*$sepx[}]\\)*[;]" drivers/net/tg3.c + + # end of generic checked expressions. + # version-specific checked bits start here + + # removed in 2.6.28 + defsnc 'static[ ]unsigned[ ]char[ ]irq_xlate\[32\][ ]=' arch/sparc/kernel/sun4m_irq.c + defsnc 'static[ ]int[ ]logitech_expanded_keymap\[LOGITECH_EXPANDED_KEYMAP_SIZE\][ ]=' drivers/hid/hid-input.c + defsnc '[ ]static[ ]const[ ]\(__\)\?u8[ ]\(read_indexs\|n\(set\)\?[0-9]*\(_other\)\?\|missing\)\[[0-9x]*\][ ]=' drivers/media/video/gspca/t613.c + defsnc 'static[ ]const[ ]u_char[ ]nand_ecc_precalc_table\[\][ ]=' drivers/mtd/nand/nand_ecc.c + oprepline '#define[ ]AR5K_RATES_\(11[ABG]\|TURBO\|XR\)[ ]' drivers/net/wireless/ath5k/ath5k.h + defsnc 'static[ ]const[ ]struct[ ]ath_hal[ ]ar5416hal[ ]=' drivers/net/wireless/ath9k/hw.c + defsnc 'const[ ]unsigned[ ]char[ ]INIT_2\[127\][ ]=' drivers/video/omap/lcd_sx1.c + + # removed in 2.6.24 + accept "[ ]Psize[ ][ ][ ][ ]Ipps[ ][ ][ ][ ][ ][ ][ ]Tput[ ][ ][ ][ ][ ]Rxint[ ][ ][ ][ ][ ]Txint[ ][ ][ ][ ]Done[ ][ ][ ][ ][ ]Ndone[\\n][ ]---------------------------------------------------------------\\([\\n][ 0-9]\\+\\)\\+"'$' + initnc 'static[ ]u_short[ ]ataplain_map\[NR_KEYS\][ ]__initdata[ ]=' + initnc '[ ]static[ ]const[ ]unsigned[ ]char[ ]invert5\[\][ ]=' + initnc 'static[ ]unsigned[ ]char[ ]alpa2target\[\][ ]=' + initnc 'static[ ]unsigned[ ]char[ ]target2alpa\[\][ ]=' + oprepline '#define[ ]INIT_THREAD[ ][{0},]\+[ ]*\\[\n][ ]*[{0},]\+' + initnc 'static[ ]uint[ ]tas300\(1c\|4\)_\(master\|mixer\|treble\|bass\)_tab\[\]=' + initnc 'static[ ]short[ ]dmasound_[au]law2dma16\[\][ ]=' + initnc 'static[ ]const[ ]unsigned[ ]short[ ]DACVolTable\[101\][ ]=' + + # removed in 2.6.23 + initnc 'static[ ]const[ ]UQItype[ ]__clz_tab\[\][ ]=' arch/arm26/lib/udivdi3.c + initnc '[ ]static[ ]unsigned[ ]char[ ]scale\[101\][ ]=' sound/oss/opl3sa2.c + initnc '[}][ ]syncs\[\][ ]=' drivers/scsi/53c7xx.c + initnc 'genoa_md:'"$sepx$blobpat*"'[\n][ ]\.ascii[ ]["]Genoa["]' arch/i386/boot/video.S + + # removed in 2.6.22 + initnc 'Vendor[ ]ID[ ][ ]Product[ ]ID[\n]-\+[ ][ ]-\+[\n]'"$blobpat*" Documentation/video4linux/sn9c102.txt + defsnc 'static[ ]short[ ][au]law2dma16\[\]' arch/ppc/8xx_io/cs4218_tdm.c + defsnc '[ ]static[ ]const[ ]char[ ]minimal_ascii_table\[\]' drivers/ieee1394/csr1212.c + defsnc 'static[ ]u16[ ]key_map[ ]\[256\][ ]=' drivers/media/dvb/ttpci/av7110_ir.c + defsnc 'static[ ]unsigned[ ]char[ ]gf64_inv\[64\][ ]=' drivers/mtd/nand/cafe_ecc.c + defsnc 'static[ ]unsigned[ ]short[ ]err_pos_lut\[4096\][ ]=' drivers/mtd/nand/cafe_ecc.c + defsnc 'static[ ]unsigned[ ]char[ ]testdata\[TESTDATA_LEN\][ ]=' fs/jffs2/comprtest.c + + # added in 2.6.25 + accept "%canned_values[ ]=[ ][(][\\n][ ]\\([0-9]\\+[ ]=>[ ]\\[[ \\n]\\+\\(\\([0-9]\\+\\|\\'0x[0-9a-f]\\+\\'\\),[ \\n]*\\)*\\]\\(,[ ]\\|[\\n]\\)\\)*[)][;]" + + # from 2.6.25-rc* patches + initnc '[ ]int[ ]bcomm_irq\[3[*]16\][ ]=' + initnc '[ ]static[ ]const[ ]int8[ ]countLeadingZerosHigh\[\][ ]=' + initnc 'static[ ]struct[ ]nic_qp_map[ ]nic_qp_mapping_[01]\[\][ ]=' + initnc 'static[ ]struct[ ]regval[ ]ov_initvals\[\][ ]=' drivers/media/usb/stkwebcam/stk-sensor.c + initnc 'static[ ]struct[ ]regval[ ]stk1125_initvals\[\][ ]=' drivers/media/usb/stkwebcam/stk-webcam.c + initnc 'static[ ]u8[ ]bnx2x_stats_len_arr\[BNX2X_NUM_STATS\][ ]=' + defsnc 'static[ ]const[ ]struct[ ]arb_line[ ]read_arb_data\[NUM_RD_Q\]\[MAX_RD_ORD[ ][+][ ]1\][ ]=' drivers/net/bnx2x/bnx2x_init_opts.h + defsnc 'static[ ]const[ ]struct[ ]arb_line[ ]write_arb_data\[NUM_WR_Q\]\[MAX_WR_ORD[ ][+][ ]1\][ ]=' drivers/net/bnx2x/bnx2x_init_opts.h + initnc '[ ][ ][}][ ]blinkrates\[\][ ]=' + initnc 'static[ ]const[ ]struct[ ]ath5k_ini[ ]ar5212_ini\[\][ ]=' + defsnc 'static[ ]const[ ]struct[ ]ath5k_ini_mode[ ]rf5413_ini_mode_end\[\][ ]=' drivers/net/wireless/ath/ath5k/initvals.c + defsnc 'static[ ]const[ ]struct[ ]ath5k_ini_rf[ ]rfregs_5111\[\][ ]=' drivers/net/wireless/ath/ath5k/rfbuffer.h + defsnc 'static[ ]const[ ]struct[ ]ath5k_ini_rf[ ]rfregs_5112\[\][ ]=' drivers/net/wireless/ath/ath5k/rfbuffer.h + defsnc 'static[ ]const[ ]struct[ ]ath5k_ini_rf[ ]rfregs_5112a\[\][ ]=' drivers/net/wireless/ath/ath5k/rfbuffer.h + defsnc 'static[ ]const[ ]struct[ ]ath5k_ini_rf[ ]rfregs_5413\[\][ ]=' drivers/net/wireless/ath/ath5k/rfbuffer.h + + # new in 2.6.26 + initnc 'static[ ]u64[ ]vec2off\[68\][ ]=' arch/ia64/kvm/process.c + accept "[ ][ ][ ]interrupts[ ]=[ ]<\\(0x\\)\\?3[ ]\\(0x\\)\\?0[ ]\\(0x\\)\\?0[ ][ ]$blobpat*>[;]" 'arch/powerpc/boot/dts/\(cm5200\|lite5200b\?\|kuroboxHG\|pcm030\|tqm5200\).dts' + initnc 'static[ ]const[ ]u32[ ]crctab32\[\][ ]=' arch/x86/boot/tools/build.c + defsnc 'static[ ]struct[ ]mse2snr_tab[ ]\(vsb\|qam\(64\|256\)\)_mse2snr_tab\[\][ ]=' drivers/media/dvb/frontends/au8522.c + defsnc '[}][ ]\(VSB\|QAM\(64\|256\)\?\)_mod_tab\[\][ ]=' 'drivers/media/dvb/frontends/au8522\(_dig\)\?\.c' + initnc '[}][ ]itd1000_\(lpf_pga\|fre_values\)\[\][ ]=' drivers/media/dvb/frontends/itd1000.c + initnc '[}][ ]\(vsb\|qam\(64\|256\)\)_snr_tab\[\][ ]=' drivers/media/dvb/frontends/s5h1411.c + initnc '[}][ ]snr_tab\[\][ ]=' drivers/media/dvb/frontends/tda10048.c + initnc 'static[ ]u32[ ]reg_init_initialize\[\][ ]=' drivers/media/video/saa717x.c + initnc 'static[ ]const[ ]u32[ ]\(main\|gear\)_seedset\[BACKOFF_SEEDSET_ROWS\]\[BACKOFF_SEEDSET_LFSRS\][ ]=' drivers/net/forcedeth.c + initnc 'static[ ]const[ ]struct[ ]ath5k_ini_mode[ ]rf24\(13\|25\)_ini_mode_end\[\][ ]=' drivers/net/wireless/ath5k/initvals.c + initnc 'static[ ]const[ ]u16[ ]wm9713_reg\[\][ ]=' sound/soc/codecs/wm9713.c + + # new in 2.6.27 + accept '[ ]\.section[ ]__ex_table,["]a["]'"$sepx$blobpat*" 'arch/x86/lib/copy_user_\(nocache_\)\?64.S' + accept 'desc_config1:[\n][ ]\.byte[ ]0x09,[ ]0x02'"$sepx$blobpat*" 'firmware/keyspan_pda/\(keyspan_pda\|xircom_pgs\).S' + accept 'string_mfg:[\n]\?\([;]\?[ ]\.byte[^\n]*[\n]\)\+string_mfg_end:' 'firmware/keyspan_pda/\(keyspan_pda\|xircom_pgs\).S' + accept 'string_product:[\n]\?\([;]\?[ ]\.byte[^\n]*[\n]\)\+string_product_end:' 'firmware/keyspan_pda/\(keyspan_pda\|xircom_pgs\).S' + accept ':03000000020200F9[\n]:040023000205\(9B0037\|5F0073\)[\n]\(:050030000000000000CB[\n]\|:0400430002010000B6[\n]\)*'"$sepx$blobpat*"'[\n]:\(0E06E0006400670065007400060334003700F4\|0606A000060334003700E0\)[\n]:00000001FF' 'firmware/keyspan_pda/\(keyspan_pda\|xircom_pgs\).HEX' + accept ':100000000C004000000000000000000000000000A4[\n]'"$sepx$blobpat*"'[\n][/][*][ ]DSP56001[ ]bootstrap[ ]code[ ][*][/]' firmware/dsp56k/bootstrap.bin.ihex + initnc 'static[ ]const[ ]u16[ ]uda1380_reg\[UDA1380_CACHEREGNUM\][ ]=' sound/soc/codecs/uda1380.c + defsnc 'static[ ]const[ ]u16[ ]wm8510_reg\[WM8510_CACHEREGNUM\][ ]=' sound/soc/codecs/wm8510.c + initnc 'static[ ]const[ ]unsigned[ ]short[ ]atkbd_unxlate_table\[128\][ ]=' drivers/input/keyboard/atkbd.c + initnc 'static[ ]const[ ]unsigned[ ]char[ ]usb_kbd_keycode\[256\][ ]=' drivers/hid/usbhid/usbkbd.c + initnc '[ ][ ]u8[ ]buf,[ ]bufs\[\][ ]=' drivers/media/dvb/dvb-usb/cxusb.c + initnc 'static[ ]struct[ ]dvb_pll_desc[ ][^\n]*[ ]=' drivers/media/dvb/frontends/dvb-pll.c + initnc '[ ]static[ ]int[ ]sysdiv_to_div_x_2\[\][ ]=' arch/powerpc/platforms/512x/clock.c + defsnc 'static[ ]const[ ]__u8[ ]cx_inits_\(176\|320\|352\|640\)\[\][ ]=' drivers/media/video/gspca/conex.c + defsnc 'static[ ]const[ ]__u8[ ]cx_jpeg_init\[\]\[8\][ ]=' drivers/media/video/gspca/conex.c + defsnc 'static[ ]const[ ]__u8[ ]cxjpeg_\(640\|352\|320\|176\|qtable\)\[\]\[8\][ ]=' drivers/media/video/gspca/conex.c + defsnc 'static[ ]const[ ]unsigned[ ]char[ ]quant\[\]\[0x88\][ ]=' drivers/media/video/gspca/jpeg.h + defsnc 'static[ ]unsigned[ ]char[ ]huffman\[\][ ]=' drivers/media/video/gspca/jpeg.h + initc '[ ]\?static[ ]const[ ]struct[ ]ov_i2c_regvals[ ]norm_76[1247]0\[\][ ]=' drivers/media/video/gspca/ov519.c + initnc 'static[ ]const[ ]__u8[ ]pac207_sensor_init\[\]\[8\][ ]=' drivers/media/video/gspca/pac207.c + initnc 'static[ ]const[ ]__u8[ ]pac7311_jpeg_header\[\][ ]=' drivers/media/video/gspca/pac7311.c + defsnc 'static[ ]const[ ]__u8[ ]\(start\|page[34]\)_73\(02\|11\)\[\][ ]=' 'drivers/media/video/gspca/pac73\(02\|11\)\.c' + initnc 'static[ ]const[ ]__u8[ ]init\(Hv7131\|Ov\(6650\|7630\(_3\)\?\)\|Pas\(106\|202\)\|Tas51[13]0\)\[\][ ]=' drivers/media/video/gspca/sonixb.c + initnc 'static[ ]const[ ]__u8[ ]\(hv7131\|ov\(6650\|7630\(_3\)\?\)\|pas\(106\|202\)\|tas51[13]0\)_sensor_init\(_com\)\?\[\]\[8\][ ]=' drivers/media/video/gspca/sonixb.c + defsnc 'static[ ]\(const[ ]\)\?\(__\)\?u8[ ]\(mt9v111\|sp80708\|hv7131[rd]\|mi0360b\?\|mo4000\|ov76\([36]0\|48\)\|om6802\|po1030\)_sensor_\(init\|param1\)\[\]\[8\][ ]=' drivers/media/video/gspca/sonixj.c + initnc 'static[ ]const[ ]__u8[ ]qtable4\[\][ ]=' drivers/media/video/gspca/sonixj.c + initnc 'static[ ]const[ ]__u16[ ]\(spca500_visual\|Clicksmart510\)_defaults\[\]\[3\][ ]=' drivers/media/video/gspca/spca500.c + initnc 'static[ ]const[ ]__u8[ ]qtable_\(creative_pccam\|kodak_ez200\|pocketdv\)\[2\]\[64\][ ]=' drivers/media/video/gspca/spca500.c + initnc 'static[ ]const[ ]__u16[ ]spca501c\?_\(\(3com\|arowana\|mysterious\)_\)\?\(init\|open\)_data\[\]\[3\][ ]=' drivers/media/video/gspca/spca501.c + defsnc 'static[ ]const[ ]\(__u16\|u8\)[ ]spca505b\?_\(init\|open\)_data\(_ccd\)\?\[\]\[3\][ ]=' drivers/media/video/gspca/spca505.c + defsnc 'static[ ]const[ ]\(__\)\?u16[ ]spca508\(cs110\|_sightcam2\?\|_vista\)\?_init_data\[\]\[[23]\][ ]=' drivers/media/video/gspca/spca508.c + initnc 'static[ ]const[ ]__u16[ ]\(spca561\|rev72a\)_init_data3\?\[\]\[2\][ ]=' drivers/media/video/gspca/spca561.c + defsnc 'static[ ]const[ ]\(__u16\|struct[ ]cmd\)[ ]spca504\(_pccam600\|A_clicksmart420\)_\(init\|open\)_data\[\]\(\[3\]\)\?[ ]=' drivers/media/video/gspca/sunplus.c + defsnc 'static[ ]const[ ]\(__\)\?u8[ ]qtable_\(creative_pccam\|spca504_default\)\[2\]\[64\][ ]=' drivers/media/video/gspca/sunplus.c + initnc 'static[ ]const[ ]__u8[ ]\(effects\|gamma\)_table\[\(MAX_[A-Z]*\|[A-Z]*_MAX\)\]\[[0-9]*\][ ]=' drivers/media/video/gspca/t631.c + initnc 'static[ ]const[ ]\(__\)\?u8[ ]tas5130a_sensor_init\[\]\[8\][ ]=' drivers/media/video/gspca/t613.c + defsnc 'static[ ]const[ ]struct[ ]usb_action[ ]\(cs2102\|hdcs2020xx\|icm105a\(xx\)\?\|ov7630c\|mt9v111_[13]\|pb0330\([3x]x\)\?\|mi0360soc\)_Initial\(Scale\)\?\[\][ ]=' drivers/media/video/gspca/zc3xx.c + initnc 'static[ ]const[ ]u8[ ]rtl8225z2_\(agc\|ofdm\|power_cck\(_ch14\)\?\)\[\][ ]=' drivers/net/wireless/rtl8187_rtl8225.c + initnc 'static[ ]const[ ]__u16[ ]t10_dif_crc_table\[256\][ ]=' lib/crc-t10dif.c + initnc 'static[ ]crb_128M_2M_block_map_t[ ]crb_128M_2M_map\[64\][ ]=' drivers/net/netxen/netxen_hw.c + initnc 'static[ ]const[ ]__u16[ ]crc10_table\[256\][ ]=' drivers/usb/serial/safe_serial.c + accept '[ ]*\([ ]*0\)*\([ ]*1\)*[\n][ ]*0[ ]1[ ]2[ ]3[ ]4[ ]5[ ]6[ ]7[ ]8[ ]9[ ]0[ ]1[ ]*2[ ]3[ ]4[ ]5[ ]6[ ]7' Documentation/bt8xxgpio.txt + defsnc '[ ]static[ ]int[ ]exp_lut\[256\][ ]=' drivers/isdn/mISDN/dsp_audio.c + initnc 'static[ ]const[ ]u32[ ]bf_pbox\[16[ ][+][ ]2\][ ]=' drivers/isdn/mISDN/dsp_blowfish.c + initnc 'static[ ]const[ ]u32[ ]bf_sbox\[256[ ][*][ ]4\][ ]=' drivers/isdn/mISDN/dsp_blowfish.c + initnc 'static[ ]u8[ ]sample_\(german_\(all\|old\)\|american_\(dialtone\|ringing\|busy\)\|special[123]\|silence\)\[\][ ]=' drivers/isdn/mISDN/dsp_tones.c + initnc 'struct[ ]pattern[ ][{][^}]*int[ ]tone[;][^}]*[}][ ]pattern\[\][ ]=' drivers/isdn/mISDN/dsp_tones.c + initnc 'static[ ]u8[ ]\([au]\|_4\)law_to_\([ua]law\|4bit\)\[256\][ ]=' drivers/isdn/mISDN/l1oip_codec.c + initnc 'static[ ]unsigned[ ]char[ ]banner_table\[\][ ]=' arch/sh/boards/mach-microdev/led.c + defsnc '[ ]static[ ]const[ ]int[ ]desc_idx_table\[\][ ]=' arch/arm/include/asm/hardware/iop3xx-adma.h + defsnc 'static[ ]\(const[ ]\)\?u32[ ]ar\(5416\|9280\)\(Modes\(_fast_clock\)\?\|Common\|BB_RfGain\|Bank6\(TPC\)\?\|Addac\)\(_91[06]0\(_\?1_1\)\?\|_9280\(_2\)\?\)\?\[\]\[[236]\][ ]=' 'drivers/net/wireless/ath9k/\(ar\(5008\|9001\)_\)\?initvals\.h' + + # new in 2.6.28 + accept '\(static[ ]\)\?const[ ]char[ ]\(inv\)\?parity\[256\][ ]=[ ][{][ \n01,]*[}][;]' 'Documentation/mtd/nand_ecc\.txt\|drivers/mtd/nand/nand_ecc\.c' + defsnc 'static[ ]const[ ]char[ ]\(bitsperbyte\|addressbits\)\[256\][ ]=' drivers/mtd/nand/nand_ecc.c + defsnc 'static[ ]struct[ ]pinmux_cfg_reg[ ]pinmux_config_regs\[\][ ]=' 'arch/sh/kernel/cpu/sh2a/pinmux-sh7203\.c\|arch/arm/mach-shmobile/pfc-sh73[67]7\.c' + defsnc '[ ]static[ ]const[ ]u8[ ]e_keymap\[\][ ]=' drivers/hid/hid-lg.c + defsnc 'DEFINE_DEFAULT_PDR[(]0x0161,[ ]256,' drivers/net/wireless/hermes_dld.c + defsnc 'static[ ]const[ ]int[ ]isink_cur\[\][ ]=' drivers/regulator/wm8350-regulator.c + defsnc 'static[ ]const[ ]s16[ ]\(converge_speed_ipb\?\|LAMBDA_table\[4\]\)\[101\][ ]=' drivers/staging/go7007/go7007-fw.c + defsnc 'static[ ]const[ ]u32[ ]addrinctab\[33\]\[2\][ ]=' drivers/staging/go7007/go7007-fw.c + defsnc 'static[ ]const[ ]u8[ ]\(default_intra_quant_table\|\(val\|bits\)_[ad]c_\(lu\|chro\)minance\)\[\][ ]=' drivers/staging/go7007/go7007-fw.c + defsnc 'static[ ]const[ ]int[ ]zz\[64\][ ]=' drivers/staging/go7007/go7007-fw.c + defsnc '[ ]u16[ ]pack\[\][ ]=' drivers/staging/go7007/go7007-fw.c + defsnc 'static[ ]u8[ ]\(initial\|channel\)_registers\[\][ ]=' 'drivers/staging/go7007/wis-\(ov7640\|saa7113\|tw2804\).c' + defsnc 'u16[ ]MTO_One_Exchange_Time_Tbl_[ls]\[MTO_MAX_FRAG_TH_LEVELS\]\[MTO_MAX_DATA_RATE_LEVELS\][ ]=' drivers/staging/winbond/mto.c + defsnc 'u32[ ]\(al2230_txvga_data\|w89rf242_txvga_old_mapping\)\[\]\[2\][ ]=' drivers/staging/winbond/reg.c + defsnc 'static[ ]const[ ]UINT16[ ]crc16tab\[256\][ ]=' drivers/staging/wlan-ng/hfa384x.c + defsnc 'static[ ]const[ ]\(UINT32\|u32\)[ ]wep_crc32_table\[256\][ ]=' drivers/staging/wlan-ng/p80211wep.c + defsnc 'static[ ]const[ ]unsigned[ ]char[ ]wm_vol\[256\][ ]=' 'sound/pci/ice1712/\(phase\|aureon\)\.c' + defsnc 'static[ ]const[ ]u16[ ]wm8900_reg_defaults\[WM8900_MAXREG\][ ]=' sound/soc/wm8900.c + defsnc '[}][ ]\(clk_sys_ratios\|bclk_divs\)\[\][ ]=' 'sound/soc/wm890[34]\.c' + defsnc 'static[ ]u8[ ]af9015_ir_table_\(leadtek\|twinhan\|a_link\|msi\|mygictv\|kworld\)\[\][ ]=' drivers/media/dvb/dvb-usb/af9015.h + defsnc 'static[ ]\(const[ ]\)\?struct[ ]\(snr_table\|af9013_snr\)[ ]\(qpsk\|qam\(16\|64\)\)_snr_\(table\|lut\)\[\][ ]=' drivers/media/dvb/frontends/af9013_priv.h + defsnc 'static[ ]\(const[ ]\)\?struct[ ]\(regdesc\|af9013_reg_bit\)[ ]\(ofsm_init\|tuner_init_\(env77h11d5\|mt2060\(_2\)\?\|mxl500\(3d\|5\)\|qt1010\|mc44s803\|unknown\|tda18271\)\)\[\][ ]=' drivers/media/dvb/frontends/af9013_priv.h + defsnc 'static[ ]u8[ ]stv0288_earda_inittab\[\][ ]=' drivers/media/dvb/frontends/eds1547.h + defsnc 'static[ ]u8[ ]serit_sp1511lhb_inittab\[\][ ]=' drivers/media/dvb/frontends/si21xx.c + defsnc 'static[ ]u8[ ]stv0288_inittab\[\][ ]=' drivers/media/dvb/frontends/stv0288.c + defsnc 'static[ ]const[ ]struct[ ]rf_channel[ ]rf_vals_b\[\][ ]=' drivers/net/wireless/rt2x00/rt2400pci.c + + # request_firmware matches for 2.6.28 + accept 'D:[ ]Firmware[ ]loader[ ][(]request_firmware[)]' CREDITS + accept 'FIRMWARE[ ]LOADER[ ][(]request_firmware[)]' MAINTAINERS + accept '[ ]-[ ]request_firmware[(][)][ ]hotplug[ ]interface[ ]info.' Documentation/00-INDEX + accept 'This[ ]driver[ ]requires[ ]a[ ]patch[ ]for[ ]firmware_class[^\n]*[\n]request_firmware_nowait[ ]function\.' Documentation/dell_rbu.txt + accept '\([ ]request_firmware[(][)][ ]hotplug[ ]interface:[\n][ ]--*[\n].*[ ]\)\?-[ ]request_firmware_nowait[(][)][ ]is[ ]also[ ]provided[ ]for[ ]convenience' Documentation/firmware_class/README + accept 'Still,[ ]there[ ]are[ ]kernel[ ]threads[ ]that[ ]may[ ]want.*For[ ]example,[ ]if[ ]request_.*_firmware[(][)][ ]will[ ]fail[ ]regardless' Documentation/power/freezing-of-tasks.txt + accept 'Also,[ ]there[ ]may[ ]be[ ]some[ ]operations,.*calling[ ]request_firmware[(][)][ ]from[ ]their[ ].resume[(][)][ ]routines' Documentation/power/notifiers.txt + accept 'There[ ]is[ ]an[ ]USB[ ]interface[ ]for[ ]downloading[/]uploading.*request_firmware[ ]interface\.' Documentation/video4linux/si470x.txt + accept '[ ]-[ ]move[ ]firmware[ ]loading[ ]to[ ]request_firmware[(][)]' drivers/staging/slicoss/README + accept 'config[ ]FIRMWARE_IN_KERNEL.*let[ ]firmware[ ]be[ ]loaded[ ]from[ ]userspace\.' drivers/base/Kconfig + accept '[ ]*and[ ]request_firmware[(][)][ ]in[ ]the[ ]source' drivers/base/Kconfig + accept '\(static[ ]\(int\|void\)[\n ]\)\?_request_firmware\(_prepare\|_cleanup\)\?[(]const[ ]struct[ ]firmware[ ][*][*]\?firmware\(_p\)\?[,)][^{]*[\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}][\n]' drivers/base/firmware_class.c + accept 'static[ ]int[\n ]request_firmware_work_func[(]void[ ][*]arg[)][\n][{]\([\n]\+[^\n}][^\n]*\)*ret[ ]=[ ]_request_firmware[(][^\n]*\([\n]\+[^\n}][^\n]*\)*[\n]\+[}][\n]' drivers/base/firmware_class.c + accept '[/][*][*][\n][ ][*][ ]request_firmware:[ ]-[ ]send[ ]firmware[ ][^{]*[\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}][\n]' drivers/base/firmware_class.c + accept '[/][*][*][\n][ ][*][ ]request_firmware_nowait\(:\|[ ]-\)[ ]asynchronous[ ]version[^{]*[\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}][\n]' drivers/base/firmware_class.c + accept 'EXPORT_SYMBOL[(]request_firmware\(_nowait\)\?[)][;]' drivers/base/firmware_class.c + accept 'int[ ]request_firmware\(_nowait\)\?[(][^;]*[)][;]' include/linux/firmware.h + accept 'static[ ]inline[ ]int[ ]request_firmware\(_nowait\)\?[(][^{]*[)][\n][{][\n][ ]return[ ]-EINVAL[;][\n][}]' include/linux/firmware.h + accept 'static[ ]inline[ ]int[\n]\(maybe_\)\?reject_firmware\(_nowait\)\?[(][^{;]*[)][\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}]' include/linux/firmware.h + + accept 'static[ ]inline[ ]int[ ]request_ihex_firmware\?[(][^{]*[)][\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}][\n]' include/linux/ihex.h + ocomment '[/][*][ ]Optional[ ]firmware\([^\n]*[\n][ ][*]\)*[^\n]*[ ]MODULE_FIRMWARE[(][)]' + oprepline '#define[ ]MODULE_FIRMWARE[(]_firmware[)]' include/linux/module.h + accept '[ ][*][ ]Sample[ ]code[ ]on[ ]how[ ]to[ ]use[ ]request_firmware[(][)][ ]from[ ]drivers\.' samples/firmware_class/firmware_sample_driver.c + accept '[ ]\(retval\|error\)[ ]=[ ]request_firmware\(_nowait\)\?[(][^;]*["]sample_driver_fw["],[^;]*[)][;]' samples/firmware_class/firmware_sample_driver.c + ocomment '[ ][/][*][ ]request_firmware[ ]blocks[ ]until[ ]userspace[ ]finished' samples/firmware_class/firmware_sample_driver.c + accept '[ ][ ][ ]*["][ ]request_firmware_nowait[ ]failed' samples/firmware_class/firmware_sample_driver.c + + # We used to remove these in early versions of Linux-libre. + # They're now believed to be mere initialization data, rather than + # code disguised as such, and they're not long enough so as to + # render the software non-Free. + defsnc 'static[ ]u8[ ]tda10021_inittab\[0x40\]=' drivers/media/dvb/frontends/tda10021.c + defsnc 'static[ ]u8[ ]tda8083_init_tab[ ]\[\][ ]=' drivers/media/dvb/frontends/tda8083.c + defsnc 'static[ ]u8[ ]ves1820_inittab\[\][ ]=' drivers/media/dvb/frontends/ves1820.c + defsnc 'static[ ]u8[ ]init_1[89]93_w\?tab[ ]\?\[\][ ]=' drivers/media/dvb/frontends/ves1x93.c + defsnc 'static[ ]const[ ]u8[ ]saa7113_tab\[\][ ]=' drivers/media/dvb/ttpci/budget-av.c + defsnc 'static[ ]u8[ ]philips_sd1878_inittab\[\][ ]=' drivers/media/dvb/ttpci/budget-av.c + defsnc 'const[ ]struct[ ]Kiara_table_entry[ ]Kiara_table\[PSZ_MAX\]\[6\]\[4\][ ]=' drivers/media/video/pwc/pwc-kiara.c + defsnc 'const[ ]unsigned[ ]int[ ]KiaraRomTable[ ]\[8\]\[2\]\[16\]\[8\][ ]=' drivers/media/video/pwc/pwc-kiara.c + defsnc 'const[ ]struct[ ]Timon_table_entry[ ]Timon_table\[PSZ_MAX\]\[PWC_FPS_MAX_TIMON\]\[4\][ ]=' drivers/media/video/pwc/pwc-timon.c + defsnc 'const[ ]unsigned[ ]int[ ]TimonRomTable[ ]\[16\]\[2\]\[16\]\[8\][ ]=' drivers/media/video/pwc/pwc-timon.c + defsnc '[ ]static[ ]const[ ]struct[ ]struct_initData[ ]initData\[\][ ]=' drivers/media/video/usbvideo/ibmcam.c + defsnc 'static[ ]const[ ]u8[ ]rtl8187b_reg_table\[\]\[3\][ ]=' drivers/net/wireless/rtl8187_dev.c + defsnc 'unsigned[ ]char[ ]\(IDX_ACTIVATE_\(READ\|WRITE\)\|\(CM\|ULP\)_\(ENABLE\|SETUP\)\|DM_ACT\|IPA_PDU_HEADER\|\(READ\|WRITE\)_CCW\)\[\][ ]=' drivers/net/qeth_core_mpc.c + defsnc 'static[ ]unsigned[ ]char[ ]camera_ncm03j_magic\[\][ ]=' 'arch/sh/boards/\(board-ap325rxa\.c\|mach-ap325rxa/setup\.c\)' + defsnc 'static[ ]const[ ]unsigned[ ]short[ ]\(sync\|magic[0-3]\)_data\[\][ ]=' arch/sh/boards/mach-migor/lcd_qvga.c + defsnc 'static[ ]unsigned[ ]char[ ]camera_ov772x_magic\[\][ ]=' arch/sh/boards/mach-migor/setup.c + defsnc 'static[ ]struct[ ]chips_init_reg[ ]chips_init_[sgacfx]r\[\][ ]=' 'drivers/video/\(asiliant\|chips\)fb.c' + + # This one is quite suspicious, but it's small enough (64 bytes + # total) that it's believable that it could be actual source code. + defsnc 'static[ ]const[ ]__u8[ ]cx11646_fw1\[\]\[3\][ ]=' drivers/media/video/gspca/conex.c + + # Hunting down non-Free firmware-loading code and instructions. + # Firmware names are to be caught anywhere. + + # 2.6.26 but not later + + blobname 'atmsar1[12]\.\(x\|start\|regions\|data\|bin[12]\?\)' 'drivers/atm/\(Makefile\|ambassador\.c\)' + blob '#\(define\|include\)[ ]UCODE2\?[(][^\n]*' drivers/atm/ambassador.c + blob 'static[ ]\(u32\|region\)[ ]__devinitdata[ ]ucode_\(start\|\(regions\|data\)\[\]\)[ ]=[^;]*[;]' drivers/atm/ambassador.c + blob '\(#\(ifdef[ ]AMB_NEW_MICROCODE\|else\|endif\)[\n]#\(define\|include\)[ ]UCODE2\?[(][^\n]*[\n]\)\+\([\n]*static[ ]\(u32\|region\)[ ]__devinitdata[ ]ucode_\(start\|\(regions\|data\)\[\]\)[ ]=[^;]*[;]\)*' drivers/atm/ambassador.c + + blobname '\(pca\|sba\)200e\(_ecd\)\?\.\(data\|bin[12]\?\)' 'drivers/atm/\(Makefile\|fore200e\(_mkfirm\)\?\.c\)' + blobna '[/][*][^*]*\([*]\+[^/*][^*]*\)*[*]*PCA-200E[ ]firmware[ ][*][/]' drivers/atm/fore200e_mkfirm.c + blobna '_fore200e_\(pca\|sba\)_fw_\(data\|size\)' drivers/atm/fore200e.c + blob '#ifdef[ ]CONFIG_ATM_FORE200E_\(PCA\|SBA\)\([\n]extern[ ]const[ ]unsigned[ ]\(char\|int\)[ ]*_fore200e_\(pca\|sba\)_fw_\(data\[\]\|size\)[;]\)\+[\n]#endif\([\n]\+#ifdef[ ]CONFIG_ATM_FORE200E_\(PCA\|SBA\)\([\n]extern[ ]const[ ]unsigned[ ]\(char\|int\)[ ]*_fore200e_\(pca\|sba\)_fw_\(data\[\]\|size\)[;]\)\+[\n]#endif\)*' drivers/atm/fore200e.c + + # 2.6.27 but not later + + blob 'cas_saturn_patch_t[ ]cas_saturn_patch\[\][ ]=[ ][{][^;]*[}][;]' drivers/net/cassini.h + accept '[ ][ ][ ]firmware[ ]files[ ]--[ ]the[ ]same[ ]names[ ]which[ ]appear[ ]in[ ]MODULE_FIRMWARE[(][)]' drivers/base/Kconfig + + # 2.6.28 or earlier + + blobname 'atmsar11\.fw' drivers/atm/ambassador.c + + blob '\(#ifdef[ ]__\(LITTLE\|BIG\)_ENDIAN[\n]\)\?#define[ ]FW_EXT[ ]["]\(_ecd\)\?\.bin2\?["]\([\n]#else[\n]#define[ ]FW_EXT[ ]["]\(_ecd\)\?\.bin2\?["]\)*\([\n]#endif\)\?' drivers/atm/fore200e.c + blobna 'sprintf[(][^;]*fore200[^;]*FW_EXT[^;]*[)][;]' drivers/atm/fore200e.c + blobname '\(pc\|sb\)a200e\(_ecd\)\?\.bin[12]\?' drivers/atm/fore200e.c + blobna 'The[ ]supplied[ ]firmware[ ]images.*https\?:[/][/][^\n]*\(fore\|FORE_Systems\).*Rebuild[ ]and[ ]re-install[^.]*\.' Documentation/networking/fore200e.txt + + blobname 'intelliport2\.bin' drivers/char/ip2/ip2main.c + + blob 'static[ ]unsigned[ ]char[ ]warp_g[24]00_t2\?gzs\?a\?f\?\[\][ ]=[ ][{][^{};]*[}][;]\([\n][\n]*static[ ]unsigned[ ]char[ ]warp_g[24]00_t2\?gzs\?a\?f\?\[\][ ]=[ ][{][^{};]*[}][;]\)*' drivers/gpu/drm/mga/mga_ucode.h + blob '\(#define[ ]WARP_UCODE_\(SIZE\|INSTALL\)[(][ ]*which\([^\n]*\\[ ]*[\n]\)*[^\n]*\|static[ ]const[ ]unsigned[ ]int[ ]mga_warp_g[24]00_microcode_size[ ]=[^;]*[;]\|static[ ]int[ ]mga_warp_install_g[24]00_microcode[(][^{]*[)][\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}]\)\([\n][\n]*\(#define[ ]WARP_UCODE_\(SIZE\|INSTALL\)[(][ ]*which\([^\n]*\\[ ]*[\n]\)*[^\n]*\|static[ ]const[ ]unsigned[ ]int[ ]mga_warp_g[24]00_microcode_size[ ]=[^;]*[;]\|static[ ]int[ ]mga_warp_install_g[24]00_microcode[(][^{]*[)][\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}]\)\)*' drivers/gpu/drm/mga/mga_warp.c + blobna '\(case[ ]MGA_CARD_TYPE_G[^:]*:[ \n]*\)\+return[ ][^;]*mga_warp[^;]*microcode[^;]*[;]\([ \n]*\(case[ ]MGA_CARD_TYPE_G[^:]*:[ \n]*\)\+return[ ][^;]*mga_warp[^;]*microcode[^;]*[;][ ]*\)*' drivers/gpu/drm/mga/mga_warp.c + + blob 'static[ ]u32[ ]r128_cce_microcode\[\][ ]=[ ][{][^;]*[}][;]' drivers/gpu/drm/r128/r128_cce.c + blob 'static[ ]void[ ]r128_cce_load_microcode[(][^{]*[)][\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}]' drivers/gpu/drm/r128/r128_cce.c + # blobna 'R128_WRITE[(]R128_PM4_MICROCODE_DATA[HL],[\n ]*r128_cce_microcode\[i[ ][*][ ]2\([ ][+][ ]1\)\?\][)]\([;][\n ]*R128_WRITE[(]R128_PM4_MICROCODE_DATA[HL],[\n ]*r128_cce_microcode\[i[ ][*][ ]2\([ ][+][ ]1\)\?\][)]\)*' drivers/gpu/drm/r128/r128_cce.c + + blob 'static[ ]const[ ]u32[ ]R[SV0-9]*[05]_\(c\|pf\)p_microcode\[\]\(\[[23]\]\)\?[ ]=[ ][{][^;]*[}][;]\([\n][\n]*static[ ]const[ ]u32[ ]R[SV0-9]*[05]_\(c\|pf\)p_microcode\[\]\(\[[23]\]\)\?[ ]=[ ][{][^;]*[}][;]\)*' 'drivers/gpu/drm/radeon/\(radeon\|r600\)_microcode\.h' + blob 'static[ ]void[ ]r\(adeon\|[167]00\)_cp_load_microcode[(][^{]*[)][\n][{]\([\n]\+[^\n}][^\n]*\)*cp_microcode[^\n]*\([\n]\+[^\n}][^\n]*\)*[\n]\+[}]' 'drivers/gpu/drm/radeon/r\(\(adeon\|600\)_cp\|100\)\.c' + # blobna 'RADEON_WRITE[(]R\(ADEON\|600\)_CP_\(ME_RAM\|PFP_UCODE\)_DATA[HL]\?,[\n ]*R[SV0-9]*[05]_\(c\|pf\)p_microcode\[i\]\(\[[012]\]\)\?[)]\([;][\n ]*RADEON_WRITE[(]R\(ADEON\|600\)_CP_\(ME_RAM\|PFP_UCODE\)_DATA[HL]\?,[\n ]*R[SV0-9]*[05]_\(c\|pf\)p_microcode\[i\]\(\[[012]\]\)\?[)]\)*' 'drivers/gpu/drm/radeon/\(radeon\|r600\)_cp\.c' + + blob 'sub[ ]\(sp887[0x]\|tda1004\(5\|6\(lifeview\)\?\)\|av7110\|dec\(2\(00\|54\)0t\|3000s\)\|opera1\|vp7041\|dibusb\|nxt200[24]\|cx\(23\(1xx\|885\)\|18\)\|pvrusb2\|or51\(211\|132_\(qam\|vsb\)\)\|bluebird\|mpc718\|af9015\|ngene\)[ ]*[{]\([\n]\+[^\n}][^\n]*\)*[\n]\+[}]\([\n]\+sub[ ]\(sp887[0x]\|tda1004\(5\|6\(lifeview\)\?\)\|av7110\|dec\(2\(00\|54\)0t\|3000s\)\|opera1\|vp7041\|dibusb\|nxt200[24]\|cx\(23\(1xx\|885\)\|18\)\|pvrusb2\|or51\(211\|132_\(qam\|vsb\)\)\|bluebird\|mpc718\|af9015\|ngene\)[ ]*[{]\([\n]\+[^\n}][^\n]*\)*[\n]\+[}]\)*' Documentation/dvb/get_dvb_firmware + blobna 'Please[ ]use[^\n]*firmware[^\n]*sp887x[^\n]*\([\n][^\n]\+\)\+' Documentation/dvb/avermedia.txt + blob 'To[ ]extract[ ]the[ ]firmware[^\n]*Opera[ ]DVB-S1[ ]USB-Box.*[/]lib[/]firmware[/][ ]\.' Documentation/dvb/opera-firmware.txt + blobname '\(dvb-usb-opera[^\n]*\.fw\|2830S[^\n]*2\.sys\)' Documentation/dvb/opera-firmware.txt + blob 'Getting[ ]the[ ]Firmware\([\n][^\n]\+\)*' Documentation/dvb/ttusb-dec.txt + + blob '[/][*][\n ]*File[ ]automatically[ ]generated[ ]by[ ]createinit\.py[ ]using[ ]data[\n ]*extracted[ ]from[ ]AF05BDA\.sys.*[}][;]' drivers/media/dvb/dvb-usb/af9005-script.h + blob '#include[ ]["]af9005-script\.h["]' drivers/media/dvb/dvb-usb/af9005-fe.c + blobna '[\n][ ]scriptlen[ ]=[ ]sizeof[(]script[)][^;]*[;][\n][ ]for[^{]*scriptlen[^{]*[{][^}]*[^\n }]' drivers/media/dvb/dvb-usb/af9005-fe.c + + accept 'struct[ ]\(sp8870\|tda1004x\)_config[\n][{][^}]*[(][*]request_firmware[)][^}]*[\n][}][;]' 'drivers/media/dvb/frontends/\(sp8870\|tda1004x\)\.h' + blob '[/][*][^*]*\([*]\+[^/*][^*]*\)*[*]*get_dvb_firmware[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]\([\n]\(#define[ ]\(\([^\n ]*_DEFAULT\|NONFREE\)_FIRMWARE\|["][^"]*["]\)[ ]\([^\n]\|[\\][\n]\)*\|[/][*][(]DEBLOBBED[)][*][/]\)\)*' 'drivers/media/dvb/frontends/\(nxt200x\|or51211\|sp887[0x]\|tda1004[8x]\)\.c' + blobname 'dvb-fe-sp8870\.fw' drivers/media/dvb/frontends/sp8870.c + blobname 'dvb-fe-tda1004[56]\.fw' drivers/media/dvb/frontends/tda1004x.c + + # This bootcode is actually Free Software under GPLv2, but since it's + # being distributed without source code, we're taking it out. + blob 'static[ ]u8[ ]bootcode\[\][ ]=[ ][{][^}]*[}][;]' drivers/media/dvb/ttpci/av7110_hw.c + blobname 'dvb-ttpci-01\.fw' drivers/media/dvb/ttpci/av7110.c + defsnc 'static[ ]u8[ ]nexusca_stv0297_inittab\[\][ ]=' drivers/media/dvb/ttpci/av7110.c + + defsnc 'static[ ]u8[ ]philips_su1278_tt_inittab\[\][ ]=' drivers/media/dvb/ttpci/budget-ci.c + defsnc 'static[ ]u8[ ]dvbc_philips_tdm1316l_inittab\[\][ ]=' drivers/media/dvb/ttpci/budget-ci.c + + blobname 'ttusb-budget[/]dspbootcode\.bin' drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c + + blobname 'cpia2[/]stv0672_vp4\.bin' drivers/media/video/cpia2/cpia2_core.c + + blobname 'dabusb[/]\(firmware\.fw\|bitstream\.bin\)' drivers/media/video/dabusb.c + + blob 'static[ ]u32[ ]tigon2\?Fw\(Text\|Rodata\|Data\)\[[(]MAX_\(TEXT\|RODATA\|DATA\)_LEN[/]4[)][ ][+][ ]1\][ ]__devinitdata[ ]=[ ][{][^}]*[}][;]\([\n]static[ ]u32[ ]tigon2\?Fw\(Text\|Rodata\|Data\)\[[(]MAX_\(TEXT\|RODATA\|DATA\)_LEN[/]4[)][ ][+][ ]1\][ ]__devinitdata[ ]=[ ][{][^}]*[}][;]\)*' drivers/net/acenic_firwmare.h + blob '#define[ ]tigon2\?Fw[^ ]*\(Addr\|Len\)[ ]0x[^\n]*\([\n]#define[ ]tigon2\?Fw[^ ]*\(Addr\|Len\)[ ]0x[^\n]*\)\+' drivers/net/acenic_firmware.h + blob '\([/][*][^*]*\([*]\+[^/*][^*]*\)*[*]*Do[ ]not[ ]try[ ]to[ ]clear[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/][\n][ ]\)\?ace_clear[^;]*[;][\n]\([^}]*[{][^}]*ace_copy[^}]*tigon2\?Fw[^}]*[}]\)*[\n]\+[ ]return[ ]0[;][\n][}]' drivers/net/acenic.c + blob 'if[ ][(]\(ACE_IS_TIGON_I[(]ap[)]\|ap->version[ ]==[ ]2\)[)][\n][ ][ ]writel[(]tigon2\?FwStartAddr,[ ][&]regs->Pc[)][;]\([\n][ ]if[ ][(]\(ACE_IS_TIGON_I[(]ap[)]\|ap->version[ ]==[ ]2\)[)][\n][ ][ ]writel[(]tigon2\?FwStartAddr,[ ][&]regs->Pc[)][;]\)*' drivers/net/acenic.c + + blob '#include[ ]["]starfire_firmware\.h["]' drivers/net/starfire.c + blob '[/][*][^*]*\([*]\+[^/*][^*]*\)*[*]*Load[ ]Rx[/]Tx[ ]firmware[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]\([\n][ ]for[ ][(][^)]*FIRMWARE_[RT]X_SIZE[^)]*[)][\n][ ][ ]writel[^;]*firmware_[rt]x[^;]*[;]\)\+' drivers/net/starfire.c + + blob 'static[ ]\(u8\|const[ ]u32\|struct[ ]fw_info\)[ ]bnx2_\(\(COM\|CP\|[RT]XP\|TPAT\)_b0[69]Fw\(Text\|Data\|Rodata\)\|\(xi_\)\?rv2p_proc[12]\|\(com\|cp\|[rt]xp\|tpat\)_fw_0[69]\)\(\[[^]};]*\]\)*[ ]=[ ][{][^}]*[}][;]\([\n][\n]*static[ ]\(u8\|const[ ]u32\|struct[ ]fw_info\)[ ]bnx2_\(\(COM\|CP\|[RT]XP\|TPAT\)_b0[69]Fw\(Text\|Data\|Rodata\)\|\(xi_\)\?rv2p_proc[12]\|\(com\|cp\|[rt]xp\|tpat\)_fw_0[69]\)\(\[[^]};]*\]\)*[ ]=[ ][{][^}]*[}][;]\)*' 'drivers/net/bnx2_fw2\?.h' + blob '#include[ ]["]bnx2_fw\.h["][\n][\n]*#include[ ]["]bnx2_fw2\.h["]' drivers/net/bnx2.c + blob 'static[ ]void[\n]load_rv2p_fw[(][^{]*[)][\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}]' drivers/net/bnx2.c + blob 'static[ ]int[\n]bnx2_init_cpus[(][^{]*[)][\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}]' drivers/net/bnx2.c + + # init_data_e1h? might actually be just data, but it doesn't + # really matter. + blob 'static[ ]const[ ]u32[ ]\(init\?\|[tucx]sem_\(int_table\|pram\)\)_data_e1h\?\[\][ ]=[ ][{][^}]*[}][;]\([\n][\n]*static[ ]const[ ]u32[ ]\(init\?\|[tucx]sem_\(int_table\|pram\)\)_data_e1h\?\[\][ ]=[ ][{][^}]*[}][;]\)*' drivers/net/bnx2x_init_values.h + blob 'static[ ]\(void[ ]\|const[ ]u32[ ][*]\)bnx2x_\(sel_blob\|init_wr_wb\|init_block\)[(][^{]*[)][\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}]\([\n][\n]*static[ ]\(void[ ]\|const[ ]u32[ ][*]\)bnx2x_\(sel_blob\|init_wr_wb\|init_block\)[(][^{]*[)][\n][{]\([\n]\+[^\n}][^\n]*\)*[^\n]*[\n]\+[}]\)*' 'drivers/net/bnx2x_init\(_ops\)\?\.h' + + blobname 'sun[/]cassini\.bin' drivers/net/cassini.c + + blobna 'static[ ]u16[ ]\(sr\|twinax\)_edc\[\][ ]=[ ][{][^;]*[}][;]' drivers/net/cxgb3/ael1002.c + blobna 'for[ ][(][^\n]*ARRAY_SIZE[(]\(sr\|twinax\)_edc[)][^\n]*[)][\n][^;]*mdio_write[^;]*[;]' drivers/net/cxgb3/ael1002.c + blobname '\(cxgb3[/]\)\?t3\(fw\|\(%c\|.\)_p\(rotocol_\)\?sram\)-\(%d\|[0-9]*\)\.\(%d\|[0-9]*\)\.\(%d\|[0-9]*\)\.bin' drivers/net/cxgb3/cxgb3_main.c + + blob '\([/][*][*]\+[/][\n]*\)*\([/][*][^*]*\([*]\+[^/*][^*]*\)*[*]*Micro[ ]code[^*]*\([*]\+[^/*][^*]*\)*[*]*8086:[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]\([\n]*[/][*][^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]\)*\|#define[ ][ ]*D10\(1M\(_B\)\?\|1S\|2_E\)_\(CPUSAVER_\(TIMER\|BUNDLE\|MIN_SIZE\)_DWORD\|RCVBUNDLE_UCODE\)[ ][^\n]*\([\\][\n][^\n]*\)*\)\([\n]*[/][*][^*]*\([*]\+\([^/*]\|[/][\n]*[/][*]\+\)[^*]*\)*[*]*Micro[ ]code[^*]*\([*]\+[^/*][^*]*\)*[*]*8086:[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]\([\n]*[/][*][^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]\)*\|[\n][\n]*#define[ ][ ]*D10\(1M\(_B\)\?\|1S\|2_E\)_\(CPUSAVER_\(TIMER\|BUNDLE\|MIN_SIZE\)_DWORD\|RCVBUNDLE_UCODE\)[ ]\(\\[\n]\|[^\n]\)*\)*' drivers/net/e100.c + blobna '\([/][*][^*]*\([*]\+[^/*][^*]*\)*[*]\+[/][\n]*[ ][ ]\)\(ucode\[opts->\(timer\|bundle\|min_size\)_dword\][ ].=[ ][^;]*[;][\n][\n]*[ ][ ]\)*[^}]*UCODE_SIZE[^}]*cb_ucode[^}]*return[;][\n][ ][}]' drivers/net/e100.c + + blob 'static[ ]unsigned[ ]char[ ]__devinitdata[ ]lanai4_\(code\|data\)\[[0-9]*\][ ]=[ ][{][^;]*[}][;]' drivers/net/myri_code.h + blob '#include[ ]["]myri_code\.h["]' drivers/net/myri_sbus.c + blobna '\([/][*][^*]*\([*]\+[^/*][^*]*\)*[*]\+[/][\n ]*\)\?for[ ][(][^\n]*sizeof[(]lanai4_\(code\|data\)[^\n]*[)][\n][^\n]*sbus_writeb[^;]*lanai4_\(code\|data\)[^;]*lanai4_code_off[^;]*[;]\([\n ]*\([/][*][^*]*\([*]\+[^/*][^*]*\)*[*]\+[/][\n ]*\)\?for[ ][(][^\n]*sizeof[(]lanai4_\(code\|data\)[^\n]*[)][\n][^\n]*sbus_writeb[^;]*lanai4_\(code\|data\)[^;]*lanai4_\(code\|data\)_off[^;]*[;]\)*' drivers/net/myri_sbus.c + + blob 'static[ ]u32[ ]s_firmLoad\[\][ ]=[ ][{][^;]*[}][;]' drivers/net/tehuti_fw.h + blobna 'bdx_tx_push_desc_safe[^;]*s_firmLoad[^;]*[;]' drivers/net/tehuti.c + blobna 'for[ ][(][^\n]*ARRAY_SIZE[(]s_firmLoad[)][^\n]*[)][\n ]*s_firmLoad[^;]*=[^;]*s_firmLoad[^;]*[;]' drivers/net/tehuti.c + + blob '[ ][*][ ]Firmware[ ]is:[\n][ ][*][ ]Derived[ ]from[ ]proprietary[^/]*notice[ ]is[ ]accompanying[ ]it\.[\n][ ][*][/]' drivers/net/tg3.c + blobna 'Derived[ ]from[ ]proprietary[ ]unpublished[ ]source[ ]code' drivers/net/tg3.c + blob '\(static[ ]const[ ]\)\?u32[ ]tg3\(Tso5\?\)\?Fw\(Text\|Rodata\|Data\)\[[^{]*\][ ]=[ ][{][^}]*[}][;]\([\n][\n]*\(static[ ]const[ ]u32[ ]tg3\(Tso5\?\)\?Fw\(Text\|Rodata\|Data\)\[[^{]*\][ ]=[ ][{][^}]*[}][;]\|#if[ ]0\([ ][/][*][^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]\)\?[\n]\(static[ ]const[ ]\)\?u32[ ]tg3\(Tso5\?\)\?Fw\(Text\|Rodata\|Data\)\[[^{]*\][ ]=[ ][{][^}]*[}][;][\n]#endif\)\)*' drivers/net/tg3.c + + blob 'static[ ]const[ ]u8[ ]typhoon_firmware_image\[\][ ]=[ ][{][^}]*[}][;]' drivers/net/typhoon-firmware.h + + blobna 'licensed[^\n]*strictly[ ]for[ ]use[^\n]*[\n]*[^\n]*COPS[ ]LocalTalk' 'drivers/net/appletalk/cops_\(ff\|lt\)drv\.h' + blob 'static[ ]const[ ]unsigned[ ]char[ ]ffdrv_code\[\][ ]=[ ][{][^}]*[}][;]' drivers/net/appletalk/cops_ffdrv.h + blob 'static[ ]const[ ]unsgined[ ]char[ ]ltdrv_code\[\][ ]=[ ][{][^}]*[}][;]' drivers/net/appletalk/cops_ltdrv.h + blob '#include[ ]["]cops_\(lt\|ff\)drv\.h["][ ]*\([/][*][^*]*\([*]\+[^/*][^*]*\)*[*]*Firmware[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]\)\?\([\n][\n]*#include[ ]["]cops_\(lt\|ff\)drv\.h["][ ]*\([/][*][^*]*\([*]\+[^/*][^*]*\)*[*]*Firmware[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]\)\?\)*' drivers/net/appletalk/cops.c + + blob 'static[ ]unsigned[ ]char[ ]bits_1200\[\][ ]*=[ ][{][^}]*[}][;]' drivers/net/hamradio/yam1200.h + blob 'static[ ]unsigned[ ]char[ ]bits_9600\[\][ ]*=[ ][{][^}]*[}][;]' drivers/net/hamradio/yam9600.h + blob '#include[ ]["]yam\(96\|12\)00\.h["]\([\n][\n]*#include[ ]["]yam\(96\|12\)00\.h["]\)*' drivers/net/hamradio/yam.c + + blobna 'static[ ]const[ ]u_char[ ]__Xilinx7OD\[\][ ]=[ ][{][^}]*[}][;]' drivers/net/pcmcia/ositech.h + blob '#include[ ]["]ositech\.h["]' drivers/net/pcmcia/smc91c92_cs.c + blobna '\([/][*][ ]Download[ ]the[ ]Seven[ ]of[ ]Diamonds[ ]firmware[^/]*[*][/][\n ]*\)\?for[ ]*[(][^\n]*__Xilinx7OD[^{}]*[{][\n][ ]*outb[ ]*[(]__Xilinx7OD[^}]*[}]' drivers/net/pcmcia/smc91c92_cs.c + + blob 'static[ ]const[ ]u8[ ]microcode\[\][ ]=[ ][{][^}]*[}][ ]*[;]' drivers/net/tokenring/3c359_microcode.h + blob '#include[ ]["]3c359_microcode\.h["]' drivers/net/tokenring/3c359.c + blobna 'start[ ]=[ ][(]0xFFFF[ ]-[ ][(]mc_size[)][^;]*[;][\n ]*[/][*][^*]*\([*]\+[^/*][^*]*\)*[*]\+[/][\n ]*printk[(]KERN_INFO[ ]["]3C359:[ ]Uploading[ ]Microcode:[ ]["][)][;][\n ]*for[ ][(][^{]*\(mc_size[^{]*[)][ ][{][^}]*writeb[(]microcode\[\|[)][ ][{][^}]*writeb[(]microcode\[mc_size\)[^}]*[}]\([\n][ ]*printk[^\n]*[;][\n ]*for[ ][(][^{]*\(mc_size[^{]*[)][ ][{][^}]*writeb[(]microcode\[\|[)][ ][{][^}]*writeb[(]microcode\[mc_size\)[^}]*[}]\)*' drivers/net/tokenring/3c359.c + + blobname 'tr_smctr\.bin' drivers/net/tokenring/smctr.c + + blobname 'kaweth[/]\(new\|trigger\)_code\(_fix\)\?\.bin' drivers/net/usb/kaweth.c + + + blobname '\(agere\|prism\)_\(sta\|ap\)_fw\.bin' 'drivers/net/wireless/\(orinico/\)\?\(orinoco\|fw\)\.c' + blobname 'symbol_sp24t_\(prim\|sec\)_fw' 'drivers/net/wireless/\(\(orinico/\)\?orinoco\.c\|spectrum_cs\.c\)' + + blob 'unsigned[ ]short[ ]sbus_risc_code01\[\][ ]__devinitdata[ ]=[ ][{][^}]*[}][;]' drivers/scsi/qlogicpti_asm.c + blob '#include[ ]["]qlogicpti_asm\.c["]' drivers/scsi/qlogicpti.c + + blob '\([/][*][ ]Microcode[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/][\n]*\)\?static[ ]\(u\(nsigned[ ]\)\?char\|unsigned[ ]short\|ADV_DCNT\)[ ]_\(asc_mcode\|adv_asc3\(550\|8C\(08\|16\)00\)\)_\(buf\[\][ ]=[ ][{][^}]*[}]\|size[ ]=[ ]sizeof[^;]*\|chksum[ ]=[ ]0x[^;]*\)[;]\([ ]*[/][*][^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]\)\?\([\n][\n]*\([/][*][ ]Microcode[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/][\n]*\)\?static[ ]\(u\(nsigned[ ]\)\?char\|unsigned[ ]short\|ADV_DCNT\)[ ]_\(asc_mcode\|adv_asc3\(550\|8C\(08\|16\)00\)\)_\(buf\[\][ ]=[ ][{][^}]*[}]\|size[ ]=[ ]sizeof[^;]*\|chksum[ ]=[ ]0x[^;]*\)[;]\([ ]*[/][*][^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]\)\?\)*' drivers/scsi/advansys.c + + blob '\(#ifdef[ ]UNIQUE_FW_NAME[\n]\)\?static[ ]unsigned[ ]short[ ]\(risc\|fw12\(80e\|160\)i\)_code01\[\][ ]=[ ][{]\([\n]#else[\n]static[ ]unsigned[ ]short[ ]risc_code01\[\][ ]=[ ][{][\n]#endif[\n]\)\?[^}]*[}][;]\([\n][\n]*\(#ifdef[ ]UNIQUE_FW_NAME[\n]\)\?static[ ]unsigned[ ]short[ ]\(risc_code\|fw12\(80e\|160\)i\)_length01[ ]=[ ][^;]*[;]\([\n]#else[\n]static[ ]unsigned[ ]short[ ]risc_code_length01[ ]=[ ][^;]*[;][\n]#endif\)\?\)\?' 'drivers/scsi/ql1\(04\|2\(8\|16\)\)0_fw\.h' + + blobname 'emi26[/]\(bitstream\|firmware\|loader\)\.fw' drivers/usb/misc/emi26.c + + blobname 'emi62[/]\(bitstream\|midi\|spdif\|loader\)\.fw' drivers/usb/misc/emi62.c + + blobname 'keyspan[/]\(mpr\|usa\(18x\|19\(q[iw]\|w\)\?\|28\(x\(a\|b\)\?\)\?\|49w\(lc\)\?\)\)\.fw' drivers/usb/serial/keyspan.c + + accept '[ ][ ]fw_name[ ]=[ ]["]keyspan_pda[/]\(keyspan_pda\|xircom_pgs\)\.fw["][;]' drivers/usb/serial/keyspan_pda.c + blobna 'fw_name[ ]=[ ][^\n]*\([\n]\+[^\n}][^\n]*\)*\([/][*]KEYSPAN_PDA[*][/]\)\?request_ihex_firmware' drivers/usb/serial/keyspan_pda.c + accept '[ ]if[ ][(][/][*]KEYSPAN_PDA[*][/]request_ihex_firmware' drivers/usb/serial/keyspan_pda.c + + blobname 'edgeport[/]\(boot\|down\)2\?\.fw' drivers/usb/serial/io_edgeport.c + blobname 'edgeport[/]down3\.bin' drivers/usb/serial/io_ti.c + + blobname 'ti_\(usb-\)\?\(%d\|3410\|5052\)\.\(fw\|bin\)' drivers/usb/serial/ti_usb_3410_5052.c + + blobname 'whiteheat\(_loader\(_debug\)\?\)\?\.fw' drivers/usb/serial/whiteheat.c + + blob 'static[ ]struct[ ]BA1struct[ ]BA1Struct[ ]=[ ][{][^;]*[}][;]' sound/pci/cs46xx/cs46xx_image.h + + blob 'static[ ]u32[ ]cwc\(4630\|async\|snoop\)_\(code\|parameter\)\[\][ ]=[ ][{][^;]*[}][;]' 'sound/pci/cs46xx/imgs/cwc\(4630\|async\|snoop\)\.h' + # cwcbinhack appears to have been created by hand. + # cwcdma has sources (not verified) in cwcdma.asp. + accept 'static[ ]u32[ ]cwc\(binhack\|dma\)_code\[\][ ]=[ ][{][^;]*[}][;]' 'sound/pci/cs46xx/imgs/cwc\(binhack\|dma\)\.h' + blob '#include[ ]["]\(cs46xx_image\|imgs[/]cwc\(4630\|async\|snoop\)\)\.h["]\([\n][\n]*#include[ ]["]\(cs46xx_image\|imgs[/]cwc\(4630\|async\|snoop\)\)\.h["]\)*' sound/pci/cs46xx/cs46xx_lib.c + + blobname 'korg[/]k1212\.dsp' sound/pci/korg1212/korg1212.c + + blobname 'ess[/]maestro3_assp_\(kernel\|minisrc\)\.fw' sound/pci/maestro3.c + + blobname 'yamaha[/]ds1e\?_\(ctrl\|dsp\)\.fw' sound/pci/ymfpci/ymfpci_main.c + + blobname 'sb16[/]\(\(a\|mu\)law_main\|ima_adpcm_\(init\|capture\|playback\)\)\.csp' sound/isa/sb/sb16_dsp.c + + blob 'static[ ]const[ ]struct[ ][{][^}]*[}][ ]yss225_registers\[\][ ]__devinitdata[ ]=[ ][{][^;]*[}][;]' sound/isa/wavefront/yss225.c + blobname 'yamaha[/]yss225_registers\.bin' sound/isa/wavefront/wavefront_fx.c + blobna 'firmware[ ]=[ ][&]yss225_registers_firmware[;]' sound/isa/wavefront/wavefront_fx.c + blob 'static[ ]const[ ]struct[ ]firmware[ ]yss225_registers_firmware[ ]=[ ][{][^;]*[}][;]' sound/isa/wavefront/wavefront_fx.c + blobna '\(ospath[ ]*-[ ]Pathname[^\n]*ICS2115[^-]*wavefront\.os\|Note:[ ]the[ ]firmware[ ]file[ ]["]wavefront\.os["]\)[^-]*[/]lib[/]firmware\.\([^.]*after[ ]upgrading[ ]the[ ]kernel\)\?' Documentation/sound/alsa/ALSA-Configuration.txt + blobname 'wavefront\.os' sound/isa/wavefront/wavefront_synth.c + + blobna 'and[\n]require[ ]the[ ]use[ ]of[^\n]*propr\?ietary[^:]*' Documentation/arm/IXP4xx + blob 'If[ ]you[ ]need[ ]to[ ]use[ ]any[ ]of[ ]the[ ]above[^\n]*download[^:]*:[\n ]*http:[^\n]*ixp4[^\n]*' Documentation/arm/IXP4xx + + blobname 'xc\(%d\|[0-9]*\)\.bin' arch/arm/mach-netx/include/mach/xc.h + accept 'int[ ]xc_request_firmware[(]struct[ ]xc[ ]*[*][ ]*x[)][;]' arch/arm/mach-netx/include/mach/xc.h + accept 'int[ ]xc_request_firmware[(]struct[ ]xc[ ]*[*][ ]*x[)][\n][{]' arch/arm/mach-netx/xc.c + accept '[ ][ ]dev_err[(]x->dev,[ ]["]request_firmware[ ]failed\\n["][)][;]' arch/arm/mach-netx/xc.c + accept 'EXPORT_SYMBOL[(]xc_request_firmware[)][;]' arch/arm/mach-netx/xc.c + accept '[ ][ ]if[ ][(]xc_request_firmware[(]priv->xc[)][)][ ][{]' drivers/net/netx-eth.c + + blobname 'iop_fw_load_[sm]pu' arch/cris/arch-v32/drivers/iop_fw_load.c + accept 'int[ ]iop_fw_load_[sm]pu[(]' arch/cris/arch-v32/drivers/iop_fw_load.c + accept '[ ]retval[ ]=[ ]request_firmware[^;]*[&]iop_[sm]pu_device' arch/cris/arch-v32/drivers/iop_fw_load.c + accept 'EXPORT_SYMBOL[(]iop_fw_load_[sm]pu[)][;]' arch/cris/arch-v32/drivers/iop_fw_load.c + + accept '[/][*][ ]fake[ ]device[ ]for[ ]request_firmware[ ][*][/]' arch/x86/kernel/microcode_core.c + + blobname 'amd-ucode[/]microcode_amd\.bin' arch/x86/kernel/microcode_amd.c + + blobname 'intel-ucode[/]\([0-9a-f][0-9a-f]\|%02x\)-\([0-9a-f][0-9a-f]\|%02x\)-\([0-9a-f][0-9a-f]\|%02x\)' 'arch/x86/kernel/microcode\(_intel\)\?\.c' + + blobname 'BCM2033-\(MD\.hex\|FW\.bin\)' drivers/bluetooth/bcm203x.c + + blobname 'bfubase\.frm' drivers/bluetooth/bfusb.c + + blobname 'BT3CPCC\.bin' drivers/bluetooth/bt3c_cs.c + + blobname 'cyzfirm\.bin' drivers/char/cyclades.c + + accept 'MODULE_FIRMWARE[(]["]dsp56k[/]bootstrap\.bin["][)][;]' drivers/char/dsp56k.c + blobna 'const[ ]char[ ]fw_name\[\][ ]=[ ]["]dsp56k[/]bootstrap\.bin["][;][^\n]*\([\n]\+[^\n}][^\n]*\)*request_firmware[^\n]*\([\n]\+[^\n}][^\n]*\)*[\n]\+[ ]err[ ]=[ ]request_firmware[(][&]fw,[ ]fw_name,[ ]' drivers/char/dsp56k.c + accept '[ ]const[ ]char[ ]fw_name\[\][ ]=[ ]["]dsp56k[/]bootstrap\.bin["][;][^\n]*\([\n]\+[^\n}][^\n]*\)*[\n]\+[ ]err[ ]=[ ]request_firmware[(][&]fw,[ ]fw_name,[ ]' drivers/char/dsp56k.c + + blobname 'isi\(6\(08\|\(08\|16\)em\)\|46\(08\|16\)\)\.bin' drivers/char/isicom.c + + blobname 'c\(218t\|p204\|320t\)unx\.cod' drivers/char/moxa.c + accept '[ ][ ]printk[(]KERN_ERR[ ]["]MOXA:[ ]request_firmware[ ]failed' drivers/char/moxa.c + + # This driver enables the user to update the non-Free BIOS, but it + # only issues a firmware request if specifically told to. It + # doesn't require any non-Free firwmare to function, and it + # doesn't actually recommend users to perform updates, so I'm + # leaving it in. + accept '[ ][ ][ ]req_firm_rc[ ]=[ ]request_firmware_nowait[(][^;]*,[ ]["]dell_rbu["],' drivers/firmware/dell_rbu.c + accept '[ ]*["]dell_rbu:%s[ ]request_firmware_nowait["]' drivers/firmware/dell_rbu.c + + blobname 'xc3028-v27\.fw' drivers/media/common/tuners/tuner-xc2028.h + blobname 'xc3028L-v36\.fw' drivers/media/common/tuners/tuner-xc2028.h + + blobname 'dvb-fe-xc5000-1\.1\.fw' drivers/media/common/tuners/xc5000.c + + blobname '4210\(100[12]\|%4X\)\.sb' drivers/net/irda/irda-usb.c + blobna '[/][*][ \n*]*[ ]Known[ ]firmware[^*]*\([*]\+[^/*][^*]*\)*[*]*\(STIR421x\|4210\(100[12]\|%4X\)\.sb\)[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]' drivers/net/irda/irda-usb.c + + blobname 'myri10ge_\(rss_\)\?ethp\?_z8e\.dat' drivers/net/myri10ge.c + blobna 'If[ ]the[ ]driver[ ]can[ ]neither[ ]enable[ ]ECRC[^*]*\([*]\+[^/*][^*]*\)*[*]*myri10ge_\(rss_\)\?ethp\?_z8e\.dat[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]' drivers/net/myri10ge.c + + blobname 'spider_fw\.bin' drivers/net/spider_net.h + + blobname 'tms380tr\.bin' drivers/net/tokenring/tms380tr.c + + blobname 'atmel_at76c50\(2\([de]\|_3com\)\?\|4a\?\(_2958\)\?\|6\)\(\.bin\)\?' drivers/net/wireless/atmel.c + accept '[ ]*priv->firmware[ ]=[ ]\(NULL\|new_firmware\)[;]' drivers/net/wireless/atmel.c + + blobname 'b43\(legacy\)\?\(%s\)\?[/]\(%s\|ucode\([2459]\|1[1345]\)\|pcm5\|[abn]0g[01]initvals\(5\|1[13]\)\)\.fw' 'drivers/net/wireless/b43\(legacy\)\?/main.c' + blobname 'pcm5\.fw' drivers/net/wireless/b43/main.c + blobna 'b43legacyerr[(][^;]*must[ ]go[ ]to[ ]http[^;]*b43#devicefirmware[^;]*[)][;]' drivers/net/wireless/b43legacy/main.c + blobna 'You[ ]must[ ]go[ ]to[^;]*b43#devicefirmware[^;]*[^";)]' drivers/net/wireless/b43/main.c + blobna 'http:[/][/]wireless[^ ";)]*b43#devicefirmware' drivers/net/wireless/b43/main.c + + blob '#define[ ]IPW2100_FW_\(\(\(MAJOR\|MINOR\)_VERSION\|\(MAJOR\|MINOR\)[(]x[)]\)\|VERSION\)\([^\n]*\\[\n]\)*[^\n]*\([\n][\n]*#define[ ]IPW2100_FW_\(\(\(MAJOR\|MINOR\)_VERSION\|\(MAJOR\|MINOR\)[(]x[)]\)\|VERSION\)\([^\n]*\\[\n]\)*[^\n]*\)*' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2100\.c' + blobname 'ipw2100-\(["]\([^"\n]\|[\\][\n]\)*["]\([^"]\|[\\]["]\)*\)\+' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2100\.c' + blobname '__stringify[(]IPW2100_FW_MINOR_VERSION[)]' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2100\.c' + accept '[ ]*Portions[ ]of[ ]ipw2100_\(do_\)\?mod_firmware_load[, ]*\(ipw2100_\(do_\)\?mod_firmware_load[, and\n]*\)*' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2100\.c' + accept '[ ]ipw2100_mod_firmware_load[(]fw[)][;]' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2100\.c' + accept 'static[ ]int[ ]ipw2100_mod_firmware_load[(]' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2100\.c' + blobna 'if[ ][(]IPW2100_FW_MAJOR[^{]*[{][^}]*[ ][}]' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2100\.c' + blobname '["]["][ ]x[ ]["]\.fw["]' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2100\.c' + + accept '[/][*][ ]Call[ ]this[ ]function[ ]from[ ]process[ ]context[^*]*\([*]\+[^/*][^*]*\)*[*]*request_firmware' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2200.c' + blobname 'ipw2200-\(i\?bss\|sniffer\)\.fw' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2200.c' + accept '[ ][ ]IPW_ERROR[(]["]%s[ ]request_firmware[ ]failed' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2200.c' + + blobname 'iwlwifi-\(3945\|4965\|[156]000\(G2[AB]\)\?\|1[03]0\|6050\)["][ ]IWL\(3945\|4965\|[156]000\(G2[AB]\)\?\|1[03]0\|6050\)_UCODE_API[ ]["]\.ucode' 'drivers/net/iwlwifi/iwl\(3945-base\|-\(3945\|4965\|[156]000\)\)\.[ch]' + blobname 'iwlwifi-3945-' drivers/net/iwlwifi/iwl-3945.h + blobname '#api[ ]["]\.ucode["]' 'drivers/net/iwlwifi/iwl-\(3945.h\|\(4965\|[156]000\)\.c\)' + accept '#define\([ ]_\?IWL3945_MODULE_FIRMWARE[(]api[)]\)\+' drivers/net/iwlwifi/iwl-3945.h + accept '[ ][ ][*][ ]request_firmware[(][)][ ]is[ ]synchronous' 'drivers/net/iwlwifi/iwl\(3945-base\|-agn\)\.c' + blobname 'iwlwifi-4965-' drivers/net/iwlwifi/iwl-4965.c + blobname 'iwlwifi-5\(00\|15\)0-' drivers/net/iwlwifi/iwl-5000.c + blobname '%s%[dus]%s["],[\n ]*name_pre,[ ]\(\(priv->fw_\)\?index\|tag\|idx\),[ ]["]\.ucode' 'drivers/net/iwlwifi/iwl\(3945-base\|-agn\).c' + + blobname 'libertas_cs\(_helper\)\?\.fw' drivers/net/wireless/libertas/if_cs.c + blobname 'sd\(8385\|868[68]\)\(_helper\)\?\.bin\(["],[\n][ ]*\.firmware[ ]=[ ]["]sd\(8385\|868[68]\)\.bin\)\?' 'drivers/\(net/wireless/libertas/if_sdio\.c\|bluetooth/btmrvl_sdio\.c\)' + blobname 'sd\(8385\|868[68]\)\(_helper\)\?\.bin' 'drivers/\(net/wireless/libertas/if_sdio\.c\|bluetooth/btmrvl_sdio\.c\)' + accept '[ ]*card->firmware[ ]=[ ]\(if_sdio\|lbs_fw\|fw_name\)' drivers/net/wireless/libertas/if_sdio.c + blobname 'usb8388\(-5\.126\.0\.p5\)\?\.bin' drivers/net/wireless/libertas/if_usb.c + blob '[/][*][^*]*\([*]\+[^/*][^*]*\)*[*]*usb8388\(-5\.126\.0\.p5\)\?\.bin[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]' drivers/net/wireless/libertas/if_usb.c + accept '[ ][ ]lbs_pr_err[(]["]request_firmware\([(][)]\)\?[ ]failed' 'drivers/net/wireless/if_\(spi\|usb\)\.c' + blobna 'o\.[ ]Copy[ ]the[ ]firmware[ ]image[^\n]*usb8388\([^\n]\|[\n][ ]*[^ \n]\)*' drivers/net/wireless/libertas/README + blobna '\[fw_name=usb8388[^]]*\]' drivers/net/wireless/libertas/README + + blobname 'usb8388\.bin' drivers/base/Kconfig + accept '[ ][ ][ ]So,[ ]for[ ]example,[ ]you[ ]might[ ]set[ ]CONFIG_EXTRA_FIRMWARE=["]whatever\.bin["]' drivers/base/Kconfig + accept '[ ][ ][ ]kernel\.[ ]Then[ ]any[ ]request_firmware[(]\(["]whatever\.bin["]\)[)]' drivers/base/Kconfig + + blobname 'lbtf_usb\.bin' drivers/net/wireless/libertas_tf/if_usb.c + + blobname 'isl38\(86\|87\|90\)\(pci\|usb\(_bare\)\?\)\?' 'drivers/net/wireless/p54/p54\(pci\.c\|usb\.[ch]\)' + blob '[/][*][ ]for[ ]isl3886[ ]register[ ]definitions[^*]*\([*]\+[^/*][^*]*\)*[*]\+[/]' drivers/net/wireless/p54/p54usb.h + blobna 'If[ ]you[ ]enable[ ]this\([^\n]\|[\n][ ]*[^ \n]\)*isl3890\([^\n]\|[\n][ ]*[^ \n]\)*' drivers/net/wireless/Kconfig + + blobname 'isl38\(77\|86\|90\)' drivers/net/wireless/prism54/islpci_dev.c + + blobname 'rt2[56]61s\?\.bin' drivers/net/wireless/rt2x00/rt61pci.h + blobname 'rt73\.bin' drivers/net/wireless/rt2x00/rt73usb.h + + blobname 'zd1201\(-ap\)\?\.fw' drivers/net/wireless/zd1201.c + + blobname 'zd1211[/]zd1211b\?_\(u\([rb]\|phr\)\?\)\?' drivers/net/wireless/zd1211/zd_usb.c + + # ??? gotta introduce some means to match false-positives + # including post context containing blobs, so that the macro name + # is not flagged or deblobbed, but the blob name is. + # blobna 'PCMCIA_\([PM]FC_\)\?DEVICE_CIS_\(MANF_CARD\|PROD_ID[1-4]*\)' + # accept '[ ] PCMCIA_\([PM]FC_\)\?DEVICE_CIS_\(MANF_CARD\|PROD_ID[1-4]*\)[(][^)]*, ["][/][*][(]DEBLOBBED[)][*][/]["][)]' + # accept '#define PCMCIA_\([PM]FC_\)\?DEVICE_CIS_\(MANF_CARD\|PROD_ID[1-4]*\)[(]' include/pcmcia/device_id.h + + # These are not software; they're Free, but GPLed without in-tree sources. + # blobname '\(cis[/]\)\?3CCFEM556\.cis' drivers/net/pcmcia/3c574_cs.c + # blobname '\(cis[/]\)\?3CXEM556\.cis' drivers/net/pcmcia/3c589_cs.c + # blobname '\(cis[/]\)\?\(PCMLM28\|DP83903\|LA-PCM\|PE520\|NE2K\|PE-200\|tamarack\)\.cis' drivers/net/pcmcia/pcnet_cs.c + # blobname '\(cis[/]\)\?\(PCMLM28\|DP83903\|3C\(CF\|X\)EM556\|MT5634ZLX\|COMpad[24]\|RS-COM-2P\|GLOBETROTTER\)\.cis' drivers/serial/serial_cs.c + # These are not software; they're Free, but GPLed without textual sources. + # It is safe to assume that these binaries *are* sources, since they + # can be trivially converted back to a textual form, without loss. + # blobname '\(cis[/]\)\?SW_\([78]xx\|555\)_SER\.cis' drivers/serial/serial_cs.c + + accept '[ ]\(ds_\)\?\(dev_\)\?dbg[(]\(1[,][ ]\)\?\([&]dev->dev,[ ]\)\?["]trying[ ]to[ ]load[ ]\(CIS[ ]file\|firmware\)[ ]%s[\\]n["],[ ]filename[)][;][\n]*[ ]if[ ][(]\(strlen[(]filename[)][^\n]*\([{][^}]*[ ][}]\|[)][\n][ ]*return[^\n]*[;]\)[\n]*[ ]snprintf[(]path,[ ]\(20\|sizeof[(]path[)]\),[^\n]*,[ ]filename[)][;][\n]*[ ]if[ ][(]request_firmware[(][&]fw,[ ]path\|request_firmware[(][&]fw,[ ]filename\),[ ][&]dev->dev[)][^\n]*[)][ ][{][\n][ ]*if[ ][(]fw->size[ ]>=[ ]CISTPL_MAX_CIS_SIZE[)]' drivers/pcmcia/ds.c + accept 'MODULE_FIRMWARE[(]["]\(cis[/]\)\?\(PCMLM28\|DP83903\|3C\(CF\|X\)EM556\|MT5634ZLX\|COMpad[24]\|RS-COM-2P\|GLOBETROTTER\|SW_\([78]xx\|555\)_SER\)\.cis["][)][;]\([\n]MODULE_FIRMWARE[(]["]\(cis[/]\)\?\(PCMLM28\|DP83903\|3C\(CF\|X\)EM556\|MT5634ZLX\|COMpad[24]\|RS-COM-2P\|GLOBETROTTER\|SW_\([78]xx\|555\)_SER\)\.cis["][)][;]\)*' drivers/serial/serial_cs.c + accept 'MODULE_FIRMWARE[(]["]\(cis[/]\)\?\(PCMLM28\|DP83903\|LA-PCM\|PE520\|NE2K\|PE-200\|tamarack\)\.cis["][)][;]\([\n]MODULE_FIRMWARE[(]["]\(cis[/]\)\?\(PCMLM28\|DP83903\|LA-PCM\|PE520\|NE2K\|PE-200\|tamarack\)\.cis["][)][;]\)*' drivers/net/pcnet_cs.c + + # This enables but does not encourage firmware updates. + accept '[ ]err[ ]=[ ]request_firmware[(][&]asd_ha->bios_image,[\n ]*filename_ptr,[\n ]*[&]asd_ha->pcidev->dev[)][;]' drivers/scsi/aic94xx/aic94xx_init.c + blobname 'aic94xx-seq\.fw' drivers/scsi/aic94xx/aic94xx_seq.h + + # This enables but does not encourage firmware updates. + accept '[ ]if[(]request_firmware[(]&fw_entry,[ ]fname,[ ]&ioa_cfg->pdev->dev[)][)]' drivers/scsi/ipr.c + + accept '[ ]res[ ]=[ ]request_firmware[(]&fw,[ ]["]sas_addr["],[ ]&shost->shost_gendev[)][;]' drivers/scsi/libsas/sas_scsi_host.c + + blobname 'ql\(2\([12345]00\|322\)\|8[12]00\)_fw\.bin' drivers/scsi/qla2xxx/qla_os.c + blobna 'By[ ]default,[ ]firmware[ ]for[ ]the[ ]ISP[ ]parts\([^\n]\|[\n]*[ ]\)*ql2[12345]00_fw\.bin\([^\n]\|[\n]*[ ]\)*ftp:[/][/][^\n]*firmware[/]\(.*linux-firmware[ ]tree[ ]as[ ]well\.\)\?' drivers/scsi/qla2xxx/Kconfig + + blobname 'icom_\(asc\|res_dce\|call_setup\)\.bin' drivers/serial/icom.c + + blobname 'fsl_qe_ucode_uart_\(%u\|[0-9]*\)_\(%u\|[0-9]*\)\(%u\|[0-9]*\)\.bin' drivers/serial/ucc_uart.c + + blobname 'atmel_at76c50\(3-\(i386[13]\|rfmd\(-acc\)\?\)\|5\(a\(mx\)\?\)\?-rfmd\(2958\)\?\)\.bin' 'drivers/\(\(staging\|net/wireless\)/at76_usb/at76_usb\.c\|at76c50x-usb\.c\)' + + accept 'static[ ]struct[ ]go7007_usb_board[ ]board_\(matrix_\(ii\|reload\|revolution\)\|star_trek\|px_tv402u\|xmen\|lifeview_lr192\|endura\|adlink_mpg24\|sensoray_2250\)[ ]=[ ][{][\n]\([ ]\.flags[ ]*=[ ][^",]*,[\n]*\)*[ ]\.main_info[ ]*=[ ][{][\n][ ][ ]\.firmware[ ]*=[ ]' drivers/staging/go7007/go7007-usb.c + accept 'static[ ]struct[ ]go7007_board_info[ ]board_voyager[ ]=[ ][{][\n][ ]\.firmware[ ]*=[ ]' drivers/staging/go7007/saa7134-go7007.c + blobname 'go7007\(fw\|tv\)\.bin' 'drivers/staging/go7007/\(go7007-\(driver\|usb\)\|saa7134-go7007\)\.c' + + blobname 'cxacru-\(%s\|fw\|bp\|cf\)\.bin' drivers/usb/atm/cxacru.c + + blobname 'speedtch-\(%d\|[0-9]*\)\.bin\(\.\(%x\|\(0x\)\?[0-9a-fA-F]*\)\(\.\(%02x\|[0-9a-fA-F][0-9a-fA-F]\)\)\?\)\?' drivers/usb/atm/speedtch.c + + blobname 'ueagle-atm[/]' drivers/usb/atm/ueagle-atm.c + blobname '\(adi930\|eagle\(I*\|IV\)\)\.fw' drivers/usb/atm/ueagle-atm.c + blobname 'DSP[49e][ip]\.bin' drivers/usb/atm/ueagle-atm.c + blobname '930-fpga\.bin' drivers/usb/atm/ueagle-atm.c + blobname 'CMV[x9ae][yip]\.bin\(\.v2\)\?' drivers/usb/atm/ueagle-atm.c + + blobname 'isight\.fw' drivers/usb/misc/isight_firwmare.c + + blobname '\(i1480-\(pre-phy\|usb\|phy\)\|ptc\)-0\.0\.bin' drivers/uwb/i1480/dfu/usb.c + + accept '[ ]retval[ ]=[ ]request_firmware[(][&]fw_entry,[ ]["]metronome\.wbf["],[ ][&]dev->dev[)][;]' drivers/video/metronomefb.c + + blobname '\(vx[/]\)\?\(bx_1_v\(xp\|p4\)\.b56\|x1_\(1_v\(x[2p]\|p4\)\|2_v22\)\.xlx\|bd56\(002\|3v2\|3s3\)\.boot\|l_1_v\(x[2p]\|p4\|22\)\.d56\)' sound/drivers/vx/vx_hwdep.c + + blobname '\(ea[/]\)\?darla20_dsp\.fw' sound/pci/echoaudio/darla20.c + blobname '\(ea[/]\)\?darla24_dsp\.fw' sound/pci/echoaudio/darla24.c + blobname '\(ea[/]\)\?\(\(loader\|echo3g\)_dsp\|3g_asic\)\.fw' sound/pci/echoaudio/echo3g.c + blobname '\(ea[/]\)\?gina20_dsp\.fw' sound/pci/echoaudio/gina20.c + blobname '\(ea[/]\)\?\(\(loader\|gina24_3[06]1\)_dsp\|gina24_3[06]1_asic\)\.fw' sound/pci/echoaudio/gina24.c + blobname '\(ea[/]\)\?\(loader\|indigo\)_dsp\.fw' sound/pci/echoaudio/indigo.c + blobname '\(ea[/]\)\?\(loader\|indigo_dj\)_dsp\.fw' sound/pci/echoaudio/indigodj.c + blobname '\(ea[/]\)\?\(loader\|indigo_io\)_dsp\.fw' sound/pci/echoaudio/indigoio.c + blobname '\(ea[/]\)\?layla20_\(dsp\|asic\)\.fw' sound/pci/echoaudio/layla20.c + blobname '\(ea[/]\)\?\(\(loader\|layla24\)_dsp\|layla24_\(1\|2[AS]\)_asic\)\.fw' sound/pci/echoaudio/layla24.c + blobname '\(ea[/]\)\?\(loader\|mia\)_dsp\.fw' sound/pci/echoaudio/mia.c + blobname '\(ea[/]\)\?\(\(loader\|mona_3[06]1\)_dsp\|mona_3[06]1\(_1\)\?_asic_\(48\|96\)\|mona_2_asic\)\.fw' sound/pci/echoaudio/gina24.mona + blobname 'ea[/]%s' sound/pci/echoaudio/echoaudio.c + + blobname 'emu[/]\(hana\|\(audio\|micro\)_dock\|emu\(0404\|1010\(b\|_notebook\)\)\)\.fw' sound/pci/emu10k1/emu10k1_main.c + + blobname '\(mixart[/]\)\?miXart8\(AES\)\?\.\(xlx\|elf\)' sound/pci/mixart/mixart_hwdep.c + + blobname '\(pcxhr[/]\)\?\(x[ic]_1_882\|[ebd]321_512\|xlxint\|\(xlxc\|dsp[ebd]\)\(882\|1\?222\|924\)\(e\|hr\)\?\)\(\.dat\|\.[ebd]56\)' sound/pci/pcxhr/pcxhr_hwdep.c + + blobna 'You[ ]need[ ]to[ ]install[\n]*riptide\.hex[\n]\.[\n]' Documentation/sound/alsa/ALSA-Configuration.txt + blobname 'riptide\.hex' sound/pci/riptide/riptide.c + defsnc 'static[ ]union[ ]firmware_version[ ]firmware_versions\[\][ ]=' sound/pci/riptide/riptide.c + blobna 'chip->firmware[ ]=[ ]firmware[;]' sound/pci/riptide/riptide.c