|
|
1.1 ! root 1: /* ! 2: * mkdev.c ! 3: * 06/28/93 ! 4: * ! 5: * Allow the user to configure devices requiring loadable drivers. ! 6: * Uses common routines in build0.c: cc -o mkdev mkdev.c build0.c ! 7: * Usage: mkdev [ -bdv ] { scsi | at | floppytape } ... ! 8: * Options: ! 9: * -b Use special processing when invoked from /etc/build ! 10: * -d Debug; echo commands without executing ! 11: * -v Verbose ! 12: * ! 13: * Roughly, do the following for device "foo" ( at | aha154x | ss ) ! 14: * ! 15: * cp /drv/foo /tmp/drv/foo ! 16: * make necessary patches "xxx" to /tmp/drv/foo ! 17: * if not "at" device ! 18: * make nodes (mknod -f) for the device ! 19: * if build mode (bflag) ! 20: * if rootdev ! 21: * append to LDKERFILE: ! 22: * HD=foo.a ! 23: * HDUNDEF="-u foocon_" ! 24: * HDPATCH="drvl_+xx0=foocon_" ! 25: * /etc/drvld -r /tmp/drv/foo ! 26: * append to PATCHFILE: ! 27: * cp /tmp/drv/foo /mnt/drv/foo ! 28: * if rootdev, also append to PATCHFILE: ! 29: * /conf/patch /mnt/coherent xxx ! 30: * else - not build mode ! 31: * display message saying patched driver is at /tmp/drv/foo ! 32: */ ! 33: ! 34: #include <stdio.h> ! 35: #include <sys/devices.h> ! 36: #include "build0.h" ! 37: ! 38: #define VERSION "V3.1" /* version number */ ! 39: #define USAGEMSG "Usage:\t/etc/mkdev [ -bdv ] [ scsi | at | floppytape ] ...\n" ! 40: #define BUFLEN 50 ! 41: #define AHA_HDS 64 ! 42: #define AHA_DMA 5 ! 43: #define AHA_IRQ 11 ! 44: #define AHA_BASE 0x330 ! 45: #define TANDY_HDS 16 ! 46: ! 47: /* ! 48: * calculate the minor number for the specified floppy tape device: ! 49: * uu: unit # (0-3) ! 50: * vv: brand of drive: 0=Archive/Mountain/Summit, 1=CMS, 2&3=rsvd ! 51: * s: select: 0=hard select, 1=soft select ! 52: * r: rewind: 0=no rewind on close, 1=rewind on close ! 53: */ ! 54: #define FL_TAPE_MINOR(uu,vv,s,r) ((1<<6)|((uu)<<4)|((s)<<3)|((r)<<2)|(vv)) ! 55: #define FL_TAPE_HARD_SEL 0 ! 56: #define FL_TAPE_SOFT_SEL 1 ! 57: #define FL_TAPE_NOREW 0 ! 58: #define FL_TAPE_REW 1 ! 59: ! 60: /* Forward. */ ! 61: void scsi(); ! 62: void at(); ! 63: void floppy_tape(); ! 64: ! 65: /* Globals. */ ! 66: int bflag; /* Invoked from /etc/build. */ ! 67: ! 68: main(argc, argv) int argc; char *argv[]; ! 69: { ! 70: register char *s; ! 71: ! 72: argv0 = argv[0]; ! 73: usagemsg = USAGEMSG; ! 74: if (argc > 1 && argv[1][0] == '-') { ! 75: for (s = &argv[1][1]; *s; ++s) { ! 76: switch(*s) { ! 77: case 'b': ++bflag; break; ! 78: case 'd': ++dflag; break; ! 79: case 'v': ++vflag; break; ! 80: case 'V': ! 81: fprintf(stderr, "mkdev: %s\n", VERSION); ! 82: break; ! 83: default: usage(); break; ! 84: } ! 85: } ! 86: --argc; ! 87: ++argv; ! 88: } ! 89: ! 90: if (argc == 1) { ! 91: usage(); ! 92: } else { ! 93: /* Do specified things. */ ! 94: while (--argc > 0) { ! 95: if (streq(argv[1], "scsi")) ! 96: scsi(); ! 97: else if (streq(argv[1], "at")) ! 98: at(); ! 99: else if (streq(argv[1], "floppytape")) ! 100: floppy_tape(); ! 101: else ! 102: usage(); ! 103: ++argv; ! 104: } ! 105: } ! 106: exit(0); ! 107: } ! 108: ! 109: void ! 110: scsi() ! 111: { ! 112: char *dev, *coh; ! 113: int i, id, lun; ! 114: int ss_dev = 0; ! 115: int fut_dev = 0; ! 116: unsigned nsdrive = 0; ! 117: int ss_int = 5, new_int; ! 118: unsigned int ss_base = 0xCA00, new_base; ! 119: unsigned char ss_patch[80], buf[BUFLEN]; ! 120: FILE *fp; ! 121: int aha_dev = 0, sd_hds = AHA_HDS, sd_dma = AHA_DMA; ! 122: int sd_irq = AHA_IRQ, sd_base = AHA_BASE; ! 123: int istape; /* is a SCSI tape device */ ! 124: #if !_I386 ! 125: rootflag = 0; ! 126: #endif ! 127: ! 128: #if 0 ! 129: /* For future use, not much use with only one supported host adapter. */ ! 130: again: ! 131: #endif ! 132: cls(0); ! 133: printf( ! 134: "COHERENT currently supports the following SCSI host adapters:\n" ! 135: "\n" ! 136: "(1) Adaptec AHA-154x series\n" ! 137: "(2) Seagate ST01 or ST02\n" ! 138: "(3) Future Domain TMC-845/850/860/875/885\n" ! 139: "(4) Future Domain TMC-840/841/880/881\n" ! 140: "\n" ! 141: ); ! 142: retry: ! 143: switch(get_int(0, 4, "Enter a number from the above list or 0 to exit:")) { ! 144: case 0: ! 145: return; ! 146: case 1: ! 147: aha_dev = 1; ! 148: coh = "aha"; ! 149: break; ! 150: case 2: ! 151: ss_dev = 1; ! 152: coh = "ss"; ! 153: break; ! 154: case 3: ! 155: ss_dev = 1; ! 156: fut_dev = 1; ! 157: coh = "ss"; ! 158: nsdrive |= 0x8000; ! 159: break; ! 160: case 4: ! 161: ss_dev = 1; ! 162: fut_dev = 1; ! 163: coh = "ss"; ! 164: nsdrive |= 0x4000; ! 165: break; ! 166: default: ! 167: goto retry; /* should never happen */ ! 168: } ! 169: ! 170: /* Make /tmp/drv if not already there. */ ! 171: #if !_I386 ! 172: if ((i = is_dir("/tmp/drv")) == 0) ! 173: sys("/bin/mkdir /tmp/drv", S_FATAL); ! 174: else if (i == -1) ! 175: fatal("/tmp/drv is not a directory"); ! 176: #endif ! 177: ! 178: /* ! 179: * If Adaptec, allow patching host adapter variables SD_HDS ! 180: * for Tandy variant of host BIOS. ! 181: */ ! 182: if (aha_dev) { ! 183: printf("\nMost versions of the Adaptec BIOS use 64-head translation mode.\n"); ! 184: printf("A few, including some Tandy variants, use 16-head translation mode.\n\n"); ! 185: if (!yes_no("Do you want 64-head translation mode")) ! 186: sd_hds = TANDY_HDS; ! 187: printf("\nWhich IRQ does the host adapter use (9/10/11/12/14/15) [%d]? ", ! 188: sd_irq); ! 189: for (;;) { ! 190: new_int = sd_irq; ! 191: fgets(buf, BUFLEN, stdin); ! 192: sscanf(buf, "%d", &new_int); ! 193: switch(new_int) { ! 194: case 9: ! 195: case 10: ! 196: case 11: ! 197: case 12: ! 198: case 14: ! 199: case 15: ! 200: goto ok_sdirq; ! 201: } ! 202: printf("Type 9,10,11,12,14,15 or just <Enter> for the default: "); ! 203: } /* endwhile */ ! 204: ok_sdirq: ! 205: sd_irq = new_int; ! 206: ! 207: printf("\nWhat is the hexadecimal host adapter base port address \n"); ! 208: printf(" (130/134/230/234/330/334) [%x]? ", sd_base); ! 209: for (;;) { ! 210: new_int = sd_base; ! 211: fgets(buf, BUFLEN, stdin); ! 212: sscanf(buf, "%x", &new_int); ! 213: switch(new_int) { ! 214: case 0x130: ! 215: case 0x134: ! 216: case 0x230: ! 217: case 0x234: ! 218: case 0x330: ! 219: case 0x334: ! 220: goto ok_sdbase; ! 221: } ! 222: printf("Type 130,134,230,234,330,334 or just <Enter> for the default: "); ! 223: } /* endfor */ ! 224: ok_sdbase: ! 225: sd_base = new_int; ! 226: ! 227: printf("\nWhich DMA channel does the host adapter use (0/5/6/7) [%d]? ", ! 228: sd_dma); ! 229: for (;;) { ! 230: new_int = sd_dma; ! 231: fgets(buf, BUFLEN, stdin); ! 232: sscanf(buf, "%d", &new_int); ! 233: if (new_int != 0 && new_int != 5 ! 234: && new_int != 6 && new_int != 7) ! 235: printf("Type 0,5,6,7 or just <Enter> for the default: "); ! 236: else ! 237: break; ! 238: } /* endwhile */ ! 239: sd_dma = new_int; ! 240: } ! 241: ! 242: /* ! 243: * If Seagate or Future Domain, allow patching host adapter ! 244: * variables SS_INT and SS_BASE. ! 245: */ ! 246: if (ss_dev) { ! 247: printf("\nPlease refer to the installation guide for your host adapter.\n"); ! 248: ! 249: /* Get value to patch for SS_INT */ ! 250: printf("\nWhich IRQ number does the host adapter use [%d]? ", ss_int); ! 251: while (1) { ! 252: new_int = ss_int; ! 253: fgets(buf, BUFLEN, stdin); ! 254: sscanf(buf, "%d", &new_int); ! 255: if (new_int < 3 || new_int > 15) ! 256: printf("Type a number between 3 and 15 or just <Enter> for the default: "); ! 257: else ! 258: break; ! 259: } /* endwhile */ ! 260: ss_int = new_int; ! 261: ! 262: /* Get value to patch for SS_BASE */ ! 263: printf("Your host adapter is configured for a base segment address. Possible\n"); ! 264: printf("values are: C800, CA00, CC00, CE00, DC00, and DE00.\n"); ! 265: printf("What is your 4-digit hexadecimal base address [%04lx]? ", ss_base); ! 266: while (1) { ! 267: new_base = ss_base; ! 268: fgets(buf, BUFLEN, stdin); ! 269: sscanf(buf, "%x", &new_base); ! 270: if (new_base < 0xC800 || new_base > 0xDE00) ! 271: printf("Type a number between C800 and DE00 or just <Enter> for the default: "); ! 272: else ! 273: break; ! 274: } /* endwhile */ ! 275: ss_base = new_base; ! 276: } ! 277: ! 278: /* ! 279: * Set rootflag if root partition is on SCSI device (286). ! 280: * If using both AT and SCSI devices on COH 3.x, write to ! 281: * drvld.all for non-root device. ! 282: */ ! 283: #if !_I386 ! 284: if (bflag) { ! 285: cls(0); ! 286: if (yes_no( ! 287: "Does your computer system include both a standard AT-type hard disk\n" ! 288: "and a SCSI hard disk" )) { ! 289: if (yes_no( ! 290: "Will the COHERENT root partition be on this SCSI device")) { ! 291: ++rootflag; ! 292: sys("/bin/echo /etc/drvld -r /drv/at >> /tmp/drvld.all", S_FATAL); ! 293: } else { /* root is on "at" device */ ! 294: sprintf(cmd, "/bin/echo /etc/drvld -r /drv/%s >> /tmp/drvld.all", ! 295: (aha_dev)?"aha154x":"ss"); ! 296: sys(cmd, S_FATAL); ! 297: } ! 298: } else { /* SCSI-only system */ ! 299: ++rootflag; ! 300: } ! 301: } ! 302: #endif ! 303: ! 304: /* Make device nodes. */ ! 305: cls(0); ! 306: if (aha_dev) { ! 307: printf( ! 308: "You must specify a SCSI-ID (0 through 7) for each SCSI hard disk or tape\n" ! 309: "device. Each SCSI hard disk device can contain up to four partitions.\n" ! 310: "Tape devices must be configured as logical unit number (LUN) 0. All current\n" ! 311: "SCSI tape drives with embedded SCSI controllers default to LUN 0.\n\n" ! 312: ); ! 313: } else { ! 314: printf( ! 315: "You must specify a SCSI-ID (0 through 7) for each SCSI hard disk device.\n" ! 316: "Each SCSI hard disk device can contain up to four partitions.\n\n" ! 317: ); ! 318: } ! 319: ! 320: newdev: ! 321: id = get_int(0, 7, "Enter the SCSI-ID:"); ! 322: ! 323: istape = 0; ! 324: if (aha_dev) { ! 325: printf( ! 326: "\nPlease select the type of device from the following list:\n\n" ! 327: "\t0) SCSI hard disk (fixed or removable media)\n" ! 328: "\t1) SCSI tape drive\n" ! 329: "\t2) Other SCSI peripheral\n\n" ! 330: ); ! 331: istape = get_int(0, 2, "Enter device type:"); ! 332: if (istape == 2) { ! 333: printf( ! 334: "\nYou have specified a SCSI device which is currently unsupported.\n\n" ! 335: ); ! 336: goto query_more_devices; ! 337: } ! 338: } /* aha_dev */ ! 339: lun = 0; ! 340: nsdrive |= (1 << id); ! 341: #if 0 ! 342: lun = get_int(0, 3, "Enter the LUN:"); ! 343: #endif ! 344: ! 345: /* Make /tmp/dev if bflag. */ ! 346: if (bflag) { ! 347: if ((i = is_dir("/tmp/dev")) == 0) ! 348: sys("/bin/mkdir /tmp/dev", S_FATAL); ! 349: else if (i == -1) ! 350: fatal("/tmp/dev is not a directory"); ! 351: } ! 352: dev = (bflag) ? "/tmp/dev" : "/dev"; ! 353: ! 354: /* ! 355: * If we are creating a SCSI tape device (Adaptec only), ! 356: * create special raw device nodes and generate links ! 357: * for /dev/tape and /dev/ntape to make it easy on the user. ! 358: */ ! 359: if (aha_dev && istape) { ! 360: sprintf(cmd, "/etc/mknod -f %s/rsd%d c %d %d", ! 361: dev, id, SCSI_MAJOR, SCSI_minor(1, id, lun, 3)); ! 362: sys(cmd, S_NONFATAL); ! 363: sprintf(cmd, "/etc/mknod -f %s/rsd%dn c %d %d", ! 364: dev, id, SCSI_MAJOR, SCSI_minor(1, id, lun, 1)); ! 365: sys(cmd, S_NONFATAL); ! 366: sprintf(cmd, "/bin/ln -f %s/rsd%d %s/tape", ! 367: dev, id, dev); ! 368: sys(cmd, S_NONFATAL); ! 369: sprintf(cmd, "/bin/ln -f %s/rsd%dn %s/ntape", ! 370: dev, id, dev); ! 371: sys(cmd, S_NONFATAL); ! 372: ! 373: /* set the device permissions. */ ! 374: sprintf(cmd, "/bin/chmog 600 sys sys %s/rsd%d*", dev, id); ! 375: sys(cmd, S_NONFATAL); ! 376: } else { ! 377: /* ! 378: * SCSI disk device: ! 379: * Make the cooked devices. ! 380: */ ! 381: for (i = 0; i < 4; i++) { ! 382: sprintf(cmd, "/etc/mknod -f %s/sd%d%c b %d %d", ! 383: dev, id, 'a'+i, SCSI_MAJOR, SCSI_minor(0, id, lun, i)); ! 384: sys(cmd, S_NONFATAL); ! 385: } ! 386: sprintf(cmd, "/etc/mknod -f %s/sd%dx b %d %d", ! 387: dev, id, SCSI_MAJOR, SCSI_minor(1, id, lun, 0)); ! 388: sys(cmd, S_NONFATAL); ! 389: ! 390: /* make the raw devices. */ ! 391: for (i = 0; i < 4; i++) { ! 392: sprintf(cmd, "/etc/mknod -f %s/rsd%d%c c %d %d", ! 393: dev, id, 'a'+i, SCSI_MAJOR, SCSI_minor(0, id, lun, i)); ! 394: sys(cmd, S_NONFATAL); ! 395: } ! 396: sprintf(cmd, "/etc/mknod -f %s/rsd%dx c %d %d", ! 397: dev, id, SCSI_MAJOR, SCSI_minor(1, id, lun, 0)); ! 398: sys(cmd, S_NONFATAL); ! 399: ! 400: /* set the device permissions. */ ! 401: sprintf(cmd, "/bin/chmog 600 sys sys %s/sd*[a-d] %s/rsd*[a-d]",dev,dev); ! 402: sys(cmd, S_NONFATAL); ! 403: sprintf(cmd, "/bin/chmog 600 root root %s/sd*x %s/rsd*x", dev, dev); ! 404: sys(cmd, S_NONFATAL); ! 405: } /* !(aha_dev && istape) */ ! 406: ! 407: /* append lines to /tmp/devices to pass device info to /etc/build. */ ! 408: if (bflag && !istape) { ! 409: for (i = 0; i < 4; i++) { ! 410: sprintf(cmd, "/bin/echo sd%dx sd%d%c %d %d >>/tmp/devices", ! 411: id, id, 'a'+i, SCSI_MAJOR, SCSI_minor(0, id, lun, i)); ! 412: sys(cmd, S_NONFATAL); ! 413: } ! 414: } ! 415: ! 416: query_more_devices: ! 417: if (yes_no((aha_dev) ? ! 418: "Do you have another SCSI disk or tape device on this host adapter" : ! 419: "Do you have another SCSI hard disk device on this host adapter")) ! 420: goto newdev; ! 421: ! 422: /* ! 423: * Ugly patching stuff specific to "ss" driver. ! 424: * At this point all SCSI id's attached to the host are known. ! 425: */ ! 426: if (ss_dev) { ! 427: int unit; ! 428: ! 429: /* "ss" device driver requires patching to work at all. */ ! 430: #if _I386 ! 431: sprintf(ss_patch, ! 432: "NSDRIVE=0x%04x SS_INT=%d SS_BASE=0x%04x", ! 433: nsdrive, ss_int, ss_base); ! 434: sprintf(cmd, "/conf/patch -K /begin %s", ss_patch); ! 435: #else ! 436: sprintf(ss_patch, ! 437: "NSDRIVE_=0x%04x SS_INT_=%d SS_BASE_=0x%04x", ! 438: nsdrive, ss_int, ss_base); ! 439: sys("/bin/cp /drv/ss /tmp/drv/ss", S_FATAL); ! 440: sprintf(cmd, "/conf/patch /tmp/drv/ss %s", ss_patch); ! 441: #endif ! 442: sys(cmd, S_FATAL); ! 443: if (bflag) { ! 444: #if _I386 ! 445: fp = fopen(LDKERFILE, "a"); ! 446: fprintf(fp, "HD=\"${HD} ss.a\"\n"); ! 447: fprintf(fp, "HDUNDEF=\"${HDUNDEF} -u sscon\"\n"); ! 448: fprintf(fp, "HDPATCH=\"${HDPATCH} drvl+260=sscon \n"); ! 449: fclose(fp); ! 450: fp = fopen(PATCHFILE,"a"); ! 451: fprintf(fp, "/conf/patch /mnt/coherent drvl+260=sscon \n"); ! 452: fclose(fp); ! 453: sys("/conf/start_dev ss", S_FATAL); ! 454: #else /* 286 */ ! 455: if (rootflag) { ! 456: fp = fopen(LDKERFILE, "a"); ! 457: fprintf(fp, "HD=ss.a\n"); ! 458: fprintf(fp, "HDUNDEF=\"-u sscon_\"\n"); ! 459: fprintf(fp, "HDPATCH=\"drvl_+130=sscon_\"\n"); ! 460: fclose(fp); ! 461: } ! 462: sys("/etc/drvld -r /tmp/drv/ss", S_FATAL); ! 463: #endif ! 464: fp = fopen(PATCHFILE, "a"); ! 465: #if !_I386 ! 466: fprintf(fp, "/conf/patch /mnt/drv/ss %s\n", ss_patch); ! 467: if (rootflag) ! 468: #endif ! 469: fprintf(fp, ! 470: "/conf/patch /mnt/coherent %s\n", ss_patch); ! 471: fclose(fp); ! 472: /* ! 473: * Allow patching of the loaded driver parameters. ! 474: */ ! 475: for (unit = 0; unit < 7; unit++) ! 476: if (nsdrive & (1<<unit)) { ! 477: sprintf(cmd, ! 478: "/etc/hdparms -%c%c %s/sd%dx", ! 479: #if _I386 ! 480: 'r', ! 481: #else ! 482: (rootflag)?'r':'b', ! 483: #endif ! 484: (fut_dev)?'f':'s', dev, unit); ! 485: sys(cmd, S_NONFATAL); ! 486: } ! 487: } else ! 488: #if _I386 ! 489: printf("Patched in-core copy of ss driver\n"); ! 490: #else ! 491: printf("Patched driver at /tmp/drv/ss\n"); ! 492: #endif ! 493: ! 494: } /* end of "ss" stuff */ ! 495: ! 496: /* ! 497: * Ugly patching stuff specific to "aha154x" driver. ! 498: * At this point all SCSI id's attached to the host are known. ! 499: */ ! 500: if (aha_dev) { ! 501: /* ! 502: * Tandy Adaptec BIOS spoofs different head count than ! 503: * Adaptec's Own Translation Mode. ! 504: */ ! 505: #if _I386 ! 506: sprintf(ss_patch, ! 507: "SD_HDS=%d SDDMA=%d SDIRQ=%d SDBASE=0x%x ", ! 508: sd_hds, sd_dma, sd_irq, sd_base); ! 509: sprintf(cmd, "/conf/patch -K /begin %s", ss_patch); ! 510: #else */ 286 */ ! 511: sprintf(ss_patch, ! 512: "SD_HDS_=%d SDDMA_=%d SDIRQ_=%d SDBASE_=0x%x ", ! 513: sd_hds, sd_dma, sd_irq, sd_base); ! 514: sys("/bin/cp /drv/aha154x /tmp/drv/aha154x", S_FATAL); ! 515: sprintf(cmd, "/conf/patch /tmp/drv/aha154x %s", ss_patch); ! 516: sys(cmd, S_FATAL); ! 517: #endif ! 518: if (bflag) { ! 519: #if _I386 ! 520: fp = fopen(LDKERFILE, "a"); ! 521: fprintf(fp, "HD=\"${HD} aha154x.a\"\n"); ! 522: fprintf(fp, "HDUNDEF=\"${HDUNDEF} -u sdcon\"\n"); ! 523: fprintf(fp, "HDPATCH=\"${HDPATCH} drvl+260=sdcon\"\n"); ! 524: fclose(fp); ! 525: fp = fopen(PATCHFILE,"a"); ! 526: fprintf(fp, "/conf/patch /mnt/coherent drvl+260=sdcon \n"); ! 527: fclose(fp); ! 528: sys("/conf/start_dev aha", S_FATAL); ! 529: #else /* 286 */ ! 530: if (rootflag) { ! 531: fp = fopen(LDKERFILE, "a"); ! 532: fprintf(fp, "HD=aha154x.a\n"); ! 533: fprintf(fp, "HDUNDEF=\"-u sdcon_\"\n"); ! 534: fprintf(fp, "HDPATCH=\"drvl_+130=sdcon_\"\n"); ! 535: fclose(fp); ! 536: } ! 537: sys("/etc/drvld -r /tmp/drv/aha154x", S_FATAL); ! 538: #endif ! 539: fp = fopen(PATCHFILE, "a"); ! 540: #if !_I386 ! 541: fprintf(fp, "/conf/patch /mnt/drv/aha154x %s\n", ! 542: ss_patch); ! 543: if (rootflag) ! 544: #endif ! 545: fprintf(fp, ! 546: "/conf/patch /mnt/coherent %s\n", ss_patch); ! 547: fclose(fp); ! 548: } else ! 549: #if _I386 ! 550: printf("Patched in-core aha154x driver\n"); ! 551: #else ! 552: printf("Patched driver at /tmp/drv/aha154x\n"); ! 553: #endif ! 554: } /* end of "aha154x" stuff */ ! 555: ! 556: #if 0 ! 557: if (yes_no("Is there another SCSI host adapter in your system")) ! 558: goto again; ! 559: #endif ! 560: } ! 561: ! 562: void ! 563: at() ! 564: { ! 565: unsigned char at_patch[80]; ! 566: FILE *fp; ! 567: #if !_I386 ! 568: int i; ! 569: int rootflag = 0; ! 570: #endif ! 571: ! 572: /* Make /tmp/drv if not there. COH 286 only */ ! 573: #if !_I386 ! 574: if ((i = is_dir("/tmp/drv")) == 0) ! 575: sys("/bin/mkdir /tmp/drv", S_FATAL); ! 576: else if (i == -1) ! 577: fatal("/tmp/drv is not a directory"); ! 578: sys("/bin/cp /drv/at /tmp/drv/at", S_FATAL); ! 579: #endif ! 580: ! 581: cls(0); ! 582: printf( ! 583: "Most AT-compatible controllers work with NORMAL polling.\n\n" ! 584: "Perstor controllers and some IDE hard drives require ALTERNATE polling.\n\n" ! 585: "If you get \"<Watchdog Timeout>\" or \"at0:TO\" errors with normal polling,\n" ! 586: "use alternate polling.\n\n"); ! 587: ! 588: if (yes_no("Use ALTERNATE polling")) ! 589: #if _I386 ! 590: strcpy(at_patch, "ATSREG=0x1F7 "); ! 591: else ! 592: strcpy(at_patch, "ATSREG=0x3F6 "); ! 593: sprintf(cmd, "/conf/patch -K /begin %s", at_patch); ! 594: #else ! 595: strcpy(at_patch, "ATSREG_=0x1F7 "); ! 596: else ! 597: strcpy(at_patch, "ATSREG_=0x3F6 "); ! 598: sprintf(cmd, "/conf/patch /tmp/drv/at %s", at_patch); ! 599: #endif ! 600: sys(cmd, S_FATAL); ! 601: ! 602: if (bflag){ ! 603: #if !_I386 ! 604: if (yes_no( ! 605: "Will the COHERENT root partition be on an AT-type (non-SCSI) drive")) { ! 606: ++rootflag; ! 607: fp = fopen(LDKERFILE, "a"); ! 608: fprintf(fp, "HD=at.a\n"); ! 609: fprintf(fp, "HDUNDEF=\"-u atcon_\"\n"); ! 610: fprintf(fp, "HDPATCH=\"drvl_+110=atcon_\"\n"); ! 611: fclose(fp); ! 612: } ! 613: sys("/etc/drvld -r /tmp/drv/at", S_FATAL); ! 614: #else /* 386 */ ! 615: fp = fopen(LDKERFILE, "a"); ! 616: fprintf(fp, "HD=\"${HD} at.a\"\n"); ! 617: fprintf(fp, "HDUNDEF=\"${HDUNDEF} -u atcon\"\n"); ! 618: fprintf(fp, "HDPATCH=\"${HDPATCH} drvl+220=atcon\"\n"); ! 619: fclose(fp); ! 620: fp = fopen(PATCHFILE,"a"); ! 621: fprintf(fp, "/conf/patch /mnt/coherent drvl+220=atcon \n"); ! 622: fclose(fp); ! 623: sys("/conf/start_dev at", S_FATAL); ! 624: #endif ! 625: fp = fopen(PATCHFILE, "a"); ! 626: #if !_I386 ! 627: fprintf(fp, "/conf/patch /mnt/drv/at %s\n", at_patch); ! 628: if (rootflag) ! 629: #endif ! 630: fprintf(fp, ! 631: "/conf/patch /mnt/coherent %s\n", at_patch); ! 632: fclose(fp); ! 633: } else ! 634: #if _I386 ! 635: printf("Patched in-core AT driver\n"); ! 636: #else ! 637: printf("Patched driver at /tmp/drv/at\n"); ! 638: #endif ! 639: } ! 640: ! 641: /* ! 642: * floppy_tape: add support for floppy tape (a really discusting device) ! 643: * ! 644: * 1) give user some info regarding COH support for floppy tape ! 645: * 2) display a list of supported drives ! 646: * 3) query the user for type of drive ! 647: * 4) create device nodes for specified drive ! 648: * 5) (optional) test for which unit number the drive is seen as ! 649: */ ! 650: void ! 651: floppy_tape() ! 652: { ! 653: int brand; /* which brand of drive (from menu) */ ! 654: int i; /* loop counter */ ! 655: ! 656: cls(0); ! 657: printf( ! 658: "The COHERENT system supports several brands of \"floppy tape backup\" drives,\n" ! 659: "including QIC-40 and QIC-80 models from Archive, Colorado Memory Systems (CMS),\n" ! 660: "Mountain, and Summit.\n\n" ! 661: "Please specify the brand of floppy tape drive on this computer:\n\n" ! 662: "\t0) Archive, Mountain, or Summit\n" ! 663: "\t1) Colorado Memory Systems (CMS)\n" ! 664: "\t2) Other\n\n" ! 665: ); ! 666: brand = get_int(0, 2, "Enter drive type:"); ! 667: if (brand == 2) { ! 668: printf( ! 669: "\nYou have specified a brand of tape drive which is currently unsupported.\n" ! 670: ); ! 671: return; ! 672: } ! 673: ! 674: /* ! 675: * now create the following nodes for the specified drive brand: ! 676: * Rewind No Rewind Unit # ! 677: * -------- --------- --------- ! 678: * DEV/rct0 DEV/nrct0 (unit #0) ! 679: * DEV/rct1 DEV/nrct1 (unit #1) ! 680: * DEV/rct2 DEV/nrct2 (unit #2) ! 681: * DEV/rct3 DEV/nrct3 (unit #3) ! 682: * DEV/rctss DEV/nrctss (soft select) ! 683: * ! 684: * where DEV is /mnt/dev if called from /etc/build and /dev otherwise. ! 685: */ ! 686: for (i = 0; i <= 3; ++i) { ! 687: sprintf(cmd, "/etc/mknod -f %s/rct%d c %d %d", ! 688: (bflag) ? "/mnt/dev" : "/dev", i, FL_MAJOR, ! 689: FL_TAPE_MINOR(i, brand, FL_TAPE_HARD_SEL, FL_TAPE_REW)); ! 690: sys(cmd, S_NONFATAL); ! 691: sprintf(cmd, "/etc/mknod -f %s/nrct%d c %d %d", ! 692: (bflag) ? "/mnt/dev" : "/dev", i, FL_MAJOR, ! 693: FL_TAPE_MINOR(i, brand, FL_TAPE_HARD_SEL, FL_TAPE_NOREW)); ! 694: sys(cmd, S_NONFATAL); ! 695: } ! 696: sprintf(cmd, "/etc/mknod -f %s/rctss c %d %d", ! 697: (bflag) ? "/mnt/dev" : "/dev", FL_MAJOR, ! 698: FL_TAPE_MINOR(0, brand, FL_TAPE_SOFT_SEL, FL_TAPE_REW)); ! 699: sys(cmd, S_NONFATAL); ! 700: sprintf(cmd, "/etc/mknod -f %s/nrctss c %d %d", ! 701: (bflag) ? "/mnt/dev" : "/dev", FL_MAJOR, ! 702: FL_TAPE_MINOR(0, brand, FL_TAPE_SOFT_SEL, FL_TAPE_NOREW)); ! 703: sys(cmd, S_NONFATAL); ! 704: } ! 705: ! 706: /* end of mkdev.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.