u-boot-stable-src-release 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/usr/bin/env bash
  2. #
  3. # helper script: generate deblobbed stable u-boot source code releases
  4. #
  5. # Copyright (C) 2020,2021 Leah Rowe <info@minifree.org>
  6. # Copyright (C) 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation, either version 3 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. #
  21. [ "x${DEBUG+set}" = 'xset' ] && set -v
  22. set -u -e
  23. version="v2022.04"
  24. revision="r1"
  25. printf "Building source code archive, version %s revision %s\n" "${version}" "${revision}"
  26. this_dir=$(realpath $(dirname $(realpath $0)))
  27. if [[ -x "${this_dir}/../../../../download" ]] # in libreboot tree?
  28. then
  29. topdir="${this_dir}/../../../../"
  30. download_dir=u-boot/u-boot
  31. tmpdir="${topdir}/release/u-boot-libre"
  32. download=( "${topdir}/download" u-boot )
  33. bloblist="resources/u-boot/default/blobs.list"
  34. elif [[ -x ./u-boot-download.sh ]] # standalone?
  35. then
  36. topdir="${this_dir}"
  37. download_dir="${this_dir}"
  38. tmpdir="${this_dir}"
  39. download=( "${this_dir}"/u-boot-download.sh )
  40. bloblist="${this_dir}"/u-boot-blobs.list
  41. else
  42. exit 1
  43. fi
  44. cd "${topdir}"
  45. "${download[@]}" "${version}" "${download_dir}" "${bloblist}"
  46. release="u-boot-libre-${version/v/}-${revision}"
  47. tarball="${tmpdir}/${release}.tar"
  48. rm -rf \
  49. "${tmpdir}/" \
  50. "${tarball}" \
  51. "${tarball}.lz" \
  52. "${tarball}.xz"
  53. mkdir -p "${tmpdir}"
  54. cp -R "${download_dir}/" "${tmpdir}/${release}"
  55. rm -rf ${tmpdir}/.git ${tmpdir}/${release}/.gitignore
  56. make -C ${tmpdir} distclean
  57. prefix="$(sed 's#^/*##' <<<${tmpdir})/"
  58. tar cf "${tarball}" "${tmpdir}/${release}" --transform="s#${prefix}##"
  59. lzip -9 --keep -vv "${tarball}"
  60. xz -9 --keep -vv "${tarball}"
  61. rm -rf "${tmpdir}/${release}/"
  62. printf "Source code archives available at:\n\t%s\n\t%s\n\t%s\n" \
  63. "${tarball}" \
  64. "${tarball}.lz" \
  65. "${tarball}.xz"