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

2014-10-11 Thread Yousong Zhou
On 9 October 2014 16:32, John Crispin blo...@openwrt.org wrote:
 Hi Yousong

 thanks for clarifying. i would prefer to use the uboot-envtools
 version that you sent a patch for unless there are any technical
 reasons to use the kernel based patch.

I take `/etc/init.d/done` as a better indication of a successful boot.
This uboot-envtools based patch should be fine as it has also been
confirmed by swigger in a previous mail.

By the way, patch [1] for fixing seama factory image generation can
also be applied if you are okay with it.  Thanks.

[1] http://patchwork.openwrt.org/patch/6325/

   yousong
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2014-10-09 Thread John Crispin


On 09/10/2014 04:30, Yousong Zhou wrote:
 On 7 October 2014 02:33, John Crispin blo...@openwrt.org wrote:
 
 On 14/09/2014 02:27, Yousong Zhou wrote:
 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@OpenWrt:/# hexdump -C -n 128 /dev/mtdblock9   9e
 f3 63 91 61 63 74 69  76 65 72 65 67 69 6f 6e
 |..c.activeregion| 0010  3d 31 00 69 6d 61 67 65  31 73 74
 61 74 75 73 3d  |=1.image1status=| 0020  30 00 69 6d 61 67
 65 32  73 74 61 74 75 73 3d 30  |0.image2status=0| 0030  00
 69 6d 61 67 65 32 74  72 79 6e 75 6d 3d 30 00
 |.image2trynum=0.| 0040  69 6d 61 67 65 6d 61 78  74 72 79
 3d 33 00 69 6d  |imagemaxtry=3.im| 0050  61 67 65 31 74 72
 79 6e  75 6d 3d 30 00 00 00 00  |age1trynum=0| 0060  00
 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
 ||
 
 Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
 
 do we need this patch and the one made by swigger ? it seems his
 patch write the crc32 somewhere and your patch resets the
 uboot-env.
 
 
 Two patches are supposed to serve the same purpose, i.e. reseting 
 imageNtrynum to zero.  Both of them needs to erase and rewrite 
 uboot-env partition on every reboot.  It is a design decision by 
 Qihoo.  fw_{get,set}env are the tools for this job.  We always
 have uboot-envtools installed for all ar71xx boards, and now
 finally it finds its use in Qihoo-C301 board...
 
 regards.
 
 yousong 

Hi Yousong

thanks for clarifying. i would prefer to use the uboot-envtools
version that you sent a patch for unless there are any technical
reasons to use the kernel based patch.

John


___
 openwrt-devel mailing list openwrt-devel@lists.openwrt.org 
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2014-10-08 Thread Yousong Zhou
On 7 October 2014 02:33, John Crispin blo...@openwrt.org wrote:

 On 14/09/2014 02:27, Yousong Zhou wrote:
 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@OpenWrt:/# hexdump -C -n 128 /dev/mtdblock9
     9e f3 63 91 61 63 74 69  76 65 72 65 67 69 6f 6e  
 |..c.activeregion|
   0010  3d 31 00 69 6d 61 67 65  31 73 74 61 74 75 73 3d  
 |=1.image1status=|
   0020  30 00 69 6d 61 67 65 32  73 74 61 74 75 73 3d 30  
 |0.image2status=0|
   0030  00 69 6d 61 67 65 32 74  72 79 6e 75 6d 3d 30 00  
 |.image2trynum=0.|
   0040  69 6d 61 67 65 6d 61 78  74 72 79 3d 33 00 69 6d  
 |imagemaxtry=3.im|
   0050  61 67 65 31 74 72 79 6e  75 6d 3d 30 00 00 00 00  
 |age1trynum=0|
   0060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  
 ||

 Signed-off-by: Yousong Zhou yszhou4t...@gmail.com

 do we need this patch and the one made by swigger ? it seems his patch
 write the crc32 somewhere and your patch resets the uboot-env.


Two patches are supposed to serve the same purpose, i.e. reseting
imageNtrynum to zero.  Both of them needs to erase and rewrite
uboot-env partition on every reboot.  It is a design decision by
Qihoo.  fw_{get,set}env are the tools for this job.  We always have
uboot-envtools installed for all ar71xx boards, and now finally it
finds its use in Qihoo-C301 board...

regards.

   yousong
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2014-10-06 Thread John Crispin

On 14/09/2014 02:27, Yousong Zhou wrote:
 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@OpenWrt:/# hexdump -C -n 128 /dev/mtdblock9
     9e f3 63 91 61 63 74 69  76 65 72 65 67 69 6f 6e  
 |..c.activeregion|
   0010  3d 31 00 69 6d 61 67 65  31 73 74 61 74 75 73 3d  
 |=1.image1status=|
   0020  30 00 69 6d 61 67 65 32  73 74 61 74 75 73 3d 30  
 |0.image2status=0|
   0030  00 69 6d 61 67 65 32 74  72 79 6e 75 6d 3d 30 00  
 |.image2trynum=0.|
   0040  69 6d 61 67 65 6d 61 78  74 72 79 3d 33 00 69 6d  
 |imagemaxtry=3.im|
   0050  61 67 65 31 74 72 79 6e  75 6d 3d 30 00 00 00 00  
 |age1trynum=0|
   0060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  
 ||

 Signed-off-by: Yousong Zhou yszhou4t...@gmail.com

do we need this patch and the one made by swigger ? it seems his patch
write the crc32 somewhere and your patch resets the uboot-env.




 ---
  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 0x1 0x1
   ;;
 +qihoo-c301)
 + ubootenv_add_uci_config /dev/mtd9 0x0 0x1 0x1
 + ;;
  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
  }
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2014-09-22 Thread Yousong Zhou
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@OpenWrt:/# hexdump -C -n 128 /dev/mtdblock9
  9e f3 63 91 61 63 74 69  76 65 72 65 67 69 6f 6e  
|..c.activeregion|
0010  3d 31 00 69 6d 61 67 65  31 73 74 61 74 75 73 3d  
|=1.image1status=|
0020  30 00 69 6d 61 67 65 32  73 74 61 74 75 73 3d 30  
|0.image2status=0|
0030  00 69 6d 61 67 65 32 74  72 79 6e 75 6d 3d 30 00  
|.image2trynum=0.|
0040  69 6d 61 67 65 6d 61 78  74 72 79 3d 33 00 69 6d  
|imagemaxtry=3.im|
0050  61 67 65 31 74 72 79 6e  75 6d 3d 30 00 00 00 00  
|age1trynum=0|
0060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  
||

Signed-off-by: Yousong Zhou yszhou4t...@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 0x1 0x1
;;
+qihoo-c301)
+   ubootenv_add_uci_config /dev/mtd9 0x0 0x1 0x1
+   ;;
 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
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel