Warning -Bad CRC using default Environment

Hi ubuntuCore guys,

I have been following your work for a while now and I am trying to get ubuntuCore on a custom board. I have run into a problem where the CRC for my imported environment is faulty and not excepted by the board. I have found some chat logs about you discussing the problem here. Seems Ogra ran into my problem.

The symptoms you experience match mine exactly, but I am confused by what you did to make the environment file work. What size was the file before you padded it, how did you pad it? Did the extra byte go away? Is this a bug on mkenvImage?

Any help on this would be appreciated.

Have a look at:

I did my patch is in the .h file, I just wanted to double check with you guys.

Hi, again. I have read that post up and down. My size is the same in the snapcraft.yaml and the .h file. Is there anything else that you think could be the problem?

Update I solved it.

I managed to get my environment imported. The problem was the -r on the mkenvimage line in my snapcraft yaml.

1 Like

you actually need the -r (snapd expects the uboot.env that resuts from it to be a redundant file (which is what -r defines)) ā€¦

so i guess your uboot patch is missing
#define CONFIG_SYS_REDUNDAND_ENVIRONMENT which tells the uboot binary to read a redundant file ā€¦
add the -r back and make sure the define is set in your patch.

if the -r is not set, kernel and core snap updates will fail since snapd can not update the boot variables for them.

1 Like

I compiled the environment outside of the snapd, I did not think about updating. After doing the above ^^ it works and I can load th environment error free. Thank you for your help!!

One last question, I been following your blog about gadget snaps and patches and such, but are you going to post the last part of the series about the u boot environment? That is putting me through the wringer right now.

1 Like

i plan to, finding some spare time to do so is the issue ā€¦ it didnt fall off my TODO (just moved to low prio)

just having the load* vars set properly as well as snappy_boot, snappy_cmdline and snap_kernel/snap_core should be fine though (they are also largely the same everywhere so just grab them from one of my github gadget snap trees).