Mkdisttap.pl

From Computer History Wiki
Jump to: navigation, search

This is a simple perl script to create a tape suitable for SIMH to use. Importantly, it places end of file markers so you can have multiple files on a 'tape' image, much like how a real tape operates.

Quasijarus 0c & 4.3 BSD UWisc

The following is the script formatted for 4.3 BSD Quasijarus 0c, however it can easily be adapted for the other BSD's.


#!/usr/local/bin/perl -w
use 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("stand", 512);
end_file();
add_file("miniroot", 10240);
end_file();
add_file("rootdump", 10240);
end_file();
add_file("usr.tar", 10240);
end_file();
add_file("srcsys.tar", 10240);
end_file();
add_file("src.tar", 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);
}

4.2 & 4.3 BSD

This is the format of the script to generate 42.tap for 4.2 BSD, and the 43.tap for 4.3 BSD.

#!/usr/local/bin/perl -w
use 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("stand", 512);
end_file();
add_file("miniroot", 10240);
end_file();
add_file("rootdump", 10240);
end_file();
add_file("srcsys.tar", 10240);
end_file();
add_file("usr.tar", 10240);
end_file();
add_file("vfont.tar", 10240);
end_file();
add_file("src.tar", 10240);
end_file();
add_file("new.tar", 10240);
end_file();
add_file("ingres.tar", 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);
}


4.3 RENO

This is the config file for RENO:

#!/usr/local/bin/perl -w
use 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("stand", 512);
end_file();
add_file("miniroot", 10240);
end_file();
add_file("rootdump", 10240);
end_file();
add_file("usr.tar", 10240);
end_file();
add_file("src.tar", 10240);
end_file();
add_file("srcsys.tar", 10240);
end_file();
add_file("contrib.tar", 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);
 }

Ultrix 4.0

The following is the script formatted for Ultrix 4.0. I would imagine it could be used for other Ultrix releases..


#!/usr/local/bin/perl -w
use 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("file.01", 512);
end_file();
add_file("file.02", 512);
end_file();
add_file("file.03", 10240);
end_file();
add_file("file.04", 10240);
end_file();
add_file("file.05", 10240);
end_file();
add_file("file.06", 10240);
end_file();
add_file("file.07", 10240);
end_file();
add_file("file.08", 10240);
end_file();
add_file("file.09", 10240);
end_file();
add_file("file.10", 10240);
end_file();
add_file("file.11", 10240);
end_file();
add_file("file.12", 10240);
end_file();
add_file("file.13", 10240);
end_file();
add_file("file.14", 10240);
end_file();
add_file("file.15", 10240);
end_file();
add_file("file.16", 10240);
end_file();
add_file("file.17", 10240);
end_file();
add_file("file.18", 10240);
end_file();
add_file("file.19", 10240);
end_file();
add_file("file.20", 10240);
end_file();
add_file("file.21", 10240);
end_file();
add_file("file.22", 10240);
end_file();
add_file("file.23", 10240);
end_file();
add_file("file.24", 10240);
end_file();
add_file("file.25", 10240);
end_file();
add_file("file.26", 10240);
end_file();
add_file("file.27", 10240);
end_file();
add_file("file.28", 10240);
end_file();
add_file("file.29", 10240);
end_file();
add_file("file.30", 10240);
end_file();
add_file("file.31", 10240);
end_file();
add_file("file.32", 10240);
end_file();
add_file("file.33", 10240);
end_file();
add_file("file.34", 10240);
end_file();
add_file("file.35", 10240);
end_file();
add_file("file.36", 10240);
end_file();
add_file("file.37", 10240);
end_file();
add_file("file.38", 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);
}


Research Unix v7

The following is the script formatted for Seventh Edition Unix.


#!/usr/local/bin/perl -w
use 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);
}