Hello Khang,
Yes, you can use a uEnv.txt or boot.scr file to set u-Boot environment variables from the SD card. These methods are still valid and can be used with recent BSPs like hardknott 5.10.52.
To use the uEnv.txt method, create a plain text file named 'uEnv.txt' in the root directory of your SD card. Add the environment variables you want to set, one per line, in the following format:
variable_name=value
For example, to set the ethaddr variable, your uEnv.txt file should contain:
ethaddr=00:11:22:33:44:55
Next, you need to modify the u-Boot configuration to read and apply the uEnv.txt file during the boot process. Add the following lines to your u-Boot configuration:
# Load uEnv.txt from SD card load mmc ${mmcdev}:${mmcpart} ${loadaddr} uEnv.txt env import -t ${loadaddr} ${filesize}
Alternatively, you can use the boot.scr method. Create a plain text file with the same environment variable settings as in the uEnv.txt method, and then convert it to a boot.scr file using the following command:
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n 'Boot script' -d input.txt boot.scr
Place the generated boot.scr file in the root directory of your SD card. The u-Boot will automatically execute the script during the boot process, setting the environment variables accordingly.
Both methods should work for setting u-Boot environment variables from the SD card. Choose the one that best fits your needs.
Best regards,