changeset 1999:0a302a23acaa

new script
author boisy
date Thu, 23 Feb 2006 02:28:30 +0000
parents 31ec6767f46c
children b461e5ff3d1f
files scripts/bndi
diffstat 1 files changed, 109 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/bndi	Thu Feb 23 02:28:30 2006 +0000
@@ -0,0 +1,109 @@
+#!/usr/bin/perl
+#
+# BNDI - Build a NitrOS-9 Disk Image
+#
+# This script builds a NitrOS-9 disk image
+
+use IO::File;
+use POSIX qw(tmpnam);
+
+$NITROS9DIR = $ENV{'NITROS9DIR'};
+$CLOUD9DIR = $ENV{'CLOUD9DIR'};
+$DISTRO = "6809l2";
+
+
+# Check for proper number of arguments
+$numargs = $#ARGV + 1;
+if ($numargs != 4)
+{
+	print "Usage: bundi <bootlist> <tracklist> <diskname> <distro>\n";
+	exit;
+}
+
+$bootlist = $ARGV[0];
+$tracklist = $ARGV[1];
+$diskname = $ARGV[2];
+$DISTRO = $ARGV[3];
+
+printf("Building '%s' distribution onto '%s'\n", $DISTRO, $diskname);
+
+$os9_sectors = 4096;
+printf("Number of sectors: %d\n", $os9_sectors);
+
+print "########## PART  I ##########\n";
+print "#                           #\n";
+print "#    Assemble EVERYTHING!   #\n";
+print "#                           #\n";
+print "#############################\n\n";
+
+print "Step 1 - Making the ENTIRE NitrOS-9 Project (could take a while)...\n";
+#system("cd $NITROS9DIR; make dsk>&/dev/null");
+
+print "Step 2 - Making the HDB-DOS Product...\n";
+system("cd $CLOUD9DIR/Products/HDB-DOS/Software; make dsk>&/dev/null");
+
+print "Step 3 - Making the Ved Product...\n";
+system("cd $ENV{'CLOUD9DIR'}/Products/Ved/Software; make dsk>&/dev/null");
+
+print "########## PART II ##########\n";
+print "#                           #\n";
+print "#   Prepare the Disk Image  #\n";
+print "#                           #\n";
+print "#############################\n\n";
+
+print "Step 1 - Format the disk and make the boot disk\n";
+system("os9 format -qe -l$os9_sectors tmp.dsk");
+
+
+# Read bootlist file and expand any variables
+open(FILE, "$bootlist") or die ("Unable to open $bootlist");
+@bootarray = <FILE>;
+close(FILE);
+foreach $element (@bootarray)
+{
+	if (($element =~ /^#/) || ($element =~ /^\*/))
+	{
+		$element = "";
+	}
+	else
+	{
+		$element =~ s/\$(\w+)/${$1}/g;
+		$element =~ s/\s+$//;
+	}
+}
+
+$bls = "@bootarray";
+system("cat $bls>bootfile");
+
+# Read tracklist file and expand any variables
+open(FILE, "$tracklist") or die ("Unable to open $tracklist");
+@trackarray = <FILE>;
+close(FILE);
+foreach $element (@trackarray)
+{
+	if (($element =~ /^#/) || ($element =~ /^\*/))
+	{
+		$element = "";
+	}
+	else
+	{
+		$element =~ s/\$(\w+)/${$1}/g;
+		$element =~ s/\s+$//;
+	}
+}
+
+$tls = "@trackarray";
+system("cat $tls>trackfile");
+system("os9 padrom 4608 trackfile");
+
+system("os9 gen -b=bootfile -t=trackfile tmp.dsk>&/dev/null");
+system("os9 copy -o=0 $NITROS9DIR/$DISTRO/modules/sysgo_dd tmp.dsk,sysgo");
+system("os9 attr tmp.dsk,sysgo -epepr");
+system("os9 dsave -e $NITROS9DIR/$DISTRO/nos9"."$DISTRO"."_80d.dsk, tmp.dsk, >&/dev/null");
+system("os9 copy -o=0 $NITROS9DIR/3rdparty/p2mods/noice/calldbg tmp.dsk,cmds/calldbg");
+system("os9 attr tmp.dsk,cmds/calldbg -epepr");
+
+print "Step 3 - Put it all together\n";
+system("mv tmp.dsk $diskname");
+
+print "Ok, we're done! The file $diskname is now a fresh disk image.\n";