Skip to contentSkip to conversation

netconsole doesn't work if $(serverip) is assigned to ncip instead of hardcoded value

U-Boot-Users Igor Marnat 2 participants 5 messages Mar 27, 2007 – Mar 28, 2007

lore
Share & tools
lore
#0 lore raw

Hello List!

When I assign 10.0.0.55 to ncip, netconsole functions ok. But when I assign 10.0.0.55 to serverip variable and ncip is equal to $(serverip), netconsole doesn't work. It still shows prompt to serial console after command "run nc" is issued (nc=setenv stdout nc;setenv stdin nc).

u-boot is of 1.1.6 version.

Am I doing something wrong or it functions as designed?

Best regards,
Igor Marnat
mailto:marny at rambler.ru

#1 lore raw
Quoted 6 lines · In message <[email protected]> you wrote:

When I assign 10.0.0.55 to ncip, netconsole functions ok. But when I assign 10.0.0.55 to serverip variable and ncip is equal to $(serverip), netconsole doesn't work. It still shows prompt to serial console after command "run nc" is issued (nc=setenv stdout nc;setenv stdin nc).

You must be doing something wrong. "ncip" and "serverip" are completely unrelated.

Please provide a full log of your actions including your environment settings.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
"We don't have to protect the environment -- the Second Coming is  at
hand."                                                   - James Watt
#2 lore raw

Hello Wolfgang,

WD> You must be doing something wrong. "ncip" and "serverip" are WD> completely unrelated.

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

works ok (it uses $(serverip)), why can't I use

ncip=$(serverip)?

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).

=> printenv baudrate=115200
loads_echo=1
eth1addr=00:50:c2:1e:af:fd
netdev=eth0
ethaddr=00:50:c2:1e:af:f1
kernel_flash_addr=ffe04000
kernel_flash_end=fffbffff
kernel_flash_space=$(kernel_flash_addr) $(kernel_flash_end)
poff=protect off $(kernel_flash_addr) $(kernel_flash_end)
erase_kernel=era $(kernel_flash_addr) $(kernel_flash_end)
upd_kernel=tftpboot; run poff; run erase_kernel; cp.b $(fileaddr) $(kernel_flash_addr) $(filesize) flash_nfs=run nfsargs addip addcons;bootm $(kernel_flash_addr)
nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) rootpath=$(rootpath) addip=setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):$(netdev):off panic=1 addcons=setenv bootargs $(bootargs) console=ttyS0,$(baudrate) nfs26=/home/igor/tz-64/ppc/tz_64_nfs
rootpath=/home/igor/tz-64/ppc/tz_64_nfs
addmem=setenv bootargs $(bootargs) mem=16M
filesize=ebe75
fileaddr=200000
netmask=255.255.255.0
serverip=10.0.0.55
bootargs=root=/dev/nfs rw nfsroot=90.0.0.55:/home/igor/tz-64/ppc/tz_64_nfs rootpath=/home/igor/tz-64/ppc/tz_64_nfs ip=90.0.0.137:90.0.0.55::255.255.255.0::eth0:off panic=1
net_nfs=tftp 200000 $(bootfile);run nfsargs addip addcons addmem;bootm
mtd_args=setenv bootargs root=/dev/mtdblock0 rw rootfstype=jffs2
net_mtd=tftp 200000 $(bootfile);run mtd_args addip addcons addmem;bootm
ipaddr=10.0.0.239
bootfilesaved=uImage26
bootcmdsaved=run net_mtd
bootfile=uImage26nandconsole
nc=setenv stdout nc;setenv stdin nc
ncip=10.0.0.55
ethact=ppc_4xx_eth0
com_eth_go=run echo_sleep; run nc; run echo_sleep; run net_nfs
bootcmd=run com_eth_go
echo_sleep=echo "I am sleeping, press CTRL-C to stop";sleep 4;
bootdelay=2
stdin=serial
stdout=serial
stderr=serial

Signature · 3 lines
Best regards,
Igor Marnat
mailto:marny at rambler.ru
#3 lore raw
Quoted 5 lines · In message <[email protected]> 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.

Quoted 1 line

ncip=$(serverip)?

What is the supposed function of this?

Quoted 2 lines

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

Signature · 5 lines
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.
#4 lore raw

Hello Wolfgang,

WD> If you define
WD> => setenv ncip ${serverip}
WD> you will set the "ncip" variable to the current value of your serverip WD> variable. If you want to delay this substitution, you could for

You are definitely right. I should have use 'setenv ncip ${serverip}'.

Thank you for your reply,
Best regards,
Igor Marnat
mailto:marny at rambler.ru