diff --git a/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic index 990cb155df9..b626c096a4b 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic @@ -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) diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index be493aa250c..c894b9e3673 100644 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -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'