Author: laurent
Date: 2009-08-29 17:43:00 +0200 (Sat, 29 Aug 2009)
New Revision: 571
Modified:
trunk/openbios-devel/arch/ppc/qemu/main.c
trunk/openbios-devel/forth/admin/nvram.fs
Log:
Replace yaboot_startup() by newworld_boot() which implements generic
CHRP boot method.
It finds the CHRP bootscript using the file attribute 'tbxi' and
the blessed directory.
This method allows to boot easily Fedora (the bitness detection is done
by the script and yaboot is called with the according yaboot.conf) but
openSUSE is broken (you have to use "boot cd:,\suseboot\yaboot")
Debian works well (as usual...).
The openSUSE needs the missing forth words: "load" and "go".
The MacOS bootloader (BootX) is also loaded automatically but forth
script is too complex to be executed correctly.
Signed-off-by: Laurent Vivier <Laurent(a)vivier.eu>
Modified: trunk/openbios-devel/arch/ppc/qemu/main.c
===================================================================
--- trunk/openbios-devel/arch/ppc/qemu/main.c 2009-08-29 15:24:49 UTC (rev 570)
+++ trunk/openbios-devel/arch/ppc/qemu/main.c 2009-08-29 15:43:00 UTC (rev 571)
@@ -36,7 +36,7 @@
#endif
#define CHRP_DPRINTF(fmt, args...) SUBSYS_DPRINTF("CHRP", fmt, ##args)
#define ELF_DPRINTF(fmt, args...) SUBSYS_DPRINTF("ELF", fmt, ##args)
-#define YABOOT_DPRINTF(fmt, args...) SUBSYS_DPRINTF("YABOOT", fmt, ##args)
+#define NEWWORLD_DPRINTF(fmt, args...) SUBSYS_DPRINTF("NEWWORLD", fmt, ##args)
static void
transfer_control_to_elf( ulong elf_entry )
@@ -236,7 +236,7 @@
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 tagbuf[256], bootscript[2048], c;
char *device, *filename, *directory;
int partition;
@@ -244,6 +244,8 @@
partition = get_partition(of_path);
filename = get_filename(of_path, &directory);
+ CHRP_DPRINTF("device %s partition %d filename %s\n", device, partition, filename);
+
/* read boot script */
if (partition == -1)
@@ -378,13 +380,10 @@
}
static void
-yaboot_startup( void )
+newworld_boot( void )
{
- 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" };
+ static const char * const chrp_path = "\\\\:tbxi" ;
char *path = pop_fstr_copy(), *param;
- int i;
param = strchr(path, ' ');
if (param) {
@@ -393,7 +392,7 @@
}
if (!path) {
- YABOOT_DPRINTF("Entering boot, no path\n");
+ NEWWORLD_DPRINTF("Entering boot, no path\n");
push_str("boot-device");
push_str("/options");
fword("(find-dev)");
@@ -415,9 +414,7 @@
param = pop_fstr_copy();
}
try_path(path, param);
- for( i=0; i < sizeof(chrp_paths) / sizeof(chrp_paths[0]); i++ ) {
- try_chrp_script(path, param, chrp_paths[i]);
- }
+ try_chrp_script(path, param, chrp_path);
} else {
uint16_t boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE);
switch (boot_device) {
@@ -429,20 +426,13 @@
path = strdup("cd:");
break;
}
- for( i=0; i < sizeof(chrp_paths) / sizeof(chrp_paths[0]); i++ ) {
- try_chrp_script(path, param, chrp_paths[i]);
- }
+ try_chrp_script(path, param, chrp_path);
}
} else {
- YABOOT_DPRINTF("Entering boot, path %s\n", path);
+ NEWWORLD_DPRINTF("Entering boot, path %s\n", path);
try_path(path, param);
- for( i=0; i < sizeof(chrp_paths) / sizeof(chrp_paths[0]); i++ ) {
- try_chrp_script(path, param, chrp_paths[i]);
- }
+ try_chrp_script(path, param, chrp_path);
}
- 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");
}
@@ -487,5 +477,5 @@
if (boot_device == 'c') {
oldworld_boot();
}
- yaboot_startup();
+ newworld_boot();
}
Modified: trunk/openbios-devel/forth/admin/nvram.fs
===================================================================
--- trunk/openbios-devel/forth/admin/nvram.fs 2009-08-29 15:24:49 UTC (rev 570)
+++ trunk/openbios-devel/forth/admin/nvram.fs 2009-08-29 15:43:00 UTC (rev 571)
@@ -365,3 +365,7 @@
\ defers
['] fcode-debug? to _fcode-debug?
['] diag-switch? to _diag-switch?
+
+: release-load-area
+ drop
+;