[U-Boot] Booting different kernel from U-Boot based on time stamp

Wolfgang Denk wd at denx.de
Mon Jan 21 13:49:16 CET 2013


Dear Hemal Patel,

In message <assp.0730d63214.50F9164E.7070301 at slscorp.com> you wrote:
>
> For example:-
> 
> |If kernel-1 is new, U-Boot will boot Kernel-1. and leave kernel-2 as it is.
> If kernel-2 is new, U-Boot will boot kernel-2. and leave kernel-2 as it is.
> |
> 
> Questions:-
> 
> |Is it possible to do so?

This is software,so everything is possible, if you assign sufficient
resources to the task ;-)

> How can I add such functionality in U-boot?

Yes, this is not difficult.

> Where to chage the code for the same?

The clean way would be to add a (board specific) command to either
make accessable (so you can use the itest command on them) or to
compare (so that you can use plain "if") the time stamps of two
images.

Assume your command "is_newer_img" takes the addresses of two legacy
image files and returns true (i. e. with a zero return code) if this
is the case, then you could just write:

	if is_newer_img ${kernel_1_addr} ${kernel_2_addr}
	then bootm ${kernel_1_addr}
	else bootm ${kernel_2_addr}
	fi

Alternatively, for a quick & dirty test or show case, you could of
course peek directly at the ih_time entry of the image_header
structure.  This would not even need any new code, existing features
would be sufficient.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Bus error -- driver executed.


More information about the U-Boot mailing list