mediatek_filogic 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. board=$(board_name)
  9. case "$board" in
  10. asus,rt-ax59u)
  11. ubootenv_add_uci_config "/dev/mtd0" "0x100000" "0x20000" "0x20000"
  12. ;;
  13. bananapi,bpi-r3)
  14. rootdev="$(cmdline_get_var root)"
  15. rootdev="${rootdev##*/}"
  16. rootdev="${rootdev%%p[0-9]*}"
  17. case "$rootdev" in
  18. mmc*)
  19. local envdev=$(find_mmc_part "ubootenv" $rootdev)
  20. ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
  21. ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
  22. ;;
  23. mtd*)
  24. local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
  25. ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
  26. ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1"
  27. ;;
  28. ubi*)
  29. . /lib/upgrade/nand.sh
  30. local envubi=$(nand_find_ubi ubi)
  31. local envdev=/dev/$(nand_find_volume $envubi ubootenv)
  32. local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
  33. ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
  34. ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
  35. ;;
  36. esac
  37. ;;
  38. cmcc,rax3000m)
  39. case "$(cmdline_get_var root)" in
  40. /dev/mmc*)
  41. local envdev=$(find_mmc_part "ubootenv" "mmcblk0")
  42. ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
  43. ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
  44. ;;
  45. *)
  46. . /lib/upgrade/nand.sh
  47. local envubi=$(nand_find_ubi ubi)
  48. local envdev=/dev/$(nand_find_volume $envubi ubootenv)
  49. local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
  50. ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
  51. ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
  52. ;;
  53. esac
  54. ;;
  55. cetron,ct3003|\
  56. netgear,wax220|\
  57. zbtlink,zbt-z8102ax|\
  58. zbtlink,zbt-z8103ax)
  59. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
  60. ;;
  61. h3c,magic-nx30-pro|\
  62. jcg,q30-pro|\
  63. qihoo,360t7|\
  64. tplink,tl-xdr4288|\
  65. tplink,tl-xdr6086|\
  66. tplink,tl-xdr6088|\
  67. xiaomi,mi-router-ax3000t-ubootmod|\
  68. xiaomi,mi-router-wr30u-ubootmod|\
  69. xiaomi,redmi-router-ax6000-ubootmod)
  70. . /lib/upgrade/nand.sh
  71. local envubi=$(nand_find_ubi ubi)
  72. local envdev=/dev/$(nand_find_volume $envubi ubootenv)
  73. local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
  74. ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
  75. ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
  76. ;;
  77. glinet,gl-mt2500|\
  78. glinet,gl-mt6000)
  79. local envdev=$(find_mmc_part "u-boot-env")
  80. ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
  81. ;;
  82. glinet,gl-mt3000)
  83. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
  84. ;;
  85. mercusys,mr90x-v1|\
  86. routerich,ax3000)
  87. local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
  88. ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
  89. ;;
  90. ubnt,unifi-6-plus)
  91. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
  92. ;;
  93. xiaomi,mi-router-ax3000t|\
  94. xiaomi,mi-router-wr30u-112m-nmbm|\
  95. xiaomi,mi-router-wr30u-stock|\
  96. xiaomi,redmi-router-ax6000-stock)
  97. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
  98. ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
  99. ;;
  100. zyxel,ex5601-t0)
  101. local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
  102. ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
  103. ;;
  104. zyxel,ex5601-t0-ubootmod)
  105. . /lib/upgrade/nand.sh
  106. local envubi=$(nand_find_ubi ubi)
  107. local envdev=/dev/$(nand_find_volume $envubi ubootenv)
  108. local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
  109. ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
  110. ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
  111. ;;
  112. zyxel,ex5700-telenor)
  113. ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
  114. ;;
  115. esac
  116. config_load ubootenv
  117. config_foreach ubootenv_add_app_config
  118. exit 0