February 3, 2015

MightyFrame cpio demystified

I personally find cpio very confusing, and I hear that I'm not alone.

When working with the UNIX PC previously in this endeavor,  I abandoned trying, because someone had provided a working version of tar for the 3b1 (MC68010 processor).

However, when I started this post, I couldn't find the equivalent for the MightyFrame MC68020 processor.  I thought that now I must break down and learn how to use cpio.  Since then, Tom has pointed out that it is actually there, at /usr/bin/tar.  But, I found other reasons that I need cpio, such as copying an entire file/directory structure.  So, here is my analysis, such that it is:

Since the MightyFrame has no man pages, I'l left to extrapolate what this means from more modern and verbose documentation.

So, here is the usage on the MightyFrame:

# cpio
Usage: cpio -o[acvBQ] <name-list >collection
       cpio -i[cdmrstuvfBQ6] [pattern ...] <collection
       cpio -p[adlmruv] directory <name-list

OK, so let's go to something much better documented, yet as close as I can find...the AT&T UNIX PC:

on the UNIX PC, v3.51, we see:
# cpio
Usage: cpio -o[acvBT#O#] <name-list >collection
       cpio -i[cdmrstuvxRBT#O#f6] [pattern ...] <collection
       cpio -p[adlmruv] directory <name-list

And, a link to this page in the AT&T UNIX PC - UNIX SYSTEM V User's Manual Volume I:

WARNING...the link above opens the entire Volume I, so there may be slow loading.

An extract from these pages:

          The first example below copies the contents of a directory into an
          archive; the second duplicates a directory hierarchy:
                    ls | cpio -o >/dev/rfp021
                    cd olddir
                    find • - depth - print I cpio - pdl newdir
          The trivial case "find • -depth -print | cpio -oB
          > /dev /rfp021" can be handled more efficiently by:
                    find • - cpio / dev/rfp021

Stolen from http://linux.about.com/od/commands/l/blcmdl1_cpio.htm

So, then the question is, how many of the options listed below for modern cpio have changed meaning and/or purpose?  I suspect a few...let's see:

cpio {-o|--create}

cpio {-i|--extract} 

cpio {-p|--pass-through}

So, now that I have the perspective in a more modern language, then I'm going to try my interpretation from the extract above.  This should copy many directories to one file, and then "unzip" them back to their original structure in the new location where the -i command is run.

Create from current all files and directories in current location:

find . -cpio destinationfile

Extract all files and directories in current location:

cpio -iduv < sourcefile


So, now that I have used cpio at least a few times successfully, I decided to take on the instructions that Chuck(G) discuss here in response to my question in post #8, and on to the end.  At the time that we discussed this topic on this thread, I didn't have hardly a clue how to execute it, but tonight, for the first time, I did.

It's a good thing that I tried it both on the UNIX PC and the MightyFrame, because the UNIX PC alone might have not been as easy.  

I downloaded the dev set files, and then did some fancy transferring using the MFM Emulator, (which I hope to elaborate on in a future post).  

Basically, I got it to the UNIX PC using by writing a .tar using modern Linux to 60Mb QIC, then copying onto the MightyFrame, then using the UNIX PC emulated as a 2nd disk on D1 position, then copied them over.  A truly circuitous route, I admit, but I was feeling creative.

Now, when trying cat then cpio on the UNIX PC, I got disheartened when I saw:

# cat disk01 disk02 disk03 disk04 disk05 disk06 disk07 disk08 > devset.cpio
# cpio -iduv < creation/devset.cpio
Out of phase--get help

Well, not being one to give up easily, I went right over to the MightyFrame (which had the exact same files on it already), and did the exact same thing...and I'm glad I did, because I DID get a different result.  

# cpio -iduv < creation/devset.cpio
Out of phase--get help
Perhaps the "-c" option should be used

VERY helpful!!!!!  The "-c" option?  What does that do??  Something I would never even have thought to check...it was SO nice of the MightyFrame CTIX to suggest it to me...great job guys, 30 years ago!!!  I'm cheering you on here!!!

-c  Write header information in ASCII character form for portability.

So, I ended up trying this:

# cpio -idcuv < creation/devset.cpio

AND, I got the whole directory set created for the UNIX PC Development Set.


So, I went right back to the UNIX PC and did the exact same thing...and it worked just as well!  Too bad the UNIX PC wasn't able to suggest "-c".

Anyway, on to more with CPIO.  What's next?  Well...let's see...I have some ideas...



The game that is being played here, If based at all in reality, seems to indicate that a VAX 11/780 ran UNIX™ System V, Release 2.2 as at least one of its operating systems.

Well, I know I've heard vintage computing people discuss this system.

Bitsavers has a lot of manuals for that...now which one has the man page for cpio?

Well, there is more exploration on this vintage-computer forum thread.



This process was discussed extensively in this Vintage-Computer Forum Thread.

Here are the highlights of installing the right cpio for this no-absolute-filenames
function on a MightyFrame:

Download the "MightyFrame-modified BSD system cpio oldest GNU cpio build still easily available"

Place it in the desired directory on the MightyFrame. We'll call it /MyDirectory
(To do this transfer, I use QIC tape written by my TandbergTDC-3620 with SCSI card on modern Linux to do create the tape that is read by the MightyFrame: dd if=/dev/rmt0 of=/MyDirectory/cpio-2.4.2.tar )


cd /MyDirectory

tar xvf cpio-2.4.2.tar

cd /MyDirectory/cpio-2.4.2

Then "./configure" followed by "make" to build it. 

If all completes well, then when you try

# /MyDirectory/cpio-2.4.2/cpio

you should see

# /MyDirectory/cpio-2.4.2/cpio
Usage: /data/cpio-2.4.2/cpio {-o|--create} [-0acvABLV] [-C bytes] [-H format] [-M message]
       [-O [[user@]host:]archive] [-F [[user@]host:]archive]
       [--file=[[user@]host:]archive] [--format=format] [--message=message]
       [--null] [--reset-access-time] [--verbose] [--dot] [--append]
       [--block-size=blocks] [--dereference] [--io-size=bytes] [--quiet]
       [--force-local] [--help] [--version] < name-list [> archive]
       /data/cpio-2.4.2/cpio {-i|--extract} [-bcdfmnrtsuvBSV] [-C bytes] [-E file] [-H format]
       [-M message] [-R [user][:.][group]] [-I [[user@]host:]archive]
       [-F [[user@]host:]archive] [--file=[[user@]host:]archive]
       [--make-directories] [--nonmatching] [--preserve-modification-time]
       [--numeric-uid-gid] [--rename] [--list] [--swap-bytes] [--swap] [--dot]
       [--unconditional] [--verbose] [--block-size=blocks] [--swap-halfwords]
       [--io-size=bytes] [--pattern-file=file] [--format=format]
       [--owner=[user][:.][group]] [--no-preserve-owner] [--message=message]
       [--force-local] [--no-absolute-filenames] [--sparse] [--only-verify-crc]
       [--quiet] [--help] [--version] [pattern...] [< archive]
       /data/cpio-2.4.2/cpio {-p|--pass-through} [-0adlmuvLV] [-R [user][:.][group]]
       [--null] [--reset-access-time] [--make-directories] [--link] [--quiet]
       [--preserve-modification-time] [--unconditional] [--verbose] [--dot]
       [--dereference] [--owner=[user][:.][group]] [--no-preserve-owner]
       [--sparse] [--help] [--version] destination-directory < name-list