configs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/usr/bin/env bash
  2. #
  3. # helper script: update coreboot configs (run make oldconfig)
  4. #
  5. # Copyright (C) 2021 Leah Rowe <info@minifree.org>
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. # This script assumes that the working directory is the root
  21. # of git or release archive
  22. [ "x${DEBUG+set}" = 'xset' ] && set -v
  23. set -u -e
  24. printf "Updating coreboot configs\n"
  25. # Build ROM images for supported boards
  26. updateconf() {
  27. board="$1"
  28. if [ -f "resources/coreboot/${board}/board.cfg" ]; then
  29. cbtree="undefined"
  30. source "resources/coreboot/${board}/board.cfg"
  31. if [ "${cbtree}" = "undefined" ]; then
  32. return 0
  33. fi
  34. if [ ! -d "coreboot/${cbtree}" ]; then
  35. ./download coreboot ${cbtree}
  36. fi
  37. for cbcfg in resources/coreboot/${board}/config/*; do
  38. if [ ! -f ${cbcfg} ]; then
  39. continue
  40. fi
  41. (
  42. cd coreboot/${cbtree}/
  43. rm -f .config*
  44. make distclean
  45. )
  46. mv $cbcfg coreboot/${cbtree}/.config
  47. (
  48. cd coreboot/${cbtree}/
  49. make oldconfig
  50. )
  51. mv coreboot/${cbtree}/.config $cbcfg
  52. rm -f coreboot/${cbtree}/.config*
  53. (
  54. cd coreboot/${cbtree}/
  55. make distclean
  56. )
  57. done
  58. else
  59. printf "\nupdate/config/coreboot: no board.cfg for: %s\n" "${board}"
  60. fi
  61. }
  62. if [ $# -gt 0 ]; then
  63. for board in "${@}"; do
  64. updateconf "${board}"
  65. done
  66. else
  67. for board in resources/coreboot/*; do
  68. if [ ! -d "${board}" ]; then
  69. continue
  70. fi
  71. updateconf "${board##*/}"
  72. done
  73. fi
  74. printf "\n\n"