how to configure fw_{printenv,setenv} to work with eMMC boot1?

1,225 views
Skip to first unread message

Robert P. J. Day

unread,
Aug 23, 2013, 7:19:06 AM8/23/13
to BeagleBoard list

not sure whether this is more appropriately a u-boot question but
i'll ask here to start with.

i'm using the current (git) version of u-boot on my BBB, where the
new BBB-specific configuration of "am335x_boneblack_config" lets me
store the u-boot environment in the eMMC hardware partition "boot1".
this not only lets me save u-boot environment information even if i'm
booting off of SD card, but it lets me see the env info after i've
booted by hexdump'ing that HW partition:

# hexdump -C /dev/mmcblk1boot1
00000000 fc d7 b6 21 61 72 63 68 3d 61 72 6d 00 62 61 75 |...!arch=arm.bau|
00000010 64 72 61 74 65 3d 31 31 35 32 30 30 00 62 6f 61 |drate=115200.boa|
00000020 72 64 3d 61 6d 33 33 35 78 00 62 6f 61 72 64 5f |rd=am335x.board_|
00000030 6e 61 6d 65 3d 41 33 33 35 42 4e 4c 54 00 62 6f |name=A335BNLT.bo|
00000040 61 72 64 5f 72 65 76 3d 30 41 35 43 00 62 6f 6f |ard_rev=0A5C.boo|
00000050 74 5f 66 64 74 3d 74 72 79 00 62 6f 6f 74 61 72 |t_fdt=try.bootar|
00000060 67 73 3d 63 6f 6e 73 6f 6c 65 3d 74 74 79 4f 30 |gs=console=ttyO0|
... etc ...

however, i've used OE to build my system and added the
u-boot-fw-utils package, which gives me the utilities fw_printenv and
fw_setenv to allegedly manipulate that u-boot env info from the
command line, but the problem is that i don't know what to place in
the config file /etc/fw_env.config to refer to that eMMC HW partition.

normally, that file points at a partition and also has to specify
flash properties of device offset, flash sector size and so on, but
none of that seems relevant here given that this is a different kind
of partition.

can this even be done? do the u-boot env utilities have the
capability to work with an eMMC HW partition like boot1?

rday

--

========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================

Tom Rini

unread,
Aug 23, 2013, 10:32:04 AM8/23/13
to beagl...@googlegroups.com

Should work by following the example in:
http://git.denx.de/?p=u-boot.git;a=blob;f=tools/env/fw_env.config;h=90e499da1e092ae84ebbb67d3aa223b5eb642480;hb=HEAD

That said, you may (I forget what I found when testing this before) find that the boot partitions are "locked" in Linux until you follow the standard instructions for unlocking them.  Or maybe that's not implemented currently, I forget honestly.

--
Tom

Robert P. J. Day

unread,
Aug 23, 2013, 10:35:52 AM8/23/13
to beagl...@googlegroups.com
On Fri, 23 Aug 2013, Tom Rini wrote:

> On Friday, August 23, 2013 7:19:06 AM UTC-4, Robert P. J. Day wrote:
>
> �ソス not sure whether this is more appropriately a u-boot question but
> i'll ask here to start with.
>
> �ソス i'm using the current (git) version of u-boot on my BBB, where the
> new BBB-specific configuration of "am335x_boneblack_config" lets me
> store the u-boot environment in the eMMC hardware partition "boot1".
> this not only lets me save u-boot environment information even if i'm
> booting off of SD card, but it lets me see the env info after i've
> booted by hexdump'ing that HW partition:
>
> # hexdump -C /dev/mmcblk1boot1
> 00000000 �ソスfc d7 b6 21 61 72 63 68 �ソス3d 61 72 6d 00 62 61 75 �ソス|...!arch=arm.bau|
> 00000010 �ソス64 72 61 74 65 3d 31 31 �ソス35 32 30 30 00 62 6f 61 �ソス|drate=115200.boa|
> 00000020 �ソス72 64 3d 61 6d 33 33 35 �ソス78 00 62 6f 61 72 64 5f �ソス|rd=am335x.board_|
> 00000030 �ソス6e 61 6d 65 3d 41 33 33 �ソス35 42 4e 4c 54 00 62 6f �ソス|name=A335BNLT.bo|
> 00000040 �ソス61 72 64 5f 72 65 76 3d �ソス30 41 35 43 00 62 6f 6f �ソス|ard_rev=0A5C.boo|
> 00000050 �ソス74 5f 66 64 74 3d 74 72 �ソス79 00 62 6f 6f 74 61 72 �ソス|t_fdt=try.bootar|
> 00000060 �ソス67 73 3d 63 6f 6e 73 6f �ソス6c 65 3d 74 74 79 4f 30 �ソス|gs=console=ttyO0|
> ... etc ...
>
> �ソス however, i've used OE to build my system and added the
> u-boot-fw-utils package, which gives me the utilities fw_printenv and
> fw_setenv to allegedly manipulate that u-boot env info from the
> command line, but the problem is that i don't know what to place in
> the config file /etc/fw_env.config to refer to that eMMC HW partition.
>
> �ソス normally, that file points at a partition and also has to specify
> flash properties of device offset, flash sector size and so on, but
> none of that seems relevant here given that this is a different kind
> of partition.
>
> �ソス can this even be done? do the u-boot env utilities have the
> capability to work with an eMMC HW partition like boot1?
>
>
> Should work by following the example in:
> http://git.denx.de/?p=u-boot.git;a=blob;f=tools/env/fw_env.config;h=90e499da1e092ae84ebbb67d3aa223b5eb642480;hb=HEAD

no, we just had a discussion of this on the u-boot list and,
currently, u-boot doesn't support environment in eMMC partitions --
the current code insists that the partition be MTD. so some extension
is going to be required.

Alexander Holler

unread,
Aug 24, 2013, 9:32:38 AM8/24/13
to beagl...@googlegroups.com
Just using env import -t (as used for uEnv.txt) is much easier and more
straightforward. If you want to change the whole environment using that
mechanism I suggest to either modify CONFIG_PREBOOT in the u-boot
configuration such that it uses "env import" (after loading something
like uPreEnv.txt) or just modify the default environment such that it
doesn't set any environment variables and only loads them using "env
import". CONFIG_PREBOOT is used before the bootdelay, so you could
modify that there too.

If you want, you could use env import -b too, but using text files (-t)
is much more user friendly than fiddling with fw_env*. I've even posted
a patch on this list which expands env -t with -r to support editing the
text files with windows editors (using crlf), which currently just ends
up with silly and hard to find errors if done without that patch.

Regards,

Alexander Holler


Reply all
Reply to author
Forward
0 new messages