Hi,
I am using Beaglebone Black. I would like to print some text messages, from uEnv.txt. But I see that the echo commands in uEnv.txt are not being printed/displayed in the serial. How can I print something on the serial, from uEnv.txt?
Thanks in advance for your time and support.
Cheers,
Sai Kiran.
uEnv.txt is basically just setting uboot environment variables it is not executed as a script.
However it looks like the uboot boot command checks for a boot.scr file and runs this. You could probably do echo in that, or any other uboot command. That only runs when booting. If you want something else to come up prior to booting, then you will probably need to build a custom uboot.
I came across this solution:
In the uEnv.txt, add the following lines,
printcmd=echo hello world; \
echo this is printcmd; \
echo signing off;
uenvcmd=run printcmd;
Ok yes you are correct, at least for the version of uboot I have.
If you have a serial console, stop uboot from booting by pressing the space bar
you can then type
env print boot
Yes the boot process checks to see if the uenvcmd variable exist and if it does it runs however it only checks if it is is /uEnv.txt and not /boot/uEnv.txt
This is the boot command, formatted for easier reading
boot=${devtype} dev ${mmcdev};
if ${devtype} rescan; then gpio set 54;
setenv bootpart ${mmcdev}:1;
if test -e ${devtype} ${bootpart} /etc/fstab; then
setenv mmcpart 1;
fi;
echo Checking for: /uEnv.txt ...;
if test -e ${devtype} ${bootpart} /uEnv.txt; then
if run loadbootenv; then gpio set 55;
echo Loaded environment from /uEnv.txt;
run importbootenv;
fi;
echo Checking if uenvcmd is set ...;
if test -n ${uenvcmd}; then gpio set 56;
echo Running uenvcmd ...;
run uenvcmd;
fi;
fi;
echo Checking for: /boot/uEnv.txt ...;
for i in 1 2 3 4 5 6 7 ;
do setenv mmcpart ${i};
setenv bootpart ${mmcdev}:${mmcpart};
if test -e ${devtype} ${bootpart} /boot/uEnv.txt; then
gpio set 55;
load ${devtype} ${bootpart} ${loadaddr} /boot/uEnv.txt;
env import -t ${loadaddr} ${filesize};
echo Loaded environment from /boot/uEnv.txt;
if test -n ${dtb}; then
echo debug: [dtb=${dtb}] ... ;
setenv fdtfile ${dtb};
echo Using: dtb=${fdtfile} ...;
fi;
echo Checking if uname_r is set in /boot/uEnv.txt...;
if test -n ${uname_r}; then
gpio set 56;
setenv oldroot /dev/mmcblk${mmcdev}p${mmcpart};
echo Running uname_boot ...;
run uname_boot;
fi;
fi;
done;
fi;
1 Like