aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2016-03-03 20:55:50 +0100
committerFrancis Rowe <info@gluglug.org.uk>2016-03-03 20:56:05 +0100
commit2f3d87aec85f5759180380cbc156472378164d11 (patch)
tree79865b35916651f6c4342e3fba977a73018eee98 /resources
parent278362ead551ebc1ed767df2e0896b04b51242cd (diff)
downloadlibrebootfr-2f3d87aec85f5759180380cbc156472378164d11.tar.gz
librebootfr-2f3d87aec85f5759180380cbc156472378164d11.zip
Revert "iunfinished patch: copy coreboot per revision, not board"
I'm an idiot. This patch wasn't supposed to be pushed yet because not finished. Reverting it for the time being. This reverts commit 89cc8c38c1cf3865c3684e5bd6658eedf0e61cfd.
Diffstat (limited to 'resources')
-rwxr-xr-xresources/scripts/helpers/build/clean/coreboot10
-rwxr-xr-xresources/scripts/helpers/build/module/coreboot140
-rwxr-xr-xresources/scripts/helpers/download/coreboot118
3 files changed, 107 insertions, 161 deletions
diff --git a/resources/scripts/helpers/build/clean/coreboot b/resources/scripts/helpers/build/clean/coreboot
index 880447d0..baaabbd4 100755
--- a/resources/scripts/helpers/build/clean/coreboot
+++ b/resources/scripts/helpers/build/clean/coreboot
@@ -32,15 +32,6 @@ printf "Cleaning the previous build of coreboot and its utilities\n"
for payload in coreboot/*; do
for board in "${payload}/"*; do
- (
- # Reset to master branch, where there are no board-specific patches applied
- # also remove the .git history and so on
- cd "${board}/"
- git checkout master
- rm -Rf ".git/"*
- rm -Rf "3rdparty/"*/*.git
- )
-
# Clean coreboot, of course
make -C "${board}/" distclean
@@ -55,7 +46,6 @@ for payload in coreboot/*; do
done
# Also do the same for the crossgcc version of coreboot
-# Note how we do not want to delete crossgcc. We only clean it
make -C "crossgcc/" crossgcc-clean
for util in {cbfs,ifd,nvram}tool cbmem; do
make -C "crossgcc/util/${util}/" clean
diff --git a/resources/scripts/helpers/build/module/coreboot b/resources/scripts/helpers/build/module/coreboot
index cfe21e6c..d3e86cd2 100755
--- a/resources/scripts/helpers/build/module/coreboot
+++ b/resources/scripts/helpers/build/module/coreboot
@@ -30,146 +30,6 @@ set -u -e
printf "Building the utilities in coreboot\n"
-for payloads in resources/libreboot/config/*; do
-
- if [ ! -d "${payloads}/" ]; then
- continue
- fi
-
- payload="${payloads##*/}"
-
- for boardconfig in resources/libreboot/config/${payload}/*; do
-
- if [ ! -d "${boardconfig}/" ]; then
- continue
- fi
-
- boardname="${boardconfig##*/}"
- cbrevision=$(cat "${boardconfig}/cbrevision")
- vbootrevision=$(cat "${boardconfig}/vbootrevision")
-
- reused_coreboot_patches="resources/libreboot/patch/coreboot/${cbrevision}/${payload}/${boardname}/reused.list"
- reused_vboot_patches="resources/libreboot/patch/vboot/${vbootrevision}/${payload}/${boardname}/reused.list"
- for reused_patches in "${reused_coreboot_patches}" "${reused_vboot_patches}"; do
- if [ -f "${reused_patches}" ]; then
- for patch in $(cat "${reused_patches}"); do
- if [ ! -f "./${patch}" ]; then
- printf "%s listed in %s does not exist\n" "${patch}" "${reused_patches}"
- exit 1
- fi
- done
- fi
- done
-
- done
-done
-
-# sanity check (check for invalid paths in the reused.list patch lists before proceeding)
-# in ascending filename order, apply patches from a directory
-apply_patches_from_directory() {
- patch_directory="${1}" # directory containing the patch files
-
- if [ -d "${patch_directory}" ]; then
- for patch in ${patch_directory}/*.patch; do
-
- if [ "${patch##*/}" = "*.patch" ]; then # oh so ugly
- continue # ugly ugly ugly ugly ugly
- fi # most hideous thing you've ever seen
-
- git am "${patch}" || return 1
- done
- fi
-}
-# files listed in the file (if found) are absolute paths, relative to the root of the libreboot src directory
-# the file lists patches patches that should be applied
-apply_patches_from_file() {
- patch_list="${1}" # file listing the paths to all the patches
- libreboot_src_root="${2}" # path to the root of the libreboot_src directory
-
- if [ -f "${patch_list}" ]; then
- for patchname in $(cat "${patch_list}"); do
- git am "${libreboot_src_root}/${patchname}" || return 1
- done
- fi
-}
-make_coreboot_src_directory() {
- payload="${1}"
- cbrevision="${2}"
- firmwarepath="${3}" # libreboot_src/coreboot/
-(
- cd "${firmwarepath}/"
- # copy coreboot directory there
- rm -Rf "${payload:?}/${cbrevision:?}/"
- if [ ! -d "${payload}/" ]; then
- mkdir -p "${payload}/"
- fi
- cp -R "coreboot/" "${payload}/${cbrevision}/"
-)
-}
-reset_at_revision() {
- revision="${1}"
- git reset --hard ${revision}
-}
-
-for payloads in ../../resources/libreboot/config/*; do
-
- if [ ! -d "${payloads}/" ]; then
- continue
- fi
-
- payload="${payloads##*/}"
-
- for boardconfig in ../../resources/libreboot/config/${payload}/*; do
-
- if [ ! -d "${boardconfig}/" ]; then
- continue
- fi
-
- boardname="${boardconfig##*/}"
- cbrevision=$(cat "${boardconfig}/cbrevision")
- vbootrevision=$(cat "${boardconfig}/vbootrevision")
-
- # the same vboot revision is always used for coreboot revision,
- # so we don't need to wworry about checking for that here
-
- if [ -d "../${cbrevision}" ]; then
- continue
- # the directory already exists, no need to recreate it
- fi
-
- make_coreboot_src_directory ${payload} ${boardname} ..
-
- # patch that version
- (
-
- cd "../${payload}/${cbrevision}/"
- reset_at_revision ${cbrevision}
-
- # apply patches (coreboot, common to all systems using this revision)
- apply_patches_from_directory "../../../resources/libreboot/patch/common/coreboot/${cbrevision}"
- # apply patches re-used from other boards, before applying main patches (common patches for similar boards)
- apply_patches_from_file "../../../resources/libreboot/patch/coreboot/${cbrevision}/${payload}/${boardname}/reused.list" ../../..
- # apply patches (coreboot, machine-specific for this revision)
- apply_patches_from_directory "../../../resources/libreboot/patch/coreboot/${cbrevision}/${payload}/${boardname}"
-
- cd "3rdparty/vboot/"
- # reset to known revision (vboot)
- reset_at_revision ${vbootrevision}
-
- # apply patches (vboot, common to all systems using this revision)
- apply_patches_from_directory "../../../../../resources/libreboot/patch/common/vboot/${vbootrevision}"
- # apply patches re-used from other boards, before applying main patches (common patches for similar boards)
- apply_patches_from_file "../../../../../resources/libreboot/patch/vboot/${vbootrevision}/${payload}/${boardname}/reused.list" ../../../../..
- # apply patches (vboot, machine-specific for this revision)
- apply_patches_from_directory "../../../../../resources/libreboot/patch/vboot/${vbootrevision}/${payload}/${boardname}"
-
- )
- done
-done
-
-
-
-
# clean coreboot and crossgcc (source archives preserved)
for payload in coreboot/*; do
for board in "${payload}/"*; do
diff --git a/resources/scripts/helpers/download/coreboot b/resources/scripts/helpers/download/coreboot
index 125d11a4..16bd1a87 100755
--- a/resources/scripts/helpers/download/coreboot
+++ b/resources/scripts/helpers/download/coreboot
@@ -36,6 +36,87 @@ fi
# coreboot revisios used for crossgcc
crossgccrevision="4351ace145c4069f9c93ca7541d6dfaf8300b53b"
+# sanity check (check for invalid paths in the reused.list patch lists before proceeding)
+for payloads in resources/libreboot/config/*; do
+
+ if [ ! -d "${payloads}/" ]; then
+ continue
+ fi
+
+ payload="${payloads##*/}"
+
+ for boardconfig in resources/libreboot/config/${payload}/*; do
+
+ if [ ! -d "${boardconfig}/" ]; then
+ continue
+ fi
+
+ boardname="${boardconfig##*/}"
+ cbrevision=$(cat "${boardconfig}/cbrevision")
+ vbootrevision=$(cat "${boardconfig}/vbootrevision")
+
+ reused_coreboot_patches="resources/libreboot/patch/coreboot/${cbrevision}/${payload}/${boardname}/reused.list"
+ reused_vboot_patches="resources/libreboot/patch/vboot/${vbootrevision}/${payload}/${boardname}/reused.list"
+ for reused_patches in "${reused_coreboot_patches}" "${reused_vboot_patches}"; do
+ if [ -f "${reused_patches}" ]; then
+ for patch in $(cat "${reused_patches}"); do
+ if [ ! -f "./${patch}" ]; then
+ printf "%s listed in %s does not exist\n" "${patch}" "${reused_patches}"
+ exit 1
+ fi
+ done
+ fi
+ done
+
+ done
+done
+
+# in ascending filename order, apply patches from a directory
+apply_patches_from_directory() {
+ patch_directory="${1}" # directory containing the patch files
+
+ if [ -d "${patch_directory}" ]; then
+ for patch in ${patch_directory}/*.patch; do
+
+ if [ "${patch##*/}" = "*.patch" ]; then # oh so ugly
+ continue # ugly ugly ugly ugly ugly
+ fi # most hideous thing you've ever seen
+
+ git am "${patch}" || return 1
+ done
+ fi
+}
+# files listed in the file (if found) are absolute paths, relative to the root of the libreboot src directory
+# the file lists patches patches that should be applied
+apply_patches_from_file() {
+ patch_list="${1}" # file listing the paths to all the patches
+ libreboot_src_root="${2}" # path to the root of the libreboot_src directory
+
+ if [ -f "${patch_list}" ]; then
+ for patchname in $(cat "${patch_list}"); do
+ git am "${libreboot_src_root}/${patchname}" || return 1
+ done
+ fi
+}
+make_coreboot_src_directory() {
+ payload="${1}"
+ boardname="${2}"
+ firmwarepath="${3}" # libreboot_src/coreboot/
+(
+ cd "${firmwarepath}/"
+ # copy coreboot directory there
+ rm -Rf "${payload:?}/${boardname:?}/"
+ if [ ! -d "${payload}/" ]; then
+ mkdir -p "${payload}/"
+ fi
+ cp -R "coreboot/" "${payload}/${boardname}/"
+)
+}
+reset_at_revision() {
+ revision="${1}"
+ git reset --hard ${revision}
+}
+
printf "Downloading coreboot, patching coreboot and deblobbing coreboot\n"
# This grabs current base used, and applies patches
@@ -87,22 +168,39 @@ for payloads in ../../resources/libreboot/config/*; do
continue
fi
+ boardname="${boardconfig##*/}"
cbrevision=$(cat "${boardconfig}/cbrevision")
vbootrevision=$(cat "${boardconfig}/vbootrevision")
- # the same vboot revision is always used for coreboot revision,
- # so we don't need to wworry about checking for that here
+ make_coreboot_src_directory ${payload} ${boardname} ..
- if [ -d "../${cbrevision}/${cbrevision}" ]; then
- continue
- # the directory already exists, no need to recreate it
- fi
+ # patch that version
+ (
- make_coreboot_src_directory ${cbrevision} ${cbrevision} ..
- done
-done
+ cd "../${payload}/${boardname}/"
+ reset_at_revision ${cbrevision}
+
+ # apply patches (coreboot, common to all systems using this revision)
+ apply_patches_from_directory "../../../resources/libreboot/patch/common/coreboot/${cbrevision}"
+ # apply patches re-used from other boards, before applying main patches (common patches for similar boards)
+ apply_patches_from_file "../../../resources/libreboot/patch/coreboot/${cbrevision}/${payload}/${boardname}/reused.list" ../../..
+ # apply patches (coreboot, machine-specific for this revision)
+ apply_patches_from_directory "../../../resources/libreboot/patch/coreboot/${cbrevision}/${payload}/${boardname}"
+ cd "3rdparty/vboot/"
+ # reset to known revision (vboot)
+ reset_at_revision ${vbootrevision}
+ # apply patches (vboot, common to all systems using this revision)
+ apply_patches_from_directory "../../../../../resources/libreboot/patch/common/vboot/${vbootrevision}"
+ # apply patches re-used from other boards, before applying main patches (common patches for similar boards)
+ apply_patches_from_file "../../../../../resources/libreboot/patch/vboot/${vbootrevision}/${payload}/${boardname}/reused.list" ../../../../..
+ # apply patches (vboot, machine-specific for this revision)
+ apply_patches_from_directory "../../../../../resources/libreboot/patch/vboot/${vbootrevision}/${payload}/${boardname}"
+
+ )
+ done
+done
# prepare directory for crossgcc
rm -Rf "../../crossgcc/"
@@ -117,8 +215,6 @@ make_coreboot_src_directory crossgcc ${crossgccrevision} ..
cd ../
mv "${crossgccrevision}/" "crossgcc/"
mv "crossgcc/" ../../
- cd ../
- rm -Rf "crossgcc/"
)
# go back to _src/coreboot/ (containing all coreboot directories)