mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-23 07:19:24 +02:00
update/coreboot: top-down coding style
also moved hardcoded strings into variables
This commit is contained in:
@@ -26,58 +26,57 @@
|
|||||||
[ "x${DEBUG+set}" = 'xset' ] && set -v
|
[ "x${DEBUG+set}" = 'xset' ] && set -v
|
||||||
set -u -e
|
set -u -e
|
||||||
|
|
||||||
printf "Updating coreboot configs\n"
|
cbcfgsdir="resources/coreboot"
|
||||||
|
|
||||||
# Build ROM images for supported boards
|
main()
|
||||||
updateconf() {
|
{
|
||||||
board="$1"
|
printf "Updating coreboot configs\n"
|
||||||
if [ -f "resources/coreboot/${board}/board.cfg" ]; then
|
|
||||||
cbtree="undefined"
|
|
||||||
. "resources/coreboot/${board}/board.cfg" # source
|
|
||||||
if [ "${cbtree}" = "undefined" ]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if [ ! -d "coreboot/${cbtree}" ]; then
|
|
||||||
./download coreboot ${cbtree}
|
|
||||||
fi
|
|
||||||
for cbcfg in resources/coreboot/${board}/config/*; do
|
|
||||||
if [ ! -f ${cbcfg} ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
(
|
|
||||||
cd coreboot/${cbtree}/
|
|
||||||
rm -f .config*
|
|
||||||
make distclean
|
|
||||||
)
|
|
||||||
mv $cbcfg coreboot/${cbtree}/.config
|
|
||||||
(
|
|
||||||
cd coreboot/${cbtree}/
|
|
||||||
make oldconfig
|
|
||||||
)
|
|
||||||
mv coreboot/${cbtree}/.config $cbcfg
|
|
||||||
rm -f coreboot/${cbtree}/.config*
|
|
||||||
(
|
|
||||||
cd coreboot/${cbtree}/
|
|
||||||
make distclean
|
|
||||||
)
|
|
||||||
done
|
|
||||||
else
|
|
||||||
printf "\nupdate/config/coreboot: no board.cfg for: %s\n" "${board}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
for board in "${@}"; do
|
for board in "${@}"; do
|
||||||
updateconf "${board}"
|
updateconf "${board}"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
for board in resources/coreboot/*; do
|
for board in ${cbcfgsdir}/*; do
|
||||||
if [ ! -d "${board}" ]; then
|
if [ ! -d "${board}" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
updateconf "${board##*/}"
|
updateconf "${board##*/}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
printf "\n\n"
|
# Build ROM images for supported boards
|
||||||
|
updateconf()
|
||||||
|
{
|
||||||
|
board=${1}
|
||||||
|
|
||||||
|
boarddir="${cbcfgsdir}/${board}"
|
||||||
|
|
||||||
|
if [ -f "${boarddir}/board.cfg" ]; then
|
||||||
|
cbtree="undefined"
|
||||||
|
. "${boarddir}/board.cfg" # source
|
||||||
|
if [ "${cbtree}" = "undefined" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
cbdir="coreboot/${cbtree}"
|
||||||
|
if [ ! -d "${cbdir}" ]; then
|
||||||
|
./download coreboot ${cbtree}
|
||||||
|
fi
|
||||||
|
for cbcfg in "${boarddir}/config/"*; do
|
||||||
|
if [ ! -f "${cbcfg}" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
make distclean -BC "${cbdir}"
|
||||||
|
mv $cbcfg ${cbdir}/.config
|
||||||
|
make oldconfig -BC "${cbdir}"
|
||||||
|
mv ${cbdir}/.config $cbcfg
|
||||||
|
make distclean -BC "${cbdir}"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
printf "\nupdate/config/coreboot: no board.cfg for: %s\n" \
|
||||||
|
${board}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main $@
|
||||||
|
|||||||
Reference in New Issue
Block a user