annotate scripts/bndi @ 1999:0a302a23acaa

new script
author boisy
date Thu, 23 Feb 2006 02:28:30 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1999
0a302a23acaa new script
boisy
parents:
diff changeset
1 #!/usr/bin/perl
0a302a23acaa new script
boisy
parents:
diff changeset
2 #
0a302a23acaa new script
boisy
parents:
diff changeset
3 # BNDI - Build a NitrOS-9 Disk Image
0a302a23acaa new script
boisy
parents:
diff changeset
4 #
0a302a23acaa new script
boisy
parents:
diff changeset
5 # This script builds a NitrOS-9 disk image
0a302a23acaa new script
boisy
parents:
diff changeset
6
0a302a23acaa new script
boisy
parents:
diff changeset
7 use IO::File;
0a302a23acaa new script
boisy
parents:
diff changeset
8 use POSIX qw(tmpnam);
0a302a23acaa new script
boisy
parents:
diff changeset
9
0a302a23acaa new script
boisy
parents:
diff changeset
10 $NITROS9DIR = $ENV{'NITROS9DIR'};
0a302a23acaa new script
boisy
parents:
diff changeset
11 $CLOUD9DIR = $ENV{'CLOUD9DIR'};
0a302a23acaa new script
boisy
parents:
diff changeset
12 $DISTRO = "6809l2";
0a302a23acaa new script
boisy
parents:
diff changeset
13
0a302a23acaa new script
boisy
parents:
diff changeset
14
0a302a23acaa new script
boisy
parents:
diff changeset
15 # Check for proper number of arguments
0a302a23acaa new script
boisy
parents:
diff changeset
16 $numargs = $#ARGV + 1;
0a302a23acaa new script
boisy
parents:
diff changeset
17 if ($numargs != 4)
0a302a23acaa new script
boisy
parents:
diff changeset
18 {
0a302a23acaa new script
boisy
parents:
diff changeset
19 print "Usage: bundi <bootlist> <tracklist> <diskname> <distro>\n";
0a302a23acaa new script
boisy
parents:
diff changeset
20 exit;
0a302a23acaa new script
boisy
parents:
diff changeset
21 }
0a302a23acaa new script
boisy
parents:
diff changeset
22
0a302a23acaa new script
boisy
parents:
diff changeset
23 $bootlist = $ARGV[0];
0a302a23acaa new script
boisy
parents:
diff changeset
24 $tracklist = $ARGV[1];
0a302a23acaa new script
boisy
parents:
diff changeset
25 $diskname = $ARGV[2];
0a302a23acaa new script
boisy
parents:
diff changeset
26 $DISTRO = $ARGV[3];
0a302a23acaa new script
boisy
parents:
diff changeset
27
0a302a23acaa new script
boisy
parents:
diff changeset
28 printf("Building '%s' distribution onto '%s'\n", $DISTRO, $diskname);
0a302a23acaa new script
boisy
parents:
diff changeset
29
0a302a23acaa new script
boisy
parents:
diff changeset
30 $os9_sectors = 4096;
0a302a23acaa new script
boisy
parents:
diff changeset
31 printf("Number of sectors: %d\n", $os9_sectors);
0a302a23acaa new script
boisy
parents:
diff changeset
32
0a302a23acaa new script
boisy
parents:
diff changeset
33 print "########## PART I ##########\n";
0a302a23acaa new script
boisy
parents:
diff changeset
34 print "# #\n";
0a302a23acaa new script
boisy
parents:
diff changeset
35 print "# Assemble EVERYTHING! #\n";
0a302a23acaa new script
boisy
parents:
diff changeset
36 print "# #\n";
0a302a23acaa new script
boisy
parents:
diff changeset
37 print "#############################\n\n";
0a302a23acaa new script
boisy
parents:
diff changeset
38
0a302a23acaa new script
boisy
parents:
diff changeset
39 print "Step 1 - Making the ENTIRE NitrOS-9 Project (could take a while)...\n";
0a302a23acaa new script
boisy
parents:
diff changeset
40 #system("cd $NITROS9DIR; make dsk>&/dev/null");
0a302a23acaa new script
boisy
parents:
diff changeset
41
0a302a23acaa new script
boisy
parents:
diff changeset
42 print "Step 2 - Making the HDB-DOS Product...\n";
0a302a23acaa new script
boisy
parents:
diff changeset
43 system("cd $CLOUD9DIR/Products/HDB-DOS/Software; make dsk>&/dev/null");
0a302a23acaa new script
boisy
parents:
diff changeset
44
0a302a23acaa new script
boisy
parents:
diff changeset
45 print "Step 3 - Making the Ved Product...\n";
0a302a23acaa new script
boisy
parents:
diff changeset
46 system("cd $ENV{'CLOUD9DIR'}/Products/Ved/Software; make dsk>&/dev/null");
0a302a23acaa new script
boisy
parents:
diff changeset
47
0a302a23acaa new script
boisy
parents:
diff changeset
48 print "########## PART II ##########\n";
0a302a23acaa new script
boisy
parents:
diff changeset
49 print "# #\n";
0a302a23acaa new script
boisy
parents:
diff changeset
50 print "# Prepare the Disk Image #\n";
0a302a23acaa new script
boisy
parents:
diff changeset
51 print "# #\n";
0a302a23acaa new script
boisy
parents:
diff changeset
52 print "#############################\n\n";
0a302a23acaa new script
boisy
parents:
diff changeset
53
0a302a23acaa new script
boisy
parents:
diff changeset
54 print "Step 1 - Format the disk and make the boot disk\n";
0a302a23acaa new script
boisy
parents:
diff changeset
55 system("os9 format -qe -l$os9_sectors tmp.dsk");
0a302a23acaa new script
boisy
parents:
diff changeset
56
0a302a23acaa new script
boisy
parents:
diff changeset
57
0a302a23acaa new script
boisy
parents:
diff changeset
58 # Read bootlist file and expand any variables
0a302a23acaa new script
boisy
parents:
diff changeset
59 open(FILE, "$bootlist") or die ("Unable to open $bootlist");
0a302a23acaa new script
boisy
parents:
diff changeset
60 @bootarray = <FILE>;
0a302a23acaa new script
boisy
parents:
diff changeset
61 close(FILE);
0a302a23acaa new script
boisy
parents:
diff changeset
62 foreach $element (@bootarray)
0a302a23acaa new script
boisy
parents:
diff changeset
63 {
0a302a23acaa new script
boisy
parents:
diff changeset
64 if (($element =~ /^#/) || ($element =~ /^\*/))
0a302a23acaa new script
boisy
parents:
diff changeset
65 {
0a302a23acaa new script
boisy
parents:
diff changeset
66 $element = "";
0a302a23acaa new script
boisy
parents:
diff changeset
67 }
0a302a23acaa new script
boisy
parents:
diff changeset
68 else
0a302a23acaa new script
boisy
parents:
diff changeset
69 {
0a302a23acaa new script
boisy
parents:
diff changeset
70 $element =~ s/\$(\w+)/${$1}/g;
0a302a23acaa new script
boisy
parents:
diff changeset
71 $element =~ s/\s+$//;
0a302a23acaa new script
boisy
parents:
diff changeset
72 }
0a302a23acaa new script
boisy
parents:
diff changeset
73 }
0a302a23acaa new script
boisy
parents:
diff changeset
74
0a302a23acaa new script
boisy
parents:
diff changeset
75 $bls = "@bootarray";
0a302a23acaa new script
boisy
parents:
diff changeset
76 system("cat $bls>bootfile");
0a302a23acaa new script
boisy
parents:
diff changeset
77
0a302a23acaa new script
boisy
parents:
diff changeset
78 # Read tracklist file and expand any variables
0a302a23acaa new script
boisy
parents:
diff changeset
79 open(FILE, "$tracklist") or die ("Unable to open $tracklist");
0a302a23acaa new script
boisy
parents:
diff changeset
80 @trackarray = <FILE>;
0a302a23acaa new script
boisy
parents:
diff changeset
81 close(FILE);
0a302a23acaa new script
boisy
parents:
diff changeset
82 foreach $element (@trackarray)
0a302a23acaa new script
boisy
parents:
diff changeset
83 {
0a302a23acaa new script
boisy
parents:
diff changeset
84 if (($element =~ /^#/) || ($element =~ /^\*/))
0a302a23acaa new script
boisy
parents:
diff changeset
85 {
0a302a23acaa new script
boisy
parents:
diff changeset
86 $element = "";
0a302a23acaa new script
boisy
parents:
diff changeset
87 }
0a302a23acaa new script
boisy
parents:
diff changeset
88 else
0a302a23acaa new script
boisy
parents:
diff changeset
89 {
0a302a23acaa new script
boisy
parents:
diff changeset
90 $element =~ s/\$(\w+)/${$1}/g;
0a302a23acaa new script
boisy
parents:
diff changeset
91 $element =~ s/\s+$//;
0a302a23acaa new script
boisy
parents:
diff changeset
92 }
0a302a23acaa new script
boisy
parents:
diff changeset
93 }
0a302a23acaa new script
boisy
parents:
diff changeset
94
0a302a23acaa new script
boisy
parents:
diff changeset
95 $tls = "@trackarray";
0a302a23acaa new script
boisy
parents:
diff changeset
96 system("cat $tls>trackfile");
0a302a23acaa new script
boisy
parents:
diff changeset
97 system("os9 padrom 4608 trackfile");
0a302a23acaa new script
boisy
parents:
diff changeset
98
0a302a23acaa new script
boisy
parents:
diff changeset
99 system("os9 gen -b=bootfile -t=trackfile tmp.dsk>&/dev/null");
0a302a23acaa new script
boisy
parents:
diff changeset
100 system("os9 copy -o=0 $NITROS9DIR/$DISTRO/modules/sysgo_dd tmp.dsk,sysgo");
0a302a23acaa new script
boisy
parents:
diff changeset
101 system("os9 attr tmp.dsk,sysgo -epepr");
0a302a23acaa new script
boisy
parents:
diff changeset
102 system("os9 dsave -e $NITROS9DIR/$DISTRO/nos9"."$DISTRO"."_80d.dsk, tmp.dsk, >&/dev/null");
0a302a23acaa new script
boisy
parents:
diff changeset
103 system("os9 copy -o=0 $NITROS9DIR/3rdparty/p2mods/noice/calldbg tmp.dsk,cmds/calldbg");
0a302a23acaa new script
boisy
parents:
diff changeset
104 system("os9 attr tmp.dsk,cmds/calldbg -epepr");
0a302a23acaa new script
boisy
parents:
diff changeset
105
0a302a23acaa new script
boisy
parents:
diff changeset
106 print "Step 3 - Put it all together\n";
0a302a23acaa new script
boisy
parents:
diff changeset
107 system("mv tmp.dsk $diskname");
0a302a23acaa new script
boisy
parents:
diff changeset
108
0a302a23acaa new script
boisy
parents:
diff changeset
109 print "Ok, we're done! The file $diskname is now a fresh disk image.\n";