[U-Boot-Users] how to enable if, then command support in uboot

1,862 views
Skip to first unread message

Gururaja Hebbar K R

unread,
Mar 28, 2008, 6:01:08 AM3/28/08
to u-boot...@lists.sourceforge.net
Hi all,

I am trying to execute some commands stored in environment as below

#define CONFIG_EXTRA_ENV_SETTINGS \
"boot_mmc="
\
"if mmcinit && " \
"fatload mmc 0 ${ramfs_addr} ${ramfs_file} && "
\
"fatload mmc 0 ${loadaddr} ${bootfile}; "
\
"then " \
"run ramargs fixedip addtty set_ramfs;"
\
"setenv bootargs ${bootargs} ${othbootargs};"
\
"bootm ${loadaddr}" \
"fi\0" \


My board config is as below

<snip>
<snip>

/*
* Command line configuration. *
*/
#include <config_cmd_default.h>

#if defined(CONFIG_MMC)

/* User serviceable stuff */
#define CONFIG_DOS_PARTITION 1

#define CONFIG_CMD_MMC
//#define CONFIG_CMD_EXT2
#define CONFIG_CMD_FAT
#endif

#undef CONFIG_CMD_AUTOSCRIPT
#undef CONFIG_CMD_CONSOLE
#undef CONFIG_CMD_ECHO
#undef CONFIG_CMD_FPGA
#undef CONFIG_CMD_IMLS
#undef CONFIG_CMD_ITEST
#undef CONFIG_CMD_LOADS
#undef CONFIG_CMD_MISC
#undef CONFIG_CMD_SETGETDCR
#undef CONFIG_CMD_XIMG

#define CONFIG_BOOTDELAY 3 /* autoboot after 3
seconds */
#define CONFIG_BOOTCOMMAND "run rom_boot"
#undef CONFIG_BOOTARGS /* the boot command will set
bootargs */
#define CONFIG_TIMESTAMP /* Print image info with
timestamp */


fom the command console when i type

uboot #> if
Unknown command 'if' - try 'help'
LC69 #> run boot_mmc
Unknown command 'if' - try 'help'
Unknown command 'then' - try 'help'
## Booting image at 0300000f ...
Bad Magic Number
uboot #>


Kindly let me know what i need to enable for this to work.

Thanks in advance

Regards
Gururaja

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
U-Boot-Users mailing list
U-Boot...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Gururaja Hebbar K R

unread,
Mar 28, 2008, 6:06:39 AM3/28/08
to u-boot...@lists.sourceforge.net

add missing info

Uboot version : 1.3.1
for ARM926EJS processor based board
using arm toolchain from CodeSourcery

Regards
Gururaja

Markus Klotzbücher

unread,
Mar 28, 2008, 6:07:47 AM3/28/08
to Gururaja Hebbar K R, u-boot...@lists.sourceforge.net
"Gururaja Hebbar K R" <gurur...@sanyo.co.in> writes:

> I am trying to execute some commands stored in environment as below
>
> #define CONFIG_EXTRA_ENV_SETTINGS \
> "boot_mmc="
> \
> "if mmcinit && " \

...

> Kindly let me know what i need to enable for this to work.

Search the README for CFG_HUSH_PARSER

Best regards

Markus Klotzbuecher

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: off...@denx.de

Gururaja Hebbar K R

unread,
Mar 28, 2008, 6:37:55 AM3/28/08
to Markus Klotzbücher, u-boot...@lists.sourceforge.net
Hi Markus Klotzbuecher,

i did and enabled,

/*
* Miscellaneous configurable options
*/
#define CFG_HUSH_PARSER 1
#define CFG_PROMPT_HUSH_PS2 "> "

#ifdef CFG_HUSH_PARSER
#define CFG_PROMPT "uboot$ " /* Monitor Command Prompt */
#else
#define CFG_PROMPT "#> " /* Monitor Command Prompt */
#endif

#define CFG_LONGHELP 1 /* undef to save memory */


<snip>
<snip>
<snip>

#define CONFIG_EXTRA_ENV_SETTINGS \
"boot_mmc=" \
"if mmcinit && " \

"fatload mmc 0 ${ramfs_addr} ${ramfs_file} && " \
"fatload mmc 0 ${loadaddr} ${bootfile}; " \
"then " \
"run ramargs fixedip addtty set_ramfs;" \
"setenv bootargs ${bootargs} ${othbootargs};" \
"bootm ${loadaddr}" \
"fi\0" \

<snip>
<snip>
<snip>
<snip>


and now when i execute the command as

uboot$ run boot_mmc
syntax error

uboot$ printenv
<snip>
<snip>
<snip>
boot_mmc=if mmcinit && fatload mmc 0 ${ramfs_addr} ${ramfs_file} && fatload mmc 0 ${loadaddr} ${bootfile


}; then run ramargs fixedip addtty set_ramfs;setenv bootargs ${bootargs} ${othbootargs};bootm ${loadaddr}fi

stdin=serial
<snip>
<snip>
<snip>

even from command line if i give

uboot$ if mmcinit then echo fi
>

i get above option

now i hvae to press ctrl+c to interrupt and come back to prompt

> <INTERRUPT>
uboot$ if mmcinit then echo fi
> <INTERRUPT>
uboot$


kindly let me know how to solve this.

thanks in advance

Regards
Gururaja

Markus Klotzbücher

unread,
Mar 28, 2008, 7:07:22 AM3/28/08
to Gururaja Hebbar K R, u-boot...@lists.sourceforge.net

"Gururaja Hebbar K R" <gurur...@sanyo.co.in> writes:

>
> #define CONFIG_EXTRA_ENV_SETTINGS \
> "boot_mmc=" \
> "if mmcinit && " \
> "fatload mmc 0 ${ramfs_addr} ${ramfs_file} && " \
> "fatload mmc 0 ${loadaddr} ${bootfile}; " \
> "then " \
> "run ramargs fixedip addtty set_ramfs;" \
> "setenv bootargs ${bootargs} ${othbootargs};" \
> "bootm ${loadaddr}" \
> "fi\0" \

I think you forgot a semicolon before the "fi" or respectively after the
"bootm ${loadaddr}"

Please also check out the excellent documentation:

http://www.denx.de/wiki/view/DULG/CommandLineParsing#Section_14.2.11.2.

Wolfgang Denk

unread,
Mar 28, 2008, 10:24:41 AM3/28/08
to Gururaja Hebbar K R, u-boot...@lists.sourceforge.net
In message <5BF78BCE8D9BF14A83F...@blrms.slti.sanyo.co.in> you wrote:
>
> even from command line if i give
>
> uboot$ if mmcinit then echo fi
>
> i get above option
> now i hvae to press ctrl+c to interrupt and come back to prompt
...

> kindly let me know how to solve this.

Maybe you should learn shell syntax ?

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
... The things love can drive a man to -- the ecstasies, the mise-
ries, the broken rules, the desperate chances, the glorious failures
and the glorious victories.
-- McCoy, "Requiem for Methuselah", stardate 5843.7

Reply all
Reply to author
Forward
0 new messages