Reseting bootcount from linux

Wolfgang Denk wd at denx.de
Mon Jun 6 18:27:03 EST 2005


Dear Tore,

in message <42A3F015.5020203 at oslo.westerngeco.slb.com> you wrote:
> 
> I am using a MPC8266ADS-PCI board and u-boot with the
> CONFIG_BOOTCOUNT_LIMIT. If i stop u-boot before it starts Linux I can
> see that the bootcount variable increments nicely. But if i dump the 
> content from flash (dd if=/dev/mtd/1 of=a1out bs=1k) and check the 
> content it is always
> bootcount=1

The environment copy in flash gets  stored  only  when  you  run  the
"saveenv"  command,  but  "bootcount" gets updated automagically upon
each boot, so even if you would change the flash contents  this  does
ot matter.

> So how can I reset the bootcount if it is always 1, or rather where is
> the real bootcount stored?

See function bootcount_store() in "cpu/mpc8260/commproc.c"; see also
include/common.h for the definition of BOOTCOUNT_MAGIC and
include/asm-ppc/cpm_8260.h for CPM_BOOTCOUNT_ADDR.


Please find attached some code (courtesy of Steffen Rumler) that  can
be  used  to  reset  the  boot  counter  under  Linux using the /proc
interface.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"If that makes any sense to you, you have a big problem."
                                  -- C. Durance, Computer Science 234

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ubootBootcountAccess.c
Type: application/octet-stream
Size: 3970 bytes
Desc: ubootBootcountAccess.c
Url : http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20050606/ec19d461/attachment.obj 


More information about the Linuxppc-embedded mailing list