kraj / meta-altera

Old Altera BSP layer for OpenEmbedded/Yocto Project ( please use https://github.com/altera-opensource/meta-intel-fpga-refdes)
MIT License
47 stars 58 forks source link

U-Boot env overwrites FAT partition #236

Closed c-thaler closed 2 years ago

c-thaler commented 2 years ago

When building out of the box, the DE10 Nano U-Boot defconfig is configured with "CONFIG_ENV_IS_IN_MMC=y". This defaults to partition 1, which is the FAT partition as you can see in the WIC file "sdimage-cyclone5-arria5.wks".

That means, saving the U-Boot env may corrupt your FAT data and vice versa. Either the U-Boot config has to be changed or the WIC file. Which one is the way to go?

kraj commented 2 years ago

it seems the wic and u-boot are not acting in tandem here. I would think you might do it in either place, perhaps doing it in wic is perhaps yocto specific then you can keep the defconfig of u-boot unmodified.

c-thaler commented 2 years ago

Ok, then I will add another small partition for the U-Boot environment as partition 1 before the FAT partition. I hope this won't cause any more trouble with other parts of the U-Boot config.

c-thaler commented 2 years ago

Eventually, I rechecked everything.

CONFIG_ENV_IS_IN_MMC actually defaults to partition 0. Partition 0 contains the MBR and the remaining space (user area) until partition 1 begins, which is the FAT partition in the WIC for Cyclone 5. The FAT partition is aligned to 1024 kByte (--align 1024). That means, there is enough space for the MBR and the U-Boot env, which starts at 0x4400 and has a length of 0x2000 bytes.