aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2016-03-07 00:59:00 +0000
committerFrancis Rowe <info@gluglug.org.uk>2016-03-07 07:07:45 +0000
commit4dd16f5a28d0d799d450a49b759f28353bf5e07f (patch)
treeaedddbe5524cc960a74d9da062d57c6f45efd50c /resources
parentb7e798ce0819a8a23c4cd4614d052e03246bba40 (diff)
downloadlibrebootfr-4dd16f5a28d0d799d450a49b759f28353bf5e07f.tar.gz
librebootfr-4dd16f5a28d0d799d450a49b759f28353bf5e07f.zip
copy coreboot directory per revision, not per board
This will speed up the build process. The plan is to, if possible, always use 1 revision.
Diffstat (limited to 'resources')
-rwxr-xr-xresources/scripts/helpers/build/module/coreboot157
-rwxr-xr-xresources/scripts/helpers/build/release/src2
-rwxr-xr-xresources/scripts/helpers/build/roms/withdepthcharge55
-rwxr-xr-xresources/scripts/helpers/build/roms/withgrub2
-rwxr-xr-xresources/scripts/helpers/build/roms/withgrub_helper32
-rwxr-xr-xresources/scripts/helpers/download/coreboot144
6 files changed, 265 insertions, 127 deletions
diff --git a/resources/scripts/helpers/build/module/coreboot b/resources/scripts/helpers/build/module/coreboot
index d3e86cd2..5788343a 100755
--- a/resources/scripts/helpers/build/module/coreboot
+++ b/resources/scripts/helpers/build/module/coreboot
@@ -30,7 +30,160 @@ set -u -e
printf "Building the utilities in coreboot\n"
-# clean coreboot and crossgcc (source archives preserved)
+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
+}
+
+create_branch() {
+ branchname="${1}"
+ git branch ${branchname}
+ git checkout ${branchname}
+ git checkout master
+}
+
+# use git-init on everything
+# this is so that we can then apply patche
+# for these revisions of vboot and coreboot
+for i in coreboot/*; do
+ if [ ! -d "${i}/" ]; then
+ continue
+ fi
+ for revision in ${i}/*; do
+ if [ ! -d "${revision}/" ]; then
+ continue
+ fi
+ (
+ cd "${revision}/"
+ git init
+ git add -A .
+ git commit -m "coreboot revision ${revision##*/}"
+ cd "3rdparty/vboot/"
+ git init
+ git add -A .
+ git commit -m "coreboot revision ${revision##*/}"
+ )
+ done
+done
+
+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")
+ branchname="${payload}_${boardname}"
+
+ # the same vboot revision is always used for coreboot revision,
+ # so we don't need to wworry about checking for that here
+
+ # patch that version
+ (
+
+ cd "coreboot/${cbrevision}/${cbrevision}/"
+ create_branch ${branchname}
+
+ git checkout ${branchname}
+
+ # 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}"
+
+ git checkout master
+
+ cd "3rdparty/vboot/"
+ # reset to known revision (vboot)
+ create_branch ${branchname}
+
+ git checkout ${branchname}
+
+ # 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}"
+
+ git checkout master
+
+ )
+ done
+done
+
+# build coreboot utilities (in each revision) and
+# create symlinks to the crossgcc archive
for payload in coreboot/*; do
for board in "${payload}/"*; do
@@ -40,8 +193,6 @@ for payload in coreboot/*; do
done
# create symlink to crossgcc
(
- boardconfig_path="resources/libreboot/config/${payload##*/}/${board##*/}"
- cbrevision="$(cat "${boardconfig_path}/cbrevision")"
cd "${board}/util/"
ln -s "../../../../crossgcc/util/crossgcc/" crossgcc
)
diff --git a/resources/scripts/helpers/build/release/src b/resources/scripts/helpers/build/release/src
index f2f5b31b..e3cdbed2 100755
--- a/resources/scripts/helpers/build/release/src
+++ b/resources/scripts/helpers/build/release/src
@@ -83,6 +83,8 @@ rm -Rf "${distdir}/flashrom/".git*
rm -Rf "${distdir}/grub/".git*
rm -Rf "${distdir}/depthcharge/".git*
+rm -f "${distdir}"/*.vim
+
# Delete useless files.
rm -Rf "${distdir}/TODO/"
rm -f "${distdir}/push"
diff --git a/resources/scripts/helpers/build/roms/withdepthcharge b/resources/scripts/helpers/build/roms/withdepthcharge
index 32e56238..431427a4 100755
--- a/resources/scripts/helpers/build/roms/withdepthcharge
+++ b/resources/scripts/helpers/build/roms/withdepthcharge
@@ -46,9 +46,16 @@ fi
buildlibpayload() {
family="${1}"
board="${2}"
+ cbrevision="${3}"
+ vbootrevision="${4}"
(
- cd "coreboot/depthcharge/${board}/payloads/libpayload/"
+ cd "coreboot/${cbrevision}/${cbrevision}/payloads/libpayload/"
+ git checkout depthcharge_${board}
+ (
+ cd "3rdparty/vboot/"
+ git checkout depthcharge_${board}
+ )
make distclean
rm -Rf "install/"
@@ -56,6 +63,10 @@ buildlibpayload() {
make KBUILD_DEFCONFIG="configs/config.$family" defconfig
make -j"$(nproc)"
make DESTDIR="install" install
+
+ git checkout master
+ cd "3rdparty/vboot/"
+ git checkout master
)
}
@@ -64,17 +75,30 @@ buildlibpayload() {
builddepthcharge() {
board="${1}"
+ cbrevision="${2}"
+ vbootrevision="${3}"
(
- cd "depthcharge/"
+ (
+ cd "coreboot/${cbrevision}/${cbrevision}/"
+ git checkout depthcharge_${board}
+ cd "3rdparty/vboot/"
+ git checkout depthcharge_${board}
+ )
+ cd "depthcharge/"
make distclean
- rm -f "../coreboot/depthcharge/${board:?}/depthcharge.elf"
+ rm -f "../coreboot/${cbrevision:?}/${cbrevision:?}/depthcharge.elf"
make BOARD="${board}" defconfig
- make BOARD="${board}" LIBPAYLOAD_DIR="$(pwd)/../coreboot/depthcharge/${board}/payloads/libpayload/install/libpayload" VB_SOURCE="$(pwd)/../coreboot/depthcharge/${board}/3rdparty/vboot" -j"$(nproc)" depthcharge_unified
+ make BOARD="${board}" LIBPAYLOAD_DIR="$(pwd)/../coreboot/${cbrevision}/${cbrevision}/payloads/libpayload/install/libpayload" VB_SOURCE="$(pwd)/../coreboot/${cbrevision}/${cbrevision}/3rdparty/vboot" -j"$(nproc)" depthcharge_unified
+
+ cp "build/depthcharge.elf" "../coreboot/${cbrevision}/${cbrevision}/"
- cp "build/depthcharge.elf" "../coreboot/depthcharge/${board}/"
+ cd "../coreboot/${cbrevision}/${cbrevision}/"
+ git checkout master
+ cd "3rdparty/vboot/"
+ git checkout master
)
}
@@ -83,9 +107,16 @@ builddepthcharge() {
buildcoreboot() {
board="${1}"
+ cbrevision="${2}"
+ vbootrevision="${3}"
(
- cd "coreboot/depthcharge/${board}/"
+ cd "coreboot/${cbrevision}/${cbrevision}"
+ git checkout depthcharge_${board}
+ (
+ cd "3rdparty/vboot/"
+ git checkout depthcharge_${board}
+ )
make distclean
rm -f ".coreboot-version"
@@ -123,19 +154,25 @@ buildcoreboot() {
# clean this up
rm -f "depthcharge.elf"
rm -f *.img
+
+ git checkout master
+ cd "3rdparty/vboot/"
+ git checkout master
)
}
# Build ROM images for supported boards
buildrom() {
board="${1}"
+ cbrevision="$(cat resources/libreboot/config/depthcharge/${board}/cbrevision)"
+ vbootrevision="$(cat resources/libreboot/config/depthcharge/${board}/vbootrevision)"
if [ -f "resources/libreboot/config/depthcharge/${board}/config" ]; then
family=$( echo ${board} |sed "s/_.*//g" )
- buildlibpayload "${family}" "${board}"
- builddepthcharge "${board}"
- buildcoreboot "${board}"
+ buildlibpayload "${family}" "${board}" "${cbrevision}" "${vbootrevision}"
+ builddepthcharge "${board}" "${cbrevision}" "${vbootrevision}"
+ buildcoreboot "${board}" "${cbrevision}" "${vbootrevision}"
fi
}
diff --git a/resources/scripts/helpers/build/roms/withgrub b/resources/scripts/helpers/build/roms/withgrub
index f3c0c053..3ef295a9 100755
--- a/resources/scripts/helpers/build/roms/withgrub
+++ b/resources/scripts/helpers/build/roms/withgrub
@@ -140,6 +140,6 @@ fi
# The GRUB files are no longer needed
rm -f "coreboot/grub"*.{elf,cfg}
-rm -f "coreboot/"*/*/grub*.{elf,cfg}
+rm -f "coreboot/"*/*/*.{elf,cfg}
printf "\n\n"
diff --git a/resources/scripts/helpers/build/roms/withgrub_helper b/resources/scripts/helpers/build/roms/withgrub_helper
index 631b96fa..047aa763 100755
--- a/resources/scripts/helpers/build/roms/withgrub_helper
+++ b/resources/scripts/helpers/build/roms/withgrub_helper
@@ -34,21 +34,31 @@ fi
boardtarget="${1}"
+if [ -f "version" ]; then
+ # release archive is being used
+ version="$(cat version)"
+else
+ # git repo is being used
+ version="$(git describe --tags HEAD)"
+fi
+
printf "GRUB Helper script: build ROM images for '%s'\n" "${boardtarget}"
(
-cd "coreboot/grub/${boardtarget}/"
+cbrevision="$(cat resources/libreboot/config/grub/${boardtarget}/cbrevision)"
+vbootrevision="$(cat resources/libreboot/config/grub/${boardtarget}/vbootrevision)"
+branchname="grub_${boardtarget}"
+
+cd "coreboot/${cbrevision}/${cbrevision}/"
+git checkout ${branchname}
+(
+ cd "3rdparty/vboot/"
+ git checkout ${branchname}
+)
# Make sure to remove these first
rm -f "grub."*{elf,cfg}
-if [ -f "../version" ]; then
- # release archive is being used
- version="$(cat ../version)"
-else
- # git repo is being used
- version="$(git describe --tags HEAD)"
-fi
printf 'libreboot-%s\n' "${version}" > ".coreboot-version" # needed for reproducible builds in coreboot
# Build ROM images with text-mode and corebootfb modes.
@@ -138,6 +148,12 @@ mv "${boardtarget}/" "../../../bin/grub/"
# version info file no longer needed
rm -f ".coreboot-version"
+
+git checkout master
+(
+ cd "3rdparty/vboot/"
+ git checkout master
+)
)
printf "\n\n"
diff --git a/resources/scripts/helpers/download/coreboot b/resources/scripts/helpers/download/coreboot
index 16bd1a87..cbf79c89 100755
--- a/resources/scripts/helpers/download/coreboot
+++ b/resources/scripts/helpers/download/coreboot
@@ -33,89 +33,36 @@ else
version="libreboot-$(git describe --tags HEAD)"
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/
+ payload="${1}"
+ cbrevision="${2}"
+ vbootrevision="${3}"
+ firmwarepath="${4}" # 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}/"
+ cd "${firmwarepath}/"
+ # copy coreboot directory there
+ rm -Rf "${payload:?}/${cbrevision:?}/"
+ if [ ! -d "${payload}/" ]; then
+ mkdir -p "${payload}/"
+ fi
+ cp -R "coreboot/" "${payload}/${cbrevision}/"
+
+ # We need to reset that revision of coreboot to the specified revision
+ cd "${payload}/${cbrevision}/"
+ git reset --hard ${cbrevision}
+
+ if [ "${vbootrevision}" != "no_vboot_revision" ]; then
+ # reset vboot revision. in practise, we always use the same
+ # vboot revision on all boards that use a given coreboot revision
+ cd "3rdparty/vboot/"
+ git reset --hard ${vbootrevision}
+ fi
)
}
-reset_at_revision() {
- revision="${1}"
- git reset --hard ${revision}
-}
+
+
+# coreboot revisios used for crossgcc
+crossgccrevision="4351ace145c4069f9c93ca7541d6dfaf8300b53b"
printf "Downloading coreboot, patching coreboot and deblobbing coreboot\n"
@@ -168,43 +115,26 @@ for payloads in ../../resources/libreboot/config/*; do
continue
fi
- boardname="${boardconfig##*/}"
cbrevision=$(cat "${boardconfig}/cbrevision")
vbootrevision=$(cat "${boardconfig}/vbootrevision")
- make_coreboot_src_directory ${payload} ${boardname} ..
-
- # patch that version
- (
-
- cd "../${payload}/${boardname}/"
- reset_at_revision ${cbrevision}
+ # the same vboot revision is always used for coreboot revision,
+ # so we don't need to wworry about checking for that here
- # 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}"
+ if [ -d "../${cbrevision}/${cbrevision}" ]; then
+ continue
+ # the directory already exists, no need to recreate it
+ fi
- 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}"
-
- )
+ make_coreboot_src_directory ${cbrevision} ${cbrevision} ${vbootrevision} ..
done
done
+
+
# prepare directory for crossgcc
rm -Rf "../../crossgcc/"
-make_coreboot_src_directory crossgcc ${crossgccrevision} ..
+make_coreboot_src_directory crossgcc ${crossgccrevision} "no_vboot_revision" ..
(
cd "../crossgcc/${crossgccrevision}"
reset_at_revision ${crossgccrevision}
@@ -215,6 +145,8 @@ 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)