diff options
author | Leah Rowe <leah@libreboot.org> | 2023-12-24 09:04:36 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-12-24 09:04:36 +0000 |
commit | 0aca6332ee5865dbf4717235cbf9f5e8e79dddc3 (patch) | |
tree | cbb2a18ec22213208ab3dcaf22eebbb84fb14e5e /script/build | |
parent | 575332f2219c9e6f435b7ed35bfb2a408de0628c (diff) |
lbmk scripts: shorter code lines
while seemingly pedantic, this does actually make code
easier to read. mostly just switching to shorthand for
variable names, where no expansions or patterns are used
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'script/build')
-rwxr-xr-x | script/build/roms | 30 | ||||
-rwxr-xr-x | script/build/serprog | 10 |
2 files changed, 20 insertions, 20 deletions
diff --git a/script/build/roms b/script/build/roms index e3378e75..44e6db14 100755 --- a/script/build/roms +++ b/script/build/roms @@ -67,7 +67,7 @@ main() eval "printf \"${targets}\"" printf "^^ ROM images available in these directories.\n\n" - printf "DO NOT flash ROM images from elf/ - please use bin/ instead.\n" + printf "DO NOT flash images from elf/ - please use bin/ instead.\n" } configure_target() @@ -80,7 +80,7 @@ configure_target() . "${targetdir}/target.cfg" [ -z "${grub_scan_disk}" ] && grub_scan_disk="both" - [ "${grub_scan_disk}" != "both" ] && [ "${grub_scan_disk}" != "ata" ] \ + [ "$grub_scan_disk" != "both" ] && [ "$grub_scan_disk" != "ata" ] \ && [ "${grub_scan_disk}" != "ahci" ] && \ grub_scan_disk="both" @@ -98,16 +98,16 @@ configure_target() # The reverse logic must not be applied. If SeaBIOS-with-GRUB works, # that doesn't mean GRUB-withSeaBIOS will. For example, the board # might have a graphics card whose vga rom coreboot doesn't execute - [ "${payload_grub}" != "y" ] && [ "${payload_seabios}" != "y" ] && \ + [ "$payload_grub" != "y" ] && [ "$payload_seabios" != "y" ] && \ [ "${payload_uboot}" != "y" ] && \ for configfile in "${targetdir}/config/"*; do [ -e "${configfile}" ] || continue err "target '${board}' defines no payload" done - [ "${payload_uboot}" != "n" ] && [ "${payload_uboot}" != "y" ] && \ + [ "$payload_uboot" != "n" ] && [ "$payload_uboot" != "y" ] && \ payload_uboot="n" - [ "${payload_uboot}" = "y" ] && [ -z "${uboot_config}" ] && \ + [ "$payload_uboot" = "y" ] && [ -z "$uboot_config" ] && \ uboot_config="default" # Override all payload directives with cmdline args @@ -127,7 +127,7 @@ configure_dependencies() cbfstool="cbutils/${tree}/cbfstool" cbrom="${cbdir}/build/coreboot.rom" - [ -f "${cbfstool}" ] || x_ ./update trees -b coreboot utils ${tree} + [ -f "$cbfstool" ] || x_ ./update trees -b coreboot utils $tree memtest_bin="memtest86plus/build64/memtest.bin" [ "${payload_memtest}" != "y" ] || [ -f "src/${memtest_bin}" ] || \ @@ -228,7 +228,7 @@ build_roms() x_ "${cbfstool}" "${cbrom}" add-payload \ -f "src/${memtest_bin}" -n img/memtest -c lzma [ "${payload_seabios}" = "y" ] && build_seabios_roms - [ "${payload_grub}" != "y" ] || x_ build_grub_roms "${cbrom}" "grub" + [ "$payload_grub" != "y" ] || x_ build_grub_roms "$cbrom" "grub" [ "${payload_uboot}" = "y" ] || return 0 x_ cp "${_cbrom}" "${cbrom}" build_uboot_roms @@ -337,15 +337,15 @@ mkSeabiosRom() { tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX) x_ cp "${_cbrom}" "${tmprom}" - x_ "${cbfstool}" "${tmprom}" add-payload -f "${_seabioself}" \ + x_ "$cbfstool" "$tmprom" add-payload -f "$_seabioself" \ -n "${_seabios_cbfs_path}" -c lzma x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup - z="2"; [ "${initmode}" = "vgarom" ] && z="0" - x_ "${cbfstool}" "${tmprom}" add-int -i $z -n etc/pci-optionrom-exec - x_ "${cbfstool}" "${tmprom}" add-int -i 0 -n etc/optionroms-checksum - [ "${initmode}" != "libgfxinit" ] || \ - x_ "${cbfstool}" "${tmprom}" add -f "${seavgabiosrom}" \ + z="2"; [ "$initmode" = "vgarom" ] && z="0" + x_ "$cbfstool" "$tmprom" add-int -i $z -n etc/pci-optionrom-exec + x_ "$cbfstool" "$tmprom" add-int -i 0 -n etc/optionroms-checksum + [ "$initmode" != "libgfxinit" ] || \ + x_ "$cbfstool" "$tmprom" add -f "$seavgabiosrom" \ -n vgaroms/seavgabios.bin -t raw printf "%s\n" "${tmprom}" @@ -387,12 +387,12 @@ mkUbootRom() { _ubdir="elf/u-boot/${board}/${uboot_config}" _ubootelf="${_ubdir}/u-boot.elf" [ -f "${_ubootelf}" ] || _ubootelf="${_ubdir}/u-boot" - [ -f "${_ubootelf}" ] || err "mkUbootRom: ${board}: cant find u-boot" + [ -f "$_ubootelf" ] || err "mkUbootRom: $board: cant find u-boot" tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX) x_ cp "${_cbrom}" "${tmprom}" - x_ "${cbfstool}" "${tmprom}" add-payload -f "${_ubootelf}" \ + x_ "$cbfstool" "$tmprom" add-payload -f "$_ubootelf" \ -n "${_uboot_cbfs_path}" -c lzma printf "%s\n" "${tmprom}" diff --git a/script/build/serprog b/script/build/serprog index c961161a..28cd70a4 100755 --- a/script/build/serprog +++ b/script/build/serprog @@ -18,7 +18,7 @@ usage="usage: ./build firmware serprog <rp2040|stm32> [board]" main() { [ -z "${1+x}" ] && err "${usage}" - [ "${1}" != "rp2040" ] && [ "${1}" != "stm32" ] && err "${usage}" + [ "$1" != "rp2040" ] && [ "$1" != "stm32" ] && err "$usage" if [ "${1}" = "rp2040" ]; then boards_dir=${pico_sdk_dir}/src/boards/include/boards [ -d "$pico_src_dir" ] || x_ ./update trees -f "pico-serprog" @@ -44,23 +44,23 @@ build_rp2040_rom() { board=${1} printf "Building pico-serprog for %s\n" "${board}" - x_ cmake -DPICO_BOARD="${board}" -DPICO_SDK_PATH="${pico_sdk_dir}" \ + x_ cmake -DPICO_BOARD="$board" -DPICO_SDK_PATH="$pico_sdk_dir" \ -B "${pico_src_dir}/build" "${pico_src_dir}" x_ cmake --build "${pico_src_dir}/build" x_ mv ${pico_src_dir}/build/pico_serprog.uf2 \ bin/serprog_rp2040/serprog_${board}.uf2 - printf "output to bin/serprog_rp2040/serprog_%s.uf2\n" "${board}" + printf "output to bin/serprog_rp2040/serprog_%s.uf2\n" "$board" } build_stm32_rom() { board=${1} printf "Building stm32-vserprog for %s\n" "${board}" - x_ make -C ${stm32_src_dir} libopencm3-just-make BOARD=${board} + x_ make -C $stm32_src_dir libopencm3-just-make BOARD=$board x_ make -C ${stm32_src_dir} BOARD=${board} x_ mv ${stm32_src_dir}/stm32-vserprog.hex \ bin/serprog_stm32/serprog_${board}.hex - printf "output to bin/serprog_stm32/serprog_%s.hex\n" "${board}" + printf "output to bin/serprog_stm32/serprog_%s.hex\n" "$board" } print_boards() |