Skip to content

Instantly share code, notes, and snippets.

@parthibx24
Created December 6, 2024 10:18
Show Gist options
  • Save parthibx24/f78335ee134ebc73c004a6f61c8e899c to your computer and use it in GitHub Desktop.
Save parthibx24/f78335ee134ebc73c004a6f61c8e899c to your computer and use it in GitHub Desktop.
# os_offset=`echo $(($(nvram get flag_boot_rootfs)-1)) | tr -d '-'`
r0_mtd=$(grep '"rootfs"' /proc/mtd | awk -F: '{print substr($1,4)}')
r1_mtd=$(grep '"rootfs_1"' /proc/mtd | awk -F: '{print substr($1,4)}')
os_idx=$(nvram get flag_boot_rootfs)
mtd_cur=$(($r0_mtd+${os_idx:-0}))
mtd_nxt=$(($r0_mtd+$r1_mtd-$mtd_cur))
MTD_DEV=/dev/mtd$mtd_nxt
ubiformat $MTD_DEV -f $IMAGE -s 2048 -O 2048
nvram set flag_ota_reboot=1
nvram set uart_en=1
nvram set telnet_en=1
nvram set ssh_en=1
nvram commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment