[U-Boot-Users] netconsole doesn't work if $(serverip) is assigned to ncip instead of hardcoded value

Wolfgang Denk wd at denx.de
Tue Mar 27 16:58:48 CEST 2007


In message <15015754812.20070327151529 at rambler.ru> you wrote:
> 
> Sure. I just thought that it's possible to use environment variables
> to assign values to all other variables. That is to say, if assignment
> 
> addip=setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):$(netdev):off panic=1

I'm not sure what this represents. Your input? Then  this  is  wrong.
The  output  of a printenv command? Then it looks ok, except that the
use of pares for variable reference  is  deprecated  and  may  become
illegal soon. Please use '${...}' instead.

> ncip=$(serverip)?

What is the supposed function of this?

> See below the full environment. The only difference between two scenarious
> is that it works if ncip=10.0.0.55 and it doesn't if ncip=$(serverip).

Of course this cannot work. The string "$(serverip)" is no valid IP
address.

U-Boot substitues variables when it parses an U-Boot command.

If you define something like

	=> setenv addip 'setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}: ...'

then you have to *run* this 'addip' definition (i. e.. you execute  a
command,  "run"); this in turn will execute the "setenv" command, and
when dong  this  the  command  arguments  are  parsed  and  variables
substituted.

If you define 

	=> setenv ncip ${serverip}

you will set the "ncip" variable to the current value of your serverip
variable. If you want to delay this substitution, you could for
example write:

	=> setenv set_ncip 'setenv ncip ${serverip}'

and later, at the appropriate place, execute it as "run set_ncip".

If you however write

	=> setenv ncip '${serverip}'

then you defined the variable  "ncip"  to  hold  the  literal  string
"${serverip}" which will probably not do what you want.


Hope this helps - I don't really understand why you expected it to
work differently.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Living on Earth may be expensive, but it includes an annual free trip
around the Sun.




More information about the U-Boot mailing list