mediatek_filogic 3.1 KB

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