Barebox Environment and State placed on eMMC boot partition

Martin Hollingsworth Martin.Hollingsworth at itk-engineering.de
Mon Jul 3 05:57:41 PDT 2017


Hi folks,
I am currently enabling the bootchooser framework on my system and need some advice on where to place the bootchooser variables so that I can read and write them from linux (marking a successful boot).

My system uses eMMC as storage and offers an extra bootloader partition (boot0), which is 2MB and implemented completely in hardware. Currently I split boot0 into 1MB for barebox and 1MB for bbenv. I add the partition layouts in barebox using devfs_add_partition("mmc3.boot0", OFFSET, SIZE, DEVFS_PARTITION_FIXED, "mmc3.barebox0-env") in the env_init() function. The bootchooser variables are currently stored as non-volatile variables in the bbenv.

However under linux boot0 is shown as a raw device. To read and write bbenv I have to first dump the env from boot0 to a file using dd and the correct offsets, import the dump using bareboxenv from dt-utils, change the values and do the same steps backwards until overwriting env with dd again. This works, but it feels overly complicated, error prone due to manual offsets and my gut tells me there might be a better solution.

If I understand chapters 6.1 and 6.2 from the documentation correctly, this can be simplified by defining the environment or state nodes within the devicetree file (dts). However my eMMC device is not listed in the dts and is rather detected during runtime - hence the boot partition reports under barebox as /dev/mmc3.boot0 and under linux as /dev/mmcblk3boot0. So now I fail to define a "device-path = " entry for Barebox Environment and a "backend =" entry for Barebox State within the dts file as needed by the environment and/or state framework.

Anyone have a clue what I might be overlocking here? Someone have a barebox tutorial handy that is running on an eMMC based device?

Thanks and cheers,
Martin



More information about the barebox mailing list