summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscript/build/boot/roms_helper44
-rwxr-xr-xscript/build/release/roms27
-rwxr-xr-xscript/build/release/src6
-rwxr-xr-xscript/handle/make/config5
-rwxr-xr-xscript/handle/make/file13
-rwxr-xr-xscript/update/blobs/download7
-rwxr-xr-xscript/update/blobs/inject5
7 files changed, 38 insertions, 69 deletions
diff --git a/script/build/boot/roms_helper b/script/build/boot/roms_helper
index dcadc4b9..506ccedf 100755
--- a/script/build/boot/roms_helper
+++ b/script/build/boot/roms_helper
@@ -37,7 +37,6 @@ handle_targets()
board="${boards%% *}"
configure_target
build_dependencies
-
build_target
}
@@ -47,7 +46,6 @@ configure_target()
[ -d "${targetdir}" ] || \
err "Target not defined: ${board}"
-
[ -f "${targetdir}/target.cfg" ] || \
err "Missing target.cfg for target: ${board}"
@@ -93,18 +91,15 @@ configure_target()
payload_uboot="n"
[ "${payload_uboot}" = "y" ] && [ "${uboot_config}" = "undefined" ] && \
uboot_config="default"
-
[ "${blobs_required}" != "n" ] && [ "${blobs_required}" != "y" ] && \
blobs_required="y"
# Override all payload directives with cmdline args
- if [ ! -z ${_payload} ]; then
- printf "setting payload to: %s\n" "${_payload}"
- eval "$(setvars "n" payload_grub payload_grub_withseabios \
- payload_seabios payload_seabios_withgrub payload_uboot \
- payload_memtest)"
- eval "payload_${_payload}=y"
- fi
+ [ -z ${_payload} ] && return 0
+ printf "setting payload to: %s\n" "${_payload}"
+ eval "$(setvars "n" payload_grub payload_memtest payload_seabios \
+ payload_seabios_withgrub payload_uboot payload_grub_withseabios)"
+ eval "payload_${_payload}=y"
}
build_dependencies()
@@ -160,10 +155,9 @@ build_dependency_grub()
[ ! -f "elf/grub/keymap_${keymap}.cfg" ] && \
rebuild_grub="y" && break
done
- if [ "${rebuild_grub}" = "y" ]; then
- ./build grub payload || \
- err "build_dependency_grub: cannot build grub payload"
- fi
+ [ "${rebuild_grub}" = "y" ] || return 0
+ ./build grub payload || \
+ err "build_dependency_grub: cannot build grub payload"
}
build_dependency_uboot()
@@ -176,9 +170,8 @@ build_dependency_uboot()
ubootelf="${ubdir}/u-boot.elf"
[ ! -f "${ubootelf}" ] && [ -f "${ubdir}/u-boot.bin" ] && \
ubootelf="${ubdir}/u-boot.bin"
- if [ ! -f "${ubootelf}" ]; then
- err "Could not find u-boot build for board, ${board}"
- fi
+ [ -f "${ubootelf}" ] && return 0
+ err "Could not find u-boot build for board, ${board}"
}
build_target()
@@ -227,18 +220,14 @@ build_roms()
"${cbfstool}" "${corebootrom}" add-payload \
-f "${memtest_bin}" -n img/memtest -c lzma || \
err "build_roms: cannot add img/memtest to coreboot rom"
-
[ "${payload_seabios}" = "y" ] && \
build_seabios_roms
-
[ "${payload_grub}" != "y" ] || \
build_grub_roms "${corebootrom}" "${initmode}" \
"${displaymode}" "grub" || \
err "build_roms: build_grub_roms failed"
-
- if [ "${payload_uboot}" = "y" ]; then
- build_uboot_roms
- fi
+ [ "${payload_uboot}" = "y" ] && return 0
+ build_uboot_roms
}
build_seabios_roms()
@@ -369,7 +358,6 @@ mkGrubRom() {
err "mkGrubRom: cannot create tmprom"
cp "${target_cbrom}" "${tmprom}" || \
err "mkGrubRom: cannot copy to tmprom"
-
"${cbfstool}" "${tmprom}" add -f "${keymapcfg}" -n keymap.cfg -t raw \
|| err "mkGrubRom: cannot add keymap.cfg to tmprom"
@@ -382,18 +370,14 @@ mkSeabiosRom() {
# (a tmpfile will be made instead)
target_seabios_cbfs_path="${2}" # e.g. fallback/payload
target_initmode="${3}" # e.g. libgfxinit
-
target_seabioself="elf/seabios/default/${target_initmode}/bios.bin.elf"
-
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)
cp "${target_cbrom}" "${tmprom}" || \
err "mkSeabiosRom: cannot copy to tmprom"
-
"${cbfstool}" "${tmprom}" add-payload -f "${target_seabioself}" \
-n ${target_seabios_cbfs_path} -c lzma || \
err "mkSeabiosRom: can't add payload, ${target_seabioself}, to rom"
-
"${cbfstool}" "${tmprom}" add-int -i 3000 -n etc/ps2-keyboard-spinup \
|| err "mkSeabiosRom: cbfs add-int etc/ps2-keyboard-spinup 3000"
@@ -410,7 +394,6 @@ mkSeabiosRom() {
"${cbfstool}" "${tmprom}" add-int -i 0 -n etc/optionroms-checksum || \
err "mkSeabiosRom: cbfs add-int etc/optionroms-checksum 0"
-
[ "${target_initmode}" != "libgfxinit" ] || \
"${cbfstool}" "${tmprom}" add -f "${seavgabiosrom}" \
-n vgaroms/seavgabios.bin -t raw || \
@@ -430,8 +413,7 @@ build_uboot_roms()
newrompath="${romdir}/uboot_payload_${board}_${initmode}.rom"
moverom "${tmprom}" "${newrompath}" || \
err "build_roms: moverom fail (u-boot)"
- rm -f "${tmprom}" || \
- err "build_roms: cannot rm u-boot rom"
+ rm -f "${tmprom}" || err "build_roms: cannot rm u-boot rom"
}
# make a rom in /tmp/ and then print the path of that ROM
diff --git a/script/build/release/roms b/script/build/release/roms
index 4a18037d..026f4eae 100755
--- a/script/build/release/roms
+++ b/script/build/release/roms
@@ -46,10 +46,9 @@ init_check()
[ ! -d "release/${version}/roms/" ] || \
rm -Rf "release/${version}/roms/" || \
err "init_check: !rm -Rf release/${version}/roms/"
- if [ ! -d "release/${version}/roms/" ]; then
- mkdir -p "release/${version}/roms/" || \
- err "init_check: !mkdir -p release/${version}/roms/"
- fi
+ [ -d "release/${version}/roms/" ] && return 0
+ mkdir -p "release/${version}/roms/" || \
+ err "init_check: !mkdir -p release/${version}/roms/"
}
make_archive()
@@ -161,20 +160,17 @@ strip_archive()
strip_ucode()
{
romfile=${1}
-
_newrom_b="${romfile%.rom}_nomicrocode.tmprom"
cp "${romfile}" "${_newrom_b}" || \
err "strip_rom_image: cp \"${romfile}\" \"${_newrom_b}\""
microcode_present="y"
"${cbfstool}" "${_newrom_b}" remove -n \
cpu_microcode_blob.bin 2>/dev/null || microcode_present="n"
- if [ "${microcode_present}" = "n" ]; then
- printf "REMARK: '%s' already lacks microcode\n" "${romfile}" \
- 1>&2
- printf "Renaming default ROM file instead.\n" 1>&2
- mv "${romfile}" "${_newrom_b}" || \
- err "strip_rom_image: can't rename no-u ${romfile}"
- fi
+ [ "${microcode_present}" = "n" ] || return 0
+ printf "REMARK: '%s' already lacks microcode\n" "${romfile}" 1>&2
+ printf "Renaming default ROM file instead.\n" 1>&2
+ mv "${romfile}" "${_newrom_b}" || \
+ err "strip_rom_image: can't rename no-u ${romfile}"
}
strip_rom_image()
@@ -196,10 +192,9 @@ strip_rom_image()
err "strip_rom_images: ${1}: can't nuke ecfw2.bin"
fi
# TODO: replace this board-specific hack
- if [ "${target}" = "e6400_4mb" ]; then
- "${cbfstool}" "${1}" remove -n "pci10de,06eb.rom" || \
- err "strip_rom_images: ${1}: can't nuke e6400 vga rom"
- fi
+ [ "${target}" = "e6400_4mb" ] || return 0
+ "${cbfstool}" "${1}" remove -n "pci10de,06eb.rom" || \
+ err "strip_rom_images: ${1}: can't nuke e6400 vga rom"
}
main $@
diff --git a/script/build/release/src b/script/build/release/src
index c29869f5..74854879 100755
--- a/script/build/release/src
+++ b/script/build/release/src
@@ -36,7 +36,6 @@ main()
purge_files
create_release_archive
-
printf "Source code archive available at %s.tar.xz\n\n" "${srcdir}"
}
@@ -116,9 +115,7 @@ copy_files()
purge_files()
{
(
- cd "${srcdir}/" || \
- err "purge_files 3: !cd ${srcdir}/"
-
+ cd "${srcdir}/" || err "purge_files 3: !cd ${srcdir}/"
[ ! -d "coreboot/default/util/kbc1126" ] || \
./handle make file -c "coreboot/default/util/kbc1126" || \
err "purge_files 1: default/util/kbc1126: ! make clean"
@@ -128,7 +125,6 @@ purge_files()
./handle make config -c "${p}" || \
err "purge_files: ${p}: cannot clean the source trees"
done
-
for p in bios_extract flashrom grub uefitool; do
./handle make file -c "${p}" || \
err "purge_files: !./handle make file -c ${p}"
diff --git a/script/handle/make/config b/script/handle/make/config
index 72cba193..0ae7796f 100755
--- a/script/handle/make/config
+++ b/script/handle/make/config
@@ -71,9 +71,8 @@ handle_targets()
handle_defconfig || fail "error handling config file"
done
- if [ "${mode}" = "all" ]; then
- printf "Done! The files are stored under %s/\n\n" "${elfdir}"
- fi
+ [ "${mode}" = "all" ] || return 0
+ printf "Done! The files are stored under %s/\n\n" "${elfdir}"
}
handle_defconfig()
diff --git a/script/handle/make/file b/script/handle/make/file
index 19807425..b76eadcd 100755
--- a/script/handle/make/file
+++ b/script/handle/make/file
@@ -34,13 +34,12 @@ handle_dependencies()
[ -d "${project}" ] || \
err "handle_dependencies: ${project%/*} not downloaded"
- if [ "${project}" = "uefitool" ]; then
- (
- cd uefitool || err "handle_dependencies: !cd uefitool"
- cmake UEFIExtract/ || [ -f Makefile ] || \
- err "handle_dependencies: !cmake UEFIExtract/"
- )
- fi
+ [ "${project}" = "uefitool" ] || return 0 # TODO: remove hardcoding
+ (
+ cd uefitool || err "handle_dependencies: !cd uefitool"
+ cmake UEFIExtract/ || [ -f Makefile ] || \
+ err "handle_dependencies: !cmake UEFIExtract/"
+ )
}
run_make_command()
diff --git a/script/update/blobs/download b/script/update/blobs/download
index 51747824..9e017cc4 100755
--- a/script/update/blobs/download
+++ b/script/update/blobs/download
@@ -74,10 +74,9 @@ download_blobs()
fetch "e6400vga" "${E6400_VGA_DL_url}" \
"${E6400_VGA_DL_url_bkup}" "${E6400_VGA_DL_hash}" \
"${CONFIG_VGA_BIOS_FILE}"
- if [ ! -z "${CONFIG_HAVE_MRC}" ]; then
- fetch "mrc" "${MRC_url}" "${MRC_url_bkup}" "${MRC_hash}" \
- "${CONFIG_MRC_FILE}"
- fi
+ [ -z "${CONFIG_HAVE_MRC}" ] && return 0
+ fetch "mrc" "${MRC_url}" "${MRC_url_bkup}" "${MRC_hash}" \
+ "${CONFIG_MRC_FILE}"
}
extract_intel_me()
diff --git a/script/update/blobs/inject b/script/update/blobs/inject
index 654af5d3..5e75d6c4 100755
--- a/script/update/blobs/inject
+++ b/script/update/blobs/inject
@@ -53,9 +53,8 @@ check_board()
fi
boarddir="${cbcfgsdir}/${board}"
- if [ ! -d "${boarddir}" ]; then
- err "check_board: board ${board} not found"
- fi
+ [ -d "${boarddir}" ] && return 0
+ err "check_board: board ${board} not found"
}
check_release()