{"id":1565,"date":"2025-12-20T21:17:39","date_gmt":"2025-12-20T21:17:39","guid":{"rendered":"https:\/\/pdp2011.sytse.net\/wordpress\/?p=1565"},"modified":"2025-12-21T22:20:51","modified_gmt":"2025-12-21T22:20:51","slug":"unix-v4","status":"publish","type":"post","link":"https:\/\/pdp2011.sytse.net\/wordpress\/unix-v4\/","title":{"rendered":"Unix V4"},"content":{"rendered":"\n<p>Today the long awaited image of the UNIX V4 tape from University of Utah was published. And it actually contained Unix &#8211; that must&#8217;ve been such a relief. Anyway, I had to try it on PDP2011. Yes, it works.<\/p>\n\n\n\n<p>There&#8217;s some trickery involved in converting the tape image to a bootable RK image, and that was figured out very quickly by the collective wisdom of the people on the PiDP-11 mailing list. Read up there, or find a very concise summary here <a href=\"http:\/\/squoze.net\/UNIX\/v4\/\">http:\/\/squoze.net\/UNIX\/v4\/<\/a><\/p>\n\n\n\n<p>Working with it is a lesson in anger management, to be honest. No, the &#8216;cd&#8217; command didn&#8217;t exist yet, you have to type &#8216;chdir&#8217; &#8211; typos are not allowed, and to make sure you get that message loud and clear a backspace lets you start all over. Guess how many tries it took me to type &#8216;chdir \/usr\/src\/conf&#8217;, and then remembering that it&#8217;s sys instead of src. Still it is super interesting to see this earlier version.<\/p>\n\n\n\n<p>A short session log then:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">boot from rk:<br> <br>Hello, world [PDP2011 boot]: cpu 11\/45 fpu<br>177776           psw<br>177774           slr<br>177772           pir<br>177770           mbr<br>177676 - 177600  pdr\/par<br>177576 - 177572  mmu<br>177570           sdr<br>177566 - 177560  kl<br>177546           kw<br>177416 - 177400  rk<br>173776 - 173000  m9312<br>172516           mmu<br>172376 - 172300  pdr\/par<br>172276 - 172200  pdr\/par<br>165776 - 165000  m9312<br><br>boot from rk:<br><strong>k<\/strong><br><strong>unix<\/strong><br><br>login: <strong>bin<\/strong><br>% <strong>chdir \/usr\/sys\/conf<\/strong><br>% <strong>.\/mkconf<\/strong><br><strong>rk<br>tc<br>tm<br>dh<br>pc<br>mem<\/strong><br><strong>^D<\/strong><br>% <strong>sh rc<\/strong><br>rm mkconf.c and rc when done<br>% <strong>cat conf.c<\/strong><br>\/*<br> *      Copyright 1974 Bell Telephone Laboratories Inc<br> *\/<br><br>int     (*bdevsw[])()<br>{<br>        &amp;nulldev,       &amp;nulldev,       &amp;rkstrategy,    &amp;rktab,<br>        &amp;nulldev,       &amp;tcclose,       &amp;tcstrategy,    &amp;tctab,<br>        &amp;tmopen,        &amp;tmclose,       &amp;tmstrategy,    &amp;tmtab,<br>        0<br>};<br><br>int     (*cdevsw[])()<br>{<br>        &amp;klopen,   &amp;klclose,   &amp;klread,   &amp;klwrite,   &amp;klsgtty,<br>        &amp;nulldev,  &amp;nulldev,   &amp;rkread,   &amp;rkwrite,   &amp;nodev,<br>        &amp;tmopen,   &amp;tmclose,   &amp;tmread,   &amp;tmwrite,   &amp;nodev,<br>        &amp;dhopen,   &amp;dhclose,   &amp;dhread,   &amp;dhwrite,   &amp;dhsgtty,<br>        &amp;pcopen,   &amp;pcclose,   &amp;pcread,   &amp;pcwrite,   &amp;nodev,<br>        &amp;nulldev,  &amp;nulldev,   &amp;mmread,   &amp;mmwrite,   &amp;nodev,<br>        0<br>};<br><br>int     rootdev {(0&lt;&lt;8)|0};<br>int     swapdev {(0&lt;&lt;8)|0};<br>int     swplo   4000;<br>int     nswap   872;<br>% <strong>^D<\/strong><br>login: <strong>root<\/strong><br># <strong>chdir \/dev<\/strong><br># <strong>ls<\/strong><br>null<br>tty8<br># <strong>rm null<\/strong><br>null: 0100444 mode y<br># <strong>\/etc\/mknod mem c 5 0<\/strong><br># <strong>\/etc\/mknod kmem c 5 1<\/strong><br># <strong>\/etc\/mknod null c 5 2<\/strong><br># <strong>sync<\/strong><br># <strong>sync<\/strong><br><br>Hello, world [PDP2011 boot]: cpu 11\/45 fpu<br>177776           psw<br>177774           slr<br>177772           pir<br>177770           mbr<br>177676 - 177600  pdr\/par<br>177576 - 177572  mmu<br>177570           sdr<br>177566 - 177560  kl<br>177546           kw<br>177416 - 177400  rk<br>173776 - 173000  m9312<br>172516           mmu<br>172376 - 172300  pdr\/par<br>172276 - 172200  pdr\/par<br>165776 - 165000  m9312<br><br>boot from rk:<br><strong>k<\/strong><br><strong>unix<\/strong><br><br>login: <strong>root<\/strong><br># <strong>ps al<\/strong><br> 31 -100  127 0     0   2   60416 ?? e?????a??Tal?&lt;Z? ????? l?  ?  <br> 12   40  127 0     1   6   60454 \/etc\/init  <br> 12   40  127 8     7   9   60500 -  <br> 13  100    1 8    30  12         ps al  <br> 12   90  127 0     6   5   60160 \/etc\/update  <br># <strong>mv . x<\/strong><br>values of B will give rise to dom!<br># <br><\/pre>\n\n\n\n<p>What did I just do?<\/p>\n\n\n\n<p>The kernel on the tape doesn&#8217;t include the mem driver &#8211; and thus, the ps command doesn&#8217;t work, and neither is there a \/dev\/null &#8211; there is a file named that on the image from the tape, but it is a regular file.<\/p>\n\n\n\n<p>To correct that, we need to make a config (ie, run mkconf) and type in a list of drivers to its standard input. I&#8217;ve kept the list of devices the same as the tape kernel has (I think!) and just added the mem. Then relink the kernel. All this is done under the bin account as intended, it won&#8217;t work nicely if you run it as root. You&#8217;ll have to be root to add the device special files in \/dev though. The major number of 5 is the number of the line in the conf.c cdevsw array; the minor numbers are 0 for mem, 1 for kmem, 2 for null.<\/p>\n\n\n\n<p>Having done that, reboot, login as root and check if the ps command now works. And if the easter egg in mv was already present in V4. Yes, it is.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today the long awaited image of the UNIX V4 tape from University of Utah was published. And it actually contained Unix &#8211; that must&#8217;ve been such a relief. Anyway, I had to try it on PDP2011. Yes, it works. There&#8217;s some trickery involved in converting the tape image to a bootable RK image, and that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1565","post","type-post","status-publish","format-standard","hentry","category-pdp11","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/posts\/1565","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/comments?post=1565"}],"version-history":[{"count":7,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/posts\/1565\/revisions"}],"predecessor-version":[{"id":1576,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/posts\/1565\/revisions\/1576"}],"wp:attachment":[{"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/media?parent=1565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/categories?post=1565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/tags?post=1565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}