[OpenWrt-Devel] 答复: [PATCH] ar71xx: qihoo-c301: reset imageNtrynum after each successful boot.

Yousong Zhou yszhou4tech at gmail.com
Mon Sep 22 10:35:30 EDT 2014


hi, swigger

On Sep 22, 2014 10:04 PM, "swigger" <swigger at gmail.com> wrote:
>
> It does NOT run on my router.
>
> root at OpenWrt:~# cat /etc/config/ubootenv
> config ubootenv
>  option dev '/dev/mtd9'
>  option offset '0x0'
>  option envsize '0x10000'
>  option secsize '0x10000'
> root at OpenWrt:~# fw_printenv
> Cannot parse config file: No such file or directory
>
> What's wrong?

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?

anyway, it should work if /etc/fw_env.config was created correctly.

regards

                yousong
>
>
> -----邮件原件-----
> 发件人: Yousong Zhou [mailto:yszhou4tech at gmail.com]
> 发送时间: 2014年9月14日 8:28
> 收件人: blogic at openwrt.org
> 抄送: swigger at gmail.com; hackpascal at gmail.com; gch981213 at gmail.com;
> openwrt-devel at lists.openwrt.org; Yousong Zhou
> 主题: [PATCH] ar71xx: qihoo-c301: reset imageNtrynum after each successful
> boot.
>
> Qihoo C301 has 2 flash chips of which one is used as primary and the other
> is used as backup.  OEM U-Boot will try to boot an activeregion N with
> imageNstatus=0 and imageNtrynum <= imagemaxtry.  If such a region is
found,
> bootloader will try to increment imageNtrynum and boot it.
>
> This patch tries to reset imageNtrynum after each successful boot (if the
> boot process reaches the execution of /etc/init.d/done).
>
>         root at OpenWrt:/# hexdump -C -n 128 /dev/mtdblock9
>         00000000  9e f3 63 91 61 63 74 69  76 65 72 65 67 69 6f 6e
> |..c.activeregion|
>         00000010  3d 31 00 69 6d 61 67 65  31 73 74 61 74 75 73 3d
> |=1.image1status=|
>         00000020  30 00 69 6d 61 67 65 32  73 74 61 74 75 73 3d 30
> |0.image2status=0|
>         00000030  00 69 6d 61 67 65 32 74  72 79 6e 75 6d 3d 30 00
> |.image2trynum=0.|
>         00000040  69 6d 61 67 65 6d 61 78  74 72 79 3d 33 00 69 6d
> |imagemaxtry=3.im|
>         00000050  61 67 65 31 74 72 79 6e  75 6d 3d 30 00 00 00 00
> |age1trynum=0....|
>         00000060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
> |................|
>
> Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
> ---
>  package/boot/uboot-envtools/files/ar71xx   |    3 +++
>  target/linux/ar71xx/base-files/etc/diag.sh |    6 ++++++
>  2 files changed, 9 insertions(+)
>
> diff --git a/package/boot/uboot-envtools/files/ar71xx
> b/package/boot/uboot-envtools/files/ar71xx
> index 5deed9c..f660883 100644
> --- a/package/boot/uboot-envtools/files/ar71xx
> +++ b/package/boot/uboot-envtools/files/ar71xx
> @@ -41,6 +41,9 @@ om2p-lc)
>  wzr-hp-ag300h)
>         ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000"
>         ;;
> +qihoo-c301)
> +       ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000"
> +       ;;
>  esac
>
>  config_load ubootenv
> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh
> b/target/linux/ar71xx/base-files/etc/diag.sh
> index ac7e20d..c7c6233 100755
> --- a/target/linux/ar71xx/base-files/etc/diag.sh
> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
> @@ -294,6 +294,12 @@ set_state() {
>                 ;;
>         done)
>                 status_led_on
> +               case $(ar71xx_board_name) in
> +               qihoo-c301)
> +                       local n=$(fw_printenv activeregion | cut -d = -f
2)
> +                       fw_setenv "image${n}trynum" 0
> +                       ;;
> +               esac
>                 ;;
>         esac
>  }
> --
> 1.7.10.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20140922/dcc1df14/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list