1874
|
1 #!/usr/bin/perl
|
1765
|
2 #
|
|
3 # BUNDI - Build the Ultimate NitrOS-9 Disk Image
|
|
4 #
|
1874
|
5 # This script builds the ULTIMATE NitrOS-9 disk image,
|
1765
|
6 # complete with HDB-DOS drives!
|
|
7 #
|
|
8 # The resulting image has a NitrOS-9 partition and an HDB-DOS partition.
|
|
9 # The first drive of the HDB-DOS partition is the HDB-DOS distribution
|
|
10 # diskette. The last drive is the NitrOS-9 boot disk.
|
|
11 #
|
|
12 # Size of image is 90,624 256-byte sectors, which fits in
|
|
13 # $00B100 OS-9 Offset in HDB-DOS
|
1875
|
14
|
|
15 use IO::File;
|
|
16 use POSIX qw(tmpnam);
|
|
17
|
1765
|
18 #
|
1770
|
19 # ATTENTION! Set the HDB-DOS offset in your HDB-DOS ROM here! (must be in decimal)
|
1874
|
20 $hdbdos_offset = 45312; # 0x00B100
|
1770
|
21 # ATTENTION! Set the number of HDB-DOS virtual disks (must be in decimal)
|
1874
|
22 $num_hdbdos_disks = 128;
|
|
23 $NITROS9DIR = $ENV{'NITROS9DIR'};
|
|
24 $CLOUD9DIR = $ENV{'CLOUD9DIR'};
|
1875
|
25 $DISTRO = "6809l2";
|
1874
|
26
|
1770
|
27
|
1874
|
28 # Check for proper number of arguments
|
|
29 $numargs = $#ARGV + 1;
|
1880
|
30 if ($numargs != 4)
|
1874
|
31 {
|
1880
|
32 print "Usage: bundi <bootlist> <tracklist> <diskname> <distro>\n";
|
1874
|
33 exit;
|
|
34 }
|
|
35
|
1875
|
36 $bootlist = $ARGV[0];
|
|
37 $tracklist = $ARGV[1];
|
|
38 $diskname = $ARGV[2];
|
1880
|
39 $DISTRO = $ARGV[3];
|
1770
|
40
|
1878
|
41 printf("Building '%s' distribution onto '%s'\n", $DISTRO, $diskname);
|
1874
|
42
|
|
43 $multiplier = 2;
|
|
44 $os9_sectors = $hdbdos_offset * $multiplier;
|
|
45 printf("Number of sectors: %d\n", $os9_sectors);
|
1933
|
46 $hdb_drives = $num_hdbdos_disks - 3;
|
1765
|
47
|
1874
|
48 print "########## PART I ##########\n";
|
|
49 print "# #\n";
|
|
50 print "# Assemble EVERYTHING! #\n";
|
|
51 print "# #\n";
|
|
52 print "#############################\n\n";
|
1765
|
53
|
1874
|
54 print "Step 1 - Making the ENTIRE NitrOS-9 Project (could take a while)...\n";
|
|
55 #system("cd $NITROS9DIR; make dsk>&/dev/null");
|
1779
|
56
|
1874
|
57 print "Step 2 - Making the HDB-DOS Product...\n";
|
|
58 system("cd $CLOUD9DIR/Products/HDB-DOS/Software; make dsk>&/dev/null");
|
1765
|
59
|
1874
|
60 print "Step 3 - Making the Ved Product...\n";
|
|
61 system("cd $ENV{'CLOUD9DIR'}/Products/Ved/Software; make dsk>&/dev/null");
|
|
62
|
|
63 print "########## PART II ##########\n";
|
|
64 print "# #\n";
|
|
65 print "# Prepare the Disk Image #\n";
|
|
66 print "# #\n";
|
|
67 print "#############################\n\n";
|
1779
|
68
|
1874
|
69 print "Step 1 - Format the disk and make the boot disk\n";
|
|
70 system("os9 format -qe -l$os9_sectors tmp.dsk");
|
1875
|
71
|
|
72
|
|
73 # Read bootlist file and expand any variables
|
|
74 open(FILE, "$bootlist") or die ("Unable to open $bootlist");
|
|
75 @bootarray = <FILE>;
|
|
76 close(FILE);
|
|
77 foreach $element (@bootarray)
|
|
78 {
|
1876
|
79 if (($element =~ /^#/) || ($element =~ /^\*/))
|
1875
|
80 {
|
|
81 $element = "";
|
|
82 }
|
|
83 else
|
|
84 {
|
|
85 $element =~ s/\$(\w+)/${$1}/g;
|
|
86 $element =~ s/\s+$//;
|
|
87 }
|
|
88 }
|
|
89
|
|
90 $bls = "@bootarray";
|
|
91 system("cat $bls>bootfile");
|
|
92
|
|
93 # Read tracklist file and expand any variables
|
|
94 open(FILE, "$tracklist") or die ("Unable to open $tracklist");
|
|
95 @trackarray = <FILE>;
|
|
96 close(FILE);
|
|
97 foreach $element (@trackarray)
|
|
98 {
|
1876
|
99 if (($element =~ /^#/) || ($element =~ /^\*/))
|
1875
|
100 {
|
|
101 $element = "";
|
|
102 }
|
|
103 else
|
|
104 {
|
|
105 $element =~ s/\$(\w+)/${$1}/g;
|
|
106 $element =~ s/\s+$//;
|
|
107 }
|
|
108 }
|
|
109
|
|
110 $tls = "@trackarray";
|
|
111 system("cat $tls>trackfile");
|
1880
|
112 system("os9 padrom 4608 trackfile");
|
1875
|
113
|
|
114 system("os9 gen -b=bootfile -t=trackfile tmp.dsk>&/dev/null");
|
|
115 system("os9 copy -o=0 $NITROS9DIR/$DISTRO/modules/sysgo_dd tmp.dsk,sysgo");
|
1874
|
116 system("os9 attr tmp.dsk,sysgo -epepr");
|
1878
|
117 system("os9 dsave -e $NITROS9DIR/$DISTRO/nos9"."$DISTRO"."_80d.dsk, tmp.dsk, >&/dev/null");
|
1874
|
118 system("os9 dsave -e $NITROS9DIR/3rdparty/packages/uucpbb/uucpbb21_6309.dsk, tmp.dsk, >&/dev/null");
|
|
119 system("os9 dsave -e $NITROS9DIR/3rdparty/packages/cc/cc.dsk, tmp.dsk, >&/dev/null");
|
|
120 system("os9 dsave -e $NITROS9DIR/3rdparty/packages/basic09/basic09v010100.dsk, tmp.dsk, >&/dev/null");
|
|
121 system("os9 dsave -e $CLOUD9DIR/Products/Ved/Software/ved.dsk, tmp.dsk, >&/dev/null");
|
|
122 system("os9 format -qe -ss -dd boot.dsk");
|
1875
|
123 system("os9 gen -b=bootfile -t=trackfile boot.dsk>&/dev/null");
|
1779
|
124
|
1874
|
125 print "Step 2 - Build the HDB-DOS drives\n";
|
|
126 system("rm hdbdrives.dsk");
|
|
127 system("decb dskini -h$hdb_drives hdbdrives.dsk");
|
|
128 system("rm hdbdrives2.dsk");
|
1933
|
129 system("cat $CLOUD9DIR/Products/HDB-DOS/Software/hdbdos.dsk hdbdrives.dsk $CLOUD9DIR/Products/SuperIDE/Distributions/v1.0/superide.dsk boot.dsk>hdbdrives2.dsk");
|
1874
|
130 system("rm hdbdrives.dsk boot.dsk");
|
|
131 system("decb hdbconv hdbdrives2.dsk hdbdrives.dsk");
|
|
132 system("rm hdbdrives2.dsk");
|
1779
|
133
|
1874
|
134 print "Step 3 - Put it all together\n";
|
|
135 system("rm $diskname");
|
|
136 system("cat tmp.dsk hdbdrives.dsk>$diskname");
|
|
137 system("rm tmp.dsk hdbdrives.dsk");
|
|
138
|
|
139 print "Ok, we're done! The file $diskname is now a fresh disk image.\n";
|