Author: blueswirl Date: 2008-12-25 11:38:40 +0100 (Thu, 25 Dec 2008) New Revision: 325
Modified: openbios-devel/arch/ppc/qemu/main.c openbios-devel/modules/filesystems.c openbios-devel/modules/mac-parts.c Log: Allow yaboot to read files from cdrom (Laurent Vivier)
Modified: openbios-devel/arch/ppc/qemu/main.c =================================================================== --- openbios-devel/arch/ppc/qemu/main.c 2008-12-25 10:36:19 UTC (rev 324) +++ openbios-devel/arch/ppc/qemu/main.c 2008-12-25 10:38:40 UTC (rev 325) @@ -61,10 +61,12 @@ /* the ELF-image (usually) starts at offset 0x4000 */ if( (elf_offs=find_elf(fd)) < 0 ) { ELF_DPRINTF("----> %s is not an ELF image\n", get_file_path(fd)); - exit(1); + return -1; } - if( !(phdr=elf_readhdrs(fd, elf_offs, &ehdr)) ) - fatal_error("elf_readhdrs failed\n"); + if( !(phdr=elf_readhdrs(fd, elf_offs, &ehdr)) ) { + ELF_DPRINTF("elf_readhdrs failed\n"); + return -1; + }
*elf_entry = ehdr.e_entry;
@@ -89,8 +91,10 @@ fatal_error("Claim failed!\n");
addr = (char*)phdr[i].p_vaddr; - if( read_io(fd, addr, s) != s ) - fatal_error("read failed\n"); + if( read_io(fd, addr, s) != s ) { + ELF_DPRINTF("read failed\n"); + return -1; + }
flush_icache_range( addr, addr+s );
@@ -116,14 +120,16 @@ try_path(const char *path, const char *param) { ulong elf_entry; - int fd; + int fd, ret;
ELF_DPRINTF("Trying %s %s\n", path, param); if ((fd = open_io(path)) == -1) { ELF_DPRINTF("Can't open %s\n", path); return; } - (void) load_elf_rom( &elf_entry, fd ); + ret = load_elf_rom( &elf_entry, fd ); + if (ret < 0) + return; close_io( fd ); encode_bootpath( path, param );
@@ -258,8 +264,8 @@ POP(); param = pop_fstr_copy(); } + try_path(path, param); try_bootinfo(path); - try_path(path, param); } else { char boot_device = nvram_read(0x34);
Modified: openbios-devel/modules/filesystems.c =================================================================== --- openbios-devel/modules/filesystems.c 2008-12-25 10:36:19 UTC (rev 324) +++ openbios-devel/modules/filesystems.c 2008-12-25 10:38:40 UTC (rev 325) @@ -256,6 +256,12 @@ }
static void +files_block_size( files_info_t *dummy ) +{ + PUSH(512); +} + +static void files_initializer( files_info_t *dummy ) { fword("register-fs-package"); @@ -269,6 +275,7 @@ { "write", files_write }, { "seek", files_seek }, { "tell", files_tell }, + { "block-size", files_block_size },
/* special */ { "reopen", files_reopen },
Modified: openbios-devel/modules/mac-parts.c =================================================================== --- openbios-devel/modules/mac-parts.c 2008-12-25 10:36:19 UTC (rev 324) +++ openbios-devel/modules/mac-parts.c 2008-12-25 10:38:40 UTC (rev 325) @@ -55,7 +55,7 @@ free( str ); } if( parnum < 0 ) - parnum = 1; + parnum = 0;
DPRINTF("macparts_open %d\n", parnum); SEEK( 0 );