int
bootxxx(void *readsector, void *disklabel, osdsc_t *od)
{
	int		fd;
	char		*errmsg;
	extern char	end[], edata[];

	memset(edata, 0, end - edata);

	/* XXX: Limit should be 16MB */
	setheap(end, (void*)0x1000000);
	printf("\033v\nNetBSD/Atari tertiary bootloader "
					"($Revision: 1.8 $)\n\n");

	if (init_dskio(readsector, disklabel, od->rootfs))
		return -1;

	sys_info(od);
	if (!(od->cputype & ATARI_ANYCPU)) {
		printf("Unknown CPU-type.\n");
		return -2;
	}

	if ((fd = open(od->osname, 0)) < 0) {
		printf("Cannot open kernel '%s'\n", od->osname);
		return -3;
	}

#ifndef __ELF__		/* a.out */
	if (aout_load(fd, od, &errmsg, 1) != 0)
#else
	if (elf_load(fd, od, &errmsg, 1) != 0)
#endif
		return -4;

	boot_BSD(&od->kp);
	return -5;

	/* NOTREACHED */
}
Esempio n. 2
0
void load(ihandle_t dev)
{
	/* Invoke the loaders on the specified device */
	char *param;
        ucell valid;

#ifdef CONFIG_LOADER_ELF

	/* Grab the boot arguments */
	push_str("bootargs");
	push_str("/chosen");
	fword("(find-dev)");
	POP();
	fword("get-package-property");
	POP();
	param = pop_fstr_copy();

	elf_load(&sys_info, dev, param, &elf_boot_notes);
        feval("state-valid @");
        valid = POP();
        if (valid) {
                return;
        }
#endif

#ifdef CONFIG_LOADER_AOUT
	aout_load(&sys_info, dev);
        feval("state-valid @");
        valid = POP();
        if (valid) {
                return;
        }
#endif

#ifdef CONFIG_LOADER_FCODE
	fcode_load(dev);
        feval("state-valid @");
        valid = POP();
        if (valid) {
                return;
        }
#endif

#ifdef CONFIG_LOADER_FORTH
	forth_load(dev);
        feval("state-valid @");
        valid = POP();
        if (valid) {
                return;
        }
#endif

#ifdef CONFIG_LOADER_BOOTCODE
	/* Check for a "raw" %BOOT bootcode payload */
	feval("want-bootcode @");
	valid = POP();
	if (valid) {
                bootcode_load(dev);
	}
#endif

}