Check if valid kernel and/or FS

Sascha Hauer s.hauer at pengutronix.de
Fri May 25 08:35:31 EDT 2012


On Fri, May 25, 2012 at 12:58:48PM +0200, Benoit RAT wrote:
> Thanks,
> 
> I want to know, if i am using the default environment (the that I am using
> from compilation)
> barebox> no valid environment found on /dev/env0. Using default environment
> 
> Or I am using the one that there is in /dev/env0
> 
> It is in the case someone break something in the NAND flash env, I want to
> save again the default one.

Currently there is no way to detect that, but there is a little trick.
Put a this_is_compiled_in file into your default environment. Then
during startup you can do:

if [ -f /env/this_is_compiled_in ]; then
	echo "Sorry man, you lost your environment"
	rm /env/this_is_compiled_in
	saveenv
fi

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list