@@ -47,18 +47,33 @@ static int valid_command(const char* p)
4747 */
4848static char * read_cfgload (void )
4949{
50- char cmd [128 ];
50+ char msg [128 ] = { 0 , } ;
5151 unsigned long filesize ;
5252 char * p ;
5353
5454 p = (char * )simple_strtoul (getenv ("loadaddr" ), NULL , 16 );
55- if (NULL == p )
55+ if (NULL == p ) {
5656 p = (char * )CONFIG_SYS_LOAD_ADDR ;
57+ sprintf (msg , "%x" , CONFIG_SYS_LOAD_ADDR );
58+ setenv ("loadaddr" , msg );
59+ }
5760
5861 setenv ("filesize" , "0" );
59-
60- sprintf (cmd , "fatload mmc 0:1 0x%p boot.ini" , (void * )p );
61- run_command (cmd , 0 );
62+ sprintf (msg , "cfgload addr = 0x%08X, Loading boot.ini from " ,
63+ simple_strtoul (getenv ("loadaddr" ), NULL , 16 ));
64+
65+ setenv ("msgload" , msg );
66+ run_command ("if fatload mmc 0:1 ${loadaddr} boot.ini;" \
67+ " then echo ${msgload} FAT;" \
68+ " else if ext4load mmc 0:1 ${loadaddr} /boot.ini;" \
69+ " then echo ${msgload} ext4 0:1 /boot.ini;" \
70+ " else if ext4load mmc 0:1 ${loadaddr} /boot/boot.ini;" \
71+ " then echo ${msgload} ext4 0:1 /boot/boot.ini;" \
72+ " else if ext4load mmc 0:2 ${loadaddr} /boot/boot.ini;" \
73+ " then echo ${msgload} ext4 0:2 /boot.ini;" \
74+ " else if ext4load mmc 0:2 ${loadaddr} /boot.ini;" \
75+ " then echo ${msgload} ext4 0:2 /boot/boot.ini;" \
76+ " fi;fi;fi;fi;fi;" , 0 );
6277
6378 filesize = getenv_ulong ("filesize" , 16 , 0 );
6479 if (0 == filesize ) {
@@ -70,7 +85,7 @@ static char* read_cfgload(void)
7085 printf ("boot.ini: 'boot.ini' exceeds %d, size=%ld\n" ,
7186 SZ_BOOTINI , filesize );
7287 return NULL ;
73- }
88+ }
7489
7590 /* Terminate the read buffer with '\0' to be treated as string */
7691 * (char * )(p + filesize ) = '\0' ;
0 commit comments