Skip to contentSkip to conversation

how to enable if, then command support in uboot

U-Boot-Users Gururaja Hebbar K R 3 participants 6 messages Mar 28, 2008 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): mailman.51200.1206425993.31037.u-boot-users@lists.sourceforge.net

#1 lore raw

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

#2 lore raw
Quoted 6 lines · Gururaja Hebbar K R

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

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

...

Quoted 1 line

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: office at denx.de

#3 lore raw

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

Quoted 1 line

i get above option

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

Quoted 1 line

<INTERRUPT>

uboot$ if mmcinit then echo fi

Quoted 1 line

<INTERRUPT>

uboot$

kindly let me know how to solve this.

thanks in advance

Regards
Gururaja

-----Original Message-----
From: Markus Klotzb?cher [mailto:mk at denx.de]
Sent: Friday, March 28, 2008 3:08 AM
To: Gururaja Hebbar K R
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [U-Boot-Users] how to enable if, then command support in uboot

Quoted 6 lines · Gururaja Hebbar K R

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

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

...

Quoted 1 line

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: office at denx.de

#4 lore raw
Quoted 11 lines · Gururaja Hebbar K R
#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.

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: office at denx.de

#5 lore raw
In reply to Gururaja Hebbar K R
Quoted 7 lines · In message <[email protected]> you…

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

...

Quoted 1 line

kindly let me know how to solve this.

Maybe you should learn shell syntax ?

Best regards,

Wolfgang Denk

Signature · 7 lines
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: wd at 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
#6 lore raw
In reply to a message not in the archive

add missing info

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

Regards
Gururaja

-----Original Message-----
From: Gururaja Hebbar K R
Sent: Friday, March 28, 2008 6:37 PM
To: 'u-boot-users at lists.sourceforge.net'
Subject: how to enable if, then command support in uboot

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