Tutorial about uEnv.txt

Hi community,

I’m starting with BeagleBone black and my idea is compile u-boot and charge it on BeagleBone using SDCard. I read some information about this but I don’t understand which is the role of uEnv.txt file, is there some tutorial of that?

Best regards

It is a bit of a hack we initiated that has gotten utilized heavily by many u-boot users.

I think the most sustainable way to understand it, is to find the source of it in u-boot, which as of the v2021.10 release is here: mmc.h - include/environment/ti/mmc.h - U-boot source code (v2021.10) - Bootlin.

	"envboot=mmc dev ${mmcdev}; " \
		"if mmc rescan; then " \
			"echo SD/MMC found on device ${mmcdev};" \
			"if run loadbootscript; then " \
				"run bootscript;" \
			"else " \
				"if run loadbootenv; then " \
					"echo Loaded env from ${bootenvfile};" \
					"run importbootenv;" \
				"fi;" \
				"if test -n $uenvcmd; then " \
					"echo Running uenvcmd ...;" \
					"run uenvcmd;" \
				"fi;" \
			"fi;" \
		"fi;\0" \

Most configs will try ‘envboot’, though I’d say we should be moving to the distro boot to be more friendly with the way Debian, Fedora, etc. expect to provide boot configuration information.

Anyway, this hack is based on the scripting language that u-boot provides. In this case, the file uEnv.txt (as defined by the u-boot environment variable bootenvfile) is read and parsed to set more u-boot environment variables. Note the uenvcmd variable gives a way for uEnv.txt to provide u-boot script code that u-boot can execute as well, rather than just set environment variables.

The impact of setting those variables can be better understood by additional hacks done in BeagleBoard customizations to support capes, primarily, as well as some other features desired at boot. Here is the patch that enables cape support today: U-Boot-BeagleBone-Cape-Manager · beagleboard/u-boot@c71d87a · GitHub.

Note, however, that this continues to be developed. Recently, we’ve devised a way to enable cape support in upstream u-boot. Expect some blog posts on that topic soon that will better explain that.

In general, there’s just a few configs for uEnv.txt that end users should be hacking on. We’ve been trying to encapsulate those in the new beaglecfg project such that we can update that program when we update what goes in uEnv.txt and it will help avoid people making errors in editing this file.

1 Like

Hi @jkridner

Thank you very much for your explanation about this. When I said tutorial about uEnv.txt I mean about if Is there some documentation about the different parameters available on this file and what it do?

Best regards