void bootminix(void) /* Load Minix and run it. (Given the size of this program it is surprising * that it ever gets to that.) */ { char *image; if ((image= select_image(b_value("image"))) == nil) return; if(serial_line >= 0) { char linename[2]; linename[0] = serial_line + '0'; linename[1] = '\0'; b_setvar(E_VAR, SERVARNAME, linename); } exec_image(image); switch (errno) { case ENOEXEC: printf("%s contains a bad program header\n", image); break; case ENOMEM: printf("Not enough memory to load %s\n", image); break; case EIO: printf("Unsuspected EOF on %s\n", image); case 0: /* No error or error already reported. */; } free(image); if(serial_line >= 0) b_unset(SERVARNAME); }
void bootminix(void) /* Load Minix and run it. (Given the size of this program it is surprising * that it ever gets to that.) */ { char *image; if ((image= select_image(b_value("image"))) == nil) return; exec_image(image); switch (errno) { case ENOEXEC: printf("%s contains a bad program header\n", image); break; case ENOMEM: printf("Not enough memory to load %s\n", image); break; case EIO: printf("Unsuspected EOF on %s\n", image); case 0: /* No error or error already reported. */ ; } free(image); }
void bootmain(void) { int bootdev, ha, fd; char bootdevstr[16]; u_long marks[MARK_MAX]; IOCS_B_PRINT(bootprog_name); IOCS_B_PRINT(" rev."); IOCS_B_PRINT(bootprog_rev); IOCS_B_PRINT("\r\n"); ha = get_scsi_host_adapter(bootdevstr); #ifdef XXBOOT_DEBUG bootdevstr[10] = '0' + (ID & 7); bootdevstr[14] = 'a'; #endif #if defined(CDBOOT) bootdev = X68K_MAKESCSIBOOTDEV(X68K_MAJOR_CD, ha >> 4, ha & 15, ID & 7, 0, 0); #elif defined(FDBOOT) || defined(SDBOOT) if (BINF_ISFD(&BOOT_INFO)) { /* floppy */ #ifdef XXBOOT_DEBUG *(uint32_t *)bootdevstr = ('f' << 24 | 'd' << 16 | '@' << 8 | '0' + (BOOT_INFO & 3)); bootdevstr[4] = '\0'; #endif /* fdNa for 1024 bytes/sector, fdNc for 512 bytes/sector */ bootdev = X68K_MAKEBOOTDEV(X68K_MAJOR_FD, BOOT_INFO & 3, (FDSECMINMAX.minsec.N == 3) ? 0 : 2); } else { /* SCSI */ bootdev = X68K_MAKESCSIBOOTDEV(X68K_MAJOR_SD, ha >> 4, ha & 15, ID & 7, 0, 0 /* XXX: assume partition a */); } #else bootdev = 0; #endif #ifdef XXBOOT_DEBUG IOCS_B_PRINT("boot device: "); IOCS_B_PRINT(bootdevstr); #endif IOCS_B_PRINT("\r\n"); marks[MARK_START] = BOOT_TEXTADDR; fd = loadfile("x68k/boot", marks, LOAD_TEXT|LOAD_DATA|LOAD_BSS); if (fd < 0) fd = loadfile("boot", marks, LOAD_TEXT|LOAD_DATA|LOAD_BSS); if (fd >= 0) { close(fd); exec_image(BOOT_TEXTADDR, /* image loaded at */ BOOT_TEXTADDR, /* image executed at */ BOOT_TEXTADDR, /* XXX: entry point */ 0, /* XXX: image size */ bootdev, 0); /* arguments */ } IOCS_B_PRINT("can't load the secondary bootstrap."); exit(0); }
void bootminix(void) /* Load Minix and run it. (Given the size of this program it is surprising * that it ever gets to that.) */ { char *image; char *mb; char *kernel; /* FIXME: modules should come from environment */ char modules[] = "boot/ds boot/rs boot/pm boot/sched boot/vfs boot/memory boot/log boot/tty boot/mfs boot/vm boot/pfs boot/init"; if ((mb = b_value("mb")) != nil) { do_multiboot = a2l(mb); kernel = b_value("kernel"); if (kernel == nil) { printf("kernel not set\n"); return; } } if (do_multiboot) { if ((kernel= select_image(b_value("kernel"))) == nil) return; } else { if ((image= select_image(b_value("image"))) == nil) return; } if(serial_line >= 0) { char linename[2]; linename[0] = serial_line + '0'; linename[1] = '\0'; b_setvar(E_VAR, SERVARNAME, linename); } if (do_multiboot) exec_mb(kernel, modules); else exec_image(image); switch (errno) { case ENOEXEC: printf("%s contains a bad program header\n", do_multiboot ? kernel : image); break; case ENOMEM: printf("Not enough memory to load %s\n", do_multiboot ? kernel : image); break; case EIO: printf("Unexpected EOF on %s\n", do_multiboot ? kernel : image); case 0: /* No error or error already reported. */; } if (do_multiboot) free(kernel); else free(image); if(serial_line >= 0) b_unset(SERVARNAME); }