configs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/usr/bin/env bash
  2. #
  3. # helper script: update U-Boot configs (run make oldconfig)
  4. #
  5. # Copyright (C) 2022 Alper Nebi Yasak <alpernebiyasak@gmail.com>
  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 U-Boot configs\n"
  25. # Build ROM images for supported boards
  26. updateconf() {
  27. board="$1"
  28. if [ -f "resources/u-boot/${board}/board.cfg" ]; then
  29. ubtree="undefined"
  30. source "resources/u-boot/${board}/board.cfg"
  31. if [ "${ubtree}" = "undefined" ]; then
  32. return 0
  33. fi
  34. if [ ! -d "u-boot/${ubtree}" ]; then
  35. ./download u-boot ${ubtree}
  36. fi
  37. for ubcfg in resources/u-boot/${board}/config/*; do
  38. if [ ! -f ${ubcfg} ]; then
  39. continue
  40. fi
  41. (
  42. cd u-boot/${ubtree}/
  43. rm -f .config*
  44. make distclean
  45. )
  46. mv $ubcfg u-boot/${ubtree}/.config
  47. (
  48. cd u-boot/${ubtree}/
  49. make oldconfig
  50. )
  51. mv u-boot/${ubtree}/.config $ubcfg
  52. rm -f u-boot/${ubtree}/.config*
  53. (
  54. cd u-boot/${ubtree}/
  55. make distclean
  56. )
  57. done
  58. else
  59. printf "\nupdate/config/u-boot: 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/u-boot/*; do
  68. if [ ! -d "${board}" ]; then
  69. continue
  70. fi
  71. updateconf "${board##*/}"
  72. done
  73. fi
  74. printf "\n\n"