[PATCH] uboot-mediatek: Linksys E8450: don't save filesize in the environment
Enrico Mioso
mrkiko.rs at gmail.com
Fri Nov 27 16:18:23 PST 2026
On first boot, ethaddr_factory reads the whole factory volume with
"ubi read", which sets filesize to the volume size (0x80000). Then
_init_env runs saveenv, so filesize=80000 ends up in the saved
environment, although it only describes that one read.
Clear filesize before saving. Nothing reads the stored value:
ubi_write_production and ubi_write_recovery always use filesize right
after a tftpboot, which sets it again.
Existing installations keep their saved environment until it is reset.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
---
package/boot/uboot-mediatek/Makefile | 2 +-
package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile
index 08dfd6d16e..22aa583a1f 100644
--- a/package/boot/uboot-mediatek/Makefile
+++ b/package/boot/uboot-mediatek/Makefile
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_VERSION:=2026.07
-PKG_RELEASE:=4
+PKG_RELEASE:=5
PKG_HASH:=78e8bfc382fe388f9b55aa1daf8c563522a037779b5d4c349d1415e381f1243e
PKG_BUILD_DEPENDS:=!(TARGET_ramips||TARGET_mediatek_mt7623):arm-trusted-firmware-tools/host
PKG_PARALLEL_VARIANTS:=1
diff --git a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch
index b9d78ac672..425a5c908a 100644
--- a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch
+++ b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch
@@ -397,7 +397,7 @@
+ubi_write_production=ubi check fit && env exists replacevol && ubi remove fit ; if ubi check fit ; then else run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ; fi
+ubi_write_recovery=ubi check recovery && env exists replacevol && ubi remove recovery ; if ubi check recovery ; then else run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ; fi
+_create_env=ubi create ubootenv 0x1f000 dynamic ; ubi create ubootenv2 0x1f000 dynamic
-+_init_env=setenv _init_env ; if ubi check ubootenv && ubi check ubootenv2 ; then else run _create_env ; fi ; setenv _create_env ; saveenv || run ubi_format ; saveenv || run ubi_format
++_init_env=setenv _init_env ; if ubi check ubootenv && ubi check ubootenv2 ; then else run _create_env ; fi ; setenv _create_env ; setenv filesize ; saveenv || run ubi_format ; saveenv || run ubi_format
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run ethaddr_factory ; run _init_env ; run boot_first
+_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title [33m$ver[0m"
--
2.56.1
More information about the openwrt-devel
mailing list