U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] macro substitution - can someone explain please
@ 2009-10-23 12:25 David Collier
  2009-10-26  7:44 ` javier Martin
  2009-10-26  8:13 ` Mike Frysinger
  0 siblings, 2 replies; 4+ messages in thread
From: David Collier @ 2009-10-23 12:25 UTC (permalink / raw)
  To: u-boot

If I put the following line in my board.h file

#define CONFIG_RAMBOOTCOMMAND						\
  "ping ${serverip} && tftp && bootm ${fileaddr}"

then when I do PRINTENV I see

ramboot=ping ${serverip} && tftp && bootm 0x10400000

so clearly at some point the text ${fileaddr} has been substituted,
whereas ${serverip} hasn't

If I retype the line at the command prompt, the ${fileaddr} appears as I
wished, so it must be happening diring compile and so on.

Can anyone explain, and/or can anyone tell me how to get the effect I
wanted.
  
  
David Collier

www.dexdyne.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] macro substitution - can someone explain please
  2009-10-23 12:25 [U-Boot] macro substitution - can someone explain please David Collier
@ 2009-10-26  7:44 ` javier Martin
  2009-10-26  8:11   ` Mike Frysinger
  2009-10-26  8:13 ` Mike Frysinger
  1 sibling, 1 reply; 4+ messages in thread
From: javier Martin @ 2009-10-26  7:44 UTC (permalink / raw)
  To: u-boot

I have a similar problem. In my environment:

bootcmd=cp.b c0040000 ${loadaddr} 280000;bootm ${loadaddr}
mtdparts=mtdparts=mxc_nor_flash.0:256k(U-Boot),2560k(kernel),29312k(rootfs),512k(config),128k(env1)
bootargs=noinitrd console=ttymxc0,115200 root=/dev/mtdblock2
init=linuxrc rw ${mtdparts}

But when I execute 'run bootm', kernel boots but "mtdparts" variable
is not substituted in kernel command line:

Uncompressing Linux..............................................................................................................
done, booting the kernel.
[    0.000000] Linux version 2.6.22.6-gb5e710ce-dirty (javier at acuario)
(gcc version 4.1.2) #219 PREEMPT Fri Oct 23 18:12:58 CEST 2009
[    0.000000] CPU: ARM926EJ-S [41069264] revision 4 (ARMv5TEJ), cr=00053177
[    0.000000] Machine: Freescale i.MX27ADS
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] CPU0: D VIVT write-back cache
[    0.000000] CPU0: I cache: 16384 bytes, associativity 4, 32 byte
lines, 128 sets
[    0.000000] CPU0: D cache: 16384 bytes, associativity 4, 32 byte
lines, 128 sets
[    0.000000] Built 1 zonelists.  Total pages: 16256
[    0.000000] Kernel command line: noinitrd console=ttymxc0,115200
root=/dev/mtdblock2 init=linuxrc rw ${mtdparts}

As stated in README file, global variables should be able to be
accessed through ${ } symbols. Is this also valid inside "bootargs"
variable?

-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] macro substitution - can someone explain please
  2009-10-26  7:44 ` javier Martin
@ 2009-10-26  8:11   ` Mike Frysinger
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2009-10-26  8:11 UTC (permalink / raw)
  To: u-boot

On Monday 26 October 2009 03:44:41 javier Martin wrote:
> I have a similar problem. In my environment:
> 
> bootcmd=cp.b c0040000 ${loadaddr} 280000;bootm ${loadaddr}
> mtdparts=mtdparts=mxc_nor_flash.0:256k(U-Boot),2560k(kernel),29312k(rootfs)
> ,512k(config),128k(env1) bootargs=noinitrd console=ttymxc0,115200
>  root=/dev/mtdblock2
> init=linuxrc rw ${mtdparts}
> 
> But when I execute 'run bootm', kernel boots but "mtdparts" variable
> is not substituted in kernel command line:

i dont think your issue is the same as David's.  you need to force expansion 
of the variable yourself.
set bootcmd "run do_args; run do_boot"
set do_args "set init linuxrc rw ${mtdparts}"
set do_boot "cp.b c0040000 ${loadaddr} 280000;bootm ${loadaddr}"
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091026/f70df714/attachment.pgp 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] macro substitution - can someone explain please
  2009-10-23 12:25 [U-Boot] macro substitution - can someone explain please David Collier
  2009-10-26  7:44 ` javier Martin
@ 2009-10-26  8:13 ` Mike Frysinger
  1 sibling, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2009-10-26  8:13 UTC (permalink / raw)
  To: u-boot

On Friday 23 October 2009 08:25:00 David Collier wrote:
> If I put the following line in my board.h file
> 
> #define CONFIG_RAMBOOTCOMMAND						\
>   "ping ${serverip} && tftp && bootm ${fileaddr}"

start with the binary.  run `strings` on your u-boot.bin (or whatever you're 
using) and see what ramboot is set to.

> then when I do PRINTENV I see
> 
> ramboot=ping ${serverip} && tftp && bootm 0x10400000
> 
> so clearly at some point the text ${fileaddr} has been substituted,
> whereas ${serverip} hasn't
> 
> If I retype the line at the command prompt, the ${fileaddr} appears as I
> wished, so it must be happening diring compile and so on.

i doubt variable expansion is happening during compile.  it isnt like gcc 
knows how to expand shell variables in C code.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091026/b142f35c/attachment.pgp 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-26  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-23 12:25 [U-Boot] macro substitution - can someone explain please David Collier
2009-10-26  7:44 ` javier Martin
2009-10-26  8:11   ` Mike Frysinger
2009-10-26  8:13 ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox