Le 3 févr. 09 à 14:27, Stefan Assmann a écrit :
Subject: ppc correctly replace &device; and &partition;
This patch correctly replaces the variables &device; and &partition; with firmware values thus allowing to boot from different partitions.
Signed-off-by: Stefan Assmann sassmann@suse.de
Index: arch/ppc/qemu/main.c
--- arch/ppc/qemu/main.c (revision 439) +++ arch/ppc/qemu/main.c (working copy) @@ -154,9 +154,9 @@ static void try_bootinfo(const char *path) {
- int fd;
- char tagbuf[256], bootscript[256], c, *left, *right;
- int len, tag, taglen, script, scriptlen;
int fd, len, tag, taglen, script, scriptlen;
char tagbuf[256], bootscript[256], c;
char *buf, *partition;
snprintf(bootscript, sizeof(bootscript), "%s,ppc\bootinfo.txt",
path); ELF_DPRINTF("Trying %s\n", bootscript); @@ -195,22 +195,33 @@ bootscript[scriptlen++] = c; } } while (1);
ELF_DPRINTF("got bootscript %s\n", bootscript);
// Replace &device;: with original path
push_str(bootscript);
PUSH('&');
fword("left-split");
fword("2swap");
PUSH(':');
fword("left-split");
fword("2drop");
right = pop_fstr_copy();
left = pop_fstr_copy();
while (right[0] != '\' && right[0] != '\0')
right++;
snprintf(bootscript, sizeof(bootscript), "%s%s,%s", left, path,
right);
- /* replace &device; and &partition; */
- if ( (buf = strstr(bootscript, (const char *) "&device;")) !=
NULL ) {
buf[0] = '\0';
buf += strlen("&device;");
snprintf(bootscript, sizeof(bootscript), "%s%s%s",
bootscript, path, buf);
what happens if strlen(path) > strlen("&device;") ? moreover device is not path, but path is "device:partition"
- }
- if ( (partition = strchr(path, ':')) != NULL ) {
*partition = '\0';
partition++;
if ( (buf = strstr(bootscript, (const char *)
"&partition;")) != NULL ) {
*buf = '\0';
buf += strlen("&partition;");
snprintf(bootscript, sizeof(bootscript), "%s%s%s",
bootscript, partition, buf);
what happens if strlen(partition) > strlen("&partition;") ?
} else {
/* FIXME: allow booting of SUSE media with following
layout (fails without this workaround)
* Number Start End Size File system
Name Flags
* 1 512B 1535B 1024B
Apple , , , , , , , , , , , , type=Apple_partition_map
* 2 8192B 4126MB 4126MB
SU1110.001 , , , , , , , , , , , , type=Apple_HFS
*/
if ( (buf = strstr(bootscript, (const char *) "1,\
\suseboot\yaboot.ibm")) != NULL ) {
what it is wrong here is we try to read a file from partition 1 which is the partition map... I guess we should write a "modules/iso9660-parts.c" to override this (as macintosh CD are hybrid: ISO9660 and HFS).
Something like that seems to work:
Index: openbios-devel/modules/disk-label.c =================================================================== --- openbios-devel.orig/modules/disk-label.c 2009-02-04 12:51:53.000000000 +0100 +++ openbios-devel/modules/disk-label.c 2009-02-04 12:56:51.000000000 +0100 @@ -78,6 +78,19 @@ } }
+ /* try to see if there is a filesystem without partition */ + + PUSH_ih( my_self() ); + selfword("find-filesystem"); + ph = POP_ph(); + if( ph ) { + push_str( filename ); + PUSH_ph( ph ); + fword("interpose"); + success = 1; + goto out; + } + /* find partition handler */ seek_io( fd, 0 ); if( read_io(fd, block0, sizeof(block0)) != sizeof(block0) )
Laurent Vivier wrote:
Le 3 févr. 09 à 14:27, Stefan Assmann a écrit :
Subject: ppc correctly replace &device; and &partition;
This patch correctly replaces the variables &device; and &partition; with firmware values thus allowing to boot from different partitions.
Signed-off-by: Stefan Assmann sassmann@suse.de
Index: arch/ppc/qemu/main.c
--- arch/ppc/qemu/main.c (revision 439) +++ arch/ppc/qemu/main.c (working copy) @@ -154,9 +154,9 @@ static void try_bootinfo(const char *path) {
- int fd;
- char tagbuf[256], bootscript[256], c, *left, *right;
- int len, tag, taglen, script, scriptlen;
int fd, len, tag, taglen, script, scriptlen;
char tagbuf[256], bootscript[256], c;
char *buf, *partition;
snprintf(bootscript, sizeof(bootscript), "%s,ppc\bootinfo.txt",
path); ELF_DPRINTF("Trying %s\n", bootscript); @@ -195,22 +195,33 @@ bootscript[scriptlen++] = c; } } while (1);
ELF_DPRINTF("got bootscript %s\n", bootscript);
// Replace &device;: with original path
push_str(bootscript);
PUSH('&');
fword("left-split");
fword("2swap");
PUSH(':');
fword("left-split");
fword("2drop");
right = pop_fstr_copy();
left = pop_fstr_copy();
while (right[0] != '\' && right[0] != '\0')
right++;
snprintf(bootscript, sizeof(bootscript), "%s%s,%s", left, path,
right);
- /* replace &device; and &partition; */
- if ( (buf = strstr(bootscript, (const char *) "&device;")) !=
NULL ) {
buf[0] = '\0';
buf += strlen("&device;");
snprintf(bootscript, sizeof(bootscript), "%s%s%s",
bootscript, path, buf);
what happens if strlen(path) > strlen("&device;") ? moreover device is not path, but path is "device:partition"
- }
- if ( (partition = strchr(path, ':')) != NULL ) {
*partition = '\0';
partition++;
if ( (buf = strstr(bootscript, (const char *)
"&partition;")) != NULL ) {
*buf = '\0';
buf += strlen("&partition;");
snprintf(bootscript, sizeof(bootscript), "%s%s%s",
bootscript, partition, buf);
what happens if strlen(partition) > strlen("&partition;") ?
} else {
/* FIXME: allow booting of SUSE media with following
layout (fails without this workaround)
* Number Start End Size File system
Name Flags
* 1 512B 1535B 1024B
Apple , , , , , , , , , , , , type=Apple_partition_map
* 2 8192B 4126MB 4126MB
SU1110.001 , , , , , , , , , , , , type=Apple_HFS
*/
if ( (buf = strstr(bootscript, (const char *) "1,\
\suseboot\yaboot.ibm")) != NULL ) {
what it is wrong here is we try to read a file from partition 1 which is the partition map... I guess we should write a "modules/iso9660-parts.c" to override this (as macintosh CD are hybrid: ISO9660 and HFS).
Something like that seems to work:
Index: openbios-devel/modules/disk-label.c
--- openbios-devel.orig/modules/disk-label.c 2009-02-04 12:51:53.000000000 +0100 +++ openbios-devel/modules/disk-label.c 2009-02-04 12:56:51.000000000 +0100 @@ -78,6 +78,19 @@ } }
/* try to see if there is a filesystem without partition */
- PUSH_ih( my_self() );
- selfword("find-filesystem");
- ph = POP_ph();
- if( ph ) {
push_str( filename );
PUSH_ph( ph );
fword("interpose");
success = 1;
goto out;
- }
- /* find partition handler */ seek_io( fd, 0 ); if( read_io(fd, block0, sizeof(block0)) != sizeof(block0) )
Nice! I'll try that and post an updated patch.
-- OpenBIOS http://openbios.org/ Mailinglist: http://lists.openbios.org/mailman/listinfo Free your System - May the Forth be with you
Stefan
Stefan Assmann wrote:
Laurent Vivier wrote:
[snip]
} else {
/* FIXME: allow booting of SUSE media with following
layout (fails without this workaround)
* Number Start End Size File system
Name Flags
* 1 512B 1535B 1024B
Apple , , , , , , , , , , , , type=Apple_partition_map
* 2 8192B 4126MB 4126MB
SU1110.001 , , , , , , , , , , , , type=Apple_HFS
*/
if ( (buf = strstr(bootscript, (const char *) "1,\
\suseboot\yaboot.ibm")) != NULL ) {
what it is wrong here is we try to read a file from partition 1 which is the partition map... I guess we should write a "modules/iso9660-parts.c" to override this (as macintosh CD are hybrid: ISO9660 and HFS).
Something like that seems to work:
Index: openbios-devel/modules/disk-label.c
--- openbios-devel.orig/modules/disk-label.c 2009-02-04 12:51:53.000000000 +0100 +++ openbios-devel/modules/disk-label.c 2009-02-04 12:56:51.000000000 +0100 @@ -78,6 +78,19 @@ } }
/* try to see if there is a filesystem without partition */
- PUSH_ih( my_self() );
- selfword("find-filesystem");
- ph = POP_ph();
- if( ph ) {
push_str( filename );
PUSH_ph( ph );
fword("interpose");
success = 1;
goto out;
- }
- /* find partition handler */ seek_io( fd, 0 ); if( read_io(fd, block0, sizeof(block0)) != sizeof(block0) )
Nice! I'll try that and post an updated patch.
Almost there! Here comes the log I get with your patch applied. I guess it worked for you because in your test yaboot was still loaded with boot cd:0,\suseboot\yaboot.ibm
Here's my log:
============================================================= OpenBIOS 1.0RC1 [Feb 4 2009 12:04] Configuration device id QEMU version 1 machine id 2 CPUs: 1 Memory: 256M UUID: 00000000-0000-0000-0000-000000000000 CPU type PowerPC,750 ELF - yaboot_startup: Entering boot, no path ELF - try_bootinfo: Trying cd:0,ppc\bootinfo.txt os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ELF - try_bootinfo: got bootscript boot &device;:1,\suseboot\yaboot.ibm ELF - try_bootinfo: fixed bootscript boot cd:1,\suseboot\yaboot.ibm ELF - yaboot_startup: Entering boot, path cd:1,\suseboot\yaboot.ibm ELF - try_path: Trying cd:1,\suseboot\yaboot.ibm os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ELF - load_elf_rom: Loading '/suseboot/yaboot.ibm' from '' ELF - load_elf_rom: filesz: 00013947 memsz: 00023FC8 p_offset: 00010000 p_vaddr 00040000 ELF - load_elf_rom: ELF ROM-section loaded at 00040000 (size 00023FC8) ELF - load_elf_rom: filesz: 00000000 memsz: 00000000 p_offset: 00000000 p_vaddr 00000000 ELF - load_elf_rom: filesz: 0000002C memsz: 00000000 p_offset: 000000B4 p_vaddr 00000000 ELF - load_elf_rom: filesz: 00000044 memsz: 00000000 p_offset: 000000E0 p_vaddr 00000000 ELF - try_path: Transfering control to cd:1,\suseboot\yaboot.ibm ELF - transfer_control_to_elf: Starting ELF boot loader os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error os_seek failure ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error ob_ide_read_blocks: error
After that I see a message in the qemu window saying bad seek: blk 00000001 c fffffc00
Stefan