From d66f6e0d5bf941e70f9126c19fb5608a3bbb4ade Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 11 Aug 2024 21:19:33 +0100 Subject: vendor.sh: don't load entire coreboot configs instead, only grep for the entries required, such as Intel ME paths. some variables in coreboot configs use $(), which is used in *make*, on the coreboot build system, and there refers to variables. here, we are sourcing them from sh, which treats this as a mini subshell to run a command; for example CONFIG_FOO would be executed, which is bad. The current logic still theoretically has this problem, with this patch, but the entries we scan from the configs do not currently have variable names in the strings. So: filter out just what we need, into a temporary config, when scanning for vendor files in coreboot configs, and use the temporary config. This fixes a build error when compiling for e5520_6mb. Signed-off-by: Leah Rowe --- include/vendor.sh | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/vendor.sh b/include/vendor.sh index ea1d4f0a..5d2b91b3 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -11,17 +11,19 @@ vendir="vendorfiles" appdir="$vendir/app" cbcfgsdir="config/coreboot" +cv="CONFIG_HAVE_ME_BIN CONFIG_ME_BIN_PATH CONFIG_INCLUDE_SMSC_SCH5545_EC_FW \ + CONFIG_SMSC_SCH5545_EC_FW_FILE CONFIG_KBC1126_FIRMWARE CONFIG_KBC1126_FW1 \ + CONFIG_KBC1126_FW2 CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2_OFFSET \ + CONFIG_VGA_BIOS_FILE CONFIG_VGA_BIOS_ID CONFIG_BOARD_DELL_E6400 \ + CONFIG_HAVE_MRC CONFIG_MRC_FILE CONFIG_HAVE_REFCODE_BLOB \ + CONFIG_REFCODE_BLOB_FILE CONFIG_GBE_BIN_PATH CONFIG_IFD_BIN_PATH" + eval `setvars "" EC_url_bkup EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ E6400_VGA_DL_hash E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset \ - E6400_VGA_romname CONFIG_HAVE_MRC SCH5545EC_DL_url_bkup SCH5545EC_DL_hash \ + E6400_VGA_romname SCH5545EC_DL_url_bkup SCH5545EC_DL_hash _dest tree \ mecleaner kbc1126_ec_dump MRC_refcode_cbtree new_mac _dl SCH5545EC_DL_url \ - CONFIG_BOARD_DELL_E6400 CONFIG_HAVE_ME_BIN archive EC_url boarddir rom \ - CONFIG_ME_BIN_PATH CONFIG_KBC1126_FIRMWARE _dest tree CONFIG_GBE_BIN_PATH \ - CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2 CONFIG_KBC1126_FW2_OFFSET \ - CONFIG_VGA_BIOS_FILE CONFIG_VGA_BIOS_ID CONFIG_KBC1126_FW1 cbdir DL_url \ - CONFIG_INCLUDE_SMSC_SCH5545_EC_FW CONFIG_SMSC_SCH5545_EC_FW_FILE nukemode \ - CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_HAVE_REFCODE_BLOB cbfstoolref \ - CONFIG_REFCODE_BLOB_FILE vrelease verify _7ztest` + archive EC_url boarddir rom cbdir DL_url nukemode cbfstoolref vrelease \ + verify _7ztest $cv` vendor_download() { @@ -32,10 +34,22 @@ vendor_download() readkconfig() { check_defconfig "$boarddir" 1>"$TMPDIR/vendorcfg.list" && return 1 + + rm -f "$TMPDIR/tmpcbcfg" || $err "!rm -f \"$TMPDIR/tmpcbcfg\"" while read -r cbcfgfile; do - set +u +e; . "$cbcfgfile" 2>/dev/null; set -u -e + for cbc in $cv; do + rm -f "$TMPDIR/tmpcbcfg2" || \ + $err "!rm $TMPDIR/tmpcbcfg2" + grep "$cbc" "$cbcfgfile" 1>"$TMPDIR/tmpcbcfg2" \ + 2>/dev/null || : + [ -f "$TMPDIR/tmpcbcfg2" ] || continue + cat "$TMPDIR/tmpcbcfg2" >> "$TMPDIR/tmpcbcfg" || \ + $err "!cat $TMPDIR/tmpcbcfg2" + done done < "$TMPDIR/vendorcfg.list" + eval `setcfg "$TMPDIR/tmpcbcfg"` + for c in CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN CONFIG_KBC1126_FIRMWARE \ CONFIG_VGA_BIOS_FILE CONFIG_INCLUDE_SMSC_SCH5545_EC_FW; do eval "[ \"\${$c}\" = \"/dev/null\" ] && continue" -- cgit v1.2.1