scripts: download: u-boot: Add help and support for multiple revisions
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
This commit is contained in:
parent
f955248044
commit
4b2d426a20
|
@ -32,6 +32,12 @@ deleteblobs="true"
|
|||
# This script handles the internet, and Git. Both are inherently unreliable.
|
||||
[[ -f build_error ]] && rm -f build_error
|
||||
|
||||
# Make sure that older revision are first as code uses that order to
|
||||
# find the latest supported revision.
|
||||
supported_uboot_revisions=" \
|
||||
v2021.07 \
|
||||
"
|
||||
|
||||
downloadfor() {
|
||||
uboot_revision="v2021.07"
|
||||
uboot_dir="u-boot/u-boot"
|
||||
|
@ -99,17 +105,41 @@ strip_comments()
|
|||
sed '/^$/d'
|
||||
}
|
||||
|
||||
printf "Downloading u-boot and (if exist in build system) applying patches\n"
|
||||
downloadfor
|
||||
usage()
|
||||
{
|
||||
progname="./download u-boot"
|
||||
|
||||
rm -f "build_error"
|
||||
printf "\n\n"
|
||||
printf "Usage:\n"
|
||||
printf "\t%s # %s\n" \
|
||||
"${progname}" \
|
||||
"Download latest u-boot git revision and deblob it"
|
||||
printf "\t%s [revision] # %s\n" \
|
||||
"${progname}" \
|
||||
"Download given u-boot git revision and deblob it"
|
||||
printf "\t%s --list-revisions # %s\n" \
|
||||
"${progname}" \
|
||||
"List supported u-boot revisions"
|
||||
printf "\t%s --help # %s\n" \
|
||||
"${progname}" \
|
||||
"Prints this help"
|
||||
}
|
||||
|
||||
if [ "${deleteblobs}" = "true" ]; then
|
||||
download_uboot_revision()
|
||||
{
|
||||
git_revision="$1"
|
||||
|
||||
printf "Downloading u-boot "
|
||||
printf "and (if exist in build system) applying patches\n"
|
||||
downloadfor "${git_revision}"
|
||||
|
||||
rm -f "build_error"
|
||||
printf "\n\n"
|
||||
|
||||
if [ "${deleteblobs}" = "true" ]; then
|
||||
bloblist="resources/u-boot/default/blobs.list"
|
||||
|
||||
for blob_path in $(strip_comments "${bloblist}"); do
|
||||
if echo "${blob_path}" | grep '/$' 2>&1 >/dev/null ; then
|
||||
if echo "${blob_path}" | \
|
||||
grep '/$' 2>&1 >/dev/null ; then
|
||||
printf "Deleting blob directory: '%s/%s'\n" \
|
||||
"${uboot_dir}" "${blob_path}"
|
||||
rm -rf "${uboot_dir}/${blob_path}"
|
||||
|
@ -119,5 +149,33 @@ if [ "${deleteblobs}" = "true" ]; then
|
|||
rm -f "${uboot_dir}/${blob_path}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ] ; then
|
||||
latest_revision="$(echo ${supported_uboot_revisions} | tail -n1)"
|
||||
download_uboot_revision "${latest_revision}"
|
||||
exit 0
|
||||
elif [ $# -eq 1 -a "$1" == "--help" ] ; then
|
||||
usage
|
||||
exit 0
|
||||
elif [ $# -eq 1 -a "$1" == "--list-revisions" ] ; then
|
||||
for revision in ${supported_uboot_revisions} ; do
|
||||
printf "${revision}\n"
|
||||
done
|
||||
exit 0
|
||||
elif [ $# -eq 1 ] ; then
|
||||
found=0
|
||||
for revision in ${supported_uboot_revisions} ; do
|
||||
if [ "${revision}" = "$1" ] ; then
|
||||
download_uboot_revision "$1"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
printf "Error: Revision '${1}' is not supported\n"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue