博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
simh中安装运行unix v7
阅读量:7000 次
发布时间:2019-06-27

本文共 8580 字,大约阅读时间需要 28 分钟。

hot3.png

参考

一、原料:

到ftp://minnie.tuhs.org/UnixArchive/PDP-11/Distributions/research/Keith_Bostic_v7/下载

f0.gz  f1.gz  f2.gz  f3.gz  f4.gz  f5.gz  f6.gz并解压为:f0  f1  f2  f3  f4  f5  f6

或到,也可下载好了的

二、工具

perl脚本

~/simhSample/v7$ cat mkdisttap.pl #!/usr/bin/perl -wuse strict;# Based on mkdisttap.pl# ftp://ftp.mrynet.com/pub/os/PUPS/PDP-11/Boot_Images/2.11_on_Simh/211bsd/mkdisttap.pl## $Id: mkdisttap.pl,v 1.1 2006/09/16 23:33:46 kirk Exp kirk $## Based on the example in the HOWTO using dd.  Does not work!# add_file("cat mtboot mtboot boot |", 512);# Based on the maketape.c program and the maketape.data data file.add_file("f0", 512);end_file();add_file("f1", 512);end_file();add_file("f2", 512);end_file();add_file("f3", 512);end_file();add_file("f4", 512);end_file();add_file("f5", 10240);end_file();add_file("f6", 10240);end_file();end_file();sub end_file {  print "\x00\x00\x00\x00";}sub add_file {  my($filename, $blocksize) = @_;  my($block, $bytes_read, $length);  open(FILE, $filename) || die("Can't open $filename: $!");  while($bytes_read = read(FILE, $block, $blocksize)) {    if($bytes_read < $blocksize) {      $block .= "\x00" x ($blocksize - $bytes_read);      $bytes_read = $blocksize;    }    $length = pack("V", $bytes_read);    print $length, $block, $length;  }  close(FILE);}

C语言:mktape.c

/* * mktape.c */#include 
#include
struct { char *name; int blocksize;} files[] = { { "f0", 512 }, { "f1", 512 }, { "f2", 512 }, { "f3", 512 }, { "f4", 512 }, { "f5", 10240 }, { "f6", 10240 }};void error(char *msg) { printf("**** Error: %s ****\n", msg); exit(0);}void writeCount(long count, FILE *file) { if (fwrite(&count, 4, 1, file) != 1) { error("cannot write byte count"); }}int main(void) { FILE *outfile; FILE *infile; long size; int blocksize; int blocks; int i, j; unsigned char buffer[20000]; outfile = fopen("unix_v7.tm", "wb"); if (outfile == NULL) { error("cannot open output file"); } for (i = 0; i < sizeof(files)/sizeof(files[0]); i++) { printf("%s: ", files[i].name); infile = fopen(files[i].name, "rb"); if (infile == NULL) { error("cannot open input file"); } fseek(infile, 0, SEEK_END); size = ftell(infile); fseek(infile, 0, SEEK_SET); blocksize = files[i].blocksize; blocks = size / blocksize; printf("%ld bytes = %d records (blocksize %d bytes)\n", size, blocks, blocksize); if (size % blocksize != 0) { error("file size is not a multiple of block size"); } for (j = 0; j < blocks; j++) { if (fread(buffer, blocksize, 1, infile) != 1) { error("cannot read input file"); } writeCount(blocksize, outfile); if (fwrite(buffer, blocksize, 1, outfile) != 1) { error("cannot write output file"); } writeCount(blocksize, outfile); } fclose(infile); writeCount(0, outfile); } writeCount(0xFFFFFFFF, outfile); fclose(outfile); return 0;}

三、生成磁带镜像文件: 

    三种方法:

         1、直接下载并解压:

         2、 ./mkdisttap.pl > v7.tap

         3、  gcc -Wall -g -o mktape mktape.c

                 ./mktape

最后两种方法必须把前面准备的f0  f1  f2  f3  f4  f5  f6放到目录下。

得到有可能unix_v7.tm、Unix-v7-Keith-Bostic.tap等,文件大小11.7M,为了下面描述的统一都改名为:v7.tap

四、安装

~/simhSample/v7/test$ lsboot.ini   tapei.ini  tboot.ini  v7.tap~/simhSample/v7/test$ cat tapei.ini set cpu 11/45set cpu idleset rp0 rp06att rp0 rp06-0.diskatt tm0 v7.tapboot tm0~/simhSample/v7/test$ cat tapei.iniset cpu 11/45set cpu idleset rp0 rp06att rp0 rp06-0.diskatt tm0 v7.tapboot tm0~/simhSample/v7/test$ cat tapei.iniset cpu 11/45set cpu idleset rp0 rp06att rp0 rp06-0.diskatt tm0 v7.tapboot tm0~/simhSample/v7/test$ pdp11 tapei.iniPDP-11 simulator V3.9-0Disabling XQRP: creating new fileOverwrite last track? [N] Boot: tm(0,3)file sys size: 5000file system: hp(0,0)isize = 1600m/n = 3 500Exit calledBoot: tm(0,4)Tape? tm(0,5)Disk? hp(0,0)Last chance before scribbling on disk. End of tapeBoot: hp(0,0)hptmunixmem = 177344# MV HPTMUNIX UNIX# RM HP*IX# LS *IXRPHTUNIXRPTMUNIXUNIX# RM RP*IX# CD /DEV# MAKE RP06/ETC/MKNOD RP0 B 6 0/ETC/MKNOD SWAP B 6 1/ETC/MKNOD RP3 B 6 7/ETC/MKNOD RRP0 C 14 0/ETC/MKNOD RRP3 C 14 7CHMOD GO-W RP0 SWAP RP3 RRP0 RRP3# MAKE TM/ETC/MKNOD MT0 B 3 0/ETC/MKNOD RMT0 C 12 0/ETC/MKNOD NRMT0 C 12 128CHMOD GO+W MT0 RMT0 NRMT0# CD /# /ETC/MKFS /DEV/RP3 322276ISIZE = 65496M/N = 3 500# DD IF=/DEV/NRMT0 OF=/DEV/NULL BS=20B FILES=6202+80 RECORDS IN202+75 RECORDS OUT# RESTOR RF /DEV/RMT0 /DEV/RP3LAST CHANCE BEFORE SCRIBBLING ON /DEV/RP3. END OF TAPE# /ETC/MOUNT /DEV/RP3 /USR# DD IF=/USR/MDEC/HPUBOOT OF=/DEV/RP0 COUNT=10+1 RECORDS IN0+1 RECORDS OUT# SYNC# SYNC# SYNC# SYNC# ^ESimulation stopped, PC: 002306 (MOV (SP)+,177776)sim> qGoodbye~/simhSample/v7/test$ cat rp06-0.disk  tapei.ini    tboot.ini    v7.tap       ~/simhSample/v7/test$ cat tboot.ini echoecho at the prompt type inecho @ hp(0,0)unixechoset cpu 11/70set cpu 2Mset cpu idleset rp0 rp06att rp0 rp06-0.diskatt tm0 v7.tapboot tm0~/simhSample/v7/test$ pdp11 tboot.ini PDP-11 simulator V3.9-0at the prompt type in@ hp(0,0)unixDisabling XQBoot: hp(0,0)unixmem = 2020544#^D# RESTRICTED RIGHTS: USE, DUPLICATION, OR DISCLOSUREIS SUBJECT TO RESTRICTIONS STATED IN YOUR CONTRACT WITHWESTERN ELECTRIC COMPANY, INC.WED DEC 31 19:04:20 EST 1969login: rootPassword:rootYou have mail.# df/dev/rp0 1297/dev/rp3 297414# ^ESimulation stopped, PC: 002306 (MOV (SP)+,177776)sim> qGoodbye

五、运行(这个boot.ini解决的维基这篇文章中不能用磁盘rp06启动的问题)

~/simhSample/v7/test$ cat boot.ini echoecho at the prompt type inecho @ hp(0,0)unixechoset cpu 11/70set cpu 2Mset cpu idleset rp0 rp06attach rp0 rp06-0.diskd cpu 2000 042102d cpu 2002 012706d cpu 2004 002000d cpu 2006 012700d cpu 2010 000000d cpu 2012 012701d cpu 2014 176700d cpu 2016 012761d cpu 2020 000040d cpu 2022 000010d cpu 2024 010061d cpu 2026 000010d cpu 2030 012711d cpu 2032 000021d cpu 2034 012761d cpu 2036 010000d cpu 2040 000032d cpu 2042 012761d cpu 2044 177000d cpu 2046 000002d cpu 2050 005061d cpu 2052 000004d cpu 2054 005061d cpu 2056 000006d cpu 2060 005061d cpu 2062 000034d cpu 2064 012711d cpu 2066 000071d cpu 2070 105711d cpu 2072 100376d cpu 2074 005002d cpu 2076 005003d cpu 2100 012704d cpu 2102 002020d cpu 2104 005005d cpu 2106 105011d cpu 2110 005007run 2002~/simhSample/v7/test$ pdp11 boot.ini PDP-11 simulator V3.9-0at the prompt type in@ hp(0,0)unixDisabling XQbootBoot: hp(0,0)unixmem = 2020544# ^D# Simulation stopped, PC: 002306 (MOV (SP)+,177776)sim> qGoodbye~/simhSample/v7/test$ pdp11 boot.ini PDP-11 simulator V3.9-0at the prompt type in@ hp(0,0)unixDisabling XQbootBoot: hp(0,0)unixmem = 2020544# ^D# RESTRICTED RIGHTS: USE, DUPLICATION, OR DISCLOSUREIS SUBJECT TO RESTRICTIONS STATED IN YOUR CONTRACT WITHWESTERN ELECTRIC COMPANY, INC.WED DEC 31 19:04:52 EST 1969login: rootPassword:rootYou have mail.# # cat /etc/passwdroot:VwL97VCAx1Qhs:0:1::/:daemon:x:1:1::/:sys::2:2::/usr/sys:bin::3:3::/bin:uucp::4:4::/usr/lib/uucp:/usr/lib/uucicodmr::7:3::/usr/dmr:# ^Dlogin: dmr$ cat >> hello.cmain(){   printf("Hello World!\n");}^D$ cc hello.c$  ./a.outHello World!$

fortran77

$ ed euclid.f?euclid.fa      PROGRAM EUCLID        PRINT *, 'A?'        READ *, NA        IF (NA.LE.0) THEN          PRINT *, 'A must be a positive integer.'          STOP        END IF        PRINT *, 'B?'        READ *, NB        IF (NB.LE.0) THEN          PRINT *, 'B must be a positive integer.'          STOP        END IF        PRINT *, 'The GCD of', NA, ' and', NB, ' is', NGCD(NA, NB), '.'        STOP      END      FUNCTION NGCD(NA, NB)        IA = NA        IB = NB    1   IF (IB.NE.0) THEN          ITEMP = IA          IA = IB          IB = MOD(ITEMP, IB)          GOTO 1        END IF        NGCD = IA        RETURN      END.w643q$ cat euclid.f      PROGRAM EUCLID        PRINT *, 'A?'        READ *, NA        IF (NA.LE.0) THEN          PRINT *, 'A must be a positive integer.'          STOP        END IF        PRINT *, 'B?'        READ *, NB        IF (NB.LE.0) THEN          PRINT *, 'B must be a positive integer.'          STOP        END IF        PRINT *, 'The GCD of', NA, ' and', NB, ' is', NGCD(NA, NB), '.'        STOP      END      FUNCTION NGCD(NA, NB)        IA = NA        IB = NB    1   IF (IB.NE.0) THEN          ITEMP = IA          IA = IB          IB = MOD(ITEMP, IB)          GOTO 1        END IF        NGCD = IA        RETURN      END$ f77 euclid.feuclid.f:   MAIN euclid:Warning on line 7 of euclid.f: statement cannot be reachedWarning on line 13 of euclid.f: statement cannot be reached   ngcd:Warning on line 26 of euclid.f: statement cannot be reached$ a.out A?20 B?28 The GCD of 20  and 28  is 4 .$ rm a.out euclid.o

unix v7源代码

转载于:https://my.oschina.net/u/2245781/blog/1815111

你可能感兴趣的文章
苏宁发布区块链白皮书,披露零售、物流、金融等场景实践
查看>>
[20180502]ORA-01580.txt
查看>>
笨办法学 Python · 续 练习 29:`diff`和`patch`
查看>>
十年Python大牛花了三天总结出来的python基础知识实例,超详细!
查看>>
C++开发的数据库连接查询修改小工具
查看>>
比特币创始人开发新型保值持久性货币,或将碾压现有数字货币
查看>>
展望下一代超级计算机
查看>>
「深度」全国仅有617位AI专家,高校开设AI学院能否填补人才缺口?
查看>>
大数据技术人年度盛事! BDTC 2016将于12月8-10日在京举行
查看>>
Android源码剖析之Framework层实战版(Ams管理Activity启动)
查看>>
Spring MVC异常处理实例
查看>>
2017 IAI国际创享节第二日:创享不止,精彩继续
查看>>
Android基础之Activity launchMode详解
查看>>
h.264直接预测
查看>>
22【在线日志分析】之项目第二阶段概述
查看>>
Windows TCP: TCP接收窗口自动调谐(Auto-Tuning)原理介绍
查看>>
因域名解析导致数据库连接延迟分析
查看>>
Oracle RAC 归档 与 非归档 切换
查看>>
oracle之 数据泵dump文件存放nfs报ORA-27054
查看>>
[AlwaysOn Availability Groups]SQL Server错误日志(AG)
查看>>