memtest86plus 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. # helper script: Downloads MemTest86+ and patches it
  3. #
  4. # Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
  5. # Copyright (C) 2015 Joseph Michael Thompson <jmt@josepht.me>
  6. # Copyright (C) 2015 Klemens Nanni <contact@autoboot.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. # This script assumes that the working directory is the
  22. # root of libreboot_src or libreboot git.
  23. [ "x${DEBUG+set}" = 'xset' ] && set -v
  24. set -u -e
  25. # Get the last version of MemTest86+ used, apply patches, build it.
  26. # Remove the old version that may exist
  27. # ------------------------------------------------------------------------------
  28. printf "Downloading MemTest86+\n"
  29. rm -Rf "memtest86plus/"
  30. # Get latest memtest86+:
  31. # ------------------------------------------------------------------------------
  32. # download it using wget
  33. wget http://www.memtest.org/download/5.01/memtest86+-5.01.tar.gz
  34. if [ "$(sha512sum memtest86+-5.01.tar.gz | cut -c1-128)" = "d872db35ef733ec8f49094251f2bf6b98cc80eb06d04044be3aecf28d534f24ba293a08b9979b112dbd07cf27368148939a33a32c7010fc9581a3a5b150c94d7" ]; then
  35. printf "Valid checksum for memtest86plus\n"
  36. else
  37. rm -f "memtest86+-5.01.tar.gz"
  38. printf "Invalid checksum for memtest86plus\n"
  39. exit 1
  40. fi
  41. # extract it
  42. tar -xzf "memtest86+-5.01.tar.gz"
  43. # delete the tar file (no longer needed)
  44. rm -f "memtest86+-5.01.tar.gz"
  45. # make direcotory name consistent
  46. mv "memtest86+-5.01/" "memtest86plus/"
  47. # Apply necessary patches
  48. # ------------------------------------------------------------------------------
  49. (
  50. cd "memtest86plus/"
  51. for patch in ../resources/memtest86plus/patch/*; do
  52. patch < "${patch}"
  53. done
  54. )
  55. printf "\n\n"