j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: blueswirl Date: 2008-12-01 19:04:16 +0100 (Mon, 01 Dec 2008) New Revision: 278
Modified: openbios-devel/arch/sparc32/aoutload.c openbios-devel/arch/sparc32/boot.c openbios-devel/arch/sparc32/boot.h openbios-devel/arch/sparc32/romvec.c Log: Fix NetBSD booting
Modified: openbios-devel/arch/sparc32/aoutload.c =================================================================== --- openbios-devel/arch/sparc32/aoutload.c 2008-11-30 13:44:38 UTC (rev 277) +++ openbios-devel/arch/sparc32/aoutload.c 2008-12-01 18:04:16 UTC (rev 278) @@ -57,22 +57,19 @@ int image_retval; struct exec ehdr; unsigned long start, size; - unsigned int offset; + unsigned int offset = 512;
image_name = image_version = NULL;
if (!file_open(filename)) goto out;
- for (offset = 0; offset < 16 * 512; offset += 512) { - file_seek(offset); - if (lfile_read(&ehdr, sizeof ehdr) != sizeof ehdr) { - debug("Can't read a.out header\n"); - retval = LOADER_NOT_SUPPORT; - goto out; - } - if (!N_BADMAG(ehdr)) - break; + file_seek(offset); + + if (lfile_read(&ehdr, sizeof ehdr) != sizeof ehdr) { + debug("Can't read a.out header\n"); + retval = LOADER_NOT_SUPPORT; + goto out; }
if (N_BADMAG(ehdr)) {
Modified: openbios-devel/arch/sparc32/boot.c =================================================================== --- openbios-devel/arch/sparc32/boot.c 2008-11-30 13:44:38 UTC (rev 277) +++ openbios-devel/arch/sparc32/boot.c 2008-12-01 18:04:16 UTC (rev 278) @@ -20,6 +20,18 @@ uint32_t cmdline_size; char boot_device;
+static void try_path(const char *path, char *param, const void *romvec) +{ + push_str(path); + fword("pathres-resolve-aliases"); + bootpath = pop_fstr_copy(); + printk("Trying %s (%s)\n", path, bootpath); + + elf_load(&sys_info, path, param, romvec); + linux_load(&sys_info, path, param); + aout_load(&sys_info, path, romvec); +} + void boot(void) { char *path = pop_fstr_copy(), *param, *oldpath = path; @@ -87,7 +99,7 @@ obp_arg.argv[1] = param; }
- romvec = init_openprom(qemu_mem_size, path); + romvec = init_openprom(qemu_mem_size);
if (kernel_size) { int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5); @@ -103,20 +115,17 @@ else printk("without parameters.\n");
- if (elf_load(&sys_info, path, param, romvec) == LOADER_NOT_SUPPORT) - if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT) - if (aout_load(&sys_info, path, romvec) == LOADER_NOT_SUPPORT) { + try_path(path, param, romvec);
- snprintf(altpath, sizeof(altpath), "%s:d", path); + push_str(path); + PUSH(':'); + fword("left-split"); + snprintf(altpath, sizeof(altpath), "%s:d", pop_fstr_copy()); + POP(); + POP();
- if (elf_load(&sys_info, altpath, param, romvec) - == LOADER_NOT_SUPPORT) - if (linux_load(&sys_info, altpath, param) - == LOADER_NOT_SUPPORT) - if (aout_load(&sys_info, altpath, romvec) - == LOADER_NOT_SUPPORT) - printk("Unsupported image format\n"); - } + try_path(altpath, param, romvec); + printk("Unsupported image format\n");
free(path); }
Modified: openbios-devel/arch/sparc32/boot.h =================================================================== --- openbios-devel/arch/sparc32/boot.h 2008-11-30 13:44:38 UTC (rev 277) +++ openbios-devel/arch/sparc32/boot.h 2008-12-01 18:04:16 UTC (rev 278) @@ -24,10 +24,11 @@ unsigned int start_elf(unsigned long entry_point, unsigned long param);
// romvec.c -void *init_openprom(unsigned long memsize, const char *path); +void *init_openprom(unsigned long memsize);
// boot.c extern struct sys_info sys_info; +extern const char *bootpath; void boot(void);
// sys_info.c
Modified: openbios-devel/arch/sparc32/romvec.c =================================================================== --- openbios-devel/arch/sparc32/romvec.c 2008-11-30 13:44:38 UTC (rev 277) +++ openbios-devel/arch/sparc32/romvec.c 2008-12-01 18:04:16 UTC (rev 278) @@ -49,7 +49,7 @@ static int obp_devseek(int dev_desc, int hi, int lo);
struct linux_arguments_v0 obp_arg; -static const char *bootpath; +const char *bootpath; static const struct linux_arguments_v0 * const obp_argp = &obp_arg;
static void (*sync_hook)(void); @@ -501,7 +501,7 @@ }
void * -init_openprom(unsigned long memsize, const char *path) +init_openprom(unsigned long memsize) { ptphys = totphys; ptmap = totmap; @@ -559,9 +559,6 @@ romvec0.pv_v2devops.v2_dev_write = obp_devwrite; romvec0.pv_v2devops.v2_dev_seek = obp_devseek;
- push_str(path); - fword("pathres-resolve-aliases"); - bootpath = pop_fstr_copy(); romvec0.pv_v2bootargs.bootpath = &bootpath;
romvec0.pv_v2bootargs.bootargs = &obp_arg.argv[1];