blobutil: support downloading E6400 VGA ROM

For Nvidia GPU models of Dell Latitude E6400
fsdg20230625
Leah Rowe 2023-05-06 21:21:42 +01:00
parent 0729d6e600
commit 5a197b4ff1
5 changed files with 150 additions and 9 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
*~
*.o
/pciroms/
/util/e6400-flash-unlock/e6400_flash_unlock
/util/ich9utils/*.bin
/util/ich9utils/demefactory

View File

@ -48,3 +48,13 @@
EC_url https://ftp.hp.com/pub/softpaq/sp96001-96500/sp96090.exe
EC_url_bkup http://web.archive.org/web/20220504072602/https://ftp.ext.hp.com/pub/softpaq/sp96001-96500/sp96090.exe
}
# nvidia vga option rom for dgpu models of Dell Latitude E6400
# for downloading the nvidia rom to pciroms/pci0x10de,0x06eb.rom
{e6400nvidia}{
E6400_VGA_DL_hash a24ed919e80287b281e407d525af31f307746250
E6400_VGA_DL_url https://dl.dell.com/FOLDER01530530M/1/E6400A34.exe
E6400_VGA_DL_url_bkup https://web.archive.org/web/20230506014903/https://dl.dell.com/FOLDER01530530M/1/E6400A34.exe
E6400_VGA_offset 274451
E6400_VGA_romname mod_21.bin
}

View File

@ -9,11 +9,18 @@ ec_url=""
ec_url_bkup=""
ec_hash=""
e6400_vga_dl_hash=""
e6400_vga_dl_url=""
e6400_vga_dl_url_bkup=""
e6400_vga_offset=""
e6400_vga_romname=""
blobdir="blobs"
dl_path="${blobdir}/vendorupdate"
appdir="${blobdir}/app"
_7ztest="a"
mecleaner="$(pwd)/me_cleaner/me_cleaner.py"
e6400_unpack="$(pwd)/bios_extract/dell_inspiron_1100_unpacker.py"
me7updateparser="$(pwd)/resources/blobs/me7_update_parser.py"
kbc1126_ec_dump="$(pwd)/coreboot/default/util/kbc1126/kbc1126_ec_dump"
board="${1}"
@ -49,6 +56,12 @@ if [ "${CONFIG_KBC1126_FIRMWARE}" = "y" ]; then
needs="${needs} EC"
fi
if [ "${CONFIG_BOARD_DELL_E6400}" = "y" ] \
&& [ "${CONFIG_VGA_BIOS_FILE}" != "" ]; then
printf "Dell E6400 with Nvidia GPU detected, downloading VGA ROM\n"
needs="${needs} E6400VGA"
fi
# Quickly exit without wasting more time if there are no blobs needed (GM45)
if [ -z ${needs+x} ]; then
printf 'No binary blobs needed for this board\n'
@ -81,6 +94,26 @@ while read -r line ; do
set ${line}
dl_url_bkup=${2}
;;
E6400_VGA_DL_hash*)
set ${line}
e6400_vga_dl_hash=${2}
;;
E6400_VGA_DL_url*)
set ${line}
e6400_vga_dl_url=${2}
;;
E6400_VGA_DL_url_bkup*)
set ${line}
e6400_vga_dl_url_bkup=${2}
;;
E6400_VGA_offset*)
set ${line}
e6400_vga_offset=${2}
;;
E6400_VGA_romname*)
set ${line}
e6400_vga_romname=${2}
;;
esac
done << EOF
$(eval "awk ' /\{.*${board_short}.*}{/ {flag=1;next} /\}/{flag=0} flag { print }' resources/blobs/sources")
@ -107,6 +140,11 @@ Build_deps(){
./download coreboot default || Fail 'could not download coreboot'
fi
if [ ! -d bios_extract ]; then
printf "downloading bios_extract\n"
./download bios_extract || Fail 'could not download bios_extract'
fi
if [ ! -f coreboot/default/util/kbc1126/kbc1126_ec_dump ]; then
printf "Building kbc1126_ec_dump from coreboot\n"
make -BC coreboot/default/util/kbc1126 || Fail \
@ -131,6 +169,9 @@ Download_needed(){
*EC*)
Download_ec || _failed="${_failed} ec"
;;
*E6400VGA*)
Download_e6400vga || _failed="${_failed} e6400vga"
;;
esac
done
@ -286,6 +327,62 @@ Extract_ec() {
cp "${appdir}/${dl_path##*/}"/ec.bin.fw* "${_ec_destination%/*}/"
}
Download_e6400vga() {
printf "Downloading Nvidia VGA ROM for Dell Latitude E6400\n"
Fetch_update e6400vga || return 1
Extract_e6400vga || return 1
return 0
}
Extract_e6400vga() {
printf "Extracting Nvidia VGA ROM for ${board}\n"
_vga_destination=${CONFIG_VGA_BIOS_FILE#../../}
if [ -f "${_vga_destination}" ]; then
printf 'vga rom already downloaded\n'
return 0
fi
if [ ! -d "${_vga_destination%/*}" ]; then
mkdir -p ${_vga_destination%/*}
fi
if [ -d "${appdir}" ]; then
rm -r ${appdir}
fi
mkdir -p "${appdir}"
mv "${dl_path}" "${appdir}"
if [ "${e6400_vga_offset}" = "" ]; then
printf "E6400 VGA offset not defined\n"
return 1
fi
if [ "${e6400_vga_romname}" = "" ]; then
printf "E6400 VGA ROM name not defined\n"
return 1
fi
(
cd "${appdir}"
tail -c +${e6400_vga_offset} "${dl_path##*/}" \
| gunzip > bios.bin
if [ ! -f "bios.bin" ]; then
Fail 'Could not extract bios.bin from Dell E6400 update'
fi
"${e6400_unpack}" bios.bin || printf "TODO: fix dell extract util\n"
if [ ! -f "${e6400_vga_romname}" ]; then
Fail 'Could not extract VGA ROM from Dell E6400 BIOS update'
fi
)
cp "${appdir}"/"${e6400_vga_romname}" "${_vga_destination}"
printf "E6400 Nvidia ROM saved to: %s\n" "${_vga_destination}"
return 0
}
Fetch_update() {
printf "Fetching vendor update for board: %s\n" ${board}
@ -301,18 +398,22 @@ Fetch_update() {
dl=${ec_url}
dl_bkup=${ec_url_bkup}
dlsum=${ec_hash}
elif [ "${fw_type}" = "e6400vga" ]; then
dl=${e6400_vga_dl_url}
dl_bkup=${e6400_vga_dl_url_bkup}
dlsum=${e6400_vga_dl_hash}
else
printf "Unsupported download type: %s\n" ${fw_type}
return 1
fi
if [ -z "${dl_url+x}" ]; then
if [ -z "${dl_url+x}" ] && [ "${fw_type}" != "e6400vga" ]; then
printf "No vendor update specified for board: %s\n" ${board}
return 1
fi
Vendor_checksum ${dlsum} || \
curl ${dl} > ${dl_path} || curl ${dl_bkup} > ${dl_path}
wget ${dl} -O ${dl_path} || wget ${dl_bkup} -O ${dl_path}
Vendor_checksum ${dlsum} || Fail \
"Cannot guarantee intergity of vendor update for board: ${board}"
@ -329,7 +430,7 @@ Vendor_checksum() {
fi
if [ "$(sha1sum ${dl_path} | awk '{print $1}')" != "${sha1}" ]; then
printf "Bad checksum on vendor update for board: %s\n" ${board}
rm ${dl_path}
# rm ${dl_path}
return 1
fi
return 0

View File

@ -121,6 +121,26 @@ set -- "resources/coreboot/${board}/config/*"
./coreboot/default/util/cbfstool/cbfstool "${rom}" add -f ${_ec2_location} -n ecfw2.bin -b ${_ec2_offset} -t raw || exit 1
fi
if [ "${CONFIG_VGA_BIOS_FILE}" != "" ] \
&& [ "${CONFIG_VGA_BIOS_ID}" != "" ]; then
_vga_location="${CONFIG_VGA_BIOS_FILE#../../}"
_vga_dir="${_vga_location%/*}"
_vga_filename="${_vga_location##*/}"
printf "adding pci option rom\n"
if [ "${_vga_dir}" != "pciroms" ]; then
printf "Invalid PCI ROM directory: %s\n" ${_vga_dir}
exit 1
fi
if [ ! -f "${_vga_location}" ]; then
printf "No such file exists: %s\n" ${_vga_location}
exit 1
fi
./coreboot/default/util/cbfstool/cbfstool ${rom} \
add -f "${_vga_location}" \
-n "pci${CONFIG_VGA_BIOS_ID}.rom" \
-t optionrom || exit 1
fi
if [ "${modifygbe}" = "true" ] && ! [ "${release}" = "true" ]; then
Modify_gbe ${rom}
fi

View File

@ -66,8 +66,9 @@ for romdir in bin/*; do
grep "CONFIG_HAVE_ME_BIN=y" "resources/coreboot/${target}/config/"* || CONFIG_HAVE_ME_BIN="n"
grep "CONFIG_HAVE_MRC=y" "resources/coreboot/${target}/config/"* || CONFIG_HAVE_MRC="n"
grep "CONFIG_KBC1126_FIRMWARE=y" "resources/coreboot/${target}/config"/* || CONFIG_KBC1126_FIRMWARE="n"
# remove ME/MRC/EC firmware from ROM images
if [ "${CONFIG_HAVE_ME_BIN}" = "y" ]; then
if [ "${CONFIG_HAVE_ME_BIN}" = "y" ] || [ "${target}" = "e6400nvidia_4mb" ]; then
if [ ! -d coreboot/default ]; then
./download coreboot default || exit 1
fi
@ -99,14 +100,15 @@ for romdir in bin/*; do
for romfile in "${romdir}"/*.rom
do
if [ ! -f "${romfile}" ]
then
if [ ! -f "${romfile}" ]; then
continue
fi
${ifdtool} --nuke me "${romfile}" || exit 1
mv "${romfile}" "${romdir}_tmp"/
mv "${romfile}.new" "${romfile}"
if [ "${CONFIG_HAVE_ME_BIN}" = "y" ]; then
${ifdtool} --nuke me "${romfile}" || exit 1
mv "${romfile}" "${romdir}_tmp"/
mv "${romfile}.new" "${romfile}"
fi
if [ "${CONFIG_HAVE_MRC}" = "y" ]
then
@ -118,6 +120,13 @@ for romdir in bin/*; do
${cbfstool} "${romfile}" remove -n ecfw1.bin || exit 1
${cbfstool} "${romfile}" remove -n ecfw2.bin || exit 1
fi
# TODO: replace this board-specific hack
if [ "${target}" = "e6400nvidia_4mb" ]; then
${cbfstool} "${romfile}" remove \
-n "pci10de,06eb.rom" \
|| exit 1
fi
done
fi