mediatek: fix U-Boot env geometry for JioRouter AX6000 JIDU6101

Correct the U-Boot env geometry from "0x80000" "1" to "0x1f000" "5".
The correct LEB size for 128k PEB / 2k page is 0x1f000, and the 0x80000 volume spans 5 LEBs.

This also hardens jiorouter_initial_setup by adding proper error handling
and dynamic UBI device/volume lookups, and generates /etc/fw_env.config to be consistent.

Signed-off-by: Sheikh Faisal <sheikhfaisal713@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23510
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
This commit is contained in:
Sheikh Faisal authored and Jonas Jelonek committed 2026-09-09 13:40:34 +02:00
1 parent d3290efad9
commit dcb5ede455
2 files changed
+20 -4

No files matched your search

@@ -150,7 +150,12 @@ gatonetworks,gdsp)
glinet,gl-mt3000)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
;;
jiorouter,ax6000-jidu6101|\
jiorouter,ax6000-jidu6101)
. /lib/upgrade/nand.sh
envubi=$(nand_find_ubi ubi)
envdev=/dev/$(nand_find_volume "$envubi" u-boot-env)
ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x1f000" "5"
;;
ltc,vl7m19k)
. /lib/upgrade/nand.sh
envubi=$(nand_find_ubi ubi)
@@ -35,9 +35,20 @@ jiorouter_initial_setup()
fi
ubidetach -m "$mtdnum" 2>/dev/null
ubiformat /dev/mtd$mtdnum -y
ubiattach -m "$mtdnum"
ubimkvol /dev/ubi0 -n 0 -N u-boot-env -s 0x80000
ubiformat /dev/mtd$mtdnum -y || exit 1
ubiattach -m "$mtdnum" || exit 1
local ubidev="$(nand_find_ubi ubi)"
[ -n "$ubidev" ] || { echo "cannot attach ubi"; exit 1; }
if ! ubimkvol /dev/$ubidev -n 0 -N u-boot-env -s 0x80000; then
echo "failed to create u-boot-env volume - aborting"
exit 1
fi
local envdev="$(nand_find_volume "$ubidev" u-boot-env)"
[ -n "$envdev" ] || { echo "cannot find u-boot-env volume - aborting"; exit 1; }
echo "/dev/$envdev 0x0 0x80000 0x1f000 5" > /etc/fw_env.config
# Set boot arguments in freshly created U-Boot environment
fw_setenv bootcmd 'ubi read 46000000 kernel;fdt addr $(fdtcontroladdr);fdt rm /signature;bootm 0x46000000'