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; 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); }