mediatek_mt7622 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. linksys,e8450-ubi)
  28. ubootenv_add_ubi_default
  29. ;;
  30. bananapi,bpi-r64)
  31. . /lib/upgrade/platform.sh
  32. bootdev="$(platform_get_bootdev)"
  33. case "$bootdev" in
  34. mmc*)
  35. ubootenv_add_mmc_default "${bootdev%p[0-9]*}"
  36. ;;
  37. ubi*)
  38. ubootenv_add_ubi_default
  39. ;;
  40. esac
  41. ;;
  42. buffalo,wsr-2533dhp2)
  43. ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x1000" "0x20000"
  44. ;;
  45. ruijie,rg-ew3200gx-pro)
  46. ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x20000" "0x20000"
  47. ;;
  48. ubnt,unifi-6-lr-ubootmod)
  49. ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x1000"
  50. ;;
  51. xiaomi,redmi-router-ax6s)
  52. ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x40000"
  53. ;;
  54. esac
  55. config_load ubootenv
  56. config_foreach ubootenv_add_app_config ubootenv
  57. exit 0