From 2db781a446c6af80460daf84eb846f795bc5b2c1 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Sat, 29 Aug 2009 15:43:00 +0000 Subject: [PATCH] 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 git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@571 f158a5a8-5612-0410-a976-696ce0be7e32 --- arch/ppc/qemu/main.c | 34 ++++++++++++---------------------- forth/admin/nvram.fs | 4 ++++ 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/arch/ppc/qemu/main.c b/arch/ppc/qemu/main.c index 1f47497..045390f 100644 --- a/arch/ppc/qemu/main.c +++ b/arch/ppc/qemu/main.c @@ -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 @@ static void 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 @@ try_chrp_script(const char *of_path, const char *param, const char *script_path) 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 @@ oldworld_boot( void ) } 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 @@ yaboot_startup( void ) } 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 @@ yaboot_startup( void ) 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,19 +426,12 @@ yaboot_startup( void ) 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]); - } - } - for( i=0; i < sizeof(elf_paths) / sizeof(elf_paths[0]); i++ ) { - try_path(elf_paths[i], args[i]); + try_chrp_script(path, param, chrp_path); } printk("*** Boot failure! No secondary bootloader specified ***\n"); } @@ -487,5 +477,5 @@ boot( void ) if (boot_device == 'c') { oldworld_boot(); } - yaboot_startup(); + newworld_boot(); } diff --git a/forth/admin/nvram.fs b/forth/admin/nvram.fs index 8efab55..e7b6d0b 100644 --- a/forth/admin/nvram.fs +++ b/forth/admin/nvram.fs @@ -365,3 +365,7 @@ no-conf-def " security-mode" secmode-config \ defers ['] fcode-debug? to _fcode-debug? ['] diag-switch? to _diag-switch? + +: release-load-area + drop +;