configs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/usr/bin/env sh
  2. #
  3. # helper script: update U-Boot configs (run make oldconfig)
  4. #
  5. # Copyright (C) 2022 Alper Nebi Yasak <alpernebiyasak@gmail.com>
  6. # Copyright (C) 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
  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 root
  22. # of git or release archive
  23. [ "x${DEBUG+set}" = 'xset' ] && set -v
  24. set -u -e
  25. printf "Updating U-Boot configs\n"
  26. # Build ROM images for supported boards
  27. updateconf() {
  28. board="$1"
  29. if [ -f "resources/u-boot/${board}/board.cfg" ]; then
  30. ubtree="undefined"
  31. . "resources/u-boot/${board}/board.cfg" # source
  32. if [ "${ubtree}" = "undefined" ]; then
  33. return 0
  34. fi
  35. if [ ! -d "u-boot/${ubtree}" ]; then
  36. ./download u-boot ${ubtree}
  37. fi
  38. for ubcfg in resources/u-boot/${board}/config/*; do
  39. if [ ! -f ${ubcfg} ]; then
  40. continue
  41. fi
  42. (
  43. cd u-boot/${ubtree}/
  44. rm -f .config*
  45. make distclean
  46. )
  47. mv $ubcfg u-boot/${ubtree}/.config
  48. (
  49. cd u-boot/${ubtree}/
  50. make oldconfig
  51. )
  52. mv u-boot/${ubtree}/.config $ubcfg
  53. rm -f u-boot/${ubtree}/.config*
  54. (
  55. cd u-boot/${ubtree}/
  56. make distclean
  57. )
  58. done
  59. else
  60. printf "\nupdate/config/u-boot: no board.cfg for: %s\n" "${board}"
  61. fi
  62. }
  63. if [ $# -gt 0 ]; then
  64. for board in "${@}"; do
  65. updateconf "${board}"
  66. done
  67. else
  68. for board in resources/u-boot/*; do
  69. if [ ! -d "${board}" ]; then
  70. continue
  71. fi
  72. updateconf "${board##*/}"
  73. done
  74. fi
  75. printf "\n\n"