[U-Boot] Saving u-boot.env to FAT partition of SDcard

Hello All
I am in the process of changing U-Boot (v2015.04) to save its environment variables to the FAT partition of an SDcard instead of saving them to the boot sector.
I have changed my board header file to: /* Include the below to write env to fat partition of mmc */ #define CONFIG_ENV_IS_IN_FAT #if defined(CONFIG_ENV_IS_IN_FAT) #define CONFIG_ENV_SIZE (8 * 1024) #define FAT_ENV_INTERFACE "mmc" #define FAT_ENV_DEVICE_AND_PART "0:1" #define FAT_ENV_FILE "uboot.env" #define CONFIG_FAT_WRITE #define FAT_ENV_DEVICE 0 #define FAT_ENV_PART 1 #define CONFIG_BOOT_PARTITION_ACCESS #endif
/* Include the below to write env to mmc (raw) */ /*#define CONFIG_ENV_IS_IN_MMC*/ #if defined(CONFIG_ENV_IS_IN_MMC) #define CONFIG_ENV_SIZE (8 * 1024) #define CONFIG_ENV_OFFSET (8 * 64 * 1024) #endif
U-Boot builds (using Yocto) and runs. I can save the environment and list the file on the card using "fatls": => saveenv Saving Environment to FAT... writing uboot.env done => reset resetting ...
However, on the following boot the file is not read: U-Boot 2015.04+fslc+g5d9ffd2 (Apr 19 2016 - 11:38:28)
CPU: Freescale i.MX6Q rev1.5 996 MHz (running at 792 MHz) CPU: Extended Commercial temperature grade (-20C to 105C) at 29C Reset cause: WDOG Board: Sw-one I2C: ready DRAM: 1 GiB Enabling i210 PMIC: PFUZE100 ID=0x10 NAND: 256 MiB MMC: FSL_SDHC: 0 reading uboot.env Invalid FAT entry *** Warning - bad CRC, using default environment
00:01.0 - 16c3:abcd - Bridge device 01:00.0 - 8086:157c - Network controller No panel detected: default to Hannstar-XGA Display: Hannstar-XGA (1024x768) In: serial Out: serial Err: serial Net: FEC [PRIME] Error: FEC address not set.
Hit any key to stop autoboot: 0 =>
I saw a post reply by Wolfgang ( http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/16117) that suggested formatting the partition using the host machine and then copying the files back. I have done this (using a Linux host machine) and can copy/write all the files except u-boot.env which gives me an I/O error.
Given that I can't copy u-boot.env I'm thinking that the binary has not been created correctly and thus fat_write.c:do_fat_write() needs patching.
I'm sure many users out there have reading/writing the env to FAT partition working flawlessly, I would welcome any suggestions or a point towards a relevant patch.
Many thanks
Adrian
participants (1)
-
Adrian Mcgrath