mediatek_filogic 3.6 KB

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