summaryrefslogtreecommitdiff
path: root/script/update
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-10-14 03:30:52 +0100
committerLeah Rowe <leah@libreboot.org>2023-10-14 03:31:45 +0100
commitec0b38afb3cad36e7eb8f8d2d2d5f6f027a9a290 (patch)
tree719f183c5a774c3efd1b4d79cbf2efa18856ff1f /script/update
parent2ebadb7ffda060f914296aff3059fa4085be86c8 (diff)
update/release: nuke roms using the inject script
This way, the handling of configs is unified into one script, which reduces the possibility of bugs later, and it reduces the repetition of code. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'script/update')
-rwxr-xr-xscript/update/project/release46
-rwxr-xr-xscript/update/vendor/inject70
2 files changed, 50 insertions, 66 deletions
diff --git a/script/update/project/release b/script/update/project/release
index c86cc227..a8447893 100755
--- a/script/update/project/release
+++ b/script/update/project/release
@@ -135,7 +135,7 @@ handle_rom_archive()
x_ mkdir -p "${romdir}"
x_ cp "${builddir}/"* "${romdir}"
- handle_vendorfiles
+ nukerom
printf "Generating release/%s/roms/%s-%s_%s.tar.xz\n" \
"${version}" "${projectname}" "${version}" "${target##*/}"
@@ -146,30 +146,12 @@ handle_rom_archive()
mkrom_tarball
}
-handle_vendorfiles()
+nukerom()
{
microcode_required="y"
. "config/coreboot/${target}/target.cfg"
if [ "${microcode_required}" != "y" ] && \
[ "${microcode_required}" != "n" ]; then microcode_required="y"; fi
-
- for x in CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN CONFIG_KBC1126_FIRMWARE \
- CONFIG_INCLUDE_SMSC_SCH5545_EC_FW; do
- eval "${x}=\"y\""
- grep "${x}=y" "config/coreboot/${target}/config/"* || \
- eval "${x}=\"n\""
- done
-
- # remove ME/MRC/EC firmware from ROM images
- if [ "${CONFIG_HAVE_ME_BIN}" = "y" ] || \
- [ "${target}" = "e6400_4mb" ] || \
- [ "${microcode_required}" = "n" ]; then
- strip_archive
- fi
-}
-
-strip_archive()
-{
if [ "${microcode_required}" = "n" ]; then
for romfile in "${romdir}"/*.rom; do
[ -f "${romfile}" ] || continue
@@ -181,16 +163,18 @@ strip_archive()
done
fi
- # Hash the rom before removing vendor files
+ # Hash the images before removing vendor files
+ # which ./update vendor inject uses for verification
x_ rm -f "${romdir}/vendorhashes"
x_ touch "${romdir}/vendorhashes"
(
x_ cd "${romdir}"
x_ sha512sum *.rom >> vendorhashes
)
+
for romfile in "${romdir}"/*.rom; do
[ -f "${romfile}" ] || continue
- strip_rom_image "${romfile}"
+ x_ ./update vendor inject -r "${romfile}" -b ${target} -n nuke
done
}
@@ -208,24 +192,6 @@ strip_ucode()
x_ mv "${romfile}" "${_newrom_b}"
}
-strip_rom_image()
-{
- [ -f "${1}" ] || return 0
- [ "${CONFIG_HAVE_ME_BIN}" != "y" ] || \
- x_ "${ifdtool}" --nuke me "${1}" -O "${1}"
- [ "${CONFIG_HAVE_MRC}" != "y" ] || \
- x_ "${cbfstool}" "${1}" remove -n mrc.bin
- [ "${CONFIG_INCLUDE_SMSC_SCH5545_EC_FW}" != "y" ] || \
- x_ "${cbfstool}" "${1}" remove -n sch5545_ecfw.bin
- if [ "${CONFIG_KBC1126_FIRMWARE}" = "y" ]; then
- x_ "${cbfstool}" "${1}" remove -n ecfw1.bin
- x_ "${cbfstool}" "${1}" remove -n ecfw2.bin
- fi
- # TODO: replace this board-specific hack
- [ "${target}" = "e6400_4mb" ] || return 0
- x_ "${cbfstool}" "${1}" remove -n "pci10de,06eb.rom"
-}
-
insert_copying_files()
{
x_ rm -Rf "${1}/licenses"
diff --git a/script/update/vendor/inject b/script/update/vendor/inject
index f4caf89e..02a7d1bf 100755
--- a/script/update/vendor/inject
+++ b/script/update/vendor/inject
@@ -18,9 +18,10 @@ main()
archive="${1}"
- while getopts r:b:m: option
+ while getopts n:r:b:m: option
do
case "${option}" in
+ n) nukemode="${OPTARG}" ;;
r) rom=${OPTARG} ;;
b) board=${OPTARG} ;;
m) modifygbe=true
@@ -31,7 +32,7 @@ main()
check_board
build_dependencies
inject_vendorfiles
-
+ [ "${nukemode}" = "nuke" ] && return 0
printf "Friendly reminder (this is *not* an error message):\n"
printf "Please always ensure that the files were inserted correctly.\n"
}
@@ -91,6 +92,7 @@ build_dependencies()
if [ ! -f "${cbfstool}" ] || [ ! -f "${ifdtool}" ]; then
x_ ./update project trees -b coreboot utils default
fi
+ [ "${nukemode}" = "nuke" ] && return 0
x_ ./update vendor download ${board}
}
@@ -126,7 +128,8 @@ patch_release_roms()
x_ cd "${_tmpdir}/bin/"*
# NOTE: For compatibility with older rom releases, defer to sha1
- sha512sum --status -c vendorhashes || \
+ [ "${nukemode}" = "nuke" ] || \
+ sha512sum --status -c vendorhashes || \
sha1sum --status -c vendorhashes || \
sha512sum --status -c blobhashes || \
sha1sum --status -c blobhashes || \
@@ -188,8 +191,6 @@ inject_vendorfile_intel_mrc()
{
rom="${1}"
- printf "adding mrc\n"
-
# mrc.bin must be inserted at a specific offset
# in cbfstool, -b values above 0x80000000 are interpreted as
@@ -207,23 +208,28 @@ inject_vendorfile_intel_mrc()
# source code, and it is *always* correct for haswell platform.
# TODO: this logic should be tweaked to handle more platforms
- x_ "${cbfstool}" "${rom}" add -f mrc/haswell/mrc.bin -n mrc.bin \
- -t mrc -b 0xfffa0000
+ if [ "${nukemode}" != "nuke" ]; then
+ x_ "${cbfstool}" "${rom}" add -f mrc/haswell/mrc.bin \
+ -n mrc.bin -t mrc -b 0xfffa0000
+ else
+ x_ "${cbfstool}" "${rom}" remove -n mrc.bin
+ fi
}
inject_vendorfile_intel_me()
{
- printf "adding intel me firmware\n"
-
rom="${1}"
[ -z "${CONFIG_ME_BIN_PATH}" ] && \
err "inject_vendorfile_intel_me: CONFIG_ME_BIN_PATH not set"
_me_location=${CONFIG_ME_BIN_PATH##*../}
- [ ! -f "${_me_location}" ] && \
+ [ ! -f "${_me_location}" ] && [ "${nukemode}" != "nuke" ] && \
err "inject_vendorfile_intel_me: per CONFIG_ME_BIN_PATH: file missing"
-
- x_ "${ifdtool}" -i me:"${_me_location}" "${rom}" -O "${rom}"
+ if [ "${nukemode}" != "nuke" ]; then
+ x_ "${ifdtool}" -i me:"${_me_location}" "${rom}" -O "${rom}"
+ else
+ x_ "${ifdtool}" --nuke me "${rom}" -O "${rom}"
+ fi
}
inject_vendorfile_hp_kbc1126_ec()
@@ -235,20 +241,25 @@ inject_vendorfile_hp_kbc1126_ec()
_ec2_location="${CONFIG_KBC1126_FW2##*../}"
_ec2_offset="${CONFIG_KBC1126_FW2_OFFSET}"
- printf "adding hp kbc1126 ec firmware\n"
-
if [ "${_ec1_offset}" = "" ] || [ "${_ec1_offset}" = "" ]; then
err "inject_vendorfile_hp_kbc1126_ec: ${board}: offset not declared"
elif [ "${_ec1_location}" = "" ] || [ "${_ec2_location}" = "" ]; then
err "inject_vendorfile_hp_kbc1126_ec: ${board}: EC path not declared"
elif [ ! -f "${_ec1_location}" ] || [ ! -f "${_ec2_location}" ]; then
+ [ "${nukemode}" != "nuke" ] && \
err "inject_vendorfile_hp_kbc1126_ec: ${board}: ecfw not downloaded"
fi
- x_ "${cbfstool}" "${rom}" add -f "${_ec1_location}" -n ecfw1.bin \
- -b ${_ec1_offset} -t raw
- x_ "${cbfstool}" "${rom}" add -f "${_ec2_location}" -n ecfw2.bin \
- -b ${_ec2_offset} -t raw
+ if [ "${nukemode}" != "nuke" ]; then
+ printf "adding hp kbc1126 ec firmware\n"
+ x_ "${cbfstool}" "${rom}" add -f "${_ec1_location}" \
+ -n ecfw1.bin -b ${_ec1_offset} -t raw
+ x_ "${cbfstool}" "${rom}" add -f "${_ec2_location}" \
+ -n ecfw2.bin -b ${_ec2_offset} -t raw
+ else
+ x_ "${cbfstool}" "${rom}" remove -n ecfw1.bin
+ x_ "${cbfstool}" "${rom}" remove -n ecfw2.bin
+ fi
}
inject_vendorfile_dell_e6400_vgarom_nvidia()
@@ -259,26 +270,33 @@ inject_vendorfile_dell_e6400_vgarom_nvidia()
_vga_dir="${_vga_location%/*}"
_vga_filename="${_vga_location##*/}"
- printf "adding pci option rom\n"
-
[ "${_vga_dir}" = "${pciromsdir}" ] || \
err "inject_vendorfile_dell_e6400vga: invalid pcirom dir: ${_vga_dir}"
- [ -f "${_vga_location}" ] || \
+ [ ! -f "${_vga_location}" ] && [ "${nukemode}" != "nuke" ] && \
err "inject_vendorfile_dell_e6400vga: ${_vga_location} doesn't exist"
- x_ "${cbfstool}" "${rom}" add -f "${_vga_location}" \
- -n "pci${CONFIG_VGA_BIOS_ID}.rom" -t optionrom
+ if [ "${nukemode}" != "nuke" ]; then
+ x_ "${cbfstool}" "${rom}" add -f "${_vga_location}" \
+ -n "pci${CONFIG_VGA_BIOS_ID}.rom" -t optionrom
+ else
+ x_ "${cbfstool}" "${rom}" remove \
+ -n "pci${CONFIG_VGA_BIOS_ID}.rom"
+ fi
}
inject_vendorfile_smsc_sch5545_ec()
{
rom="${1}"
_sch5545ec_location="${CONFIG_SMSC_SCH5545_EC_FW_FILE##*../}"
- [ -f "${_sch5545ec_location}" ] || \
+ [ ! -f "${_sch5545ec_location}" ] && [ "${nukemode}" != "nuke" ] && \
err "inject_vendorfile_smsc_sch5545_ec: SCH5545 fw missing"
- x_ "${cbfstool}" "${rom}" add -f "${_sch5545ec_location}" \
- -n sch5545_ecfw.bin -t raw
+ if [ "${nukemode}" != "nuke" ]; then
+ x_ "${cbfstool}" "${rom}" add -f "${_sch5545ec_location}" \
+ -n sch5545_ecfw.bin -t raw
+ else
+ x_ "${cbfstool}" "${rom}" remove -n sch5545_ecfw.bin
+ fi
}
modify_gbe()