mediatek_mt7622 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #
  2. # Copyright (C) 2021 OpenWrt.org
  3. #
  4. [ -e /etc/config/ubootenv ] && exit 0
  5. touch /etc/config/ubootenv
  6. . /lib/uboot-envtools.sh
  7. . /lib/functions.sh
  8. ubootenv_add_mmc_default() {
  9. local envdev="$(find_mmc_part "ubootenv" "${1:-mmcblk0}")"
  10. ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
  11. ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
  12. }
  13. ubootenv_add_ubi_default() {
  14. . /lib/upgrade/nand.sh
  15. local envubi=$(nand_find_ubi ubi)
  16. local envdev=/dev/$(nand_find_volume $envubi ubootenv)
  17. local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
  18. ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
  19. ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
  20. }
  21. board=$(board_name)
  22. case "$board" in
  23. dlink,eagle-pro-ai-m32-a1|\
  24. dlink,eagle-pro-ai-r32-a1)
  25. ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x2000" "0x2000"
  26. ;;
  27. bananapi,bpi-r64|\
  28. linksys,e8450-ubi)
  29. . /lib/upgrade/fit.sh
  30. export_fitblk_bootdev
  31. case "$CI_METHOD" in
  32. emmc)
  33. bootdev=${EMMC_KERN_DEV%%p[0-9]*}
  34. ubootenv_add_mmc_default "${bootdev#/dev/}"
  35. ;;
  36. ubi)
  37. ubootenv_add_ubi_default
  38. ;;
  39. esac
  40. ;;
  41. buffalo,wsr-2533dhp2)
  42. ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x1000" "0x20000"
  43. ;;
  44. ruijie,rg-ew3200gx-pro)
  45. ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x20000" "0x20000"
  46. ;;
  47. ubnt,unifi-6-lr-v1-ubootmod|\
  48. ubnt,unifi-6-lr-v2-ubootmod|\
  49. ubnt,unifi-6-lr-v3-ubootmod)
  50. ubootenv_add_uci_config "/dev/mtd$(find_mtd_index "u-boot-env")" "0x0" "0x4000" "0x1000"
  51. ;;
  52. ubnt,unifi-6-lr-v2|\
  53. ubnt,unifi-6-lr-v3)
  54. ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x1000" "0x1000" "1"
  55. ;;
  56. xiaomi,redmi-router-ax6s)
  57. ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x40000"
  58. ubootenv_add_uci_sys_config "/dev/mtd4" "0x0" "0x10000" "0x40000"
  59. ;;
  60. esac
  61. config_load ubootenv
  62. config_foreach ubootenv_add_app_config ubootenv
  63. exit 0