Can i access the barebox env from linux

Alexander Aring alex.aring at gmail.com
Wed Mar 26 02:57:36 EDT 2014


Hi Sascha and Ashutosh,

On Wed, Mar 26, 2014 at 07:26:19AM +0100, Sascha Hauer wrote:
> On Wed, Mar 26, 2014 at 11:25:07AM +0530, Ashutosh Singh wrote:
> > Dear All,
> > 
> > Can i access the barebox env from linux.
> > Once the kernel boot if i want to create a directory and store some parameter
> > in default barebox /env folder without going to barebox from kernel.
> > For Eg.
> > I booted the board i get the linux promt and depending on some condition
> > i want to update the barebox env and create a directory in /env so the
> > next time
> > when barebox is loading the kernel image it can check that directory
> > and according
> > to that it can select the kernel from any source such as mmc, nand, nor, tftp.
> > 
> > What i observe that after the kernel boot i can see the barebox.env is
> > mounted as mtdblock5 (case of Nand)
> > now according to my understanding can i mount this partition modify
> > with my custom directory
> > and again boot so that this directory is available in barebox /env .
> 
> There is no filesystem support for the barebox environment, but you can
> access the barebox env under Linux using the bareboxenv tool. Enable
>  [x] build bareboxenv tool for target
> and you'll find the tool under scripts/
> 

I wrote fast some skript to handle a automatic write of the bareboxenv On
env changes. It use inotify to detect changes at the environment.

--- snip

#!/bin/sh 

MNT=$1
ENV=$2

bareboxenv -l $MNT $ENV

while true
do
inotifywait -e modify $MNT --excludei ".*.swp"
bareboxenv -s $MNT $ENV
done

--- snap

NOTE: Don't use this on nand partitions!

This script can be run as daemon on the target and will automatic write
the environment back. Usage: "./script $MNTPOINT $BBENV".


I hacked this in 10 seconds but it depends if it a mtd device then we
should use nandwrite etc... but maybe we can write a proper C
implementation, with inotify, mtd ioctl calls (if mtd), etc...

I mean this would be very easy to implemented. :-)

- Alex



More information about the barebox mailing list