blobs/download: simplify defconfig handling

use the variable names directly, as defined in defconfig.

do not hardcode the if/else chain in detect_firmware, use
eval instead.

Signed-off-by: Leah Rowe <leah@libreboot.org>
btrfsvols
Leah Rowe 2023-09-27 15:01:49 +01:00
parent b5628131ba
commit 6b17cda137
1 changed files with 17 additions and 30 deletions

View File

@ -17,7 +17,7 @@ main()
boarddir="${cbcfgsdir}/${board}" boarddir="${cbcfgsdir}/${board}"
check_defconfig "${boarddir}" || exit 0 check_defconfig "${boarddir}" || exit 0
detect_firmware || exit 0 detect_firmware && exit 0
scan_sources_config scan_sources_config
build_dependencies build_dependencies
@ -29,18 +29,12 @@ detect_firmware()
set -- "${boarddir}/config/"* set -- "${boarddir}/config/"*
. "${1}" 2>/dev/null . "${1}" 2>/dev/null
[ "${CONFIG_HAVE_MRC}" = "y" ] && needs="${needs} MRC" for c in CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN CONFIG_KBC1126_FIRMWARE \
[ "${CONFIG_HAVE_ME_BIN}" = "y" ] && needs="${needs} ME" CONFIG_VGA_BIOS_FILE CONFIG_INCLUDE_SMSC_SCH5545_EC_FW; do
[ "${CONFIG_KBC1126_FIRMWARE}" = "y" ] && needs="${needs} EC" eval "[ -z \"\${${c}}\" ] || return 1"
[ "${CONFIG_BOARD_DELL_E6400}" = "y" ] && \ done
[ "${CONFIG_VGA_BIOS_FILE}" != "" ] && needs="${needs} E6400VGA"
[ "${CONFIG_INCLUDE_SMSC_SCH5545_EC_FW}" = "y" ] && \ printf "Blobs not needed for: %s\n" "${board}" 1>&2
needs="${needs} SCH5545EC"
[ -z ${needs+x} ] && \
printf "No binary blobs needed for board: %s\n" "${board}" \
1>&2 && \
return 1
printf "Firmware needed for board '%s':\n%s\n" "${board}" "${needs}"
} }
scan_sources_config() scan_sources_config()
@ -121,23 +115,16 @@ build_dependencies()
download_blobs() download_blobs()
{ {
for need in ${needs}; do [ -z "${CONFIG_HAVE_ME_BIN}" ] || \
case ${need} in download_blob_intel_me || err "download_blobs ${board}: !me"
*ME*) [ -z "${CONFIG_INCLUDE_SMSC_SCH5545_EC_FW}" ] || \
download_blob_intel_me || _failed="${_failed} me" ;; download_sch5545ec || err "download_blobs ${board}: !sch5545"
*SCH5545EC*) [ -z "${CONFIG_KBC1126_FIRMWARE}" ] || \
download_sch5545ec || failed="${_failed} sch5545ec" ;; download_ec || err "download_blobs ${board}: kbc1126"
*EC*) [ -z "${CONFIG_VGA_BIOS_FILE}" ] || \
download_ec || _failed="${_failed} ec" ;; download_e6400vga || err "download_blobs ${board}: !e6400vga"
*E6400VGA*) if [ ! -z "${CONFIG_HAVE_MRC}" ]; then
download_e6400vga || _failed="${_failed} e6400vga" ;; ./update blobs mrc || err "download_blobs ${board}: !mrc"
*MRC*)
./update blobs mrc || _failed="${_failed} mrc" ;;
esac
done
if [ ! -z ${_failed+x} ]; then
err "download_blobs: can't download blobs: ${_failed}\n"
fi fi
} }