general code cleanup on lbmk shell scripts

in update/blobs/download, i saw instances where
appdir was being deleted with rm -r, but the more
appropriate command would rm -Rf. this is now fixed.

other than that, i've mostly just simplified a bunch
of if statements and consolidated some duplicated
logic (e.g. if/else block for dependencies in
build_dependencies() of update/blobs/download

one or two functions and/or variables have been
renamed, for greater clarity in the code, also
removed a few messages that were redundant

used printf instead of echo, in a few places, also
fixed up the indentation in a few places

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2023-08-21 19:41:49 +01:00
parent 7be4706552
commit 62f23123cb
17 changed files with 307 additions and 581 deletions
+13 -34
View File
@@ -36,20 +36,11 @@ firstoption=""
main()
{
if [ $# -lt 1 ]; then
usage
exit 1
fi
firstoption="${1}"
[ $# -lt 1 ] && usage && exit 1
if [ "${firstoption}" = "help" ]; then
usage
exit 0
fi
if [ "${firstoption}" = "list" ]; then
listboards
exit 0
fi
firstoption="${1}"
[ "${firstoption}" = "help" ] && usage && exit 0
[ "${firstoption}" = "list" ] && listboards && exit 0
while [ $# -gt 0 ]; do
case ${1} in
@@ -68,21 +59,16 @@ main()
shift
done
if [ -z ${opts+x} ]; then
opts=""
fi
[ -z ${opts+x} ] && opts=""
printf "Building %s ROM images\n" "${projectname}"
if [ "${firstoption}" = "all" ]; then
for boardname in $(listboards); do
buildrom "${boardname}" \
|| die "build/roms: error"
buildrom "${boardname}" || err "build/roms: error"
done
else
for board in ${boards}; do
buildrom "${board}" \
|| die "build/roms: error"
buildrom "${board}" || err "build/roms: error"
done
fi
@@ -116,9 +102,7 @@ usage()
listboards()
{
for boarddir in resources/coreboot/*; do
if [ ! -d "${boarddir}" ]; then
continue
fi
[ ! -d "${boarddir}" ] && continue
board="${boarddir##resources/coreboot/}"
board="${board%/}"
printf '%s\n' "${board##*/}"
@@ -127,18 +111,13 @@ listboards()
# Build ROM images for supported boards
buildrom() {
board="$1"
if [ -d "resources/coreboot/${board}/" ]; then
./build boot roms_helper ${board}${opts}
else
printf "\nbuild/roms: target not defined: %s\n" ${board}
die "Run: ./build boot roms list"
fi
[ -d "resources/coreboot/${1}/" ] || \
err "build/roms: target not defined: ${1}"
./build boot roms_helper ${1}${opts}
}
die() {
printf 'Error: %s\n' "${@}" 1>&2
err() {
printf '%s\n' "${1}" 1>&2
exit 1
}
+54 -70
View File
@@ -115,8 +115,8 @@ fi
# NOTE: reverse logic must NOT be applied. If SeaBIOS-with-GRUB works, that
# doesn't necessarily mean GRUb-with-SeaBIOS will. For example, the board
# might have an external GPU, where it's recommended to boot SeaBIOS first
if [ "${payload_grub}" != "y" ] && [ "${payload_seabios}" != "y" ] \
&& [ "${payload_uboot}" != "y" ]; then
if [ "${payload_grub}" != "y" ] && [ "${payload_seabios}" != "y" ] && \
[ "${payload_uboot}" != "y" ]; then
for configfile in "resources/coreboot/${board}/config/"*; do
[ ! -e "${configfile}" ] && continue
printf "ERROR build/roms: Target '%s' defines no payload. " \
@@ -153,7 +153,7 @@ fi
romdir="bin/${board}"
cbdir="coreboot/${board}"
[ "${board}" != "${tree}" ] && \
[ "${board}" = "${tree}" ] || \
cbdir="coreboot/${tree}"
cbfstool="cbutils/${tree}/cbfstool"
corebootrom="${cbdir}/build/coreboot.rom"
@@ -191,10 +191,7 @@ if [ "${payload_grub}" = "y" ] \
printf "Required GRUB payloads not yet built. Building now:\n"
fi
for keymapfile in ${kmapdir}/*; do
if [ ! -f "${keymapfile}" ]; then
continue
fi
[ -f "${keymapfile}" ] || continue
keymap="${keymapfile##*/}"
keymap="${keymap%.gkb}"
@@ -216,7 +213,7 @@ if [ "${payload_uboot}" = "y" ]; then
ubootelf="${ubdir}/u-boot.elf"
[ ! -f "${ubootelf}" ] && [ -f "${ubdir}/u-boot.bin" ] && \
ubootelf="${ubdir}/u-boot.bin"
[ ! -f "${ubootelf}" ] && \
[ -f "${ubootelf}" ] || \
err "Could not find u-boot build for board, ${board}"
fi
@@ -234,8 +231,7 @@ moverom() {
if [ "${cuttype}" = "4MiB IFD BIOS region" ]; then
dd if=${rompath} of=${newrompath} bs=1 \
skip=$(($(stat -c %s ${rompath}) - 0x400000)) \
count=4194304
skip=$(($(stat -c %s ${rompath}) - 0x400000)) count=4194304
else
cp ${rompath} ${newrompath}
fi
@@ -248,7 +244,7 @@ moverom() {
touch "${emptyrom}"
for deviceID in "0072" "3050"; do
"${cbfstool}" "${newrompath}" add -f "${emptyrom}" \
-n pci1000,${deviceID}.rom -t raw
-n pci1000,${deviceID}.rom -t raw
done
rm -f "${emptyrom}"
fi
@@ -256,30 +252,27 @@ moverom() {
for romsize in 4 8 16; do
ifdgbe="descriptors/ich9m/ich9fdgbe_${romsize}m.bin"
if [ "${cuttype}" = "${romsize}MiB ICH9 IFD NOR flash" ]; then
if [ ! -f "${ifdgbe}" ]; then
[ -f "${ifdgbe}" ] || \
./build descriptors ich9m
fi
dd if=${ifdgbe} of=${newrompath} bs=1 count=12k \
conv=notrunc
conv=notrunc
fi
cmpstr="${romsize}MiB ICH9 IFD NOGBE NOR flash"
ifdgbe="descriptors/ich9m/ich9fdnogbe_${romsize}m.bin"
if [ "${cuttype}" = "${cmpstr}" ]; then
if [ ! -f "${ifdgbe}" ]; then
[ -f "${ifdgbe}" ] || \
./build descriptors ich9m
fi
dd if=${ifdgbe} of=${newrompath} bs=1 count=4k \
conv=notrunc
conv=notrunc
fi
done
if [ "${cuttype}" = "i945 laptop" ]; then
dd if=${newrompath} of=top64k.bin bs=1 \
skip=$(($(stat -c %s ${newrompath}) - 0x10000)) \
count=64k
skip=$(($(stat -c %s ${newrompath}) - 0x10000)) count=64k
dd if=top64k.bin of=${newrompath} bs=1 \
seek=$(($(stat -c %s ${newrompath}) - 0x20000)) \
count=64k conv=notrunc
seek=$(($(stat -c %s ${newrompath}) - 0x20000)) count=64k \
conv=notrunc
rm -f top64k.bin
fi
@@ -288,11 +281,11 @@ moverom() {
cp "${newrompath}" "${_newrom_b}" || exit 1
microcode_present="y"
"${cbfstool}" "${_newrom_b}" remove -n \
cpu_microcode_blob.bin || microcode_present="n"
cpu_microcode_blob.bin || microcode_present="n"
if [ "${microcode_present}" = "n" ]; then
rm -f "${_newrom_b}" || exit 1
printf "REMARK: '%s' already lacks microcode\n" \
${newrompath}
${newrompath}
printf "Renaming default ROM file instead.\n"
mv "${newrompath}" "${_newrom_b}" || exit 1
fi
@@ -313,27 +306,26 @@ mkSeabiosRom() {
cp "${target_cbrom}" "${tmprom}"
"${cbfstool}" "${tmprom}" add-payload -f "${target_seabioself}" \
-n ${target_seabios_cbfs_path} -c lzma || exit 1
-n ${target_seabios_cbfs_path} -c lzma || exit 1
"${cbfstool}" "${tmprom}" add-int -i 3000 -n etc/ps2-keyboard-spinup \
|| exit 1
|| exit 1
if [ "${target_initmode}" = "normal" ] \
|| [ "${target_initmode}" = "libgfxinit" ]; then
if [ "${target_initmode}" = "normal" ] || \
[ "${target_initmode}" = "libgfxinit" ]; then
"${cbfstool}" "${tmprom}" add-int -i 2 \
-n etc/pci-optionrom-exec || exit 1
-n etc/pci-optionrom-exec || exit 1
elif [ "${target_initmode}" = "vgarom" ]; then # coreboot executes it
"${cbfstool}" "${tmprom}" add-int -i 0 \
-n etc/pci-optionrom-exec || exit 1
-n etc/pci-optionrom-exec || exit 1
fi # for undefined modes, don't add this integer. use SeaBIOS defaults
"${cbfstool}" "${tmprom}" add-int -i 0 -n etc/optionroms-checksum \
|| exit 1
"${cbfstool}" "${tmprom}" add-int -i 0 -n etc/optionroms-checksum || \
exit 1
if [ "${target_initmode}" = "libgfxinit" ]; then
[ "${target_initmode}" != "libgfxinit" ] || \
"${cbfstool}" "${tmprom}" add -f "${seavgabiosrom}" \
-n vgaroms/seavgabios.bin -t raw || exit 1
fi
-n vgaroms/seavgabios.bin -t raw || exit 1
printf "%s\n" "${tmprom}"
}
@@ -348,16 +340,16 @@ mkUbootRom() {
target_ubdir="elf/u-boot/${board}/${target_uboot_config}"
target_ubootelf="${target_ubdir}/u-boot.elf"
[ ! -f "${target_ubootelf}" ] && \
[ -f "${target_ubootelf}" ] || \
target_ubootelf="${target_ubdir}/u-boot.bin"
[ ! -f "${target_ubootelf}" ] && \
[ -f "${target_ubootelf}" ] || \
err "Could not find u-boot build for board, ${board}"
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)
cp "${target_cbrom}" "${tmprom}"
"${cbfstool}" "${tmprom}" add-payload -f "${target_ubootelf}" \
-n ${target_uboot_cbfs_path} -c lzma || exit 1
-n ${target_uboot_cbfs_path} -c lzma || exit 1
printf "%s\n" "${tmprom}"
}
@@ -376,34 +368,34 @@ mkGrubRom() {
cp "${target_cbrom}" "${tmprom}" || exit 1
"${cbfstool}" "${tmprom}" add-payload -f "${grubelf}" \
-n ${target_grubelf_cbfs_path} -c lzma || exit 1
-n ${target_grubelf_cbfs_path} -c lzma || exit 1
tmpgrubcfg=$(mktemp -t grub.cfg.XXXXXXXXXX)
tmpgrubtestcfg=$(mktemp -t grubtest.cfg.XXXXXXXXXX)
if [ "${grub_scan_disk}" = "ahci" ]; then
sed \
's/set\ grub_scan_disk=\"both\"/set\ grub_scan_disk=\"ahci\"/' \
"${grubcfg}" > "${tmpgrubcfg}"
"${grubcfg}" > "${tmpgrubcfg}"
sed \
's/set\ grub_scan_disk=\"both\"/set\ grub_scan_disk=\"ahci\"/' \
"${grubtestcfg}" > "${tmpgrubtestcfg}"
"${grubtestcfg}" > "${tmpgrubtestcfg}"
elif [ "${grub_scan_disk}" = "ata" ]; then
sed \
's/set\ grub_scan_disk=\"both\"/set\ grub_scan_disk=\"ata\"/' \
"${grubcfg}" > "${tmpgrubcfg}"
"${grubcfg}" > "${tmpgrubcfg}"
sed \
's/set\ grub_scan_disk=\"both\"/set\ grub_scan_disk=\"ata\"/' \
"${grubtestcfg}" > "${tmpgrubtestcfg}"
"${grubtestcfg}" > "${tmpgrubtestcfg}"
else
cp "${grubcfg}" "${tmpgrubcfg}"
cp "${grubtestcfg}" "${tmpgrubtestcfg}"
fi
"${cbfstool}" "${tmprom}" add -f "${tmpgrubcfg}" -n grub.cfg -t raw \
|| exit 1
"${cbfstool}" "${tmprom}" add -f "${tmpgrubcfg}" -n grub.cfg -t raw || \
exit 1
"${cbfstool}" "${tmprom}" add -f "${tmpgrubtestcfg}" -n grubtest.cfg \
-t raw || exit 1
-t raw || exit 1
rm -f "${tmpgrubcfg}" "${tmpgrubtestcfg}"
backgroundfile="background1280x800.png"
@@ -413,7 +405,7 @@ mkGrubRom() {
fi
backgroundfile="resources/grub/background/${backgroundfile}"
"${cbfstool}" "${tmprom}" add -f ${backgroundfile} -n background.png \
-t raw || exit 1
-t raw || exit 1
printf "%s\n" "${tmprom}"
}
@@ -427,20 +419,18 @@ mkRomsWithGrub() {
x=${tmprompath}
y=${initmode}
if [ "${payload_grub_withseabios}" = "y" ] \
&& [ "${firstpayloadname}" = "grub" ]; then
mv "$(mkSeabiosRom "${x}" "seabios.elf" "${y}")" \
"${tmprompath}"
elif [ "${payload_seabios_withgrub}" ] \
&& [ "${firstpayloadname}" != "grub" ]; then
if [ "${payload_grub_withseabios}" = "y" ] && \
[ "${firstpayloadname}" = "grub" ]; then
mv "$(mkSeabiosRom "${x}" "seabios.elf" "${y}")" "${tmprompath}"
elif [ "${payload_seabios_withgrub}" ] && \
[ "${firstpayloadname}" != "grub" ]; then
mv "$(mkSeabiosRom "${x}" "fallback/payload" "$y")" \
"${tmprompath}"
"${tmprompath}"
fi
keymaps=""
if [ -z ${keyboard_layouts} ]; then
for kmapfile in "${kmapdir}"/*
do
for kmapfile in "${kmapdir}"/*; do
keymaps="${keymaps} ${kmapfile}"
done
else
@@ -451,17 +441,14 @@ mkRomsWithGrub() {
for keymapfile in ${keymaps}; do
echo "keymaps is $keymaps, keymapfile is $keymapfile"
if [ ! -f "${keymapfile}" ]; then
continue
fi
[ -f "${keymapfile}" ] || continue
keymap="${keymapfile##*/}"
keymap="${keymap%.gkb}"
grub_path_in_cbfs="fallback/payload"
if [ "${firstpayloadname}" != "grub" ]; then
[ "${firstpayloadname}" = "grub" ] || \
grub_path_in_cbfs="img/grub2"
fi
# evil bofh rfc 2646 compliance hack
x=${keymap}
@@ -492,8 +479,7 @@ mkRoms()
if [ ! -f "${cbcfgpath}" ]; then
printf "'%s' does not exist. Skipping build for %s %s %s\n" \
${cbcfgpath} ${board} \
${displaymode} ${initmode}
${cbcfgpath} ${board} ${displaymode} ${initmode}
return 0
fi
@@ -506,11 +492,10 @@ mkRoms()
corebootrom="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
cp "${_corebootrom}" "${corebootrom}"
if [ "${displaymode}" = "txtmode" ] \
&& [ "${payload_memtest}" = "y" ]; then
if [ "${displaymode}" = "txtmode" ] && \
[ "${payload_memtest}" = "y" ]; then
"${cbfstool}" "${corebootrom}" add-payload \
-f memtest86plus/memtest -n img/memtest \
-c lzma || exit 1
-f memtest86plus/memtest -n img/memtest -c lzma || exit 1
fi
if [ "${payload_seabios}" = "y" ]; then
@@ -533,15 +518,14 @@ mkRoms()
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)
cp "${corebootrom}" "${tmprom}"
mkRomsWithGrub "${tmprom}" "${initmode}" \
"${displaymode}" "seabios_withgrub"
"${displaymode}" "seabios_withgrub"
rm -f "${tmprom}"
fi
fi
if [ "${payload_grub}" = "y" ]; then
[ "${payload_grub}" = "y" ] && \
mkRomsWithGrub "${corebootrom}" "${initmode}" \
"${displaymode}" "grub"
fi
"${displaymode}" "grub"
if [ "${payload_uboot}" = "y" ]; then
x=${corebootrom}
+3 -6
View File
@@ -33,12 +33,9 @@ rm -Rf cbutils
[ ! -d "coreboot/" ] && exit 0
for tree in coreboot/*; do
if [ "${tree##*/}" = "coreboot" ]; then
continue
fi
if [ ! -d "${tree}" ]; then
continue
fi
[ "${tree##*/}" = "coreboot" ] && continue
[ -d "${tree}" ] || continue
# Clean coreboot, of course
make -C "${tree}/" distclean
+2 -5
View File
@@ -25,14 +25,11 @@ set -u -e
main()
{
printf "Cleaning crossgcc builds in all coreboot archives\n"
[ ! -d "coreboot/" ] && exit 0
for board in coreboot/*; do
[ "${board##*/}" = "coreboot" ] && \
continue
[ ! -d "${board}" ] && \
continue
[ "${board##*/}" = "coreboot" ] && continue
[ ! -d "${board}" ] && continue
make -C "${board}/" crossgcc-clean || err "make-clean"
done
}
+5 -10
View File
@@ -39,10 +39,8 @@ main()
build_for_mainboard() {
board="${1}"
[ ! -d "resources/coreboot/${board}" ] && \
continue
[ ! -f "resources/coreboot/${board}/target.cfg" ] && \
continue
[ -d "resources/coreboot/${board}" ] || continue
[ -f "resources/coreboot/${board}/target.cfg" ] || continue
tree="undefined"
. "resources/coreboot/${board}/target.cfg" # source
if [ "${tree}" = "undefined" ]; then
@@ -55,15 +53,12 @@ build_for_mainboard() {
buildutils() {
tree="${1}"
if [ ! -d "coreboot/${tree}/" ]; then
[ -d "coreboot/${tree}/" ] || \
./fetch_trees coreboot $tree || return 1
fi
for util in cbfstool ifdtool; do
[ -f "cbutils/${tree}/${util}" ] \
&& continue
if [ ! -d "cbutils/${tree}" ]; then
[ -f "cbutils/${tree}/${util}" ] && continue
[ -d "cbutils/${tree}" ] || \
mkdir -p "cbutils/${tree}" || return 1
fi
utildir="coreboot/${tree}/util/${util}"
make distclean -C "${utildir}" || return 1
+3 -3
View File
@@ -23,9 +23,9 @@ ich9gen="util/ich9utils/ich9gen"
main()
{
[ -f "${ich9gen}" ] || ./build src for -b ich9utils || err "ich9utils make"
[ ! -f "${ich9gen}" ] && \
err "ich9gen doesn't exist"
[ -f "${ich9gen}" ] || ./build src for -b ich9utils || \
err "ich9utils make"
[ ! -f "${ich9gen}" ] && err "ich9gen doesn't exist"
[ -d "descriptors/ich9m/" ] || mkdir -p "descriptors/ich9m/"
rm -f descriptors/ich9m/* || err "rm-rf"
+14 -19
View File
@@ -53,18 +53,15 @@ main()
build_grub_payloads()
{
keylayoutfile=${1}
[ -f "${keylayoutfile}" ] || continue
if [ ! -f "${keylayoutfile}" ]; then
continue
fi
keymap="${keylayoutfile##${grubcfgsdir}/keymap/}"
keymap="${keymap%.gkb}"
build_grub_elf "${keylayoutfile}"
create_grub_config
printf "Created 'elf/grub/grub_%s.elf' and configs.'\n" \
"${keymap}"
printf "Created 'elf/grub/grub_%s.elf' and configs.'\n" "${keymap}"
}
build_grub_elf()
@@ -75,24 +72,22 @@ build_grub_elf()
gcfg="${gcfg}/config/grub_memdisk.cfg"
grubk="/boot/grub/layouts/${keymap}.gkb=${keylayoutfile}"
grub/grub-mkstandalone \
--grub-mkimage="grub/grub-mkimage" \
-O i386-coreboot \
-o elf/grub/grub_${keymap}.elf \
-d grub/grub-core/ \
--fonts= --themes= --locales= \
--modules="${grub_modules}" \
--install-modules="${grub_install_modules}" \
${gcfg} ${grubk}
--grub-mkimage="grub/grub-mkimage" \
-O i386-coreboot \
-o elf/grub/grub_${keymap}.elf \
-d grub/grub-core/ \
--fonts= --themes= --locales= \
--modules="${grub_modules}" \
--install-modules="${grub_install_modules}" \
${gcfg} ${grubk}
}
create_grub_config()
{
sed "s/usqwerty/${keymap}/" \
< ${grubcfgsdir}/config/grub.cfg \
> elf/grub/grub_${keymap}.cfg
sed "s/grubtest.cfg/grub.cfg/" \
< elf/grub/grub_${keymap}.cfg \
> elf/grub/grub_${keymap}_test.cfg
sed "s/usqwerty/${keymap}/" < ${grubcfgsdir}/config/grub.cfg \
> elf/grub/grub_${keymap}.cfg
sed "s/grubtest.cfg/grub.cfg/" < elf/grub/grub_${keymap}.cfg \
> elf/grub/grub_${keymap}_test.cfg
}
main $@
+2 -13
View File
@@ -25,11 +25,7 @@ set -u -e
main()
{
printf "Building GRUB\n"
if [ ! -d "grub/" ]; then
./fetch grub || exit 1
fi
[ -d "grub/" ] || ./fetch grub || exit 1
build_grub
}
@@ -37,15 +33,8 @@ build_grub()
{
(
cd grub/ || err "cd"
# clean up first
if [ -d Makefile ]; then
make distclean || err "make-distclean"
fi
[ ! -d Makefile ] || make distclean || err "make-distclean"
./bootstrap --gnulib-srcdir=gnulib/ --no-git || err "bootstrap"
# build
./autogen.sh || err "autogen"
./configure --with-platform=coreboot || err "configure"
make -j$(nproc) || err "make"
+19 -34
View File
@@ -70,26 +70,22 @@ make_archive()
target="${romdir##*/}"
echo ${target}
if [ ! -d "${romdir}/" ]; then
continue
fi
[ -d "${romdir}/" ] || continue
CONFIG_HAVE_MRC="y"
CONFIG_HAVE_ME_BIN="y"
CONFIG_KBC1126_FIRMWARE="y"
CONFIG_INCLUDE_SMSC_SCH5545_EC_FW="y"
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_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"
"resources/coreboot/${target}/config"/* || \
CONFIG_KBC1126_FIRMWARE="n"
grep "CONFIG_INCLUDE_SMSC_SCH5545_EC_FW=y" \
"resources/coreboot/${target}/config"/* \
|| CONFIG_INCLUDE_SMSC_SCH5545_EC_FW="n"
"resources/coreboot/${target}/config"/* || \
CONFIG_INCLUDE_SMSC_SCH5545_EC_FW="n"
# remove ME/MRC/EC firmware from ROM images
if [ "${CONFIG_HAVE_ME_BIN}" = "y" ] \
@@ -107,8 +103,7 @@ make_archive()
f="release/${version}/roms/${projectname}-${version}_${target##*/}"
tar -c "${romdir}/" | xz -9e > "${f}.tar.xz"
if [ -d "${romdir}_tmp" ]
then
if [ -d "${romdir}_tmp" ]; then
rm -Rf "${romdir}"
mv "${romdir}_tmp" "${romdir}"
fi
@@ -118,9 +113,8 @@ strip_archive()
{
romdir=${1}
if [ ! -d coreboot/${tree} ]; then
[ -d coreboot/${tree} ] || \
./fetch_trees coreboot ${tree} || exit 1
fi
./build coreboot utils ${tree} || exit 1
rm -Rf "${romdir}_tmp" # dirty hack, to reduce disk io later
@@ -128,17 +122,15 @@ strip_archive()
mkdir "${romdir}_tmp"
# Hash the rom before removing blobs
if [ ! -f "${romdir}/blobhashes" ]; then
[ -f "${romdir}/blobhashes" ] || \
printf "ROMs must match these hashes after blob insertion:" \
> "${romdir}/blobhashes"
fi
> "${romdir}/blobhashes"
(
cd ${romdir} || err "subshell: cd"
sha1sum *.rom >> blobhashes || err "subshell: sha1sum"
)
for romfile in "${romdir}"/*.rom
do
for romfile in "${romdir}"/*.rom; do
strip_rom_image "${romfile}"
done
}
@@ -147,9 +139,7 @@ strip_rom_image()
{
romfile=${1}
if [ ! -f "${romfile}" ]; then
continue
fi
[ -f "${romfile}" ] || continue
if [ "${CONFIG_HAVE_ME_BIN}" = "y" ]; then
${ifdtool} --nuke me "${romfile}" || exit 1
@@ -157,8 +147,7 @@ strip_rom_image()
mv "${romfile}.new" "${romfile}"
fi
if [ "${CONFIG_HAVE_MRC}" = "y" ]
then
if [ "${CONFIG_HAVE_MRC}" = "y" ]; then
${cbfstool} "${romfile}" remove -n mrc.bin || exit 1
${cbfstool} "${romfile}" print
fi
@@ -168,16 +157,12 @@ strip_rom_image()
${cbfstool} "${romfile}" remove -n ecfw2.bin || exit 1
fi
if [ "${CONFIG_INCLUDE_SMSC_SCH5545_EC_FW}" = "y" ]; then
[ "${CONFIG_INCLUDE_SMSC_SCH5545_EC_FW}" != "y" ] || \
${cbfstool} "${romfile}" remove -n sch5545_ecfw.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
[ "${target}" != "e6400nvidia_4mb" ] || \
${cbfstool} "${romfile}" remove -n "pci10de,06eb.rom" || exit 1
}
err()
+8 -13
View File
@@ -77,12 +77,10 @@ create_release_directory()
download_modules()
{
for modname in ${trees_fetch_list}; do
[ ! -d "${modname}" ] && \
./fetch_trees ${modname}
[ ! -d "${modname}" ] && ./fetch_trees ${modname}
done
for modname in ${simple_fetch_list}; do
[ ! -d "${modname}/" ] && \
./fetch ${modname}
[ ! -d "${modname}/" ] && ./fetch ${modname}
done
}
@@ -110,12 +108,10 @@ copy_blobs()
for i in t440p xx20 xx30 hp8200sff hp_ivybridge hp_sandybridge \
hp8300usdt t1650; do
for j in ifd gbe 4_ifd 8_ifd 12_ifd 16_ifd; do
if [ -f "blobs/${i}/${j}.bin" ]; then
if [ ! -e "${srcdir}/blobs/${i}" ]; then
mkdir -p "${srcdir}/blobs/${i}"
fi
cp blobs/${i}/${j}.bin "${srcdir}/blobs/${i}"
fi
[ -f "blobs/${i}/${j}.bin" ] || continue
[ -e "${srcdir}/blobs/${i}" ] || \
mkdir -p "${srcdir}/blobs/${i}"
cp blobs/${i}/${j}.bin "${srcdir}/blobs/${i}"
done
done
}
@@ -125,8 +121,7 @@ purge_files()
(
cd "${srcdir}/coreboot/" || err "cd1"
for i in *; do
[ ! -d "${i}" ] && \
continue
[ ! -d "${i}" ] && continue
(
cd "${i}/" || err "cd2"
make distclean || err "make-distclean1"
@@ -148,7 +143,7 @@ purge_files()
rm -Rf coreboot/coreboot/ || err "rm-rf1"
rm -Rf .git .gitignore */.git* coreboot/*/.git* \
coreboot/*/3rdparty/*/.git* || err "rm-rf2"
coreboot/*/3rdparty/*/.git* || err "rm-rf2"
rm -Rf coreboot/*/util/nvidia/cbootimage/.git* || err "rm-rf3"
rm -Rf u-boot/u-boot/ u-boot/*/.git* || err "rm-rf4"
)
+2 -2
View File
@@ -44,8 +44,8 @@ main()
[ -z "${project}" ] && err "project name not specified"
[ "${project}" = "ich9utils" ] && project="util/ich9utils"
[ -d "${project}" ] || ./fetch "${project}" \
|| err "Cannot download project, ${project}"
[ -d "${project}" ] || ./fetch "${project}" || \
err "Cannot download project, ${project}"
[ -d "${project}" ] || err "Project, ${project}, not downloaded"
if [ "${project}" = "uefitool" ]; then