From ee2731af4493e0e9510e1a5f9bb48bb91feaddcc Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Wed, 16 Feb 2022 15:31:08 +0100 Subject: boot-libre: ship the blob list too This should enable various distributions and build system to reuse that blob to deblob u-boot releases themselves. Signed-off-by: Denis 'GNUtoo' Carikli --- resources/scripts/build/release/u-boot-libre | 66 ++++++++++++++++++++++++++-- resources/scripts/download/u-boot | 39 +++++++++++++--- tests/u-boot-libre.sha512 | 3 ++ 3 files changed, 98 insertions(+), 10 deletions(-) diff --git a/resources/scripts/build/release/u-boot-libre b/resources/scripts/build/release/u-boot-libre index 7aaff3bf..30c5a0ab 100755 --- a/resources/scripts/build/release/u-boot-libre +++ b/resources/scripts/build/release/u-boot-libre @@ -29,6 +29,11 @@ supported_uboot_versions=" \ 2021.07 \ " +topdir="$(realpath $(dirname $(realpath $0))/../../../../)" +uboot_release_topdir="${topdir}/release/u-boot-libre" + +release_files="" + usage() { progname="resources/scripts/build/release/u-boot-libre" @@ -48,13 +53,36 @@ usage() "Prints this help" } +append_release_file() +{ + if [ -z "${release_files}" ] ; then + release_files="${release_files}$1" + else + release_files="${release_files} $1" + fi +} + +append_release_files() +{ + for file in "$@" ; do + append_release_file "${file}" + done +} + +print_release_files() +{ + printf "Source code archives available at:\n" + for file in "${release_files}" ; do + printf "\t${file}\n" + done +} + release_deblobbed_uboot() { version="$1" - topdir="$(realpath $(dirname $(realpath $0))/../../../../)" - versiondir="${topdir}/release/u-boot-libre/${version}-${revision}" - tmpdir="${versiondir}/u-boot-libre-${version}-${revision}" + release_version_dir="${uboot_release_topdir}/${version}-${revision}" + tmpdir="${release_version_dir}/u-boot-libre-${version}-${revision}" tarball="${tmpdir}.tar" printf "Building source code archive, version %s revision %s\n" \ @@ -88,15 +116,44 @@ release_deblobbed_uboot() rm -rf "${tmpdir}/" - printf "Source code archives available at:\n\t%s\n\t%s\n\t%s\n" \ + append_release_files \ "${tarball}" \ "${tarball}.lz" \ "${tarball}.xz" } +release_uboot_blobs_list() +{ + version="$1" + + blobs_list="$(${topdir}/download u-boot --blobs-list v${version})" + + release_version_dir="${uboot_release_topdir}/${version}-${revision}" + destination="${release_version_dir}/blobs-${version}-${revision}.list" + + cd "${topdir}" + + rm -rf \ + "${destination}" \ + "${destination}.lz" \ + "${destination}.xz" + + install -m 755 -d "${release_version_dir}" + install -m 644 -T "${blobs_list}" "${destination}" + + lzip -9 --keep -vv "${destination}" + xz -9 --keep -vv "${destination}" + + append_release_files \ + "${destination}" \ + "${destination}.lz" \ + "${destination}.xz" +} + if [ $# -eq 0 ] ; then for version in ${supported_uboot_versions} ; do release_deblobbed_uboot "${version}" + release_uboot_blobs_list "${version}" done exit 0 elif [ $# -eq 1 -a "$1" == "--help" ] ; then @@ -112,6 +169,7 @@ elif [ $# -eq 1 ] ; then for revision in ${supported_uboot_revisions} ; do if [ "${revision}" = "$1" ] ; then release_deblobbed_uboot "$1" + release_uboot_blobs_list "$1" exit 0 fi done diff --git a/resources/scripts/download/u-boot b/resources/scripts/download/u-boot index ca7883ca..b67d6bd0 100755 --- a/resources/scripts/download/u-boot +++ b/resources/scripts/download/u-boot @@ -110,16 +110,22 @@ usage() progname="./download u-boot" printf "Usage:\n" - printf "\t%s # %s\n" \ + printf "\t%s # %s\n" \ "${progname}" \ "Download latest u-boot git revision and deblob it" - printf "\t%s [revision] # %s\n" \ + printf "\t%s [revision] # %s\n" \ "${progname}" \ "Download given u-boot git revision and deblob it" - printf "\t%s --list-revisions # %s\n" \ + printf "\t%s --blobs-list # %s\n" \ + "${progname}" \ + "Print the path of the blobs.list file for the latest supported u-boot revision" + printf "\t%s --blobs-list [revision] # %s\n" \ + "${progname}" \ + "Print the path of the blobs.list file for the given u-boot revision" + printf "\t%s --list-revisions # %s\n" \ "${progname}" \ "List supported u-boot revisions" - printf "\t%s --help # %s\n" \ + printf "\t%s --help # %s\n" \ "${progname}" \ "Prints this help" } @@ -136,8 +142,8 @@ download_uboot_revision() printf "\n\n" if [ "${deleteblobs}" = "true" ]; then - bloblist="resources/u-boot/default/blobs.list" - for blob_path in $(strip_comments "${bloblist}"); do + blobslist="resources/u-boot/default/blobs.list" + for blob_path in $(strip_comments "${blobslist}"); do if echo "${blob_path}" | \ grep '/$' 2>&1 >/dev/null ; then printf "Deleting blob directory: '%s/%s'\n" \ @@ -152,6 +158,11 @@ download_uboot_revision() fi } +print_blobs_list_path() +{ + printf "resources/u-boot/default/blobs.list\n" +} + if [ $# -eq 0 ] ; then latest_revision="$(echo ${supported_uboot_revisions} | tail -n1)" download_uboot_revision "${latest_revision}" @@ -164,6 +175,22 @@ elif [ $# -eq 1 -a "$1" == "--list-revisions" ] ; then printf "${revision}\n" done exit 0 +elif [ $# -eq 1 -a "$1" == "--blobs-list" ] ; then + latest_revision="$(echo ${supported_uboot_revisions} | tail -n1)" + print_blobs_list_path "${latest_revision}" + exit 0 +elif [ $# -eq 2 -a "$1" == "--blobs-list" ] ; then + found=0 + for revision in ${supported_uboot_revisions} ; do + if [ "${revision}" = "$2" ] ; then + print_blobs_list_path "$2" + exit 0 + fi + done + + printf "Error: Revision '${1}' is not supported\n" + + exit 1 elif [ $# -eq 1 ] ; then found=0 for revision in ${supported_uboot_revisions} ; do diff --git a/tests/u-boot-libre.sha512 b/tests/u-boot-libre.sha512 index 2254c000..8977dac4 100644 --- a/tests/u-boot-libre.sha512 +++ b/tests/u-boot-libre.sha512 @@ -1,3 +1,6 @@ 1684a70273e177cdc4f94da7214198cde5e86bebf76ff29a8e7a7ed8c2470bd392eb4b1ec7eda55ee95335e76123dc28429e90b2015453734f07c28f83358bf2 release/u-boot-libre/2021.07-r1/u-boot-libre-2021.07-r1.tar 3e26aa796759dd5af01795963cc35b1ae9c9e93844c73f22a4881bae30e98f68f8d1695983da76ab5fb8aa9785b0c37d3b8a1186ed5d64b11758a4ae2b146e2c release/u-boot-libre/2021.07-r1/u-boot-libre-2021.07-r1.tar.lz d6bbd0c311fa7d73a018d2195618a9cff9984502624e83097e94c310557eb47da85f43a9e06bb3bc15828b050d9af0799fbaa828aff0a73e7f0592cccc4a2f47 release/u-boot-libre/2021.07-r1/u-boot-libre-2021.07-r1.tar.xz +007968618d182bb26eb13f25720a06f28a59b0a67e5b0e66ae2f7c1246c82139091606e61f780d60496866b31cb037a5a41f207d1b00e293280bcfc17cba8317 release/u-boot-libre/2021.07-r1/blobs-2021.07-r1.list +cc338a69266cc94d3a283a2f0e14660a649573eaf70f11254db00c190a85da5892f9ca78d2d44633d46f90c857297b954ba41d3d9e076a94433326a161f73b61 release/u-boot-libre/2021.07-r1/blobs-2021.07-r1.list.lz +174726b4505a9af850fb15cbfba73c6ea2eeb669352f37e577f37c225c8407f8c0da63f43d0d2285fdd6123fab4ac59233c8bd01bc863ba0e338c8469df10c1c release/u-boot-libre/2021.07-r1/blobs-2021.07-r1.list.xz -- cgit v1.2.1