
Hi Nitin,
Hi!
I am doing env settings some thing like this,
ROOT1=/dev/mmcblk0p1 ROOT2=/dev/mmcblk0p2 ROOT=${ROOT1} bootargs1=console=ttyS0,115200n8 mem=256M noinitrd rw rootdelay=1 ${ROOT}
when I say 'setenv bootargs ${bootargs1}', ${ROOT} gets resolved to 'ROOT1', it does not get completely resolved to '/dev/mmcblk0p1'.
Is there something fundamentally wrong in setting the env variables this way?
There is nothing fundamentally wrong - it will simply not work ;) No, seriously, you want U-Boot to do two evaluation passes over bootargs, which we cannot do. In a regular shell this would be done by a separate "eval" or backtick round, but we lack this.
What we usually do is something like this (example taken from an arbitrary board):
nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off panic=1 addtty=setenv bootargs ${bootargs} console=tty0 console=${consdev},${baudrate} addfb=setenv bootargs ${bootargs} fbcon=map:5 video=fslfb:800x480-32@60 flash_nfs=run nfsargs addip addtty addfb;bootm ${kernel_addr} - ${fdt_addr}
When "run flash_nfs" is executed, little "scripts" are called and they assemble a full command line from different variables. So in this example, one could simply change ${kernel_addr} and "run flash_nfs" would boot the new kernel.
If you don't like such constructs, you can also get more funky and start using "if ... then .. else .." construct in the hush shell parser.
What would be the right way to achieve this, as I want ROOT to be ${ROOT1} sometimes and ${ROOT2} some times?
There is more than one way to do it ;)
Cheers Detlev