Skip to content

Commit

Permalink
dist: Add support for BIN/CUE images and ISO images.
Browse files Browse the repository at this point in the history
Worth noting that SGI boot CDs are _NOT_ ISO-9660.  For those of us used
to 2048-byte sectored discs with a raw ISO-9660 or UDF file systems, SGI
CDs are weird.

They use 512-byte sectors and a SGI disklabel like a SGI hard drive
would.  They have multiple partitions (up to 16), and use the same
filesystems as they would on a hard drive.

Typically the convention is:
- 8 is used for general-purpose volume file system data
- 9 is the volume header partition, and is used to store the
  layout of the volume.  It *must* start at sector 0.
- 11 represents the "whole device"

https://irix7.com/techpubs/007-2825-001.pdf page 6 details all the
various conventions (note IRIX counts partitions from 0 not 1).

Our support just loads from partition 8 without considering other
partitions, since this seems to be the structure used for the foundation
discs.
  • Loading branch information
sjlongland committed Jul 3, 2022
1 parent f39fe3b commit 7ddc35b
Showing 1 changed file with 50 additions and 5 deletions.
55 changes: 50 additions & 5 deletions scripts/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ function formatdisk {
}


### Extract an image from the given source file to the specified directory
function extractefs {
mount -t efs "$1" /mnt
rsync -aq /mnt/ $2
umount /mnt
}


### Populate the distribution disk with CD images stored in irix/<IRIX VERSION>
### Images must be in subfolders - multiple images in a directory will be copied on top of one another
### e.g.
Expand All @@ -53,19 +61,56 @@ function copydist {
SUB=${d::-1}
mkdir -p /irix/$SUB

# Convert BIN/CUE files (e.g. archive.org) to raw EFS
for i in /vagrant/irix/$IRIXVERS/$SUB/*.bin
do
echo "Converting BIN/CUE image \"$i\" to ISO..."
i_bn="${i%%.bin}"
img="${i_bn}.img"
cue="${i_bn}.cue"
# Skip .bin missing .cue, or already extracted
if [ -f "$cue" ] ; then
# This will create ${i_bn}-01.iso
bchunk "$i" "$cue" "${i_bn}-"
fi
done

for i in /vagrant/irix/$IRIXVERS/$SUB/*
do
case "$( basename "$i" )" in
*.tar.gz) # Tar/Gzip
echo "Extracting files from \"$i\"..."
mkdir /irix/$SUB
if [ ! -d /irix/$SUB ]; then
mkdir /irix/$SUB
fi
tar -C /irix/$SUB -xzpf "$i"
;;
*) # EFS image
*.bin|*.cue) # BIN/CUE image -- ignore
echo "Ignoring BIN/CUE image \"$i\""
;;
*.iso) # "ISO" image
echo "Copying files from \"$i\"..."
# loop-mount the "ISO" image, it will
# be a raw SGI disklabel (i.e. like a HDD),
# not really an ISO9660 image. We call it an "ISO"
# because bchunk does -- it won't let us call it
# anything else.
d="$( losetup -f -P -r --show "$i" )"
echo "- Loop-mounted at $d, waiting for part scan"
# EFS image is in partition 8
echo "- Extracting from ${d}p8"
extractefs ${d}p8 /irix/$SUB
# Unmount loop image
losetup -d $d
;;
*) # EFS image (assumed)
echo "Copying files from \"$i\"..."
mount -o loop -t efs "$i" /mnt
rsync -aq /mnt/ /irix/$SUB
umount /mnt
# To keep extractefs simple, we'll do our own
# loop-mount here.
d="$( losetup -f -r --show "$i" )"
extractefs "$d" /irix/$SUB
# Unmount loop image
losetup -d $d
;;
esac
done
Expand Down

0 comments on commit 7ddc35b

Please sign in to comment.