[OpenBIOS] r544 - trunk/openbios-devel/arch/ppc/qemu
svn at openbios.org
svn at openbios.org
Mon Aug 10 21:50:04 CEST 2009
Author: laurent
Date: 2009-08-10 21:50:04 +0200 (Mon, 10 Aug 2009)
New Revision: 544
Modified:
trunk/openbios-devel/arch/ppc/qemu/main.c
Log:
try_chrp_script() now accepts a third parameter which indicates the
script to be loaded and parsed. It will also terminate parsing on
the '</chrp-boot>' tag, which makes locating embedded data after
the script easier.
Signed-off-by: Steven Noonan <steven at uplinklabs.net>
(laurent: remove XCOFF placeholder)
Modified: trunk/openbios-devel/arch/ppc/qemu/main.c
===================================================================
--- trunk/openbios-devel/arch/ppc/qemu/main.c 2009-08-08 22:42:52 UTC (rev 543)
+++ trunk/openbios-devel/arch/ppc/qemu/main.c 2009-08-10 19:50:04 UTC (rev 544)
@@ -223,21 +223,21 @@
http://playground.sun.com/1275/bindings/chrp/chrp1_7a.ps
*/
static void
-try_bootinfo(const char *path, const char *param)
+try_chrp_script(const char *of_path, const char *param, const char *script_path)
{
int fd, len, tag, taglen, script, scriptlen, entity;
char tagbuf[256], bootscript[256], c;
char *device, *filename, *directory;
int partition;
- device = get_device(path);
- partition = get_partition(path);
- filename = get_filename(path, &directory);
+ device = get_device(of_path);
+ partition = get_partition(of_path);
+ filename = get_filename(of_path, &directory);
/* read boot script */
- snprintf(bootscript, sizeof(bootscript), "%s:%d,ppc\\bootinfo.txt",
- device, partition);
+ snprintf(bootscript, sizeof(bootscript), "%s:%d,%s",
+ device, partition, script_path);
ELF_DPRINTF("Trying %s\n", bootscript);
if ((fd = open_io(bootscript)) == -1) {
@@ -267,10 +267,10 @@
tagbuf[taglen] = '\0';
if (strcasecmp(tagbuf, "boot-script") == 0)
script = 1;
- else if (strcasecmp(tagbuf, "/boot-script") == 0) {
+ else if (strcasecmp(tagbuf, "/boot-script") == 0)
bootscript[scriptlen] = '\0';
- break;
- }
+ else if (strcasecmp(tagbuf, "/chrp-boot") == 0)
+ break;
} else if (tag && taglen < sizeof(tagbuf)) {
tagbuf[taglen++] = c;
} else if (script && c == '&') {
@@ -292,8 +292,8 @@
strcpy(bootscript + scriptlen, filename);
scriptlen += strlen(filename);
} else if (strcasecmp(tagbuf, "full-path") == 0) {
- strcpy(bootscript + scriptlen, path);
- scriptlen += strlen(path);
+ strcpy(bootscript + scriptlen, of_path);
+ scriptlen += strlen(of_path);
} else { /* unknown, keep it */
bootscript[scriptlen] = '&';
strcpy(bootscript + scriptlen + 1, tagbuf);
@@ -310,7 +310,7 @@
ELF_DPRINTF("got bootscript %s\n", bootscript);
- encode_bootpath(path, param);
+ encode_bootpath(of_path, param);
feval(bootscript);
badf:
@@ -386,7 +386,8 @@
static void
yaboot_startup( void )
{
- static const char * const paths[] = { "hd:2,\\ofclient", "hd:2,\\yaboot" };
+ static const char * const chrp_paths[] = { "ppc\\bootinfo.txt", "System\\Library\\CoreServices\\BootX" };
+ static const char * const elf_paths[] = { "hd:2,\\ofclient", "hd:2,\\yaboot" };
static const char * const args[] = { "", "conf=hd:2,\\yaboot.conf" };
char *path = pop_fstr_copy(), *param;
int i;
@@ -420,7 +421,9 @@
param = pop_fstr_copy();
}
try_path(path, param);
- try_bootinfo(path, param);
+ for( i=0; i < sizeof(chrp_paths) / sizeof(chrp_paths[0]); i++ ) {
+ try_chrp_script(path, param, chrp_paths[i]);
+ }
} else {
uint16_t boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE);
switch (boot_device) {
@@ -432,15 +435,19 @@
path = strdup("cd:0");
break;
}
- try_bootinfo(path, NULL);
+ for( i=0; i < sizeof(chrp_paths) / sizeof(chrp_paths[0]); i++ ) {
+ try_chrp_script(path, param, chrp_paths[i]);
+ }
}
} else {
ELF_DPRINTF("Entering boot, path %s\n", path);
try_path(path, param);
- try_bootinfo(path, param);
+ for( i=0; i < sizeof(chrp_paths) / sizeof(chrp_paths[0]); i++ ) {
+ try_chrp_script(path, param, chrp_paths[i]);
+ }
}
- for( i=0; i < sizeof(paths) / sizeof(paths[0]); i++ ) {
- try_path(paths[i], args[i]);
+ for( i=0; i < sizeof(elf_paths) / sizeof(elf_paths[0]); i++ ) {
+ try_path(elf_paths[i], args[i]);
}
printk("*** Boot failure! No secondary bootloader specified ***\n");
}
More information about the OpenBIOS
mailing list