cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
4,181 Views
Registered: ‎05-10-2019

U-Boot Initialization Issues

Jump to solution

I'm getting this message when U-Boot runs:

Loading Environment from FAT... *** Warning - bad CRC, using default environment

I believe it is trying to load the binary file uboot.env that is created if one saves the environment from U-Boot. But I don't want to mess with this at all. I simply want to load from uenv.txt and boot Linux.

I've used platform-top.h in meta-user to winnow down the default environment (see below). How do I bootstrap the environment? In other words, how can I get it to load my uenv.txt when it runs rather than uboot.env?

#define CONFIG_EXTRA_ENV_SETTINGS \
	SERIAL_MULTI \ 
	CONSOLE_ARG \ 
	PSSERIAL0 \ 
	"environment_text_file=uenv.txt\0" \ 
	"import_environment=echo \"Importing environment from SD ...\"; " \ 
		"env import -t ${environment_address} $filesize\0" \ 
	"load_environment=load mmc 0 ${environment_address} ${environment_text_file}\0" \ 
	"environment_address=0x00400000\0" \ 
	"script_exists=test -e mmc 0 /uenv.txt\0" \ 
	"uenvboot=" \ 
		"if run script_exists; then " \ 
			"run load_environment; " \ 
			"echo Loading environment from ${environment_text_file}.; " \ 
			"run import_environment; " \ 
			"fi; " \ 
		"if test -n $uenvcmd; then " \ 
			"echo Running uenvcmd ...; " \ 
			"run uenvcmd; " \ 
		"fi\0" \ 
	"autoload=no\0" \ 
	"default_bootcmd=echo No default boot command is defined.\0" \ 
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Scholar
Scholar
4,146 Views
Registered: ‎05-28-2013

You can prevent the "Warning - bad CRC" by changing the u-boot configuration:

- disable CONFIG_ENV_IS_IN_FAT

- enable CONFIG_ENV_IS_NOWHERE

 

That said, I would recommend sticking with uboot.env rather than the text file. The two are almost identical - uboot.env contains all of the strings from the text file, plus a CRC checksum. The checksum provides useful detection in case of file corruption.

 

If your goal is to be able to easily modify the environment from Linux, there are existing tools for that: fw_printenv and fw_setenv. These are part of u-boot and may well be included in your target already.

View solution in original post

2 Replies
Highlighted
Scholar
Scholar
4,147 Views
Registered: ‎05-28-2013

You can prevent the "Warning - bad CRC" by changing the u-boot configuration:

- disable CONFIG_ENV_IS_IN_FAT

- enable CONFIG_ENV_IS_NOWHERE

 

That said, I would recommend sticking with uboot.env rather than the text file. The two are almost identical - uboot.env contains all of the strings from the text file, plus a CRC checksum. The checksum provides useful detection in case of file corruption.

 

If your goal is to be able to easily modify the environment from Linux, there are existing tools for that: fw_printenv and fw_setenv. These are part of u-boot and may well be included in your target already.

View solution in original post

Highlighted
4,137 Views
Registered: ‎05-10-2019

Thanks. I came to that conclusion last night and read that there is a utility to generate uboot.env. I'll write it myself if I have to but it seems like a good way to proceed.

0 Kudos