mediatek_mt7622 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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/common.sh
  32. bootdev="$(fitblk_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-v1-ubootmod|\
  49. ubnt,unifi-6-lr-v2-ubootmod|\
  50. ubnt,unifi-6-lr-v3-ubootmod)
  51. ubootenv_add_uci_config "/dev/mtd$(find_mtd_index "u-boot-env")" "0x0" "0x4000" "0x1000"
  52. ;;
  53. xiaomi,redmi-router-ax6s)
  54. ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x40000"
  55. ;;
  56. esac
  57. config_load ubootenv
  58. config_foreach ubootenv_add_app_config ubootenv
  59. exit 0