Transferring Files between Unix v7 and host

519 views
Skip to first unread message

Yifan Nie

unread,
Jan 4, 2021, 11:34:07 PM1/4/21
to [PiDP-11]
Hi there,
I'm sorry to raise this question again if there were already solutions in the forum (I tried to search the specific term Unix v7 but didn't find satisfying answers).

I'm running unix v7 on my PiDP-11, and I have some script on host (raspberry pi linux) that I wanted to transfer to the simh emulated unix v7 system. I know I could do :
$ed script.c
a
ctrl +v copy
lines of codes
.
w
q
but its slow and if I need to modify something, my abysmal skill of ed really sucks and might blow it...
Is there a way to transfer files between the host(pi) to the unix v7 file system?
I knew there's the FSIO tool but it seemed to work on DEC file systems like the one in RSX11? Will that work on unix v7?

Thanks
Yifan

Warner Losh

unread,
Jan 4, 2021, 11:44:48 PM1/4/21
to Yifan Nie, [PiDP-11]


On Mon, Jan 4, 2021, 9:34 PM Yifan Nie <yifan....@gmail.com> wrote:
Hi there,
I'm sorry to raise this question again if there were already solutions in the forum (I tried to search the specific term Unix v7 but didn't find satisfying answers).

I'm running unix v7 on my PiDP-11, and I have some script on host (raspberry pi linux) that I wanted to transfer to the simh emulated unix v7 system. I know I could do :
$ed script.c
a
ctrl +v copy
lines of codes
.
w
q
but its slow and if I need to modify something, my abysmal skill of ed really sucks and might blow it...
Is there a way to transfer files between the host(pi) to the unix v7 file system?

Tar tapes? I used them extensively when I was doing the 2.11BSD work... i can't recall if I used a hacked tar from V7 to create them files that I fed to simh or not...  it was way easier than terminal programs... but if you want those, both xmodem and older Kermit programs will run there.

Warner

I knew there's the FSIO tool but it seemed to work on DEC file systems like the one in RSX11? Will that work on unix v7?

Thanks
Yifan

--
You received this message because you are subscribed to the Google Groups "[PiDP-11]" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-11/20bae7b9-97f5-43ec-ba14-eb1a62685b4bn%40googlegroups.com.

Geert Rolf

unread,
Jan 5, 2021, 7:36:31 AM1/5/21
to [PiDP-11]
I haven/t used V7 yet, but the hints are:
- See if v7 sees the tape-unit. It will only support TS-11 or TM-11 drives not the TMSCP type from early '80s. I expect it will as the drivers in V7 are not polling for devices: system crashes at startup if exepcted hardware is not there.
- in the SIMH ini file attach the tapedrive to a xxx.tar file in stead of a xxx.tap file. This allows a tar file to be treated as a tape without metainfo about TapeMarks and Blocksize.
- you can create a tar-file under Raspbian or any other [LU]*x.  Blocksize for old PDP-11s is "1" aka 512 bytes per block:  tar cbf 1 file.tar data1... data2. Or use tar xvb 20 on V7 to read a "tape" with large blocks of 10240 bytes each as is standard on bigger gear than PDP-11s.

The above is not a ready to use solution, but feel free to tell where you het stuck.

Geert

ma...@infocomm.com

unread,
Jan 5, 2021, 8:32:21 AM1/5/21
to [PiDP-11]
simh has direct support for getting data on tar files into simulators:

sim> ATTACH {TM0|TQ0|TS0|TU0} -F TAR tar-file-spec

The default block size is 10K, but alternatives can be specified with:

sim> ATTACH  {TM0|TQ0|TS0|TU0}  -FB TAR 512 tar-file-spec

- Mark

Clem Cole

unread,
Jan 5, 2021, 10:21:17 AM1/5/21
to Yifan Nie, [PiDP-11]
There are numerous solutions, but one of the quickest and easiest is to create a virtual disk (this is just blocks).   Under V7, use makedev in the /dev directory to add do the mknod's of the block and character files), then you can read/write with "tar -f"  (or any other utility) to the virtual disk (/dev/rp0x, /dev/rrp0x or whatever)  In simh, before to start the simulation, attach a local file to the RP/RL/RK - what ever device you pick.   I tend to it 'buffer_file."

You have in effect created a 'two port' disk with that file.   Then when you read/write the blocks will be tar images - since tar writes things in terms of 512-byte blocks which of course is what the disk will do also -- not extra metadata.   On the V7 side, I would recommend the character (raw) device, not the blocked one but both can be made to work.

One small warning about tar with 7th edition.  The original Thompson tar in V7 does not create directories automatically, so tar images being read on V7 that were created on modern systems >>may<< produce errors because of assumptions about the reader program.  That said, nothing is fatal and no bits are changed, you just may have to create a few directories before you read the image.   To save a little hassle, you might want to grab a slightly newer version, like the one from 4.1BSD which should recompile as is and not need anything you don't have.  [IIRC Noel has a few tools on his web site for v6 and v7 that make some of this work a little easier]

--

Adam Thornton

unread,
Jan 5, 2021, 10:50:52 AM1/5/21
to Yifan Nie, [PiDP-11]
You can also do this the classical way and set up UUCP on each end and transfer files that way.


documents the process well.


Yifan Nie

unread,
Jan 5, 2021, 1:43:24 PM1/5/21
to [PiDP-11]
Hi Mark,
Thanks a lot for your help. Actually I encountered another problem (sorry i'm a newbie with simh):
I prepared my file to be transferred on host by tar -cvf FIB.tar FIB.FT and got FIB.tar.
then in the simh I did sim> attach -f tar /home/pi/Downloads/FIB.tar
I got error:
Invalid Tape Format: TAR
I searched in the simh manual

For simulated magnetic tapes, the ATTACH command can specify the format of the attached tape image file: ATTACH -f <tape_unit> <format> <filename>

The currently supported tape image file formats are:

SIMH SIMH simulator format 
 E11 E11 simulator format
TPC TPC format 
 P7B Pierce simulator 7-track format 

This that because tar was not supported by simh? how can I zip my file into the above format? Thanks

ma...@infocomm.com

unread,
Jan 5, 2021, 1:47:47 PM1/5/21
to [PiDP-11]
Try this:

$ git pull https://github.com/simh/simh
$ cd simh
$ make pdp11
$ BIN/pdp11
sim> ATTACH TS0 -F TAR tar-container-file.tar

- Mark

Yifan Nie

unread,
Jan 5, 2021, 1:51:49 PM1/5/21
to [PiDP-11]
Hi Clem, 
Thanks a lot for your help, I didn't find the makedev tool under my /dev/ dir, neither on my user account nor root account.
where can I find this makedev tool to proceed? 
Thanks
Screen Shot 2021-01-05 at 1.50.19 PM.png

Clem Cole

unread,
Jan 5, 2021, 2:39:36 PM1/5/21
to Yifan Nie, [PiDP-11]
There is a makefile in /dev   make XXX will make device XXX   for instance, make tm  will make the tm11 based devices.
If you look inside (with a cat command) you will see the commands that will be used.   In your case, you will need to add rp06, rl, rk style devices.   You can also try do type: ls -l /dev/*rk* /dev/*rp* /dev/*mt* 

setup.pdf

Yifan Nie

unread,
Jan 5, 2021, 3:31:46 PM1/5/21
to [PiDP-11]
Hi Mark,
Thanks for your help. I tried on my freshly built simh (v4-0-0) (just a few days ago) on a x86-64 mac, it could work
sim> attach TQ0 -f tar /Users/nyf/Downloads/a.tar
TQ0: Tape Image '/Users/nyf/Downloads/a.tar' scanned as TAR format

But on my PiDP-11 (simh v4-0-0) it couldn't recognize the tar format 😂
sim> attach tm0 -f tar /home/pi/Downloads/FIB.tar
Invalid Tape Format: TAR
If  I replace the type TAR with SIMH it could attach... 

It's really strange, both of the two simhs are of V4-0-0 as I typed
sim> SHOW VERSION
But I could not replace the PiDP-11 version with the github one because it was a modified version with the realcons/panel blinkenlights driving codes incorporated in it...
Screen Shot 2021-01-05 at 3.26.53 PM.png

Yifan Nie

unread,
Jan 5, 2021, 5:58:59 PM1/5/21
to [PiDP-11]
Hi Clem,
Thanks a lot for your help. I'm so sorry to ask you again (I'm really a newbie). I now understand a little bit about the make command, it will execute the script in makefile like /etc/mknod ......
upon checking my makefile, it shows:
$ cat makefile
rp03:
        /etc/mknod rp0 b 1 1
        /etc/mknod swap b 1 2
        /etc/mknod rp3 b 1 3
        /etc/mknod rrp0 c 11 1
        /etc/mknod rrp3 c 11 3
        chmod go-w rp0 swap rp3 rrp0 rrp3

rp04 rp05:
        /etc/mknod rp0 b 6 0
        /etc/mknod swap b 6 1
        /etc/mknod rp3 b 6 6
        /etc/mknod rrp0 c 14 0
        /etc/mknod rrp3 c 14 6
        chmod go-w rp0 swap rp3 rrp0 rrp3

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 7
        chmod go-w rp0 swap rp3 rrp0 rrp3

tm:
        /etc/mknod mt0 b 3 0
        /etc/mknod rmt0 c 12 0
        /etc/mknod nrmt0 c 12 128
        chmod go+w mt0 rmt0 nrmt0

ht:
        /etc/mknod mt0 b 7 64
        /etc/mknod mt1 b 7 0
        /etc/mknod rmt0 c 15 64
        /etc/mknod rmt1 c 15 0
        /etc/mknod nrmt0 c 15 192
        /etc/mknod nrmt1 c 15 128
        chmod go+w mt0 mt1 rmt0 rmt1 nrmt0 nrmt1

and ls /dev/ shows
...rp0, rp3, rrp0, rrp3. etc...
How can I make a new disk dev called for example rp4 and rrp4 so as to use this rp4/rrp4 as the temp disk to transfer files? 
Should i add a line in the rp06 section like /etc/mknod rp4 x x x what are the numbers that I should fill here? I really don't dare modify it blindly because I might ruin the whole system and need to reburn the sd card image...
If I don't do anything, when I type make rp06, it seems to execute the script in the rp06 section and recreate the rp0, rp3 which might flush my current root / file system and user file system?

Thanks a lot.
Yifan

Clem Cole

unread,
Jan 5, 2021, 8:06:07 PM1/5/21
to Yifan Nie, [PiDP-11]
I feel a little of the teach a man to fish vs. give a man a fish here -- .
type this:
cd /dev
for I in 0 1 2 3 4 5 6 7
do
/etc/mknod rk$I b 2 $i
/etc/mknod rrk$I c 9 0
done
chmod go-w rk* rrk*


This will set up 7 rk05 disks, the rrk* are raw devices - that should get you unstuck but ....

Respectfully please, stop, do not pass go .... open the URL : Seventh Edition Unix Users Manuals   note both PS and PDF are available from that top directory.

Download the Volume 2 as a minimum  which has all the V7 papers stuff in /usr/doc ...  (getting the man pages - vol1 - would be a good idea too - which is everything from /usr/man/man*/*).

I would also >>highly<< suggest that you at a minimum find a copy of Kernighan and Pikes’ ‘The Unix Programming Environment’ (a.k.a. UPE) and even look for Steven’s ‘Advanced Programming in the Unix Environment‘ (a.k.a. APUE) and if you don't already have it a copy of K&R[1] - do yourself a favor and get that also.  All three are available at any good online book retailer, many small independents, most college libraries (as well as many small public ones), and even in the wild as downloadable PDFs. Please do the exercises in UPE (and K&R if you have not already) and you should have mastered the basics of C and UNIX. 

You will quickly master ed, sed, grep, and all the Unix tools which frankly will make you a better UNIX user of modern Unix implementations be it Mac, Linux or Win/WSL subsystem [In fact, I highly recommend that you do the exercises on any of those systems before to continue with simh -- it will make your life >>much<< easier.

FWIW: Steven’s many texts will help make you a better Unix (and/or Linux) programmer as you will now understand the basic UNIX API - but for playing with simh, they are probably less interesting.

Feel free to send me email off list and I'll try to help/answer questions.   You probably want to download a copy of fsck for V7, as well as a few other tools.  Again Noel's web site has a number of extras.   Obviously 2BSD was for V7 but loading that can be a bit of a task for the novice.   I believe Aharon Robbin's got 's' running on V7 and that might be easier (which is Webb Miller's 'tiny vi') from his book 'A Software tools sampler' and that might be kicking around -- which will make working on V7 a tad easier.

Clem

[1] K&R second edition describes the language from after the original ANSI standard.  The original K&R describes the language just before Seventh Edition - a.k.a. 'typesetter c.'   If you are messing with V7, that compiler will not match the current book.



rk.pdf
rp.pdf
tm.pdf

Clem Cole

unread,
Jan 5, 2021, 8:09:35 PM1/5/21
to Yifan Nie, [PiDP-11]
typo:
cd /dev
for I in 0 1 2 3 4 5 6 7
do
/etc/mknod rk$I b 2 $I
/etc/mknod rrk$I c 9 $I

done
chmod go-w rk* rrk*

ma...@infocomm.com

unread,
Jan 5, 2021, 8:13:13 PM1/5/21
to [PiDP-11]
> But on my PiDP-11 (simh v4-0-0) it couldn't recognize the tar format 😂
> sim> attach tm0 -f tar /home/pi/Downloads/FIB.tar
>   Invalid Tape Format: TAR

Well, imbedded TAR functionality has been a part of the simh codebase since 
early April 2019.  I can't speak to who or how it was packaged for your use, but 
maybe users could pressure those who supply that stuff to provide easy ways 
for either them to update the critical components that they depend on, or to
provide guidance for how the users can do it themselves.

- Mark

Clem Cole

unread,
Jan 5, 2021, 8:15:36 PM1/5/21
to Yifan Nie, [PiDP-11]


On Tue, Jan 5, 2021 at 5:59 PM Yifan Nie <yifan....@gmail.com> wrote:

/etc/mknod rp4 x y z what are the numbers that I should fill here? 

Quickly, mknod creates 'special files' which are mapping between the user space and the kernel drivers. x y z define first the type special file ('b' - block or 'c' character) - which says with table in the file c.c to use (bdevsw or cdevsw).   The Y is called the 'major number' and is the index into that table.   The z is called the minor number and is passed into each device driver routine as a parameter.   Look in the /usr/sys/conf for the file c.c and then at a driver like the rk05 (rk.c) /usr/sys/dev

Best wishes,
Clem

will...@gmail.com

unread,
Feb 9, 2022, 12:02:02 PM2/9/22
to [PiDP-11]
Clem,

Great answers all around. This one is crystal. I wish I'd have seen it when I started out on this path, would have saved me so many readings (but your point about fishing vs fish prolly holds here).

Will
Reply all
Reply to author
Forward
0 new messages