U-Boot environment questions

U-Boot default variable/script.

  mmc dev ${mmcdev(=0)};
  if mmc rescan; then echo SD/MMC found on device ${mmcdev};
    if run loadbootscript; then run bootscript;
      if run loadbootenv; then 
        echo Loaded env from ${bootenvfile};
        run importbootenv;
      if test -n $uenvcmd; then echo Running uenvcmd ...;
        run uenvcmd;

In line 2, mmc dev ${mmcdev(=0)};
What does ’ (=0)’ do?

Thank you,

My guess, if mmcdev was not set prior, it would automatically set it as 0…

Sorry, i forget what shell u-boot uses for it’s console.


My bad,
I figured it out. As I have been parsing through U-Boot scripts, I forgot I added ‘(=0)’ as a comment to myself that the default value of mmcdev was zero.

However, if anyone wanted to use the syntax to mean if the variable does not exist the create it with a default value of zero. You are welcome to do so.

I apologize for my confusion.