seabios 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (C) 2015, 2016, 2021 Leah Rowe <info@minifree.org>
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #
  18. [ "x${DEBUG+set}" = 'xset' ] && set -v
  19. set -u -e
  20. usage()
  21. {
  22. progname="./download seabios"
  23. printf "Usage:\n"
  24. printf "\t%s # %s\n" \
  25. "${progname}" \
  26. "Download SeaBIOS"
  27. printf "\t%s --help # %s\n" \
  28. "${progname}" \
  29. "Prints this help"
  30. }
  31. if [ $# -ne 0 ] ; then
  32. usage
  33. exit 0
  34. fi
  35. # Get SeaBIOS, revert to commit last used and apply patches.
  36. # Remove the old version that may still exist
  37. # ------------------------------------------------------------------------------
  38. printf "Downloading SeaBIOS\n"
  39. rm -f build_error
  40. rm -rf "seabios/"
  41. # Get latest SeaBIOS
  42. # ------------------------------------------------------------------------------
  43. # download it using git
  44. git clone https://review.coreboot.org/seabios || git clone https://github.com/coreboot/seabios
  45. if [ ! -d "seabios" ]; then
  46. printf "seabios not downloaded; check network connection?\n\n"
  47. exit 1
  48. fi
  49. (
  50. # modifications are required
  51. cd "seabios/"
  52. # Reset to the last commit that was tested (we use stable releases for seabios)
  53. # ------------------------------------------------------------------------------
  54. git reset --hard 64f37cc530f144e53c190c9e8209a51b58fd5c43
  55. for patchfile in ../resources/seabios/patches/*.patch; do
  56. if [ ! -f "${patchfile}" ]; then continue; fi
  57. git am "${patchfile}" || touch ../build_error
  58. if [ -f ../build_error ]; then
  59. git am --abort
  60. break
  61. fi
  62. done
  63. )
  64. if [ -f build_error ]; then
  65. rm -f build_error
  66. exit 1
  67. fi
  68. exit 0