right setting for fw_env.config

714 views
Skip to first unread message

Harry ten Berge

unread,
Jul 30, 2018, 1:13:29 PM7/30/18
to Mender List mender.io
Hi,

I'm running a (non-Yocto) build on a Raspberry Pi.
Everyhting works fine, including the update process itself. 

However, I'm still puzzled about the u-boot environment settings. I see that you can point it directly to a device, but also to a file.
My first test with a u-boot.env file with an fw_env.config that looks like this:

/uboot/uboot.env 0x0000 0x4000

Now, in a different post from Don Cross it's mentioned that for the Pi you need a setup like this:

/dev/mmcblk0 0x4000 0x4000
/dev/mmcblk0 0x8000 0x4000


So ... can anyone clear up my confusion? ;-)


Regards Harry

Vladimir Bashkirtsev

unread,
Jul 30, 2018, 1:24:00 PM7/30/18
to men...@lists.mender.io
It depends on where u-boot is configured to keep its environment and if there redundant environment present.

If u-boot configured to keep the environment in the beginning of SD card then you use

/dev/mmcblk0 0x4000 0x4000

Note that second field is byte position off the beginning of SD card and third field is number of bytes to be used for environment. These figures must match to what u-boot has compiled in.

However Raspberry Pi u-boot default config stores the environment in first FAT partition in a file called uboot.env . Hence for Raspberry you generally going to use

/uboot/uboot.env 0x0000 0x4000

where /uboot is a folder where first FAT partition is mounted, second field is byte position where environment starts (zero is the beginning of that file), third field is number of bytes reserverd for environment. Again it should match settings compiled in u-boot.

Second line in fw_env.config file is a location of redundant environment. And again it should match what is compiled into u-boot.

--
You received this message because you are subscribed to the Google Groups "Mender List mender.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mender+un...@lists.mender.io.
To post to this group, send email to men...@lists.mender.io.
Visit this group at https://groups.google.com/a/lists.mender.io/group/mender/.

Harry ten Berge

unread,
Jul 30, 2018, 1:32:28 PM7/30/18
to men...@lists.mender.io
Thanks Vladimir for your quick response!

Couple of questions though: any advantage/disadvantage of using a file (like I did) vs directly on the disk?
And can I use a redundant environment also in a second file?

Thanks,
--

Vladimir Bashkirtsev

unread,
Jul 30, 2018, 1:51:56 PM7/30/18
to men...@lists.mender.io
No big difference really. One still should not look inside of this file anyway and modify it only with envtools or u-boot itself.

In case of the file u-boot can only use one at a time. So redundant environment will be stored in the same file.

Drew Moseley

unread,
Jul 30, 2018, 6:03:24 PM7/30/18
to men...@lists.mender.io

The main downside of using a file is that you have the filesystem layer to deal with which potentially adds another failure point.  If your env file is stored on VFAT partition, you are more susceptible to corruption due to an inopportune power sync than if it is stored in raw flash.


Drew

--
Drew Moseley | Technical Solutions Architect | (+1) 480-797-0552 | https://mender.io

Northern.tech AS | @northerntechHQ | @drewmoseley

Vladimir Bashkirtsev

unread,
Jul 30, 2018, 7:06:45 PM7/30/18
to men...@lists.mender.io
Don't think that it has any bearing. After file is allocated in the FAT then FAT remains unaltered provided writes do not expand the file any further. envtools preallocate space in the file and only at this moment FAT is changed. Further writes to uboot.env from the point of view of the hardware are no different to writing directly to SD sectors.

Kristian Amlie

unread,
Aug 1, 2018, 10:25:34 AM8/1/18
to men...@lists.mender.io, Vladimir Bashkirtsev
On 30/07/18 19:06, Vladimir Bashkirtsev wrote:
> Don't think that it has any bearing. After file is allocated in the FAT
> then FAT remains unaltered provided writes do not expand the file any
> further. envtools preallocate space in the file and only at this moment
> FAT is changed. Further writes to uboot.env from the point of view of
> the hardware are no different to writing directly to SD sectors.

Unfortunately not. File system writes from user space also triggers file
modification time updates. Since VFAT has no journal, and the
modification time is stored in the same sector as the file name, this
can cause that sector to become corrupted during a powerloss, and the
file can literally disappear.

AFAIK this can only happen while writing with the user space tools, not
when writing with U-Boot itself, which writes to direct sectors as you
say. But both are required for correct operation.

--
Kristian
>> <ha...@baseflow.com <mailto:ha...@baseflow.com>> wrote:
>>
>> Hi,
>>
>> I'm running a (non-Yocto) build on a Raspberry Pi.
>> Everyhting works fine, including the update process
>> itself. 
>>
>> However, I'm still puzzled about the u-boot
>> environment settings. I see that you can point it
>> directly to a device, but also to a file.
>> My first test with a u-boot.env file with an
>> fw_env.config that looks like this:
>>
>> /uboot/uboot.env 0x0000 0x4000
>>
>> Now, in a different post from Don Cross it's mentioned
>> that for the Pi you need a setup like this:
>>
>> /dev/mmcblk0 0x4000 0x4000
>> /dev/mmcblk0 0x8000 0x4000
>>
>> So ... can anyone clear up my confusion? ;-)
>>
>>
>> Regards Harry
>> --
>> You received this message because you are subscribed
>> to the Google Groups "Mender List mender.io
>> <http://mender.io>" group.
>> To unsubscribe from this group and stop receiving
>> emails from it, send an email to
>> mender+un...@lists.mender.io
>> <mailto:mender+un...@lists.mender.io>.
>> To post to this group, send email to
>> men...@lists.mender.io <mailto:men...@lists.mender.io>.
>> Visit this group at
>> https://groups.google.com/a/lists.mender.io/group/mender/.
>>
>>
>> --
>> You received this message because you are subscribed to
>> the Google Groups "Mender List mender.io
>> <http://mender.io>" group.
>> To unsubscribe from this group and stop receiving emails
>> from it, send an email to
>> mender+un...@lists.mender.io
>> <mailto:mender+un...@lists.mender.io>.
>> To post to this group, send email to
>> men...@lists.mender.io <mailto:men...@lists.mender.io>.
>> Visit this group at
>> https://groups.google.com/a/lists.mender.io/group/mender/.
>>
>>
>>
>> --
>> --
>> You received this message because you are subscribed to the
>> Google Groups "Mender List mender.io <http://mender.io>" group.
>> To unsubscribe from this group and stop receiving emails from
>> it, send an email to mender+un...@lists.mender.io
>> <mailto:mender+un...@lists.mender.io>.
>> To post to this group, send email to men...@lists.mender.io
>> <mailto:men...@lists.mender.io>.
>> Visit this group at
>> https://groups.google.com/a/lists.mender.io/group/mender/.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Mender List mender.io <http://mender.io>" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to mender+un...@lists.mender.io
>> <mailto:mender+un...@lists.mender.io>.
>> To post to this group, send email to men...@lists.mender.io
>> <mailto:men...@lists.mender.io>.
>> Visit this group at
>> https://groups.google.com/a/lists.mender.io/group/mender/.
>
> --
> Drew Moseley | Technical Solutions Architect | (+1) 480-797-0552 |
> https://mender.io
>
> Northern.tech AS <https://northern.tech> | @northerntechHQ
> <https://twitter.com/northerntechhq> | @drewmoseley
> <https://twitter.com/drewmoseley>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Mender List mender.io <http://mender.io>" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to mender+un...@lists.mender.io
> <mailto:mender+un...@lists.mender.io>.
> To post to this group, send email to men...@lists.mender.io
> <mailto:men...@lists.mender.io>.
> Visit this group at
> https://groups.google.com/a/lists.mender.io/group/mender/.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Mender List mender.io" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to mender+un...@lists.mender.io
> <mailto:mender+un...@lists.mender.io>.
> To post to this group, send email to men...@lists.mender.io
> <mailto:men...@lists.mender.io>.
signature.asc
Reply all
Reply to author
Forward
0 new messages