mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
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@vivier.eu> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@571 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user