Skip to content

Commit 5d2e57e

Browse files
committed
ODROID-XU4 : serach logic add for boot.ini file.
boot.ini file serach sequence. fatload mmc 0:1 / -> ext4load mmc 0:1 / -> ext4load mmc 0:1 /boot/ -> ext4load mmc 0:2 / -> ext4load mmc 0:2 /boot/
1 parent d0752a9 commit 5d2e57e

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

cmd/cfgload.c

100644100755
Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,33 @@ static int valid_command(const char* p)
4747
*/
4848
static 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

Comments
 (0)