mediatek_filogic 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. glinet,gl-mt3000)
  36. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
  37. ;;
  38. mercusys,mr90x-v1)
  39. local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
  40. ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
  41. ;;
  42. cetron,ct3003|\
  43. netgear,wax220)
  44. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
  45. ;;
  46. xiaomi,mi-router-wr30u-112m-nmbm|\
  47. xiaomi,mi-router-wr30u-stock|\
  48. xiaomi,redmi-router-ax6000-stock)
  49. ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
  50. ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
  51. ;;
  52. h3c,magic-nx30-pro|\
  53. qihoo,360t7|\
  54. tplink,tl-xdr4288|\
  55. tplink,tl-xdr6086|\
  56. tplink,tl-xdr6088|\
  57. xiaomi,mi-router-wr30u-ubootmod|\
  58. xiaomi,redmi-router-ax6000-ubootmod)
  59. . /lib/upgrade/nand.sh
  60. local envubi=$(nand_find_ubi ubi)
  61. local envdev=/dev/$(nand_find_volume $envubi ubootenv)
  62. local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
  63. ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
  64. ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
  65. ;;
  66. zyxel,ex5601-t0)
  67. local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
  68. ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
  69. ;;
  70. zyxel,ex5700-telenor)
  71. ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
  72. ;;
  73. esac
  74. config_load ubootenv
  75. config_foreach ubootenv_add_app_config
  76. exit 0