b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (C) 2014-2016 OpenWrt.org |
| 4 | # Copyright (C) 2016 LEDE-Project.org |
| 5 | # |
| 6 | |
| 7 | [ -e /etc/config/ubootenv ] && exit 0 |
| 8 | |
| 9 | touch /etc/config/ubootenv |
| 10 | |
| 11 | . /lib/uboot-envtools.sh |
| 12 | . /lib/functions.sh |
| 13 | |
| 14 | board=$(board_name) |
| 15 | |
| 16 | case "$board" in |
| 17 | buffalo,ls421de) |
| 18 | ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" |
| 19 | ;; |
| 20 | cznic,turris-omnia) |
| 21 | if grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then |
| 22 | ubootenv_add_uci_config "/dev/mtd0" "0xc0000" "0x10000" "0x40000" |
| 23 | else |
| 24 | ubootenv_add_uci_config "/dev/mtd0" "0xf0000" "0x10000" "0x10000" |
| 25 | fi |
| 26 | ;; |
| 27 | glinet,gl-mv1000) |
| 28 | ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x8000" "1" |
| 29 | ;; |
| 30 | globalscale,espressobin|\ |
| 31 | globalscale,espressobin-emmc|\ |
| 32 | globalscale,espressobin-ultra|\ |
| 33 | globalscale,espressobin-v7|\ |
| 34 | globalscale,espressobin-v7-emmc) |
| 35 | idx="$(find_mtd_index u-boot-env)" |
| 36 | if [ -n "$idx" ]; then |
| 37 | ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1" |
| 38 | else |
| 39 | ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1" |
| 40 | fi |
| 41 | ;; |
| 42 | marvell,armada8040-mcbin-doubleshot|\ |
| 43 | marvell,armada8040-mcbin-singleshot) |
| 44 | ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1" |
| 45 | ;; |
| 46 | linksys,wrt1200ac|\ |
| 47 | linksys,wrt1900ac-v2|\ |
| 48 | linksys,wrt1900acs) |
| 49 | ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x40000" |
| 50 | ;; |
| 51 | linksys,wrt1900ac-v1) |
| 52 | ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000" |
| 53 | ;; |
| 54 | linksys,wrt3200acm|\ |
| 55 | linksys,wrt32x) |
| 56 | ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" |
| 57 | ;; |
| 58 | methode,udpu) |
| 59 | ubootenv_add_uci_config "/dev/mtd0" "0x180000" "0x10000" "0x10000" |
| 60 | ;; |
| 61 | esac |
| 62 | |
| 63 | config_load ubootenv |
| 64 | config_foreach ubootenv_add_app_config ubootenv |
| 65 | |
| 66 | exit 0 |