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

John Crispin blogic at openwrt.org
Thu Oct 9 04:32:09 EDT 2014



On 09/10/2014 04:30, Yousong Zhou wrote:
> On 7 October 2014 02:33, John Crispin <blogic at 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 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>
>> 
>> 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 at lists.openwrt.org 
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> 
_______________________________________________
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