summaryrefslogtreecommitdiffstats
path: root/resources/scripts/helpers/build
diff options
context:
space:
mode:
Diffstat (limited to 'resources/scripts/helpers/build')
-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
5 files changed, 227 insertions, 21 deletions
diff --git a/resources/scripts/helpers/build/module/coreboot b/resources/scripts/helpers/build/module/coreboot
index d3e86cd..5788343 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 f2f5b31..e3cdbed 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 32e5623..431427a 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 f3c0c05..3ef295a 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 631b96f..047aa76 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"