mediatek_filogic 3.2 KB

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