aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/uboot-envtools
diff options
context:
space:
mode:
Diffstat (limited to 'package/boot/uboot-envtools')
-rw-r--r--package/boot/uboot-envtools/Makefile23
-rw-r--r--package/boot/uboot-envtools/files/apm821xx4
-rw-r--r--package/boot/uboot-envtools/files/ath7983
-rw-r--r--package/boot/uboot-envtools/files/imx_cortexa719
-rw-r--r--package/boot/uboot-envtools/files/imx_cortexa9 (renamed from package/boot/uboot-envtools/files/imx6)2
-rw-r--r--package/boot/uboot-envtools/files/ipq40xx10
-rw-r--r--package/boot/uboot-envtools/files/ipq806x9
-rw-r--r--package/boot/uboot-envtools/files/kirkwood1
-rw-r--r--package/boot/uboot-envtools/files/layerscape5
-rw-r--r--package/boot/uboot-envtools/files/mediatek_filogic127
-rw-r--r--package/boot/uboot-envtools/files/mediatek_mt762250
-rw-r--r--package/boot/uboot-envtools/files/mediatek_mt76234
-rw-r--r--package/boot/uboot-envtools/files/mediatek_mt762924
-rw-r--r--package/boot/uboot-envtools/files/mpc85xx14
-rw-r--r--package/boot/uboot-envtools/files/mvebu21
-rw-r--r--package/boot/uboot-envtools/files/octeon23
-rw-r--r--package/boot/uboot-envtools/files/oxnas2
-rw-r--r--package/boot/uboot-envtools/files/qoriq19
-rw-r--r--package/boot/uboot-envtools/files/qualcommax_ipq807x63
-rw-r--r--package/boot/uboot-envtools/files/ramips90
-rw-r--r--package/boot/uboot-envtools/files/realtek34
-rw-r--r--package/boot/uboot-envtools/patches/002-Revert-tools-env-use-run-to-store-lockfile.patch41
-rw-r--r--package/boot/uboot-envtools/patches/010-fw_env-fix-reading-NVMEM-device-s-compatible-value.patch70
-rw-r--r--package/boot/uboot-envtools/patches/011-fw_env-keep-calling-read-until-whole-flash-block-is-.patch75
-rw-r--r--package/boot/uboot-envtools/patches/012-fw_env-autodetect-NAND-erase-size-and-env-sectors.patch49
25 files changed, 809 insertions, 53 deletions
diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile
index 1ace390c40a..00aa4241625 100644
--- a/package/boot/uboot-envtools/Makefile
+++ b/package/boot/uboot-envtools/Makefile
@@ -9,15 +9,15 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=uboot-envtools
PKG_DISTNAME:=u-boot
-PKG_VERSION:=2021.01
-PKG_RELEASE:=$(AUTORELEASE)
+PKG_VERSION:=2024.01
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:= \
https://ftp.denx.de/pub/u-boot \
https://mirror.cyberbits.eu/u-boot \
ftp://ftp.denx.de/pub/u-boot
-PKG_HASH:=b407e1510a74e863b8b5cb42a24625344f0e0c2fc7582d8c866bd899367d0454
+PKG_HASH:=b99611f1ed237bf3541bdc8434b68c96a6e05967061f992443cb30aabebef5b3
PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION)
@@ -45,18 +45,19 @@ define Package/uboot-envtools/description
endef
define Build/Configure
- touch $(PKG_BUILD_DIR)/include/config.h
- mkdir -p $(PKG_BUILD_DIR)/include/config
- touch $(PKG_BUILD_DIR)/include/config/auto.conf
- mkdir -p $(PKG_BUILD_DIR)/include/generated
- touch $(PKG_BUILD_DIR)/include/generated/autoconf.h
+ $(call Build/Compile/Default,tools-only_defconfig)
endef
+define Build/Compile
+ $(call Build/Compile/Default,envtools)
+endef
+
+# We need to override the ARCH passed by buildsystem as otherwise the defconfig
+# for tools-only wont match and the includes for sandbox will be dropped
MAKE_FLAGS += \
+ ARCH="sandbox" \
TARGET_CFLAGS="$(TARGET_CFLAGS)" \
- TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
- no-dot-config-targets=envtools \
- envtools
+ TARGET_LDFLAGS="$(TARGET_LDFLAGS)"
define Package/uboot-envtools/conffiles
/etc/config/ubootenv
diff --git a/package/boot/uboot-envtools/files/apm821xx b/package/boot/uboot-envtools/files/apm821xx
index 690fbba3321..e73aaab7a0d 100644
--- a/package/boot/uboot-envtools/files/apm821xx
+++ b/package/boot/uboot-envtools/files/apm821xx
@@ -19,6 +19,10 @@ netgear,wndap620|\
netgear,wndap660)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000" "4"
;;
+wd,mybooklive)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" "1"
+ ubootenv_add_uci_config "/dev/mtd1" "0x1000" "0x1000" "0x1000" "1"
+ ;;
esac
config_load ubootenv
diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79
index 91ba587bf8f..7c0cdf9013f 100644
--- a/package/boot/uboot-envtools/files/ath79
+++ b/package/boot/uboot-envtools/files/ath79
@@ -12,17 +12,31 @@ touch /etc/config/ubootenv
board=$(board_name)
case "$board" in
+alcatel,hh40v|\
alfa-network,ap121f|\
alfa-network,ap121fe|\
alfa-network,n2q|\
alfa-network,n5q|\
alfa-network,pi-wifi4|\
alfa-network,r36a|\
+alfa-network,tube-2hq|\
allnet,all-wap02860ac|\
+araknis,an-300-ap-i-n|\
+araknis,an-500-ap-i-ac|\
+araknis,an-700-ap-i-ac|\
arduino,yun|\
+asus,rt-ac59u|\
+asus,rt-ac59u-v2|\
+asus,zenwifi-cd6n|\
+asus,zenwifi-cd6r|\
buffalo,bhr-4grv2|\
devolo,magic-2-wifi|\
+dlink,dap-1720-a1|\
+dlink,dir-859-a1|\
+dlink,dir-859-a3|\
+dlink,dir-869-a1|\
engenius,eap1200h|\
+engenius,eap1750h|\
engenius,eap300-v2|\
engenius,eap350-v1|\
engenius,eap600|\
@@ -33,12 +47,14 @@ engenius,ecb600|\
engenius,enh202-v1|\
engenius,ens202ext-v1|\
engenius,enstationac-v1|\
+engenius,ews660ap|\
etactica,eg200|\
glinet,gl-ar750s-nor|\
glinet,gl-ar750s-nor-nand|\
librerouter,librerouter-v1|\
-netgear,ex6400|\
+moxa,awk-1137c|\
netgear,ex7300|\
+netgear,ex7300-v2|\
netgear,wndr4300-v2|\
netgear,wndr4500-v3|\
netgear,wnr1000-v2|\
@@ -57,21 +73,52 @@ openmesh,mr900-v2|\
openmesh,mr1750-v1|\
openmesh,mr1750-v2|\
openmesh,om5p|\
+openmesh,om5p-an|\
+openmesh,om5p-ac-v1|\
openmesh,om5p-ac-v2|\
samsung,wam250|\
+ubnt,airrouter|\
+ubnt,bullet-m-ar7240|\
+ubnt,bullet-m-ar7241|\
+ubnt,nanobridge-m|\
+ubnt,nanostation-loco-m|\
ubnt,nanostation-m|\
+ubnt,picostation-m|\
+ubnt,powerbridge-m|\
+ubnt,rocket-m|\
+watchguard,ap100|\
+watchguard,ap200|\
+watchguard,ap300|\
yuncore,a770|\
yuncore,a782|\
+yuncore,a930|\
+yuncore,xd3200|\
yuncore,xd4200|\
ziking,cpe46b|\
zyxel,nbg6616)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
;;
+aruba,ap-105|\
+aruba,ap-115|\
+aruba,ap-175|\
+dongwon,dw02-412h-64m|\
+dongwon,dw02-412h-128m|\
+glinet,gl-ar300m-lite|\
+glinet,gl-ar300m-nand|\
+glinet,gl-ar300m-nor|\
+glinet,gl-ar300m16|\
+glinet,gl-s200-nor|\
+glinet,gl-s200-nor-nand)
+ idx="$(find_mtd_index u-boot-env)"
+ [ -n "$idx" ] && \
+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000"
+ ;;
buffalo,wzr-hp-ag300h)
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000"
;;
buffalo,wzr-hp-g300nh-rb|\
-buffalo,wzr-hp-g300nh-s)
+buffalo,wzr-hp-g300nh-s|\
+linksys,ea4500-v3)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
;;
domywifi,dw33d)
@@ -80,25 +127,19 @@ domywifi,dw33d)
glinet,gl-ar150)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x10000"
;;
-glinet,gl-ar300m-lite|\
-glinet,gl-ar300m-nand|\
-glinet,gl-ar300m-nor|\
-glinet,gl-ar300m16)
- idx="$(find_mtd_index u-boot-env)"
- [ -n "$idx" ] && \
- ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000"
- ;;
netgear,wndr3700|\
netgear,wndr3700-v2|\
netgear,wndrmac-v1)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x10000"
;;
+netgear,pgzng1|\
netgear,wndr3700-v4|\
netgear,wndr4300|\
netgear,wndr4300tn|\
netgear,wndr4300sw)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000"
;;
+openmesh,om2p-v1|\
openmesh,om2p-v2|\
openmesh,om2p-v4|\
openmesh,om2p-hs-v1|\
@@ -113,9 +154,31 @@ plasmacloud,pa300e)
qihoo,c301)
ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000"
;;
+ruckus,zf7025|\
+ruckus,zf7341|\
+ruckus,zf7351|\
+ruckus,zf7363)
+ ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x40000" "0x40000"
+ ;;
+ruckus,zf7321|\
+ruckus,zf7372)
+ ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x40000" "0x10000"
+ ;;
+sophos,ap15|\
+sophos,ap55|\
+sophos,ap55c|\
+sophos,ap100|\
+sophos,ap100c)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
+ ;;
wallys,dr531)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0xf800" "0x10000"
;;
+zte,mf286|\
+zte,mf286a|\
+zte,mf286r)
+ ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x20000" "0x10000"
+ ;;
esac
config_load ubootenv
diff --git a/package/boot/uboot-envtools/files/imx_cortexa7 b/package/boot/uboot-envtools/files/imx_cortexa7
new file mode 100644
index 00000000000..df6a4362607
--- /dev/null
+++ b/package/boot/uboot-envtools/files/imx_cortexa7
@@ -0,0 +1,19 @@
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+technexion,imx7d-pico-pi)
+ ubootenv_add_uci_config "/dev/mmcblk2" "0xc0000" "0x2000" "0x2000"
+ ;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config ubootenv
+
+exit 0
diff --git a/package/boot/uboot-envtools/files/imx6 b/package/boot/uboot-envtools/files/imx_cortexa9
index dac3c3792ef..c6d6d94d164 100644
--- a/package/boot/uboot-envtools/files/imx6
+++ b/package/boot/uboot-envtools/files/imx_cortexa9
@@ -6,7 +6,7 @@
touch /etc/config/ubootenv
-. /lib/imx6.sh
+. /lib/imx.sh
. /lib/uboot-envtools.sh
. /lib/functions.sh
diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx
index 1462aa991d7..8d993fae366 100644
--- a/package/boot/uboot-envtools/files/ipq40xx
+++ b/package/boot/uboot-envtools/files/ipq40xx
@@ -26,6 +26,7 @@ ubootenv_mtdinfo () {
fi
sectors=$(( $ubootenv_size / $mtd_erase ))
+ sectors=$(printf "0x%x" $sectors )
echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors
}
@@ -33,12 +34,15 @@ case "$board" in
alfa-network,ap120c-ac|\
devolo,magic-2-wifi-next|\
edgecore,ecw5211|\
+glinet,gl-a1300 |\
glinet,gl-ap1300|\
glinet,gl-b1300|\
+glinet,gl-b2200|\
luma,wrtq-329acn|\
netgear,wac510|\
openmesh,a42|\
openmesh,a62|\
+pakedge,wr-1|\
plasmacloud,pa1200|\
plasmacloud,pa2200)
ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x10000" "0x10000"
@@ -59,6 +63,12 @@ linksys,ea8300|\
linksys,mr8300)
ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x40000" "0x20000"
;;
+linksys,whw01)
+ ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x40000" "0x10000"
+ ;;
+linksys,whw03v2)
+ ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x80000" "0x20000"
+ ;;
zyxel,nbg6617)
ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x10000" "0x10000"
;;
diff --git a/package/boot/uboot-envtools/files/ipq806x b/package/boot/uboot-envtools/files/ipq806x
index 7e1d71a7e9b..443a0e13d40 100644
--- a/package/boot/uboot-envtools/files/ipq806x
+++ b/package/boot/uboot-envtools/files/ipq806x
@@ -26,16 +26,22 @@ ubootenv_mtdinfo () {
fi
sectors=$(( $ubootenv_size / $mtd_erase ))
+ sectors=$(printf "0x%x" $sectors )
echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors
}
case "$board" in
+arris,tr4400-v2|\
askey,rt4230w-rev6)
ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x40000" "0x20000"
;;
edgecore,ecw5410)
ubootenv_add_uci_config "/dev/mtd11" "0x0" "0x10000" "0x10000"
;;
+extreme,ap3935)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
+ ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000"
+ ;;
linksys,ea7500-v1|\
linksys,ea8500)
ubootenv_add_uci_config "/dev/mtd10" "0x0" "0x20000" "0x20000"
@@ -43,6 +49,9 @@ linksys,ea8500)
netgear,r7800)
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x040000" "0x20000"
;;
+nokia,ac400i)
+ ubootenv_add_uci_config "/dev/mtd20" "0x0" "0x040000" "0x20000"
+ ;;
qcom,ipq8064-ap148|\
qcom,ipq8064-db149)
ubootenv_add_uci_config $(ubootenv_mtdinfo)
diff --git a/package/boot/uboot-envtools/files/kirkwood b/package/boot/uboot-envtools/files/kirkwood
index 6a3dfcaba81..240371f48d8 100644
--- a/package/boot/uboot-envtools/files/kirkwood
+++ b/package/boot/uboot-envtools/files/kirkwood
@@ -19,6 +19,7 @@ globalscale,sheevaplug|\
iom,ix2-200|\
linksys,e4200-v2|\
linksys,ea4500|\
+netgear,readynas-duo-v2|\
raidsonic,ib-nas62x0|\
seagate,dockstar|\
zyxel,nsa310b|\
diff --git a/package/boot/uboot-envtools/files/layerscape b/package/boot/uboot-envtools/files/layerscape
index b11587d8765..acc5a073ad9 100644
--- a/package/boot/uboot-envtools/files/layerscape
+++ b/package/boot/uboot-envtools/files/layerscape
@@ -12,9 +12,8 @@ touch /etc/config/ubootenv
board=$(board_name)
case "$board" in
- traverse,ls1043v|\
- traverse,ls1043s)
- ubootenv_add_uci_config "/dev/mtd1" "0x40000" "0x2000" "0x20000"
+ traverse,ten64)
+ ubootenv_add_uci_config "/dev/mtd3" "0x0000" "0x80000" "0x80000"
;;
esac
diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic
new file mode 100644
index 00000000000..fcab697d904
--- /dev/null
+++ b/package/boot/uboot-envtools/files/mediatek_filogic
@@ -0,0 +1,127 @@
+#
+# Copyright (C) 2021 OpenWrt.org
+#
+
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+ubootenv_add_mmc_default() {
+ local envdev="$(find_mmc_part "ubootenv" "${1:-mmcblk0}")"
+ ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
+ ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
+}
+
+ubootenv_add_nor_default() {
+ local envdev="/dev/mtd$(find_mtd_index "u-boot-env")"
+ ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
+ ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1"
+}
+
+ubootenv_add_ubi_default() {
+ . /lib/upgrade/nand.sh
+ local envubi=$(nand_find_ubi ubi)
+ local envdev=/dev/$(nand_find_volume $envubi ubootenv)
+ local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
+ ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
+ ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
+}
+
+case "$board" in
+asus,rt-ax59u)
+ ubootenv_add_uci_config "/dev/mtd0" "0x100000" "0x20000" "0x20000"
+ ;;
+bananapi,bpi-r3|\
+bananapi,bpi-r3-mini|\
+bananapi,bpi-r4)
+ . /lib/upgrade/platform.sh
+
+ bootdev="$(platform_get_bootdev)"
+ case "$bootdev" in
+ ubi*)
+ ubootenv_add_ubi_default
+ ;;
+ mmc*)
+ ubootenv_add_mmc_default "${bootdev%%p[0-9]*}"
+ ;;
+ mtd*)
+ ubootenv_add_nor_default
+ ;;
+ esac
+ ;;
+cmcc,rax3000m)
+ case "$(cmdline_get_var root)" in
+ /dev/mmc*)
+ ubootenv_add_mmc_default
+ ;;
+ *)
+ ubootenv_add_ubi_default
+ ;;
+ esac
+ ;;
+comfast,cf-e393ax)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x80000"
+ ;;
+cetron,ct3003|\
+netgear,wax220|\
+zbtlink,zbt-z8102ax|\
+zbtlink,zbt-z8103ax)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
+ ;;
+h3c,magic-nx30-pro|\
+jcg,q30-pro|\
+qihoo,360t7|\
+tplink,tl-xdr4288|\
+tplink,tl-xdr6086|\
+tplink,tl-xdr6088|\
+xiaomi,mi-router-ax3000t-ubootmod|\
+xiaomi,mi-router-wr30u-ubootmod|\
+xiaomi,redmi-router-ax6000-ubootmod|\
+zyxel,ex5601-t0-ubootmod)
+ ubootenv_add_ubi_default
+ ;;
+glinet,gl-mt2500|\
+glinet,gl-mt6000)
+ local envdev=$(find_mmc_part "u-boot-env")
+ ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
+ ;;
+glinet,gl-mt3000)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
+ ;;
+jdcloud,re-cp-03)
+ local envdev=$(find_mmc_part "ubootenv" "mmcblk0")
+ ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
+ ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
+ ;;
+mercusys,mr90x-v1|\
+routerich,ax3000)
+ local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
+ ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
+ ;;
+ubnt,unifi-6-plus)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
+ ;;
+xiaomi,mi-router-ax3000t|\
+xiaomi,mi-router-wr30u-stock|\
+xiaomi,redmi-router-ax6000-stock)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
+ ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
+ ;;
+zyxel,ex5601-t0)
+ local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
+ ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
+ ;;
+zyxel,ex5700-telenor)
+ ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
+ ;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config
+
+exit 0
diff --git a/package/boot/uboot-envtools/files/mediatek_mt7622 b/package/boot/uboot-envtools/files/mediatek_mt7622
index 495a837274f..b4b1698d3fd 100644
--- a/package/boot/uboot-envtools/files/mediatek_mt7622
+++ b/package/boot/uboot-envtools/files/mediatek_mt7622
@@ -9,34 +9,56 @@ touch /etc/config/ubootenv
. /lib/uboot-envtools.sh
. /lib/functions.sh
+ubootenv_add_mmc_default() {
+ local envdev="$(find_mmc_part "ubootenv" "${1:-mmcblk0}")"
+ ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
+ ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
+}
+
+ubootenv_add_ubi_default() {
+ . /lib/upgrade/nand.sh
+ local envubi=$(nand_find_ubi ubi)
+ local envdev=/dev/$(nand_find_volume $envubi ubootenv)
+ local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
+ ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
+ ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
+}
+
board=$(board_name)
case "$board" in
+dlink,eagle-pro-ai-m32-a1|\
+dlink,eagle-pro-ai-r32-a1)
+ ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x2000" "0x2000"
+ ;;
linksys,e8450-ubi)
- ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1"
- ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
+ ubootenv_add_ubi_default
;;
bananapi,bpi-r64)
- . /lib/upgrade/common.sh
- export_bootdevice
- export_partdevice rootdev 0
- case "$rootdev" in
+ . /lib/upgrade/platform.sh
+ bootdev="$(platform_get_bootdev)"
+ case "$bootdev" in
mmc*)
- local envdev=/dev/$(get_partition_by_name $rootdev ubootenv)
- ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
- ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
+ ubootenv_add_mmc_default "${bootdev%p[0-9]*}"
;;
- *)
- ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1"
- ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
+ ubi*)
+ ubootenv_add_ubi_default
;;
esac
;;
buffalo,wsr-2533dhp2)
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x1000" "0x20000"
;;
-ubnt,unifi-6-lr-ubootmod)
- ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x10000"
+ruijie,rg-ew3200gx-pro)
+ ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x20000" "0x20000"
+ ;;
+ubnt,unifi-6-lr-v1-ubootmod|\
+ubnt,unifi-6-lr-v2-ubootmod|\
+ubnt,unifi-6-lr-v3-ubootmod)
+ ubootenv_add_uci_config "/dev/mtd$(find_mtd_index "u-boot-env")" "0x0" "0x4000" "0x1000"
+ ;;
+xiaomi,redmi-router-ax6s)
+ ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x40000"
;;
esac
diff --git a/package/boot/uboot-envtools/files/mediatek_mt7623 b/package/boot/uboot-envtools/files/mediatek_mt7623
index 863c8bc2110..fd2a01006a8 100644
--- a/package/boot/uboot-envtools/files/mediatek_mt7623
+++ b/package/boot/uboot-envtools/files/mediatek_mt7623
@@ -17,6 +17,10 @@ bananapi,bpi-r2)
export_bootdevice
export_partdevice ubootpart 1
ubootenv_add_uci_config "/dev/$ubootpart" "0xb0000" "0x10000" "0x10000" "1"
+ ;;
+unielec,u7623-02)
+ ubootenv_add_uci_config "/dev/mmcblk0p1" "0xc0000" "0x10000" "0x10000" "1"
+ ;;
esac
config_load ubootenv
diff --git a/package/boot/uboot-envtools/files/mediatek_mt7629 b/package/boot/uboot-envtools/files/mediatek_mt7629
new file mode 100644
index 00000000000..313fb6a4480
--- /dev/null
+++ b/package/boot/uboot-envtools/files/mediatek_mt7629
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2021 OpenWrt.org
+#
+
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+iptime,a6004mx|\
+netgear,ex6250-v2)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000"
+ ;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config ubootenv
+
+exit 0
diff --git a/package/boot/uboot-envtools/files/mpc85xx b/package/boot/uboot-envtools/files/mpc85xx
index 004ec241316..a74466ab3a6 100644
--- a/package/boot/uboot-envtools/files/mpc85xx
+++ b/package/boot/uboot-envtools/files/mpc85xx
@@ -8,10 +8,24 @@ touch /etc/config/ubootenv
board=$(board_name)
case "$board" in
+enterasys,ws-ap3715i)
+ ubootenv_add_uci_config "$(find_mtd_part 'cfg1')" "0x0" "0x10000" "0x10000"
+ ubootenv_add_uci_config "$(find_mtd_part 'cfg2')" "0x0" "0x10000" "0x10000"
+ ;;
+extreme-networks,ws-ap3825i)
+ ubootenv_add_uci_config "$(find_mtd_part 'cfg1')" "0x0" "0x10000" "0x20000"
+ ubootenv_add_uci_config "$(find_mtd_part 'cfg2')" "0x0" "0x10000" "0x20000"
+ ;;
ocedo,panda)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000"
;;
+watchguard,firebox-t10)
+ ubootenv_add_uci_config "$(find_mtd_part 'u-boot-env')" "0x0" "0x2000" "0x10000"
+ ;;
+aerohive,hiveap-330)
+ ubootenv_add_uci_config "$(find_mtd_part 'u-boot-env')" "0x0" "0x20000" "0x10000"
+ ;;
esac
config_load ubootenv
diff --git a/package/boot/uboot-envtools/files/mvebu b/package/boot/uboot-envtools/files/mvebu
index 25f29599a3a..c4ce76cf240 100644
--- a/package/boot/uboot-envtools/files/mvebu
+++ b/package/boot/uboot-envtools/files/mvebu
@@ -13,11 +13,15 @@ touch /etc/config/ubootenv
board=$(board_name)
case "$board" in
+buffalo,ls220de|\
buffalo,ls421de)
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000"
;;
cznic,turris-omnia)
- if grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then
+ idx="$(find_mtd_index u-boot-env)"
+ if [ -n "$idx" ]; then
+ ubootenv_add_uci_config "/dev/mtd${idx}" "0x0" "0x10000" "0x10000"
+ elif grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then
ubootenv_add_uci_config "/dev/mtd0" "0xc0000" "0x10000" "0x40000"
else
ubootenv_add_uci_config "/dev/mtd0" "0xf0000" "0x10000" "0x10000"
@@ -30,7 +34,8 @@ globalscale,espressobin|\
globalscale,espressobin-emmc|\
globalscale,espressobin-ultra|\
globalscale,espressobin-v7|\
-globalscale,espressobin-v7-emmc)
+globalscale,espressobin-v7-emmc|\
+globalscale,mochabin)
idx="$(find_mtd_index u-boot-env)"
if [ -n "$idx" ]; then
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
@@ -54,8 +59,18 @@ linksys,wrt3200acm|\
linksys,wrt32x)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
;;
-methode,udpu)
+methode,udpu|\
+methode,edpu)
+ idx="$(find_mtd_index u-boot-env)"
+ if [ -n "$idx" ]; then
+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
+ else
ubootenv_add_uci_config "/dev/mtd0" "0x180000" "0x10000" "0x10000"
+ fi
+ ;;
+synology,ds213j)
+ idx="$(find_mtd_index u-boot-env)"
+ [ -n "$idx" ] && ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000"
;;
esac
diff --git a/package/boot/uboot-envtools/files/octeon b/package/boot/uboot-envtools/files/octeon
new file mode 100644
index 00000000000..a6faed6eb3a
--- /dev/null
+++ b/package/boot/uboot-envtools/files/octeon
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2023 OpenWrt.org
+#
+
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+cisco,vedge1000)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000"
+ ;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config ubootenv
+
+exit 0
diff --git a/package/boot/uboot-envtools/files/oxnas b/package/boot/uboot-envtools/files/oxnas
index bf872b697df..bd407c67d53 100644
--- a/package/boot/uboot-envtools/files/oxnas
+++ b/package/boot/uboot-envtools/files/oxnas
@@ -14,7 +14,7 @@ board=$(board_name)
case "$board" in
"cloudengines,pogoplug"*|\
"shuttle,kd20")
- ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x2000" "0x2000" "1"
+ ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x2000" "0x20000" "1"
;;
"mitrastar,stg-212")
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000" "1"
diff --git a/package/boot/uboot-envtools/files/qoriq b/package/boot/uboot-envtools/files/qoriq
new file mode 100644
index 00000000000..d024a7f0086
--- /dev/null
+++ b/package/boot/uboot-envtools/files/qoriq
@@ -0,0 +1,19 @@
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+watchguard,firebox-m300)
+ ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x2000" "0x10000"
+ ;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config ubootenv
+
+exit 0
diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-envtools/files/qualcommax_ipq807x
new file mode 100644
index 00000000000..bcedfd9adc9
--- /dev/null
+++ b/package/boot/uboot-envtools/files/qualcommax_ipq807x
@@ -0,0 +1,63 @@
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+dynalink,dl-wrx36|\
+netgear,rax120v2|\
+netgear,wax218|\
+netgear,wax620|\
+netgear,wax630)
+ idx="$(find_mtd_index 0:appsblenv)"
+ [ -n "$idx" ] && \
+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
+ ;;
+compex,wpq873|\
+edgecore,eap102|\
+zyxel,nbg7815)
+ idx="$(find_mtd_index 0:appsblenv)"
+ [ -n "$idx" ] && \
+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
+ ;;
+edimax,cax1800)
+ idx="$(find_mtd_index 0:appsblenv)"
+ [ -n "$idx" ] && \
+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
+ ;;
+linksys,mx4200v1|\
+linksys,mx4200v2)
+ idx="$(find_mtd_index u_env)"
+ [ -n "$idx" ] && \
+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
+ ;;
+redmi,ax6|\
+xiaomi,ax3600|\
+xiaomi,ax9000)
+ idx="$(find_mtd_index 0:appsblenv)"
+ [ -n "$idx" ] && \
+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
+ idx2="$(find_mtd_index bdata)"
+ [ -n "$idx2" ] && \
+ ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x10000" "0x20000"
+ ;;
+prpl,haze)
+ mmcpart="$(find_mmc_part 0:APPSBLENV)"
+ [ -n "$mmcpart" ] && \
+ ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x400" "0x100"
+ ;;
+qnap,301w)
+ idx="$(find_mtd_index 0:appsblenv)"
+ [ -n "$idx" ] && \
+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x20000" "1"
+ ;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config
+
+exit 0
diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips
index 7941c106e42..30bf635b6df 100644
--- a/package/boot/uboot-envtools/files/ramips
+++ b/package/boot/uboot-envtools/files/ramips
@@ -17,59 +17,133 @@ alfa-network,awusfree1|\
alfa-network,quad-e4g|\
alfa-network,r36m-e4g|\
alfa-network,tube-e4g|\
-engenius,esr600h)
+engenius,epg600|\
+engenius,esr600h|\
+linksys,re7000|\
+meig,slt866|\
+sitecom,wlr-4100-v1-002|\
+zyxel,keenetic-lite-iii-a)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000"
;;
+alfa-network,ax1800rm|\
allnet,all0256n-4m|\
allnet,all0256n-8m|\
-allnet,all5002)
+allnet,all5002|\
+yuncore,ax820)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
;;
+arcadyan,we420223-99|\
+dlink,dir-806a-b1)
+ ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x1000" "0x1000"
+ ;;
ampedwireless,ally-00x19k|\
ampedwireless,ally-r1900k)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" "4"
;;
+beeline,smartbox-giga|\
+beeline,smartbox-turbo|\
+beeline,smartbox-turbo-plus|\
+etisalat,s3|\
+rostelecom,rt-fe-1a|\
+rostelecom,rt-sf-1)
+ ubootenv_add_uci_config "/dev/mtd0" "0x80000" "0x1000" "0x20000"
+ ;;
+beeline,smartbox-pro|\
+tplink,ec330-g5u-v1|\
+wifire,s1500-nbn)
+ idx="$(find_mtd_index u-boot-env)"
+ [ -n "$idx" ] && \
+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x20000"
+ ;;
buffalo,wsr-1166dhp|\
buffalo,wsr-600dhp|\
+kroks,kndrt31r16|\
+kroks,kndrt31r19|\
mediatek,linkit-smart-7688|\
samknows,whitebox-v8|\
-xiaomi,mi-router-3g-v2|\
-xiaomi,mi-router-4a-gigabit|\
xiaomi,mi-router-4c|\
xiaomi,miwifi-nano|\
zbtlink,zbt-wg2626|\
zte,mf283plus)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
;;
+asus,rt-ax53u|\
+asus,rt-ax54|\
+belkin,rt1800|\
+h3c,tx1800-plus|\
+h3c,tx1801-plus|\
+h3c,tx1806|\
+jcg,q20|\
+linksys,e7350|\
+netgear,eax12|\
+netgear,wax202|\
+zyxel,wsm20)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
+ ;;
+haier,har-20s2u1|\
+sim,simax1800t)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
+ ubootenv_add_uci_sys_config "/dev/mtd1" "0x40000" "0x40000" "0x20000"
+ ;;
hootoo,ht-tm05|\
ravpower,rp-wd03)
idx="$(find_mtd_index u-boot-env)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000" "0x1000"
;;
-jcg,q20)
- ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
- ;;
+beeline,smartbox-flash|\
+linksys,ea6350-v4|\
linksys,ea7300-v1|\
linksys,ea7300-v2|\
linksys,ea7500-v2|\
linksys,ea8100-v1|\
linksys,ea8100-v2|\
+mts,wg430223)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000"
+ ;;
+snr,snr-cpe-me1|\
+snr,snr-cpe-me2-sfp|\
+snr,cpe-w4n-mt)
+ idx="$(find_mtd_index uboot-env)"
+ [ -n "$idx" ] && \
+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x1000"
+ ;;
+xiaomi,miwifi-mini)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
+ ubootenv_add_uci_sys_config "/dev/mtd9" "0x0" "0x4000" "0x10000"
+ ;;
+xiaomi,mi-router-3g-v2|\
+xiaomi,mi-router-4a-gigabit|\
+xiaomi,miwifi-3c)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
+ ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x4000" "0x10000"
+ ;;
xiaomi,mi-router-3g|\
xiaomi,mi-router-3-pro|\
xiaomi,mi-router-4|\
xiaomi,mi-router-ac2100|\
xiaomi,redmi-router-ac2100)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000"
+ ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x4000" "0x20000"
+ ;;
+zyxel,lte3301-plus)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x80000"
;;
+zyxel,lte5398-m904|\
zyxel,nr7101)
idx="$(find_mtd_index Config)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x80000"
;;
+bolt,arion|\
+xiaomi,mi-router-cr6606|\
+xiaomi,mi-router-cr6608|\
+xiaomi,mi-router-cr6609)
+ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
+ ;;
esac
config_load ubootenv
-config_foreach ubootenv_add_app_config ubootenv
+config_foreach ubootenv_add_app_config
exit 0
diff --git a/package/boot/uboot-envtools/files/realtek b/package/boot/uboot-envtools/files/realtek
index 75a399208e6..cd2446432d7 100644
--- a/package/boot/uboot-envtools/files/realtek
+++ b/package/boot/uboot-envtools/files/realtek
@@ -8,13 +8,28 @@ touch /etc/config/ubootenv
board=$(board_name)
case "$board" in
+apresia,aplgs120gtss)
+ idx="$(find_mtd_index u-boot-env)"
+ [ -n "$idx" ] && \
+ 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-10p|\
d-link,dgs-1210-16|\
+d-link,dgs-1210-20|\
d-link,dgs-1210-28|\
-d-link,dgs-1210-10p|\
zyxel,gs1900-8|\
zyxel,gs1900-8hp-v1|\
zyxel,gs1900-8hp-v2|\
-zyxel,gs1900-10hp)
+zyxel,gs1900-10hp|\
+zyxel,gs1900-16|\
+zyxel,gs1900-24-v1|\
+zyxel,gs1900-24e|\
+zyxel,gs1900-24hp-v1|\
+zyxel,gs1900-24hp-v2)
idx="$(find_mtd_index u-boot-env)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x400" "0x10000"
@@ -22,6 +37,21 @@ zyxel,gs1900-10hp)
[ -n "$idx2" ] && \
ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x1000" "0x10000"
;;
+tplink,sg2008p-v1|\
+tplink,sg2210p-v3|\
+tplink,sg2452p-v4)
+ idx="$(find_mtd_index u-boot-env)"
+ [ -n "$idx" ] && \
+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x10000"
+ ;;
+iodata,bsh-g24mb)
+ idx="$(find_mtd_index u-boot-env)"
+ [ -n "$idx" ] && \
+ 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)"
[ -n "$idx" ] && \
diff --git a/package/boot/uboot-envtools/patches/002-Revert-tools-env-use-run-to-store-lockfile.patch b/package/boot/uboot-envtools/patches/002-Revert-tools-env-use-run-to-store-lockfile.patch
new file mode 100644
index 00000000000..e843e4252bb
--- /dev/null
+++ b/package/boot/uboot-envtools/patches/002-Revert-tools-env-use-run-to-store-lockfile.patch
@@ -0,0 +1,41 @@
+Revert "tools: env: use /run to store lockfile"
+
+In OpenWRT we still use /var/lock as default location for lock files and
+/run might not even exist. Revert the upstream change and restore the
+previous default path.
+
+This reverts upstream commit
+ https://source.denx.de/u-boot/u-boot/-/commit/aeb40f1166e072856f865d26d42a4bea1ec3a514
+---
+ tools/env/fw_env_main.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/tools/env/fw_env_main.c
++++ b/tools/env/fw_env_main.c
+@@ -73,7 +73,7 @@ void usage_printenv(void)
+ " -c, --config configuration file, default:" CONFIG_FILE "\n"
+ #endif
+ " -n, --noheader do not repeat variable name in output\n"
+- " -l, --lock lock node, default:/run\n"
++ " -l, --lock lock node, default:/var/lock\n"
+ "\n");
+ }
+
+@@ -88,7 +88,7 @@ void usage_env_set(void)
+ #ifdef CONFIG_FILE
+ " -c, --config configuration file, default:" CONFIG_FILE "\n"
+ #endif
+- " -l, --lock lock node, default:/run\n"
++ " -l, --lock lock node, default:/var/lock\n"
+ " -s, --script batch mode to minimize writes\n"
+ "\n"
+ "Examples:\n"
+@@ -206,7 +206,7 @@ int parse_setenv_args(int argc, char *ar
+
+ int main(int argc, char *argv[])
+ {
+- char *lockname = "/run/" CMD_PRINTENV ".lock";
++ char *lockname = "/var/lock/" CMD_PRINTENV ".lock";
+ int lockfd = -1;
+ int retval = EXIT_SUCCESS;
+ char *_cmdname;
diff --git a/package/boot/uboot-envtools/patches/010-fw_env-fix-reading-NVMEM-device-s-compatible-value.patch b/package/boot/uboot-envtools/patches/010-fw_env-fix-reading-NVMEM-device-s-compatible-value.patch
new file mode 100644
index 00000000000..5af8a1aa0e6
--- /dev/null
+++ b/package/boot/uboot-envtools/patches/010-fw_env-fix-reading-NVMEM-device-s-compatible-value.patch
@@ -0,0 +1,70 @@
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Tue, 12 Dec 2023 18:23:45 +0100
+Subject: [PATCH] fw_env: fix reading NVMEM device's "compatible" value
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Call to fread() was changed to check for return value. The problem is it
+can't be checked for returning 1 (as it is) to determine success.
+
+We call fread() with buffer size as "size" argument. Reading any
+"compatible" value shorter than buffer size will result in returning 0
+even on success.
+
+Modify code to use fstat() to determine expected read length.
+
+This fixes regression that broke using fw_env with NVMEM devices.
+
+Fixes: c059a22b7776 ("tools: env: fw_env: Fix unused-result warning")
+Cc: Jaehoon Chung <jh80.chung@samsung.com>
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+ tools/env/fw_env.c | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+--- a/tools/env/fw_env.c
++++ b/tools/env/fw_env.c
+@@ -1732,6 +1732,7 @@ static int find_nvmem_device(void)
+ }
+
+ while (!nvmem && (dent = readdir(dir))) {
++ struct stat s;
+ FILE *fp;
+ size_t size;
+
+@@ -1749,14 +1750,22 @@ static int find_nvmem_device(void)
+ continue;
+ }
+
+- size = fread(buf, sizeof(buf), 1, fp);
++ if (fstat(fileno(fp), &s)) {
++ fprintf(stderr, "Failed to fstat %s\n", comp);
++ goto next;
++ }
++
++ if (s.st_size >= sizeof(buf)) {
++ goto next;
++ }
++
++ size = fread(buf, s.st_size, 1, fp);
+ if (size != 1) {
+ fprintf(stderr,
+ "read failed about %s\n", comp);
+- fclose(fp);
+- return -EIO;
++ goto next;
+ }
+-
++ buf[s.st_size] = '\0';
+
+ if (!strcmp(buf, "u-boot,env")) {
+ bytes = asprintf(&nvmem, "%s/%s/nvmem", path, dent->d_name);
+@@ -1765,6 +1774,7 @@ static int find_nvmem_device(void)
+ }
+ }
+
++next:
+ fclose(fp);
+ }
+
diff --git a/package/boot/uboot-envtools/patches/011-fw_env-keep-calling-read-until-whole-flash-block-is-.patch b/package/boot/uboot-envtools/patches/011-fw_env-keep-calling-read-until-whole-flash-block-is-.patch
new file mode 100644
index 00000000000..af1c32fe91c
--- /dev/null
+++ b/package/boot/uboot-envtools/patches/011-fw_env-keep-calling-read-until-whole-flash-block-is-.patch
@@ -0,0 +1,75 @@
+From 9e3003f79d168eac7ee65cd457e3904e2fb4eea8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Wed, 13 Dec 2023 13:13:54 +0100
+Subject: [PATCH] fw_env: keep calling read() until whole flash block is read
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It's totally valid for read() to provide less bytes than requested
+maximum. It may happen if there is no more data available yet or source
+pushes data in small chunks.
+
+This actually happens when trying to read env data from NVMEM device.
+Kernel may provide NVMEM content in page size parts (like 4096 B).
+
+This fixes warnings like:
+Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 16384 bytes but got 4096
+Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 12288 bytes but got 4096
+Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 8192 bytes but got 4096
+
+Since the main loop in flash_read_buf() is used to read blocks this
+patch adds a new nested one.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+ tools/env/fw_env.c | 34 +++++++++++++++-------------------
+ 1 file changed, 15 insertions(+), 19 deletions(-)
+
+--- a/tools/env/fw_env.c
++++ b/tools/env/fw_env.c
+@@ -948,29 +948,25 @@ static int flash_read_buf(int dev, int f
+ */
+ lseek(fd, blockstart + block_seek, SEEK_SET);
+
+- rc = read(fd, buf + processed, readlen);
+- if (rc == -1) {
+- fprintf(stderr, "Read error on %s: %s\n",
+- DEVNAME(dev), strerror(errno));
+- return -1;
+- }
++ while (readlen) {
++ rc = read(fd, buf + processed, readlen);
++ if (rc == -1) {
++ fprintf(stderr, "Read error on %s: %s\n",
++ DEVNAME(dev), strerror(errno));
++ return -1;
++ }
+ #ifdef DEBUG
+- fprintf(stderr, "Read 0x%x bytes at 0x%llx on %s\n",
+- rc, (unsigned long long)blockstart + block_seek,
+- DEVNAME(dev));
++ fprintf(stderr, "Read 0x%x bytes at 0x%llx on %s\n",
++ rc, (unsigned long long)blockstart + block_seek,
++ DEVNAME(dev));
+ #endif
+- processed += rc;
+- if (rc != readlen) {
+- fprintf(stderr,
+- "Warning on %s: Attempted to read %zd bytes but got %d\n",
+- DEVNAME(dev), readlen, rc);
++ processed += rc;
+ readlen -= rc;
+- block_seek += rc;
+- } else {
+- blockstart += blocklen;
+- readlen = min(blocklen, count - processed);
+- block_seek = 0;
+ }
++
++ blockstart += blocklen;
++ readlen = min(blocklen, count - processed);
++ block_seek = 0;
+ }
+
+ return processed;
diff --git a/package/boot/uboot-envtools/patches/012-fw_env-autodetect-NAND-erase-size-and-env-sectors.patch b/package/boot/uboot-envtools/patches/012-fw_env-autodetect-NAND-erase-size-and-env-sectors.patch
new file mode 100644
index 00000000000..78f555fb1f3
--- /dev/null
+++ b/package/boot/uboot-envtools/patches/012-fw_env-autodetect-NAND-erase-size-and-env-sectors.patch
@@ -0,0 +1,49 @@
+From d73a6641868029b5cae53ed00c5766921c9d8b1f Mon Sep 17 00:00:00 2001
+From: Anthony Loiseau <anthony.loiseau@allcircuits.com>
+Date: Thu, 21 Dec 2023 23:44:38 +0100
+Subject: [PATCH] fw_env: autodetect NAND erase size and env sectors
+
+As already done for NOR chips, if device ESIZE and ENVSECTORS static
+configurations are both zero, then autodetect them at runtime.
+
+Cc: Joe Hershberger <joe.hershberger@ni.com>
+cc: Stefan Agner <stefan@agner.ch>
+cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
+Signed-off-by: Anthony Loiseau <anthony.loiseau@allcircuits.com>
+---
+ tools/env/README | 3 +++
+ tools/env/fw_env.c | 11 +++++++++--
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+--- a/tools/env/README
++++ b/tools/env/README
+@@ -58,6 +58,9 @@ DEVICEx_ENVSECTORS defines the number of
+ this environment instance. On NAND this is used to limit the range
+ within which bad blocks are skipped, on NOR it is not used.
+
++If DEVICEx_ESIZE and DEVICEx_ENVSECTORS are both zero, then a runtime
++detection is attempted for NOR and NAND mtd types.
++
+ To prevent losing changes to the environment and to prevent confusing the MTD
+ drivers, a lock file at /run/fw_printenv.lock is used to serialize access
+ to the environment.
+--- a/tools/env/fw_env.c
++++ b/tools/env/fw_env.c
+@@ -1655,8 +1655,15 @@ static int check_device_config(int dev)
+ }
+ DEVTYPE(dev) = mtdinfo.type;
+ if (DEVESIZE(dev) == 0 && ENVSECTORS(dev) == 0 &&
+- mtdinfo.type == MTD_NORFLASH)
+- DEVESIZE(dev) = mtdinfo.erasesize;
++ mtdinfo.erasesize > 0) {
++ if (mtdinfo.type == MTD_NORFLASH)
++ DEVESIZE(dev) = mtdinfo.erasesize;
++ else if (mtdinfo.type == MTD_NANDFLASH) {
++ DEVESIZE(dev) = mtdinfo.erasesize;
++ ENVSECTORS(dev) =
++ mtdinfo.size / mtdinfo.erasesize;
++ }
++ }
+ if (DEVESIZE(dev) == 0)
+ /* Assume the erase size is the same as the env-size */
+ DEVESIZE(dev) = ENVSIZE(dev);