Ejemplo n.º 1
0
int
bootxx(void *readsector, void *disklabel, int autoboot)
{
    static osdsc_t	os_desc;
    extern char	end[], edata[];
    osdsc_t		*od = &os_desc;
    bxxx_t		bootxxx = (bxxx_t)(LOADADDR3);

    bzero(edata, end - edata);
    setheap(end, (void*)(LOADADDR3 - 4));

    printf("\033v\nNetBSD/atari secondary bootloader"
           " ($Revision: 1.12 $)\n\n");

    if (init_dskio(readsector, disklabel, -1))
        return -1;

    for (;;) {
        od->rootfs = 0;			/* partition a */
        od->osname = "/netbsd";
        od->ostype = &od->osname[1];
        od->boothowto = (RB_RDONLY);

        if (!autoboot) {
            int	pref;

            od->boothowto = (RB_RDONLY|RB_SINGLE);
            pref = usr_info(od);
            if (pref < 0)
                continue;
            if (pref > 0)
                return pref;
        }
        autoboot = 0;			/* in case auto boot fails */

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

        if (load_booter(od))
            continue;

        (*bootxxx)(readsector, disklabel, od);
    }
    /* NOTREACHED */
}
Ejemplo n.º 2
0
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 */
}