Commit 34bd23e42f3ba9b7fb333a29ea36e9a73b608b8e

Authored by Rob Herring
Committed by Wolfgang Denk
1 parent 90ba7d7c44

pxe: parse initrd file from append string

For syslinux, the initrd can be set in the append string as
"initrd=<file>", so try to find it there if we haven't already set the
initrd.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>

Showing 2 changed files with 14 additions and 4 deletions Side-by-side Diff

... ... @@ -999,6 +999,7 @@
999 999 static int parse_label(char **c, struct pxe_menu *cfg)
1000 1000 {
1001 1001 struct token t;
  1002 + int len;
1002 1003 char *s = *c;
1003 1004 struct pxe_label *label;
1004 1005 int err;
1005 1006  
... ... @@ -1033,10 +1034,22 @@
1033 1034  
1034 1035 case T_APPEND:
1035 1036 err = parse_sliteral(c, &label->append);
  1037 + if (label->initrd)
  1038 + break;
  1039 + s = strstr(label->append, "initrd=");
  1040 + if (!s)
  1041 + break;
  1042 + s += 7;
  1043 + len = (int)(strchr(s, ' ') - s);
  1044 + label->initrd = malloc(len + 1);
  1045 + strncpy(label->initrd, s, len);
  1046 + label->initrd[len] = '\0';
  1047 +
1036 1048 break;
1037 1049  
1038 1050 case T_INITRD:
1039   - err = parse_sliteral(c, &label->initrd);
  1051 + if (!label->initrd)
  1052 + err = parse_sliteral(c, &label->initrd);
1040 1053 break;
1041 1054  
1042 1055 case T_LOCALBOOT:
... ... @@ -224,9 +224,6 @@
224 224 - U-boot's pxe expects U-boot uimg's as kernels. Anything that would work
225 225 with the 'bootm' command in U-boot could work with the 'pxe boot' command.
226 226  
227   -- U-boot's pxe doesn't recognize initrd options in the append command - you
228   - must specify initrd files using the initrd command.
229   -
230 227 - U-boot's pxe only recognizes a single file on the initrd command line. It
231 228 could be extended to support multiple.
232 229