j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: mcayland Date: Sun Aug 1 00:46:00 2010 New Revision: 823 URL: http://tracker.coreboot.org/trac/openbios/changeset/823
Log: Fix the bootinfo loader so that it will correctly accept device strings with no partition id, e.g. load cdrom:,\path\to\file. Also add a little bootscript debugging for those people that may need it.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk
Modified: trunk/openbios-devel/libopenbios/bootinfo_load.c
Modified: trunk/openbios-devel/libopenbios/bootinfo_load.c ============================================================================== --- trunk/openbios-devel/libopenbios/bootinfo_load.c Sun Jul 25 19:34:13 2010 (r822) +++ trunk/openbios-devel/libopenbios/bootinfo_load.c Sun Aug 1 00:46:00 2010 (r823) @@ -43,20 +43,28 @@ return buf; }
-static int +static char * get_partition( const char *path ) { + static char buf[2]; + + buf[0] = '\0'; + buf[1] = '\0'; + while ( *path && *path != ':' ) path++;
if (!*path) - return -1; + return buf; path++;
- if (!strchr(path, ',')) /* check if there is a ',' */ - return -1; + if (path[0] == ',' || !strchr(path, ',')) /* if there is not a ',' or no partition id then return */ + return buf;
- return atol(path); + /* Must be a partition id */ + buf[0] = path[0]; + + return buf; }
static char * @@ -128,8 +136,7 @@ phandle_t chosen; int tag, taglen, script, scriptlen, scriptvalid, entity, chrp; char tagbuf[128], c; - char *device, *filename, *directory; - int partition; + char *device, *filename, *directory, *partition; int current, size; char *bootscript; char *tmp; @@ -220,11 +227,8 @@ strcpy(bootscript + scriptlen, device); scriptlen += strlen(device); } else if (strncasecmp(tagbuf, "partition", 9) == 0) { - if (partition != -1) - sprintf(bootscript + scriptlen, "%d", partition); - else - *(bootscript + scriptlen) = 0; - scriptlen = strlen(bootscript); + strcpy(bootscript + scriptlen, partition); + scriptlen += strlen(partition); } else if (strncasecmp(tagbuf, "directory", 9) == 0) { strcpy(bootscript + scriptlen, directory); scriptlen += strlen(directory); @@ -249,8 +253,10 @@ }
/* If the payload is bootinfo then we execute it immediately */ - if (scriptvalid) + if (scriptvalid) { + DPRINTF("bootscript: %s\n", bootscript); feval(bootscript); + } else DPRINTF("Unable to parse bootinfo bootscript\n"); }