mboehmer Posted January 3, 2018 Posted January 3, 2018 Hi, maybe someone can give me a hint on this issue. I'm working on U-Boot v2017.11 currently, and just found out that on the Odroid C2 env settings are not changable inside the eMMC, but only at compile time for Uboot. I use an 16GB eMMC, not a sdcard. So my question is: where and to what values have the following CONFIG_* parameters be set to have env settings changeable by setenv and saveenv in Uboot again? #define CONFIG_ENV_SIZE (32 * SZ_1K) #define CONFIG_ENV_OFFSET (720 * SZ_1K) #define CONFIG_SYS_MMC_ENV_DEV 1 #define CONFIG_SYS_MMC_ENV_PART 0 That's what I tried inside the include/configs/odroid-c2.h file, but it doesn't seem to work. EDIT: the variables are not inside the image, after it has been written to eMMC by etcher. After a first reboot, and inside UBoot, I can "saveenv" the standard values and see them afterwards on the eMMC on the right position. I can also change and save them again. What fails is using fw_printenv inside Linux. With the /etc/fw_env.config file # <device> <offset> <length> /dev/mmcblk0 0xB4000 0x8000 I get an error message like "Environment does not start on (erase) block boundary". Any help / hint is appreciated. Michael
Igor Posted January 4, 2018 Posted January 4, 2018 7 hours ago, mboehmer said: Any help / hint is appreciated. People reported eMMC corruption with some variants of eMMC when using 2017.11 and mainline kernel. There are some dirty hacks in old u-boot regarding eMMCs. Perhaps it's related.
mboehmer Posted January 4, 2018 Author Posted January 4, 2018 I just checked. In the image produced by compile.sh, there is no data no offset 0xb4000 (all 0x00). After starting the C2 with this image, and manually "saveenv" in Uboot, I can readout the eMMC by dd, and see the envs correctly stored on offset 0xb4000. This problem seems to be build related - compile.sh does not include the env section on the image in that case? As you get a "CRC error" on the empty env section on booting, it may look like a corrupted memory area. Any ideas on why the scripts does not include the env variables into the image? EDIT: the env area must be 64kB aligned to fit the "erase page boundary". This allows to access the env from Linux by fw_printenv et.al. # <device> <offset> <length> /dev/mmcblk0 0xc0000 0x8000 Still, the image for flashing the SDcard / eMMC does lack the initial settings. EDIT2: I still get a CRC error with that file if accessing the env variables by fw_printenv. If I do a dd if=/dev/mmcblk0 of=y bs=512 skip=1536 count=64 (which is directly translated from fw_env.config file), I get the variables as they are printed in Uboot. So something seems still to be broken if accessing from fw_printenv, while it seems to work inside Uboot now.
Recommended Posts