summaryrefslogtreecommitdiff
path: root/resources/scripts/build
diff options
context:
space:
mode:
Diffstat (limited to 'resources/scripts/build')
-rwxr-xr-xresources/scripts/build/boot/roms2
-rwxr-xr-xresources/scripts/build/boot/roms_helper53
-rwxr-xr-xresources/scripts/build/clean/seabios6
-rwxr-xr-xresources/scripts/build/coreboot/utils6
-rwxr-xr-xresources/scripts/build/grub/utils2
-rwxr-xr-xresources/scripts/build/release/roms28
6 files changed, 58 insertions, 39 deletions
diff --git a/resources/scripts/build/boot/roms b/resources/scripts/build/boot/roms
index f634918e..966750a2 100755
--- a/resources/scripts/build/boot/roms
+++ b/resources/scripts/build/boot/roms
@@ -38,7 +38,7 @@ firstoption=""
main()
{
- [ $# -lt 1 ] && usage && exit 1
+ [ $# -lt 1 ] && usage && err "target not specified"
firstoption="${1}"
[ "${firstoption}" = "help" ] && usage && exit 0
diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper
index 462b9403..6136e708 100755
--- a/resources/scripts/build/boot/roms_helper
+++ b/resources/scripts/build/boot/roms_helper
@@ -115,10 +115,7 @@ if [ "${payload_grub}" != "y" ] && [ "${payload_seabios}" != "y" ] && \
[ "${payload_uboot}" != "y" ]; then
for configfile in "resources/coreboot/${board}/config/"*; do
[ ! -e "${configfile}" ] && continue
- printf "ERROR build/roms: Target '%s' defines no payload. " \
- ${board}
- printf "Exiting.\n"
- exit 1
+ err "target '${board}' defines no payload"
done
fi
@@ -155,7 +152,7 @@ cbfstool="cbutils/${tree}/cbfstool"
corebootrom="${cbdir}/build/coreboot.rom"
seavgabiosrom="elf/seabios/default/libgfxinit/vgabios.bin"
-./build coreboot utils ${tree} || exit 1
+./build coreboot utils ${tree} || err "cannot build cbutils/${tree}"
if [ ! -f "${seavgabiosrom}" ] \
|| [ ! -f elf/seabios/default/libgfxinit/bios.bin.elf ] \
@@ -275,16 +272,18 @@ moverom() {
if [ "${microcode_required}" = "n" ]; then
_newrom_b="${newrompath%.rom}_nomicrocode.rom"
- cp "${newrompath}" "${_newrom_b}" || exit 1
+ cp "${newrompath}" "${_newrom_b}" || \
+ err "cannot do: cp \"${newrompath}\" \"${_newrom_b}\""
microcode_present="y"
"${cbfstool}" "${_newrom_b}" remove -n \
cpu_microcode_blob.bin || microcode_present="n"
if [ "${microcode_present}" = "n" ]; then
- rm -f "${_newrom_b}" || exit 1
+ rm -f "${_newrom_b}" || err "cannot remove ${_newrom_b}"
printf "REMARK: '%s' already lacks microcode\n" \
${newrompath}
printf "Renaming default ROM file instead.\n"
- mv "${newrompath}" "${_newrom_b}" || exit 1
+ mv "${newrompath}" "${_newrom_b}" || \
+ err "fail: mv \"${newrompath}\" \"${_newrom_b}\""
fi
fi
}
@@ -303,26 +302,30 @@ mkSeabiosRom() {
cp "${target_cbrom}" "${tmprom}"
"${cbfstool}" "${tmprom}" add-payload -f "${target_seabioself}" \
- -n ${target_seabios_cbfs_path} -c lzma || exit 1
+ -n ${target_seabios_cbfs_path} -c lzma || \
+ err "cannot add payload, ${target_seabioself}, to tmprom, ${tmprom}"
"${cbfstool}" "${tmprom}" add-int -i 3000 -n etc/ps2-keyboard-spinup \
- || exit 1
+ || err "cannot add-int etc/ps2-keyboard-spinup to tmprom, ${tmprom}"
if [ "${target_initmode}" = "normal" ] || \
[ "${target_initmode}" = "libgfxinit" ]; then
"${cbfstool}" "${tmprom}" add-int -i 2 \
- -n etc/pci-optionrom-exec || exit 1
+ -n etc/pci-optionrom-exec || \
+ err "cannot add-int etc/pci-optionrom-exec 2 to tmprom"
elif [ "${target_initmode}" = "vgarom" ]; then # coreboot executes it
"${cbfstool}" "${tmprom}" add-int -i 0 \
- -n etc/pci-optionrom-exec || exit 1
+ -n etc/pci-optionrom-exec || \
+ err "cannot add-int etc/pci-optionrom-exec 0 to tmprom"
fi # for undefined modes, don't add this integer. use SeaBIOS defaults
"${cbfstool}" "${tmprom}" add-int -i 0 -n etc/optionroms-checksum || \
- exit 1
+ err "cannot add-int etc/optionroms-checksum 0 to tmprom"
[ "${target_initmode}" != "libgfxinit" ] || \
"${cbfstool}" "${tmprom}" add -f "${seavgabiosrom}" \
- -n vgaroms/seavgabios.bin -t raw || exit 1
+ -n vgaroms/seavgabios.bin -t raw || \
+ err "cannot add vgaroms/seavgabios.bin to tmprom"
printf "%s\n" "${tmprom}"
}
@@ -346,7 +349,8 @@ mkUbootRom() {
cp "${target_cbrom}" "${tmprom}"
"${cbfstool}" "${tmprom}" add-payload -f "${target_ubootelf}" \
- -n ${target_uboot_cbfs_path} -c lzma || exit 1
+ -n ${target_uboot_cbfs_path} -c lzma || \
+ err "cannot add u-boot to tmprom"
printf "%s\n" "${tmprom}"
}
@@ -361,11 +365,14 @@ mkGrubRom() {
grubcfg="elf/grub/grub_${target_keymap}.cfg"
grubtestcfg="elf/grub/grub_${target_keymap}_test.cfg"
- tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX) || exit 1
- cp "${target_cbrom}" "${tmprom}" || exit 1
+ tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX) || \
+ err "mkGrubRom: cannot create tmprom"
+ cp "${target_cbrom}" "${tmprom}" || \
+ err "mkGrubRom: cannot copy to tmprom"
"${cbfstool}" "${tmprom}" add-payload -f "${grubelf}" \
- -n ${target_grubelf_cbfs_path} -c lzma || exit 1
+ -n ${target_grubelf_cbfs_path} -c lzma || \
+ err "mkGrubRom: cannot add grub payload to tmprom"
tmpgrubcfg=$(mktemp -t grub.cfg.XXXXXXXXXX)
tmpgrubtestcfg=$(mktemp -t grubtest.cfg.XXXXXXXXXX)
@@ -389,10 +396,10 @@ mkGrubRom() {
fi
"${cbfstool}" "${tmprom}" add -f "${tmpgrubcfg}" -n grub.cfg -t raw || \
- exit 1
+ err "mkGrubRom: cannot add grub.cfg to tmprom"
"${cbfstool}" "${tmprom}" add -f "${tmpgrubtestcfg}" -n grubtest.cfg \
- -t raw || exit 1
+ -t raw || err "mkGrubRom: cannot add grubtest.cfg to tmprom"
rm -f "${tmpgrubcfg}" "${tmpgrubtestcfg}"
backgroundfile="background1280x800.png"
@@ -402,7 +409,7 @@ mkGrubRom() {
fi
backgroundfile="resources/grub/background/${backgroundfile}"
"${cbfstool}" "${tmprom}" add -f ${backgroundfile} -n background.png \
- -t raw || exit 1
+ -t raw || err "mkGrubRom: cannot add background.png to tmprom"
printf "%s\n" "${tmprom}"
}
@@ -491,8 +498,8 @@ mkRoms()
if [ "${payload_memtest}" = "y" ]; then
"${cbfstool}" "${corebootrom}" add-payload \
- -f ${memtest_bin} -n img/memtest \
- -c lzma || exit 1
+ -f ${memtest_bin} -n img/memtest -c lzma || \
+ err "mkRoms: cannot add img/memtest to coreboot rom"
fi
if [ "${payload_seabios}" = "y" ]; then
diff --git a/resources/scripts/build/clean/seabios b/resources/scripts/build/clean/seabios
index b8b17068..e9b11e5b 100755
--- a/resources/scripts/build/clean/seabios
+++ b/resources/scripts/build/clean/seabios
@@ -21,16 +21,18 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
+. "include/err.sh"
+
# clean bucts
# --------------------------------------------------------
printf "Cleaning the previous builds of seabios\n"
-rm -Rf elf/seabios || exit 1
+[ ! -d "elf/seabios" ] || rm -Rf elf/seabios || err "cannot remove elf/seabios"
[ ! -d "seabios/" ] && exit 0
for x in seabios/*; do
[ "${x}" = "seabios/seabios" ] && continue
[ ! -d "${x}" ] && continue
- make -C "${x}" distclean || exit 1
+ make -C "${x}" distclean || err "cannot distclean tree, ${x}"
done
diff --git a/resources/scripts/build/coreboot/utils b/resources/scripts/build/coreboot/utils
index a21da691..e24378d3 100755
--- a/resources/scripts/build/coreboot/utils
+++ b/resources/scripts/build/coreboot/utils
@@ -27,12 +27,14 @@ main()
{
if [ $# -gt 0 ]; then
for board in "${@}"; do
- build_for_mainboard ${board} || exit 1
+ build_for_mainboard ${board} || \
+ err "cannot build cbutils for target, ${board}"
done
else
for boarddir in resources/coreboot/*; do
[ ! -d "${boarddir}" ] && continue
- build_for_mainboard ${boarddir##*/} || exit 1
+ build_for_mainboard ${boarddir##*/} || \
+ err "cannot build cbutils for target, ${board}"
done
fi
}
diff --git a/resources/scripts/build/grub/utils b/resources/scripts/build/grub/utils
index dbe14bc0..3ef78227 100755
--- a/resources/scripts/build/grub/utils
+++ b/resources/scripts/build/grub/utils
@@ -27,7 +27,7 @@ set -u -e
main()
{
printf "Building GRUB\n"
- [ -d "grub/" ] || ./fetch grub || exit 1
+ [ -d "grub/" ] || ./fetch grub || err "cannot fetch grub"
build_grub
}
diff --git a/resources/scripts/build/release/roms b/resources/scripts/build/release/roms
index 2f9524c5..8afba9bf 100755
--- a/resources/scripts/build/release/roms
+++ b/resources/scripts/build/release/roms
@@ -116,8 +116,10 @@ strip_archive()
romdir=${1}
[ -d coreboot/${tree} ] || \
- ./fetch_trees coreboot ${tree} || exit 1
- ./build coreboot utils ${tree} || exit 1
+ ./fetch_trees coreboot ${tree} || \
+ err "cannot fetch source tree, coreboot/${tree}"
+ ./build coreboot utils ${tree} || \
+ err "cannot build utils for coreboot/${tree}"
rm -Rf "${romdir}_tmp" # dirty hack, to reduce disk io later
# rather than using /tmp, which might not be tmpfs
@@ -141,30 +143,36 @@ strip_rom_image()
{
romfile=${1}
- [ -f "${romfile}" ] || continue
+ [ -f "${romfile}" ] || return 0
if [ "${CONFIG_HAVE_ME_BIN}" = "y" ]; then
- ${ifdtool} --nuke me "${romfile}" || exit 1
+ ${ifdtool} --nuke me "${romfile}" || \
+ err "cannot nuke Intel ME region on file, ${romfile}"
mv "${romfile}" "${romdir}_tmp"/
mv "${romfile}.new" "${romfile}"
fi
if [ "${CONFIG_HAVE_MRC}" = "y" ]; then
- ${cbfstool} "${romfile}" remove -n mrc.bin || exit 1
- ${cbfstool} "${romfile}" print
+ ${cbfstool} "${romfile}" remove -n mrc.bin || \
+ err "cannot remove mrc.bin from file, ${romfile}"
+ ${cbfstool} "${romfile}" print || :
fi
if [ "${CONFIG_KBC1126_FIRMWARE}" = "y" ]; then
- ${cbfstool} "${romfile}" remove -n ecfw1.bin || exit 1
- ${cbfstool} "${romfile}" remove -n ecfw2.bin || exit 1
+ ${cbfstool} "${romfile}" remove -n ecfw1.bin || \
+ err "cannot remove ecfw1.bin from file, ${romfile}"
+ ${cbfstool} "${romfile}" remove -n ecfw2.bin || \
+ err "cannot remove ecfw2.bin from file, ${romfile}"
fi
[ "${CONFIG_INCLUDE_SMSC_SCH5545_EC_FW}" != "y" ] || \
- ${cbfstool} "${romfile}" remove -n sch5545_ecfw.bin || exit 1
+ ${cbfstool} "${romfile}" remove -n sch5545_ecfw.bin || \
+ err "cannot remove sch5545_ecfw.bin from file, ${romfile}"
# TODO: replace this board-specific hack
[ "${target}" != "e6400nvidia_4mb" ] || \
- ${cbfstool} "${romfile}" remove -n "pci10de,06eb.rom" || exit 1
+ ${cbfstool} "${romfile}" remove -n "pci10de,06eb.rom" || \
+ err "cannot remove pci10de,06eb.rom from file, ${romfile}"
}
main $@