From 0b98c9b00c6b99940555cff25f7c6858745a560c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 19 Oct 2023 23:36:56 +0100 Subject: minor code cleanup in shell scripts Signed-off-by: Leah Rowe --- script/build/fw/coreboot | 26 ++++++++++---------------- script/update/project/trees | 16 ++++++++-------- script/update/vendor/download | 8 +++----- script/update/vendor/inject | 2 +- 4 files changed, 22 insertions(+), 30 deletions(-) (limited to 'script') diff --git a/script/build/fw/coreboot b/script/build/fw/coreboot index 9e266ce7..8853f749 100755 --- a/script/build/fw/coreboot +++ b/script/build/fw/coreboot @@ -25,15 +25,14 @@ pv="${pv} payload_seabios_withgrub payload_uboot memtest_bin" v="romdir cbrom initmode displaymode cbcfg targetdir tree arch" v="${v} grub_timeout ubdir vendorfiles board grub_scan_disk uboot_config" eval "$(setvars "n" ${pv})" -eval "$(setvars "" ${v})" -eval "$(setvars "" boards _displaymode _payload _keyboard all targets)" +eval "$(setvars "" ${v} boards _displaymode _payload _keyboard all targets)" main() { while [ $# -gt 0 ]; do case ${1} in help) usage && exit 0 ;; - list) listitems config/coreboot && exit 0 ;; + list) items config/coreboot && exit 0 ;; -d) _displaymode="${2}" ;; -p) _payload="${2}" ;; -k) _keyboard="${2}" ;; @@ -45,7 +44,7 @@ main() shift 2 done - [ "${all}" != "y" ] || boards=$(listitems config/coreboot) || \ + [ "${all}" != "y" ] || boards=$(items config/coreboot) || \ err "Cannot generate list of boards for building" for x in ${boards}; do @@ -63,11 +62,7 @@ main() printf "\nROM images available in these directories:\n" printf "${targets}^^ ROM images available in these directories.\n\n" - printf "WARNING!!!!!!! PLEASE READ:\n\n" - - printf "DO NOT flash ROM images contained under elf/, because they lack" - printf " payloads and will BRICK your machine. Please flash ROM images" - printf " contained under bin/ instead. YOU HAVE BEEN WARNED.\n\n" + printf "DO NOT flash ROM images from elf/ - please use bin/ instead.\n" } check_target() @@ -151,13 +146,12 @@ prepare_target() build_dependency_seabios() { [ "${payload_seabios}" = "y" ] || return 0 + [ -f "${seavgabiosrom}" ] && \ + [ -f elf/seabios/default/libgfxinit/bios.bin.elf ] && \ + [ -f elf/seabios/default/vgarom/bios.bin.elf ] && \ + [ -f elf/seabios/default/normal/bios.bin.elf ] && return 0 - if [ ! -f "${seavgabiosrom}" ] \ - || [ ! -f elf/seabios/default/libgfxinit/bios.bin.elf ] \ - || [ ! -f elf/seabios/default/vgarom/bios.bin.elf ] \ - || [ ! -f elf/seabios/default/normal/bios.bin.elf ]; then - x_ ./update project trees -b seabios - fi + x_ ./update project trees -b seabios } build_dependency_grub() @@ -413,7 +407,7 @@ usage() ./build fw coreboot x60 -p grub -d corebootfb -k usqwerty possible values for 'target': - $(listitems "config/coreboot") + $(items "config/coreboot") Refer to the ${projectname} documentation for more information. EOF diff --git a/script/update/project/trees b/script/update/project/trees index c8643966..7ba9a38b 100755 --- a/script/update/project/trees +++ b/script/update/project/trees @@ -87,7 +87,7 @@ build_targets() [ $# -gt 0 ] && target1="${1}" [ "${target1}" = "utils" ] && [ "${project}" = "coreboot" ] && \ shift 1 - targets=$(listitems "${cfgsdir}") || \ + targets=$(items "${cfgsdir}") || \ err "Cannot get options for ${cfgsdir}" [ $# -gt 0 ] && targets=$@ @@ -173,15 +173,14 @@ handle_src_tree() fi [ "${target1}" = "utils" ] && [ "${project}" = "coreboot" ] && return 0 + [ "$project" != "coreboot" ] && [ "$project" != "u-boot" ] && return 0 # u-boot and coreboot are both compiled with coreboot's crossgcc - if [ "${project}" = "coreboot" ] || [ "${project}" = "u-boot" ]; then - [ ! -z ${mode} ] || check_cross_compiler || \ - err "handle_src_tree ${project}/${target}: crossgcc" - cbfstool="cbutils/${tree}/cbfstool" - [ -f "${cbfstool}" ] || \ - x_ ./update project trees -b coreboot utils "${tree}" - fi + [ ! -z ${mode} ] || check_cross_compiler || \ + err "handle_src_tree ${project}/${target}: crossgcc" + cbfstool="cbutils/${tree}/cbfstool" + [ -f "${cbfstool}" ] && return 0 + x_ ./update project trees -b coreboot utils "${tree}" } # set up cross-compiler (coreboot crossgcc) for u-boot and coreboot @@ -279,6 +278,7 @@ run_make_command() x_ printf "%s\n" "${version%%-*}" >"${codedir}/.coreboot-version" x_ make ${mode} -j$(nproc) -C "${codedir}" + [ "${mode}" != "clean" ] && return 0 make -C "${codedir}" distclean 2>/dev/null || : } diff --git a/script/update/vendor/download b/script/update/vendor/download index 87e9d3a5..b5618c3b 100755 --- a/script/update/vendor/download +++ b/script/update/vendor/download @@ -63,9 +63,8 @@ build_dependencies() x_ ./update project trees -b uefitool [ -f "${kbc1126_ec_dump}" ] || \ x_ make -C "${cbdir}/util/kbc1126" - if [ ! -f "${cbfstool}" ] || [ ! -f "${ifdtool}" ]; then - x_ ./update project trees -b coreboot utils default - fi + [ -f "${cbfstool}" ] && [ -f "${ifdtool}" ] && return 0 + x_ ./update project trees -b coreboot utils default } download_vendorfiles() @@ -85,8 +84,7 @@ download_vendorfiles() "${E6400_VGA_DL_url_bkup}" "${E6400_VGA_DL_hash}" \ "${CONFIG_VGA_BIOS_FILE}" [ -z "${CONFIG_HAVE_MRC}" ] && return 0 - fetch "mrc" "${MRC_url}" "${MRC_url_bkup}" "${MRC_hash}" \ - "${CONFIG_MRC_FILE}" + fetch "mrc" "$MRC_url" "$MRC_url_bkup" "$MRC_hash" "$CONFIG_MRC_FILE" } fetch() diff --git a/script/update/vendor/inject b/script/update/vendor/inject index c4a7f702..d156be25 100755 --- a/script/update/vendor/inject +++ b/script/update/vendor/inject @@ -15,7 +15,7 @@ main() { [ $# -lt 1 ] && err "No options specified." [ "${1}" = "listboards" ] && \ - listitems config/coreboot && exit 0 + items config/coreboot && exit 0 archive="${1}" -- cgit v1.2.1