uboot-tools: use ubootenv_add_* functions
Use ubootenv_add_* functions for code simplification. Signed-off-by: Paweł Owoc <frut3k7@gmail.com> Link: https://github.com/openwrt/openwrt/pull/18818 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
40e4dd5d31
commit
8aae84757d
8 changed files with 30 additions and 86 deletions
|
@ -101,9 +101,7 @@ glinet,gl-ar300m-nor|\
|
||||||
glinet,gl-ar300m16|\
|
glinet,gl-ar300m16|\
|
||||||
glinet,gl-s200-nor|\
|
glinet,gl-s200-nor|\
|
||||||
glinet,gl-s200-nor-nand)
|
glinet,gl-s200-nor-nand)
|
||||||
idx="$(find_mtd_index u-boot-env)"
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x10000" "0x10000"
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000"
|
|
||||||
;;
|
;;
|
||||||
buffalo,wzr-hp-ag300h)
|
buffalo,wzr-hp-ag300h)
|
||||||
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000"
|
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000"
|
||||||
|
|
|
@ -25,9 +25,7 @@ zyxel,p-2812hnu-f1)
|
||||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x2000" "0x20000" "1"
|
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x2000" "0x20000" "1"
|
||||||
;;
|
;;
|
||||||
buffalo,wbmr-300hpd)
|
buffalo,wbmr-300hpd)
|
||||||
idx="$(find_mtd_index u-boot-env)"
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x2000" "0x1000" "2"
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x2000" "0x1000" "2"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -12,15 +12,13 @@ touch /etc/config/ubootenv
|
||||||
board=$(board_name)
|
board=$(board_name)
|
||||||
|
|
||||||
ubootenv_add_mmc_default() {
|
ubootenv_add_mmc_default() {
|
||||||
local envdev="$(find_mmc_part "ubootenv" "${1:-mmcblk0}")"
|
ubootenv_add_mmc "ubootenv" "${1:-mmcblk0}" "0x0" "0x40000" "0x40000" "1"
|
||||||
ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
|
ubootenv_add_mmc "ubootenv" "${1:-mmcblk0}" "0x40000" "0x40000" "0x40000" "1"
|
||||||
ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ubootenv_add_nor_default() {
|
ubootenv_add_nor_default() {
|
||||||
local envdev="/dev/mtd$(find_mtd_index "u-boot-env")"
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x20000" "0x20000" "1"
|
||||||
ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
|
ubootenv_add_mtd "u-boot-env" "0x20000" "0x20000" "0x20000" "1"
|
||||||
ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ubootenv_add_ubi_default() {
|
ubootenv_add_ubi_default() {
|
||||||
|
@ -66,8 +64,7 @@ glinet,gl-x3000|\
|
||||||
glinet,gl-xe3000|\
|
glinet,gl-xe3000|\
|
||||||
huasifei,wh3000|\
|
huasifei,wh3000|\
|
||||||
nradio,c8-668gl)
|
nradio,c8-668gl)
|
||||||
local envdev=$(find_mmc_part "u-boot-env")
|
ubootenv_add_mmc "u-boot-env" "" "0x0" "0x80000"
|
||||||
ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
|
|
||||||
;;
|
;;
|
||||||
asus,rt-ax59u)
|
asus,rt-ax59u)
|
||||||
ubootenv_add_uci_config "/dev/mtd0" "0x100000" "0x20000" "0x20000"
|
ubootenv_add_uci_config "/dev/mtd0" "0x100000" "0x20000" "0x20000"
|
||||||
|
@ -119,8 +116,7 @@ routerich,ax3000|\
|
||||||
routerich,ax3000-v1|\
|
routerich,ax3000-v1|\
|
||||||
tenbay,wr3000k|\
|
tenbay,wr3000k|\
|
||||||
tplink,re6000xd)
|
tplink,re6000xd)
|
||||||
local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x20000" "0x20000" "1"
|
||||||
ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
|
|
||||||
;;
|
;;
|
||||||
openembed,som7981)
|
openembed,som7981)
|
||||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x80000"
|
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x80000"
|
||||||
|
@ -132,8 +128,7 @@ openwrt,one)
|
||||||
smartrg,sdg-8733|\
|
smartrg,sdg-8733|\
|
||||||
smartrg,sdg-8733a|\
|
smartrg,sdg-8733a|\
|
||||||
smartrg,sdg-8734)
|
smartrg,sdg-8734)
|
||||||
local envdev=$(find_mmc_part "u-boot-env" "mmcblk0")
|
ubootenv_add_mmc "u-boot-env" "mmcblk0" "0x0" "0x8000" "0x8000"
|
||||||
ubootenv_add_uci_config "$envdev" "0x0" "0x8000" "0x8000"
|
|
||||||
;;
|
;;
|
||||||
tplink,archer-ax80-v1)
|
tplink,archer-ax80-v1)
|
||||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" "8"
|
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" "8"
|
||||||
|
@ -148,8 +143,7 @@ xiaomi,redmi-router-ax6000-stock)
|
||||||
ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
|
ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
|
||||||
;;
|
;;
|
||||||
zyxel,ex5601-t0)
|
zyxel,ex5601-t0)
|
||||||
local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x20000" "0x40000" "2"
|
||||||
ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
|
|
||||||
;;
|
;;
|
||||||
zyxel,ex5700-telenor)
|
zyxel,ex5700-telenor)
|
||||||
ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
|
ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
|
||||||
|
|
|
@ -10,9 +10,8 @@ touch /etc/config/ubootenv
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
|
|
||||||
ubootenv_add_mmc_default() {
|
ubootenv_add_mmc_default() {
|
||||||
local envdev="$(find_mmc_part "ubootenv" "${1:-mmcblk0}")"
|
ubootenv_add_mmc "ubootenv" "${1:-mmcblk0}" "0x0" "0x80000" "0x80000" "1"
|
||||||
ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
|
ubootenv_add_mmc "ubootenv" "${1:-mmcblk0}" "0x80000" "0x80000" "0x80000" "1"
|
||||||
ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ubootenv_add_ubi_default() {
|
ubootenv_add_ubi_default() {
|
||||||
|
@ -54,7 +53,7 @@ ruijie,rg-ew3200gx-pro)
|
||||||
ubnt,unifi-6-lr-v1-ubootmod|\
|
ubnt,unifi-6-lr-v1-ubootmod|\
|
||||||
ubnt,unifi-6-lr-v2-ubootmod|\
|
ubnt,unifi-6-lr-v2-ubootmod|\
|
||||||
ubnt,unifi-6-lr-v3-ubootmod)
|
ubnt,unifi-6-lr-v3-ubootmod)
|
||||||
ubootenv_add_uci_config "/dev/mtd$(find_mtd_index "u-boot-env")" "0x0" "0x4000" "0x1000"
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x4000" "0x1000"
|
||||||
;;
|
;;
|
||||||
ubnt,unifi-6-lr-v2|\
|
ubnt,unifi-6-lr-v2|\
|
||||||
ubnt,unifi-6-lr-v3)
|
ubnt,unifi-6-lr-v3)
|
||||||
|
|
|
@ -73,8 +73,7 @@ methode,edpu)
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
synology,ds213j)
|
synology,ds213j)
|
||||||
idx="$(find_mtd_index u-boot-env)"
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x10000" "0x10000"
|
||||||
[ -n "$idx" ] && ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -7,37 +7,19 @@ touch /etc/config/ubootenv
|
||||||
|
|
||||||
board=$(board_name)
|
board=$(board_name)
|
||||||
|
|
||||||
ubootenv_add_mtd() {
|
|
||||||
local idx="$(find_mtd_index "${1}")"
|
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "${2}" "${3}" "${4}"
|
|
||||||
}
|
|
||||||
|
|
||||||
ubootenv_add_sys_mtd() {
|
|
||||||
local idx="$(find_mtd_index "${1}")"
|
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_sys_config "/dev/mtd$idx" "${2}" "${3}" "${4}"
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$board" in
|
case "$board" in
|
||||||
elecom,wrc-x3000gs2|\
|
elecom,wrc-x3000gs2|\
|
||||||
iodata,wn-dax3000gr)
|
iodata,wn-dax3000gr)
|
||||||
idx="$(find_mtd_index 0:appsblenv)"
|
ubootenv_add_mtd "0:appsblenv" "0x0" "0x40000" "0x20000"
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000"
|
|
||||||
;;
|
;;
|
||||||
glinet,gl-b3000)
|
glinet,gl-b3000)
|
||||||
idx="$(find_mtd_index 0:APPSBLENV)"
|
ubootenv_add_mtd "0:APPSBLENV" "0x0" "0x40000" "0x20000"
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000"
|
|
||||||
;;
|
;;
|
||||||
linksys,mr5500|\
|
linksys,mr5500|\
|
||||||
linksys,mx2000|\
|
linksys,mx2000|\
|
||||||
linksys,mx5500|\
|
linksys,mx5500|\
|
||||||
linksys,spnmx56)
|
linksys,spnmx56)
|
||||||
idx="$(find_mtd_index u_env)"
|
ubootenv_add_mtd "u_env" "0x0" "0x40000" "0x20000"
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000"
|
|
||||||
;;
|
;;
|
||||||
xiaomi,ax6000)
|
xiaomi,ax6000)
|
||||||
ubootenv_add_mtd "0:appsblenv" "0x0" "0x10000" "0x20000"
|
ubootenv_add_mtd "0:appsblenv" "0x0" "0x10000" "0x20000"
|
||||||
|
|
|
@ -52,9 +52,7 @@ rostelecom,rt-sf-1)
|
||||||
beeline,smartbox-pro|\
|
beeline,smartbox-pro|\
|
||||||
tplink,ec330-g5u-v1|\
|
tplink,ec330-g5u-v1|\
|
||||||
wifire,s1500-nbn)
|
wifire,s1500-nbn)
|
||||||
idx="$(find_mtd_index u-boot-env)"
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x1000" "0x20000"
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x20000"
|
|
||||||
;;
|
;;
|
||||||
buffalo,wsr-1166dhp|\
|
buffalo,wsr-1166dhp|\
|
||||||
buffalo,wsr-600dhp|\
|
buffalo,wsr-600dhp|\
|
||||||
|
@ -93,9 +91,7 @@ sim,simax1800t)
|
||||||
;;
|
;;
|
||||||
hootoo,ht-tm05|\
|
hootoo,ht-tm05|\
|
||||||
ravpower,rp-wd03)
|
ravpower,rp-wd03)
|
||||||
idx="$(find_mtd_index u-boot-env)"
|
ubootenv_add_mtd "u-boot-env" "0x4000" "0x1000" "0x1000"
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000" "0x1000"
|
|
||||||
;;
|
;;
|
||||||
beeline,smartbox-flash|\
|
beeline,smartbox-flash|\
|
||||||
iptime,t5004|\
|
iptime,t5004|\
|
||||||
|
@ -113,9 +109,7 @@ ubnt,edgerouter-x-sfp)
|
||||||
snr,snr-cpe-me1|\
|
snr,snr-cpe-me1|\
|
||||||
snr,snr-cpe-me2-sfp|\
|
snr,snr-cpe-me2-sfp|\
|
||||||
snr,cpe-w4n-mt)
|
snr,cpe-w4n-mt)
|
||||||
idx="$(find_mtd_index uboot-env)"
|
ubootenv_add_mtd "uboot-env" "0x0" "0x1000" "0x1000"
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x1000"
|
|
||||||
;;
|
;;
|
||||||
xiaomi,miwifi-mini)
|
xiaomi,miwifi-mini)
|
||||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
|
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
|
||||||
|
@ -141,9 +135,7 @@ zyxel,lte3301-plus)
|
||||||
zyxel,lte5398-m904|\
|
zyxel,lte5398-m904|\
|
||||||
zyxel,lte7490-m904|\
|
zyxel,lte7490-m904|\
|
||||||
zyxel,nr7101)
|
zyxel,nr7101)
|
||||||
idx="$(find_mtd_index Config)"
|
ubootenv_add_mtd "Config" "0x0" "0x1000" "0x80000"
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x80000"
|
|
||||||
;;
|
;;
|
||||||
bolt,arion|\
|
bolt,arion|\
|
||||||
xiaomi,mi-router-cr6606|\
|
xiaomi,mi-router-cr6606|\
|
||||||
|
|
|
@ -9,12 +9,8 @@ board=$(board_name)
|
||||||
|
|
||||||
case "$board" in
|
case "$board" in
|
||||||
apresia,aplgs120gtss)
|
apresia,aplgs120gtss)
|
||||||
idx="$(find_mtd_index u-boot-env)"
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x40000" "0x10000"
|
||||||
[ -n "$idx" ] && \
|
ubootenv_add_sys_mtd "u-boot-env2" "0x0" "0x40000" "0x10000"
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x10000"
|
|
||||||
idx2="$(find_mtd_index u-boot-env2)"
|
|
||||||
[ -n "$idx2" ] && \
|
|
||||||
ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x40000" "0x10000"
|
|
||||||
;;
|
;;
|
||||||
d-link,dgs-1210-10mp|\
|
d-link,dgs-1210-10mp|\
|
||||||
d-link,dgs-1210-10p|\
|
d-link,dgs-1210-10p|\
|
||||||
|
@ -31,35 +27,21 @@ zyxel,gs1900-24e|\
|
||||||
zyxel,gs1900-24ep|\
|
zyxel,gs1900-24ep|\
|
||||||
zyxel,gs1900-24hp-v1|\
|
zyxel,gs1900-24hp-v1|\
|
||||||
zyxel,gs1900-24hp-v2)
|
zyxel,gs1900-24hp-v2)
|
||||||
idx="$(find_mtd_index u-boot-env)"
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x400" "0x10000"
|
||||||
[ -n "$idx" ] && \
|
ubootenv_add_sys_mtd "u-boot-env2" "0x0" "0x1000" "0x10000"
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x400" "0x10000"
|
|
||||||
idx2="$(find_mtd_index u-boot-env2)"
|
|
||||||
[ -n "$idx2" ] && \
|
|
||||||
ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x1000" "0x10000"
|
|
||||||
;;
|
;;
|
||||||
tplink,sg2008p-v1|\
|
tplink,sg2008p-v1|\
|
||||||
tplink,sg2210p-v3|\
|
tplink,sg2210p-v3|\
|
||||||
tplink,sg2452p-v4)
|
tplink,sg2452p-v4)
|
||||||
idx="$(find_mtd_index u-boot-env)"
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x20000" "0x10000"
|
||||||
[ -n "$idx" ] && \
|
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x10000"
|
|
||||||
;;
|
;;
|
||||||
iodata,bsh-g24mb)
|
iodata,bsh-g24mb)
|
||||||
idx="$(find_mtd_index u-boot-env)"
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x10000" "0x10000"
|
||||||
[ -n "$idx" ] && \
|
ubootenv_add_sys_mtd "u-boot-env2" "0x0" "0x3800" "0x10000"
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000"
|
|
||||||
idx2="$(find_mtd_index u-boot-env2)"
|
|
||||||
[ -n "$idx2" ] && \
|
|
||||||
ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x3800" "0x10000"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
idx="$(find_mtd_index u-boot-env)"
|
ubootenv_add_mtd "u-boot-env" "0x0" "0x10000" "0x10000"
|
||||||
[ -n "$idx" ] && \
|
ubootenv_add_sys_mtd "u-boot-env2" "0x0" "0x1000" "0x10000"
|
||||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000"
|
|
||||||
idx2="$(find_mtd_index u-boot-env2)"
|
|
||||||
[ -n "$idx2" ] && \
|
|
||||||
ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x1000" "0x10000"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue