mediatek_filogic 3.1 KB

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