aboutsummaryrefslogtreecommitdiff
path: root/resources/scripts/helpers/build
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2016-01-02 22:10:32 +0000
committerFrancis Rowe <info@gluglug.org.uk>2016-01-04 20:28:39 +0000
commitd1f408f3725aa02bc1d76c4c6aadb4697bd073c0 (patch)
tree7eed036543ae1f8c57b56825880a722a8efbedf1 /resources/scripts/helpers/build
parent91aec7e72005dcda72d19f2d024a02d8c0f86590 (diff)
downloadlibrebootfr-d1f408f3725aa02bc1d76c4c6aadb4697bd073c0.tar.gz
librebootfr-d1f408f3725aa02bc1d76c4c6aadb4697bd073c0.zip
Use different coreboot revisions and patches per board
The release archives will be bigger, but this is a necessary change that makes libreboot development easier. At present, there are boards maintained in libreboot by different people. By doing it this way, that becomes much easier. This is in contrast to the present situation, where a change to one board potentially affects all other boards, especially when updating to a new version of coreboot. Coreboot-libre scripts, download scripts, build scripts - everything. The entire build system has been modified to reflect this change of development. For reasons of consistency, cbfstool and nvramtool are no longer included in the util archives.
Diffstat (limited to 'resources/scripts/helpers/build')
-rwxr-xr-xresources/scripts/helpers/build/clean/coreboot29
-rwxr-xr-xresources/scripts/helpers/build/config/dcmodify23
-rwxr-xr-xresources/scripts/helpers/build/config/dcreplace17
-rwxr-xr-xresources/scripts/helpers/build/config/dcupdate23
-rwxr-xr-xresources/scripts/helpers/build/config/grubmodify23
-rwxr-xr-xresources/scripts/helpers/build/config/grubreplace17
-rwxr-xr-xresources/scripts/helpers/build/config/grubupdate23
-rwxr-xr-xresources/scripts/helpers/build/module/coreboot33
-rwxr-xr-xresources/scripts/helpers/build/release/util65
-rwxr-xr-xresources/scripts/helpers/build/roms/withdepthcharge83
-rwxr-xr-xresources/scripts/helpers/build/roms/withgrub7
-rwxr-xr-xresources/scripts/helpers/build/roms/withgrub_helper36
12 files changed, 189 insertions, 190 deletions
diff --git a/resources/scripts/helpers/build/clean/coreboot b/resources/scripts/helpers/build/clean/coreboot
index 135e1944..2f7701ec 100755
--- a/resources/scripts/helpers/build/clean/coreboot
+++ b/resources/scripts/helpers/build/clean/coreboot
@@ -2,7 +2,7 @@
# helper script: clean the dependencies that were built in coreboot
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# This program is free software: you can redistribute it and/or modify
@@ -29,12 +29,27 @@ set -u -e
printf "Cleaning the previous build of coreboot and its utilities\n"
# clean coreboot and crossgcc (source archives preserved)
-make -C coreboot clean
-make -C coreboot crossgcc-clean
-
-# Clean its utilities as well
-for util in {cbfs,ifd,nvram}tool cbmem; do
- make -C coreboot/util/"${util}" clean
+for payload in coreboot/*; do
+ for board in "${payload}/"*; do
+ # Clean coreboot, of course
+ make -C "${board}/" distclean
+
+ # Clean its utilities as well
+ for util in {cbfs,ifd,nvram}tool cbmem; do
+ make -C "${board}/util/${util}/" clean
+ done
+ make -C "${board}/payloads/libpayload/" distclean
+
+ # Clean crossgcc
+ if [ "${payload##*/}" != "crossgcc" ]; then # is a symlink
+ # delete symlink to crossgcc
+ rm -f "${board}/util/crossgcc"
+ else # is the real crossgcc
+ # payload is crossgcc
+ # board is not a board, it's a coreboot revision
+ make -C "${board}/" crossgcc-clean
+ fi
+ done
done
printf "\n\n"
diff --git a/resources/scripts/helpers/build/config/dcmodify b/resources/scripts/helpers/build/config/dcmodify
index e71af260..90c65783 100755
--- a/resources/scripts/helpers/build/config/dcmodify
+++ b/resources/scripts/helpers/build/config/dcmodify
@@ -3,7 +3,7 @@
#
# helper script: run "make menuconfig" on config(s) to modify them
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
#
# 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
@@ -25,25 +25,28 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
-configpath="resources/libreboot/config/depthcharge"
+payload="depthcharge"
+configpath="resources/libreboot/config/${payload}"
hackconfig () {
- cd "coreboot/"
+ board="${1}"
- printf "Modifying config for %s\n" "${1}"
+ cd "coreboot/${payload}/${board}/"
+
+ printf "Modifying config for %s (%s payload)\n" "${board}" "${payload}"
sleep 2
- if [ ! -d "../${configpath}/${1}/" ]; then
- printf "build/config/corebootmodify WARNING: config '%s' does not exist. Skipping.\n" "${1}"
- cd "../"
+ if [ ! -d "../../../${configpath}/${board}/" ]; then
+ printf "build/config/dcmodify WARNING: config '%s' does not exist. Skipping.\n" "${board}"
+ cd "../../../"
return
fi
- mv "../${configpath}/${1}/config" ".config"
+ mv "../../../${configpath}/${board}/config" ".config"
make menuconfig
- mv ".config" "../${configpath}/${1}/config"
+ mv ".config" "../../../${configpath}/${board}/config"
- cd "../"
+ cd "../../../"
}
if [ $# -lt 1 ]; then
diff --git a/resources/scripts/helpers/build/config/dcreplace b/resources/scripts/helpers/build/config/dcreplace
index 85b765c2..13511fcc 100755
--- a/resources/scripts/helpers/build/config/dcreplace
+++ b/resources/scripts/helpers/build/config/dcreplace
@@ -3,7 +3,7 @@
#
# helper script: run "make menuconfig" on config(s) to replace them
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
#
# 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
@@ -25,20 +25,23 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
-configpath="resources/libreboot/config/depthcharge"
+payload="depthcharge"
+configpath="resources/libreboot/config/${payload}"
hackconfig () {
- cd "coreboot/"
+ board="${1}"
- printf "Replacing or creating new config for %s\n" "${1}"
+ cd "coreboot/${payload}/${board}/"
+
+ printf "Replacing or creating new config for %s (%s payload)\n" "${board}" "${payload}"
sleep 2
make menuconfig
- [ ! -d "../${configpath}/${1}/" ] && mkdir -p "../${configpath}/${1}/"
- mv ".config" "../${configpath}/${1}/config"
+ [ ! -d "../../../${configpath}/${board}/" ] && mkdir -p "../../../${configpath}/${board}/"
+ mv ".config" "../../../${configpath}/${board}/config"
- cd "../"
+ cd "../../../"
}
if [ $# -lt 1 ]; then
diff --git a/resources/scripts/helpers/build/config/dcupdate b/resources/scripts/helpers/build/config/dcupdate
index fd3a99c5..cfea022d 100755
--- a/resources/scripts/helpers/build/config/dcupdate
+++ b/resources/scripts/helpers/build/config/dcupdate
@@ -3,7 +3,7 @@
#
# helper script: run "make oldconfig" on all coreboot config files
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
#
# 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
@@ -25,25 +25,28 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
-configpath="resources/libreboot/config/depthcharge"
+payload="depthcharge"
+configpath="resources/libreboot/config/${payload}"
hackconfig () {
- cd "coreboot/"
+ board="${1}"
- printf "Updating config for %s\n" "${1}"
+ cd "coreboot/${payload}/${board}/"
+
+ printf "Updating config for %s (%s payload)\n" "${board}" "${payload}"
sleep 2
- if [ ! -d "../${configpath}/${1}/" ]; then
- printf "build/config/corebootupdate WARNING: config '%s' does not exist. Skipping.\n" "${1}"
- cd "../"
+ if [ ! -d "../../../${configpath}/${board}/" ]; then
+ printf "build/config/dcupdate WARNING: config '%s' does not exist. Skipping.\n" "${board}"
+ cd "../../../"
return
fi
- mv "../${configpath}/${1}/config" ".config"
+ mv "../../../${configpath}/${board}/config" ".config"
make oldconfig
- mv ".config" "../${configpath}/${1}/config"
+ mv ".config" "../../../${configpath}/${board}/config"
- cd "../"
+ cd "../../../"
}
if [ $# -lt 1 ]; then
diff --git a/resources/scripts/helpers/build/config/grubmodify b/resources/scripts/helpers/build/config/grubmodify
index dc866532..f05f22e7 100755
--- a/resources/scripts/helpers/build/config/grubmodify
+++ b/resources/scripts/helpers/build/config/grubmodify
@@ -3,7 +3,7 @@
#
# helper script: run "make menuconfig" on config(s) to modify them
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
#
# 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
@@ -25,25 +25,28 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
-configpath="resources/libreboot/config/grub"
+payload="grub"
+configpath="resources/libreboot/config/${payload}"
hackconfig () {
- cd "coreboot/"
+ board="${1}"
- printf "Modifying config for %s\n" "${1}"
+ cd "coreboot/${payload}/${board}/"
+
+ printf "Modifying config for %s (%s payload)\n" "${board}" "${payload}"
sleep 2
- if [ ! -d "../${configpath}/${1}/" ]; then
- printf "build/config/corebootmodify WARNING: config '%s' does not exist. Skipping.\n" "${1}"
- cd "../"
+ if [ ! -d "../../../${configpath}/${board}/" ]; then
+ printf "build/config/grubmodify WARNING: config '%s' does not exist. Skipping.\n" "${board}"
+ cd "../../../"
return
fi
- mv "../${configpath}/${1}/config" ".config"
+ mv "../../../${configpath}/${board}/config" ".config"
make menuconfig
- mv ".config" "../${configpath}/${1}/config"
+ mv ".config" "../../../${configpath}/${board}/config"
- cd "../"
+ cd "../../../"
}
if [ $# -lt 1 ]; then
diff --git a/resources/scripts/helpers/build/config/grubreplace b/resources/scripts/helpers/build/config/grubreplace
index 36d45584..87d89599 100755
--- a/resources/scripts/helpers/build/config/grubreplace
+++ b/resources/scripts/helpers/build/config/grubreplace
@@ -3,7 +3,7 @@
#
# helper script: run "make menuconfig" on config(s) to replace them
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
#
# 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
@@ -25,20 +25,23 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
-configpath="resources/libreboot/config/grub"
+payload="grub"
+configpath="resources/libreboot/config/${payload}"
hackconfig () {
- cd "coreboot/"
+ board="${1}"
- printf "Replacing or creating new config for %s\n" "${1}"
+ cd "coreboot/${payload}/${board}/"
+
+ printf "Replacing or creating new config for %s (%s payload)\n" "${board}" "${payload}"
sleep 2
make menuconfig
- [ ! -d "../${configpath}/${1}/" ] && mkdir -p "../${configpath}/${1}/"
- mv ".config" "../${configpath}/${1}/config"
+ [ ! -d "../../../${configpath}/${board}/" ] && mkdir -p "../../../${configpath}/${board}/"
+ mv ".config" "../../../${configpath}/${board}/config"
- cd "../"
+ cd "../../../"
}
if [ $# -lt 1 ]; then
diff --git a/resources/scripts/helpers/build/config/grubupdate b/resources/scripts/helpers/build/config/grubupdate
index 63902534..5bb1a57e 100755
--- a/resources/scripts/helpers/build/config/grubupdate
+++ b/resources/scripts/helpers/build/config/grubupdate
@@ -3,7 +3,7 @@
#
# helper script: run "make oldconfig" on all coreboot config files
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
#
# 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
@@ -25,25 +25,28 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
-configpath="resources/libreboot/config/grub"
+payload="grub"
+configpath="resources/libreboot/config/${payload}"
hackconfig () {
- cd "coreboot/"
+ board="${1}"
- printf "Updating config for %s\n" "${1}"
+ cd "coreboot/${payload}/${board}/"
+
+ printf "Updating config for %s (%s payload)\n" "${board}" "${payload}"
sleep 2
- if [ ! -d "../${configpath}/${1}/" ]; then
- printf "build/config/corebootupdate WARNING: config '%s' does not exist. Skipping.\n" "${1}"
- cd "../"
+ if [ ! -d "../../../${configpath}/${board}/" ]; then
+ printf "build/config/grubupdate WARNING: config '%s' does not exist. Skipping.\n" "${board}"
+ cd "../../../"
return
fi
- mv "../${configpath}/${1}/config" ".config"
+ mv "../../../${configpath}/${board}/config" ".config"
make oldconfig
- mv ".config" "../${configpath}/${1}/config"
+ mv ".config" "../../../${configpath}/${board}/config"
- cd "../"
+ cd "../../../"
}
if [ $# -lt 1 ]; then
diff --git a/resources/scripts/helpers/build/module/coreboot b/resources/scripts/helpers/build/module/coreboot
index eb99c25c..07659cdd 100755
--- a/resources/scripts/helpers/build/module/coreboot
+++ b/resources/scripts/helpers/build/module/coreboot
@@ -2,7 +2,7 @@
# helper script: builds the dependencies that coreboot needs before building a ROM image
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# This program is free software: you can redistribute it and/or modify
@@ -30,13 +30,28 @@ set -u -e
printf "Building the utilities in coreboot\n"
-# crossgcc
-# coreboot on x86 is 32-bit, so only build for i386. Also build for ARM
-for architecture in i386 arm; do
- make -j$(nproc) -BC coreboot crossgcc-${architecture}
-done
+# clean coreboot and crossgcc (source archives preserved)
+for payload in coreboot/*; do
+ for board in "${payload}/"*; do
+
+ if [ "${payload##*/}" = "crossgcc" ]; then # build crossgcc
+
+ for architecture in i386 arm; do
+ make -j$(nproc) -BC "${board}/" crossgcc-${architecture}
+ done
+ else # build other utils
+ # cbfstool, cbmem, nvramtool
+ for util in {cbfs,nvram}tool cbmem; do
+ make -BC "${board}/util/${util}"
+ done
+ # create symlink to crossgcc
+ (
+ boardconfig_path="resources/libreboot/config/${payload##*/}/${board##*/}"
+ cbrevision="$(cat "${boardconfig_path}/cbrevision")"
+ cd "${board}/util/"
+ ln -s "../../../crossgcc/${cbrevision}/util/crossgcc/" crossgcc
+ )
+ fi
-# cbfstool, cbmem, nvramtool
-for util in {cbfs,nvram}tool cbmem; do
- make -BC coreboot/util/${util}
+ done
done
diff --git a/resources/scripts/helpers/build/release/util b/resources/scripts/helpers/build/release/util
index 3e9910d9..fce64202 100755
--- a/resources/scripts/helpers/build/release/util
+++ b/resources/scripts/helpers/build/release/util
@@ -3,7 +3,7 @@
#
# helper script: generate the release archives
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
#
# 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
@@ -110,41 +110,6 @@ rm -Rf "flashrom/"
mv "flashrom_/" "flashrom/"
# ----------------
-# cbfstool related
-# ----------------
-# build cbfstool, compiled (statically linked) and include the binary
-
-mkdir -p "${distdir}/cbfstool/${arch}/"
-
-cd "coreboot/util/"
-cp -R "cbfstool" "cbfstool_/"
-cd "cbfstool/"
-make clean
-make SHARED=0 CC='gcc -static'
-
-mv "cbfstool" "../../../${distdir}/cbfstool/${arch}/"
-
-if [ "${arch}" = "x86_64" ]
- then
- # Now build 32-bit binaries
- make clean
- make SHARED=0 CC='gcc -static -m32'
- mkdir "../../../${distdir}/cbfstool/i686"
- mv "cbfstool" "../../../${distdir}/cbfstool/i686/"
-fi
-
-# cross-compile for ARM
-make clean
-make SHARED=0 CC='arm-linux-gnueabi-gcc -static'
-mkdir "../../../${distdir}/cbfstool/armv7l/"
-mv "cbfstool" "../../../${distdir}/cbfstool/armv7l/"
-
-cd ../
-rm -Rf "cbfstool/"
-mv "cbfstool_/" "cbfstool/"
-cd ../../
-
-# ----------------
# ich9deblob related
# ----------------
# build ich9deblob, compiled (statically linked) and include the binary
@@ -185,34 +150,6 @@ rm -Rf "ich9deblob/"
mv "ich9deblob_/" "ich9deblob/"
cd "../../"
-# -----------------
-# nvramtool related
-# -----------------
-# build nvramtool, compiled (statically linked) and include the binary
-cd "coreboot/util/"
-cp -R "nvramtool/" "nvramtool_/"
-cd "nvramtool/"
-make clean
-make SHARED=0 CC='gcc -static'
-
-mkdir -p "../../../${distdir}/nvramtool/${arch}/"
-
-mv "nvramtool" "../../../${distdir}/nvramtool/${arch}/"
-
-if [ "${arch}" = "x86_64" ]
- then
- # Now build 32-bit binaries
- make clean
- make SHARED=0 CC='gcc -static -m32'
- mkdir "../../../${distdir}/nvramtool/i686/"
- mv "nvramtool" "../../../${distdir}/nvramtool/i686/"
-fi
-
-cd "../"
-rm -Rf "nvramtool/"
-mv "nvramtool_/" "nvramtool/"
-cd "../../"
-
# -------------
# Miscellaneous
# -------------
diff --git a/resources/scripts/helpers/build/roms/withdepthcharge b/resources/scripts/helpers/build/roms/withdepthcharge
index 1c371026..32e56238 100755
--- a/resources/scripts/helpers/build/roms/withdepthcharge
+++ b/resources/scripts/helpers/build/roms/withdepthcharge
@@ -2,7 +2,7 @@
# helper script: build ROM images with depthcharge and put them in ./bin/
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
# Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
#
# This program is free software: you can redistribute it and/or modify
@@ -32,13 +32,23 @@ then
mkdir "bin/"
fi
+if [ -f "version" ]; then
+ # _src release archive is being used
+ version="$(cat "version")"
+else
+ # git repo is being used
+ version="$(git describe --tags HEAD)" # note: in libreboot, coreboot/.git doesn't exist, this uses libreboot .git
+fi
+
# Build libpayload
# ------------------------------------------------------------------------------
buildlibpayload() {
- family="$1"
+ family="${1}"
+ board="${2}"
- cd "coreboot/payloads/libpayload"
+ (
+ cd "coreboot/depthcharge/${board}/payloads/libpayload/"
make distclean
rm -Rf "install/"
@@ -46,95 +56,92 @@ buildlibpayload() {
make KBUILD_DEFCONFIG="configs/config.$family" defconfig
make -j"$(nproc)"
make DESTDIR="install" install
-
- cd "../../../"
+ )
}
# Build depthcharge
# ------------------------------------------------------------------------------
builddepthcharge() {
- board="$1"
+ board="${1}"
+ (
cd "depthcharge/"
make distclean
- rm -f "../coreboot/depthcharge.elf"
+ rm -f "../coreboot/depthcharge/${board:?}/depthcharge.elf"
- make BOARD="$board" defconfig
- make BOARD="$board" LIBPAYLOAD_DIR="$(pwd)/../coreboot/payloads/libpayload/install/libpayload" VB_SOURCE="$(pwd)/../coreboot/3rdparty/vboot" -j"$(nproc)" depthcharge_unified
+ 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
- cp "build/depthcharge.elf" "../coreboot/"
-
- cd "../"
+ cp "build/depthcharge.elf" "../coreboot/depthcharge/${board}/"
+ )
}
# Build coreboot
# ------------------------------------------------------------------------------
buildcoreboot() {
- board="$1"
+ board="${1}"
- cd "coreboot/"
+ (
+ cd "coreboot/depthcharge/${board}/"
make distclean
rm -f ".coreboot-version"
rm -f *.img
- if [ -f "../version" ]; then
- # _src release archive is being used
- version="$(cat ../version)"
- else
- # git repo is being used
- version="$(git describe --tags HEAD)" # note: in libreboot, coreboot/.git doesn't exist, this uses libreboot .git
- fi
printf 'libreboot-%s' "${version}" > "ro-frid"
printf 'libreboot-%s\n' "${version}" > ".coreboot-version" # needed for reproducible builds in coreboot
- make KBUILD_DEFCONFIG="$(pwd)/../resources/libreboot/config/depthcharge/${board}/config" defconfig
+ make KBUILD_DEFCONFIG="$(pwd)/../../../resources/libreboot/config/depthcharge/${board}/config" defconfig
make -j"$(nproc)"
cbfs_size=$( grep CONFIG_CBFS_SIZE ".config" | sed "s/.*[[:space:]]*=[[:space:]]*//g" )
- cbfs_size=$( printf "%d\n" "$cbfs_size" )
+ cbfs_size=$( printf "%d\n" "${cbfs_size}" )
cbfs_size=$(( $cbfs_size / 1024 ))
- dd if="build/coreboot.rom" of="coreboot.img" bs=1024 count="$cbfs_size"
+ dd if="build/coreboot.rom" of="coreboot.img" bs=1024 count="${cbfs_size}"
objcopy -I binary -O binary --pad-to=0x100 --gap-fill=0x00 "ro-frid" "ro-frid.img"
# prepare directory for new images
rm -Rf "${board:?}/"
- mkdir "$board/"
+ mkdir "${board}/"
# move the images into the newly created directory
- mv "coreboot.img" "$board/"
- mv "ro-frid.img" "$board/"
+ mv "coreboot.img" "${board}/"
+ mv "ro-frid.img" "${board}/"
# copy the scripts too
- cp "../resources/libreboot/install/depthcharge/cros-flash-replace" "$board/"
- cp "../resources/libreboot/install/depthcharge/${board}/layout.txt" "$board/"
+ cp "../../../resources/libreboot/install/depthcharge/cros-flash-replace" "${board}/"
+ cp "../../../resources/libreboot/install/depthcharge/${board}/layout.txt" "${board}/"
# delete the old images from ../bin
- rm -Rf "../bin/depthcharge/${board}/"
+ rm -Rf "../../../bin/depthcharge/${board}/"
# now put the new images in ./bin/depthcharge/
- [ ! -d "../bin/depthcharge/" ] && mkdir -p "../bin/depthcharge/"
- mv "$board/" "../bin/depthcharge/"
+ [ ! -d "../../../bin/depthcharge/" ] && mkdir -p "../../../bin/depthcharge/"
+ mv "${board}/" "../../../bin/depthcharge/"
- cd "../"
+ # clean this up
+ rm -f "depthcharge.elf"
+ rm -f *.img
+ )
}
# Build ROM images for supported boards
buildrom() {
- board="$1"
+ board="${1}"
+
if [ -f "resources/libreboot/config/depthcharge/${board}/config" ]; then
family=$( echo ${board} |sed "s/_.*//g" )
- buildlibpayload "$family"
- builddepthcharge "$board"
- buildcoreboot "$board"
+ buildlibpayload "${family}" "${board}"
+ builddepthcharge "${board}"
+ buildcoreboot "${board}"
fi
}
if [ $# -gt 0 ]; then
for board in "${@}"; do
- buildrom "$board"
+ buildrom "${board}"
done
else
for board in resources/libreboot/config/depthcharge/*; do
diff --git a/resources/scripts/helpers/build/roms/withgrub b/resources/scripts/helpers/build/roms/withgrub
index fd1aa5de..f3c0c053 100755
--- a/resources/scripts/helpers/build/roms/withgrub
+++ b/resources/scripts/helpers/build/roms/withgrub
@@ -3,7 +3,7 @@
#
# helper script: build ROM images with GRUB and put them in ./bin/
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# This program is free software: you can redistribute it and/or modify
@@ -28,6 +28,10 @@ set -u -e
printf "Building ROM images with the GRUB payload\n"
+# The GRUB files should be deleted first
+rm -f "coreboot/grub"*.{elf,cfg}
+rm -f "coreboot/"*/*/grub*.{elf,cfg}
+
[ -d bin ] || mkdir "bin/"
# Put GRUB payloads and config files
@@ -136,5 +140,6 @@ fi
# The GRUB files are no longer needed
rm -f "coreboot/grub"*.{elf,cfg}
+rm -f "coreboot/"*/*/grub*.{elf,cfg}
printf "\n\n"
diff --git a/resources/scripts/helpers/build/roms/withgrub_helper b/resources/scripts/helpers/build/roms/withgrub_helper
index b952417a..009028ed 100755
--- a/resources/scripts/helpers/build/roms/withgrub_helper
+++ b/resources/scripts/helpers/build/roms/withgrub_helper
@@ -2,7 +2,7 @@
# helper script: create ROM images for a given system, with GRUB
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# This program is free software: you can redistribute it and/or modify
@@ -36,7 +36,11 @@ boardtarget="${1}"
printf "GRUB Helper script: build ROM images for '%s'\n" "${boardtarget}"
-cd "coreboot/"
+(
+cd "coreboot/grub/${boardtarget}/"
+
+# Make sure to remove these first
+rm -f "grub."*{elf,cfg}
if [ -f "../version" ]; then
# release archive is being used
@@ -53,11 +57,11 @@ if [ "${boardtarget}" = "qemu_i440fx_piix4" ] || [ "${boardtarget}" = "qemu_q35_
then
# assume that the default config enable framebuffer mode, duplicate and patch for text-mode
# necessary, otherwise it will ask you to enter the Y/X resolution of the framebuffer at build time
- cp "../resources/libreboot/config/grub/${boardtarget}/config" "config_vesafb"
+ cp "../../../resources/libreboot/config/grub/${boardtarget}/config" "config_vesafb"
sed 's/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/' < "config_vesafb" > "config_txtmode"
else
# assume that the default config enables text-mode, duplicate and patch for framebuffer mode
- cp "../resources/libreboot/config/grub/${boardtarget}/config" "config_txtmode"
+ cp "../../../resources/libreboot/config/grub/${boardtarget}/config" "config_txtmode"
sed 's/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/' < "config_txtmode" > "config_vesafb"
fi
@@ -83,9 +87,9 @@ do
# Build coreboot ROM image
make clean
mv "config_${romtype}" ".config"
- mv "grub_${romtype}.elf" "grub.elf"
+ cp "../../grub_${romtype}.elf" "grub.elf"
make -j"$(nproc)"
- mv "grub.elf" "grub_${romtype}.elf"
+ rm -f "grub.elf"
mv "build/coreboot.rom" "${boardtarget}_${romtype}.rom"
# .config no longer needed
rm -f ".config"
@@ -95,14 +99,14 @@ do
then
if [ "$1" = "macbook21" ] || [ "$1" = "x200_4mb" ] || [ "$1" = "x200_8mb" ] || [ "$1" = "r400_4mb" ] || [ "$1" = "r400_8mb" ] || [ "$1" = "r500_4mb" ] || [ "$1" = "r500_8mb" ] || [ "$1" = "t400_4mb" ] || [ "$1" = "t400_8mb" ] || [ "$1" = "t500_4mb" ] || [ "$1" = "t500_8mb" ]
then
- ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f ../resources/grub/background/background1280x800.png -n background.png -t raw
+ ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f ../../../resources/grub/background/background1280x800.png -n background.png -t raw
else
- ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f ../resources/grub/background/background1024x768.png -n background.png -t raw
+ ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f ../../../resources/grub/background/background1024x768.png -n background.png -t raw
fi
fi
# Add the correct GRUB configuration file for this image.
- for keylayout in ../resources/utilities/grub-assemble/keymap/original/*
+ for keylayout in ../../../resources/utilities/grub-assemble/keymap/original/*
do
keymap="${keylayout##*/}"
@@ -110,9 +114,9 @@ do
cp "${boardtarget}_${romtype}.rom" "${boardtarget}_${keymap}_${romtype}.rom"
# Insert grub config into the image
- ./util/cbfstool/cbfstool "${boardtarget}_${keymap}_${romtype}.rom" add -f "grub_${keymap}_${romtype}.cfg" -n grub.cfg -t raw
+ ./util/cbfstool/cbfstool "${boardtarget}_${keymap}_${romtype}.rom" add -f ../../"grub_${keymap}_${romtype}.cfg" -n grub.cfg -t raw
# Insert grub test config into the image (for the user to test modifications to before modifying the main one)
- ./util/cbfstool/cbfstool "${boardtarget}_${keymap}_${romtype}.rom" add -f "grub_${keymap}_${romtype}_test.cfg" -n grubtest.cfg -t raw
+ ./util/cbfstool/cbfstool "${boardtarget}_${keymap}_${romtype}.rom" add -f ../../"grub_${keymap}_${romtype}_test.cfg" -n grubtest.cfg -t raw
done
# This config-less ROM is no longer needed
@@ -127,15 +131,13 @@ mkdir "${boardtarget}/"
mv "${boardtarget}"*.rom "${boardtarget}/"
# delete old ROM images
-rm -Rf "../bin/grub/${boardtarget}/"
+rm -Rf "../../../bin/grub/${boardtarget}/"
# put new ROM images in ../bin/grub/
-[ -d "../bin/grub/" ] || mkdir -p "../bin/grub/"
-mv "${boardtarget}/" "../bin/grub/"
+[ -d "../../../bin/grub/" ] || mkdir -p "../../../bin/grub/"
+mv "${boardtarget}/" "../../../bin/grub/"
# version info file no longer needed
rm -f ".coreboot-version"
-
-# go back to main source directory
-cd "../"
+)
printf "\n\n"