mediatek_filogic 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. dlink,aquila-pro-ai-m30-a1)
  68. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x40000"
  69. ;;
  70. h3c,magic-nx30-pro|\
  71. jcg,q30-pro|\
  72. netcore,n60|\
  73. qihoo,360t7|\
  74. tplink,tl-xdr4288|\
  75. tplink,tl-xdr6086|\
  76. tplink,tl-xdr6088|\
  77. xiaomi,mi-router-ax3000t-ubootmod|\
  78. xiaomi,mi-router-wr30u-ubootmod|\
  79. xiaomi,redmi-router-ax6000-ubootmod|\
  80. zyxel,ex5601-t0-ubootmod)
  81. ubootenv_add_ubi_default
  82. ;;
  83. glinet,gl-mt2500|\
  84. glinet,gl-mt6000)
  85. local envdev=$(find_mmc_part "u-boot-env")
  86. ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
  87. ;;
  88. glinet,gl-mt3000)
  89. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
  90. ;;
  91. jdcloud,re-cp-03)
  92. local envdev=$(find_mmc_part "ubootenv" "mmcblk0")
  93. ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
  94. ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
  95. ;;
  96. mercusys,mr90x-v1|\
  97. routerich,ax3000)
  98. local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
  99. ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
  100. ;;
  101. openembed,som7981)
  102. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x80000"
  103. ubootenv_add_uci_sys_config "/dev/mtd3" "0x0" "0x100000" "0x100000"
  104. ;;
  105. ubnt,unifi-6-plus)
  106. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
  107. ;;
  108. xiaomi,mi-router-ax3000t|\
  109. xiaomi,mi-router-wr30u-stock|\
  110. xiaomi,redmi-router-ax6000-stock)
  111. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
  112. ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
  113. ;;
  114. zyxel,ex5601-t0)
  115. local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
  116. ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
  117. ;;
  118. zyxel,ex5700-telenor)
  119. ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
  120. ;;
  121. esac
  122. config_load ubootenv
  123. config_foreach ubootenv_add_app_config
  124. exit 0