<p dir="ltr">hi, swigger</p>
<p dir="ltr">On Sep 22, 2014 10:04 PM, "swigger" <<a href="mailto:swigger@gmail.com">swigger@gmail.com</a>> wrote:<br>
><br>
> It does NOT run on my router.<br>
><br>
> root@OpenWrt:~# cat /etc/config/ubootenv<br>
> config ubootenv<br>
> option dev '/dev/mtd9'<br>
> option offset '0x0'<br>
> option envsize '0x10000'<br>
> option secsize '0x10000'<br>
> root@OpenWrt:~# fw_printenv<br>
> Cannot parse config file: No such file or directory<br>
><br>
> What's wrong?</p>
<p dir="ltr">i am not sure. if /e/c/ubootenv was generated, so should be /etc/fw_env.config. was this ubootenv created by you manually or generated by script in uci-defaults during first boot after the fresh installation?</p>
<p dir="ltr">anyway, it should work if /etc/fw_env.config was created correctly.</p>
<p dir="ltr">regards</p>
<p dir="ltr"> yousong<br>
><br>
><br>
> -----邮件原件-----<br>
> 发件人: Yousong Zhou [mailto:<a href="mailto:yszhou4tech@gmail.com">yszhou4tech@gmail.com</a>]<br>
> 发送时间: 2014年9月14日 8:28<br>
> 收件人: <a href="mailto:blogic@openwrt.org">blogic@openwrt.org</a><br>
> 抄送: <a href="mailto:swigger@gmail.com">swigger@gmail.com</a>; <a href="mailto:hackpascal@gmail.com">hackpascal@gmail.com</a>; <a href="mailto:gch981213@gmail.com">gch981213@gmail.com</a>;<br>
> <a href="mailto:openwrt-devel@lists.openwrt.org">openwrt-devel@lists.openwrt.org</a>; Yousong Zhou<br>
> 主题: [PATCH] ar71xx: qihoo-c301: reset imageNtrynum after each successful<br>
> boot.<br>
><br>
> Qihoo C301 has 2 flash chips of which one is used as primary and the other<br>
> is used as backup. OEM U-Boot will try to boot an activeregion N with<br>
> imageNstatus=0 and imageNtrynum <= imagemaxtry. If such a region is found,<br>
> bootloader will try to increment imageNtrynum and boot it.<br>
><br>
> This patch tries to reset imageNtrynum after each successful boot (if the<br>
> boot process reaches the execution of /etc/init.d/done).<br>
><br>
> root@OpenWrt:/# hexdump -C -n 128 /dev/mtdblock9<br>
> 00000000 9e f3 63 91 61 63 74 69 76 65 72 65 67 69 6f 6e<br>
> |..c.activeregion|<br>
> 00000010 3d 31 00 69 6d 61 67 65 31 73 74 61 74 75 73 3d<br>
> |=1.image1status=|<br>
> 00000020 30 00 69 6d 61 67 65 32 73 74 61 74 75 73 3d 30<br>
> |0.image2status=0|<br>
> 00000030 00 69 6d 61 67 65 32 74 72 79 6e 75 6d 3d 30 00<br>
> |.image2trynum=0.|<br>
> 00000040 69 6d 61 67 65 6d 61 78 74 72 79 3d 33 00 69 6d<br>
> |imagemaxtry=<a href="http://3.im">3.im</a>|<br>
> 00000050 61 67 65 31 74 72 79 6e 75 6d 3d 30 00 00 00 00<br>
> |age1trynum=0....|<br>
> 00000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00<br>
> |................|<br>
><br>
> Signed-off-by: Yousong Zhou <<a href="mailto:yszhou4tech@gmail.com">yszhou4tech@gmail.com</a>><br>
> ---<br>
> package/boot/uboot-envtools/files/ar71xx | 3 +++<br>
> target/linux/ar71xx/base-files/etc/diag.sh | 6 ++++++<br>
> 2 files changed, 9 insertions(+)<br>
><br>
> diff --git a/package/boot/uboot-envtools/files/ar71xx<br>
> b/package/boot/uboot-envtools/files/ar71xx<br>
> index 5deed9c..f660883 100644<br>
> --- a/package/boot/uboot-envtools/files/ar71xx<br>
> +++ b/package/boot/uboot-envtools/files/ar71xx<br>
> @@ -41,6 +41,9 @@ om2p-lc)<br>
> wzr-hp-ag300h)<br>
> ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000"<br>
> ;;<br>
> +qihoo-c301)<br>
> + ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000"<br>
> + ;;<br>
> esac<br>
><br>
> config_load ubootenv<br>
> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh<br>
> b/target/linux/ar71xx/base-files/etc/diag.sh<br>
> index ac7e20d..c7c6233 100755<br>
> --- a/target/linux/ar71xx/base-files/etc/diag.sh<br>
> +++ b/target/linux/ar71xx/base-files/etc/diag.sh<br>
> @@ -294,6 +294,12 @@ set_state() {<br>
> ;;<br>
> done)<br>
> status_led_on<br>
> + case $(ar71xx_board_name) in<br>
> + qihoo-c301)<br>
> + local n=$(fw_printenv activeregion | cut -d = -f 2)<br>
> + fw_setenv "image${n}trynum" 0<br>
> + ;;<br>
> + esac<br>
> ;;<br>
> esac<br>
> }<br>
> --<br>
> 1.7.10.4<br>
><br>
><br>
</p>