[TOOL] Finding address of stock envs of fw_printenv January 23, 2017 04:01AM |
Registered: 9 years ago Posts: 298 |
#!/bin/sh # MTD device name Device offset Env. size Flash sector size Number of sectors #/dev/mtd0 0xc0000 0x20000 0x20000 #backing up current config mv /etc/fw_env.config /etc/fw_env.config.backup #list of block addresses #128k = 131072 bytes -> 0x20000 in hexadecimal and we sum 0x20000 to it to get our addresses. # address=180000 # # while [ "$address" != "0" ] ; do # # address=$( echo "obase=16;ibase=16;$address-20000" | bc ) # echo $address # # done # addresses for mtd0 # E0000 # C0000 # A0000 # 80000 # 60000 # 40000 # 20000 # 0 # addresses for mtd1 # same as above, it restarts from 0 in each mtd #zyxel nsa310 new mtdparts, kinda #mtdparts=orion_nand:0x100000(uboot),0x80000(uboot_env),0x100000(second_stage_uboot),0x7b80000(ubi) for address in e0000 c0000 a0000 80000 60000 40000 20000 0; do echo "/dev/mtd0 0x$address 0x20000 0x20000" > /etc/fw_env.config cat /etc/fw_env.config echo "stuff found at mtd0 $address" fw_printenv echo ----------------------------- done for address in e0000 c0000 a0000 80000 60000 40000 20000 0; do echo "/dev/mtd1 0x$address 0x20000 0x20000" > /etc/fw_env.config echo "stuff found at mtd1 $address" fw_printenv echo ----------------------------- done #restoring current config mv /etc/fw_env.config.backup /etc/fw_env.config
Re: [TOOL] Finding address of stock envs of fw_printenv January 23, 2017 07:10AM |
Registered: 11 years ago Posts: 1,303 |
Re: [TOOL] Finding address of stock envs of fw_printenv January 23, 2017 01:31PM |
Admin Registered: 14 years ago Posts: 19,295 |