소스 검색

[contrib] Add rom-o-matic to contrib

tags/v1.0.0-rc1
Marty Connor 15 년 전
부모
커밋
67a10ef000
41개의 변경된 파일1854개의 추가작업 그리고 0개의 파일을 삭제
  1. 62
    0
      contrib/rom-o-matic/bottom.php
  2. 306
    0
      contrib/rom-o-matic/build.php
  3. 69
    0
      contrib/rom-o-matic/customize-flags.php
  4. 63
    0
      contrib/rom-o-matic/directions.php
  5. 1
    0
      contrib/rom-o-matic/doc/AUTOBOOT_CMD.html
  6. 1
    0
      contrib/rom-o-matic/doc/BANNER_TIMEOUT.html
  7. 3
    0
      contrib/rom-o-matic/doc/COMCONSOLE.html
  8. 1
    0
      contrib/rom-o-matic/doc/COMDATA.html
  9. 1
    0
      contrib/rom-o-matic/doc/COMPARITY.html
  10. 1
    0
      contrib/rom-o-matic/doc/COMPRESERVE.html
  11. 1
    0
      contrib/rom-o-matic/doc/COMSPEED.html
  12. 1
    0
      contrib/rom-o-matic/doc/COMSTOP.html
  13. 1
    0
      contrib/rom-o-matic/doc/CONFIG_CMD.html
  14. 1
    0
      contrib/rom-o-matic/doc/CONSOLE_PC_BIOS.html
  15. 1
    0
      contrib/rom-o-matic/doc/CONSOLE_SERIAL.html
  16. 1
    0
      contrib/rom-o-matic/doc/CRYPTO_80211_WEP.html
  17. 1
    0
      contrib/rom-o-matic/doc/CRYPTO_80211_WPA.html
  18. 1
    0
      contrib/rom-o-matic/doc/CRYPTO_80211_WPA2.html
  19. 1
    0
      contrib/rom-o-matic/doc/DHCP_CMD.html
  20. 1
    0
      contrib/rom-o-matic/doc/DNS_RESOLVER.html
  21. 1
    0
      contrib/rom-o-matic/doc/DOWNLOAD_PROTO_FTP.html
  22. 1
    0
      contrib/rom-o-matic/doc/DOWNLOAD_PROTO_HTTP.html
  23. 1
    0
      contrib/rom-o-matic/doc/DOWNLOAD_PROTO_TFTP.html
  24. 1
    0
      contrib/rom-o-matic/doc/IFMGMT_CMD.html
  25. 1
    0
      contrib/rom-o-matic/doc/IMAGE_BZIMAGE.html
  26. 1
    0
      contrib/rom-o-matic/doc/IMAGE_CMD.html
  27. 1
    0
      contrib/rom-o-matic/doc/IMAGE_ELF.html
  28. 1
    0
      contrib/rom-o-matic/doc/IMAGE_MULTIBOOT.html
  29. 1
    0
      contrib/rom-o-matic/doc/IMAGE_NBI.html
  30. 1
    0
      contrib/rom-o-matic/doc/IMAGE_PXE.html
  31. 1
    0
      contrib/rom-o-matic/doc/IMAGE_SCRIPT.html
  32. 1
    0
      contrib/rom-o-matic/doc/IWMGMT_CMD.html
  33. 1
    0
      contrib/rom-o-matic/doc/NMB_RESOLVER.html
  34. 1
    0
      contrib/rom-o-matic/doc/NVO_CMD.html
  35. 1
    0
      contrib/rom-o-matic/doc/ROUTE_CMD.html
  36. 1
    0
      contrib/rom-o-matic/doc/SANBOOT_CMD.html
  37. 498
    0
      contrib/rom-o-matic/flag-table.php
  38. 51
    0
      contrib/rom-o-matic/globals.php
  39. 47
    0
      contrib/rom-o-matic/index.php
  40. 41
    0
      contrib/rom-o-matic/top.php
  41. 683
    0
      contrib/rom-o-matic/utils.php

+ 62
- 0
contrib/rom-o-matic/bottom.php 파일 보기

@@ -0,0 +1,62 @@
1
+<?
2
+
3
+/**
4
+ * Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
5
+ * Copyright (C) 2009 Entity Cyber, Inc.
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License as
9
+ * published by the Free Software Foundation; either version 2 of the
10
+ * License, or any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful, but
13
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
+ */
21
+
22
+?>
23
+<hr>
24
+<h4>
25
+Resources:
26
+</h4>
27
+<ul>
28
+  <li>
29
+    Source code for gPXE images is available at
30
+    <a href="http://etherboot.org/wiki/download" target="_blank">
31
+    http://etherboot.org/wiki/download</a>
32
+    <br><br>
33
+  </li>
34
+  <li>
35
+    For general information about using gPXE, please visit the
36
+    <a href="http://www.etherboot.org/" target="_blank">
37
+    Etherboot Project Home Page</a>
38
+    <br><br>
39
+  </li>
40
+  <li>
41
+    For Email-based support for gPXE please join
42
+    <a href="http://etherboot.org/wiki/mailinglists" target="_blank">
43
+    Etherboot Project mailing lists.</a>
44
+    <br><br>
45
+  </li>
46
+  <li>
47
+    For real-time online gPXE support via IRC please visit the
48
+    <a href="irc://irc.freenode.net/%23etherboot"> #etherboot channel
49
+    of irc.freenode.net</a>.
50
+    <br><br>
51
+  </li>
52
+</ul>
53
+<hr>
54
+  <font size="-1">
55
+    <br>
56
+    Please email <a href="mailto:<? echo "${webmaster_email}" ?>"><? echo "${webmaster_email}"?></a>
57
+    with questions or comments about this website.
58
+  </font>
59
+  <br><br>
60
+<hr>
61
+</body>
62
+</html>

+ 306
- 0
contrib/rom-o-matic/build.php 파일 보기

@@ -0,0 +1,306 @@
1
+<?php // -*- Mode: PHP; -*-
2
+
3
+/**
4
+ * Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
5
+ * Copyright (C) 2009 Entity Cyber, Inc.
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License as
9
+ * published by the Free Software Foundation; either version 2 of the
10
+ * License, or any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful, but
13
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
+ */
21
+
22
+// Get utility functions and set globals
23
+require_once "utils.php";
24
+
25
+// Make sure at least $A (action)  was supplied
26
+if ( ! isset ( $_POST['A'] ) ) {
27
+
28
+    // Present user with form to customize build options
29
+    require_once "customize-flags.php";
30
+
31
+    exit ();
32
+
33
+// If user chose "Customize" option on form
34
+} else if ( $_POST['A'] == "Customize" ) {
35
+
36
+    // Present user with form to customize build options
37
+    require_once "customize-flags.php";
38
+
39
+    exit ();
40
+
41
+// The following conditional includes all other cases except "Get Image"
42
+// particularly the explicit ($A == "Start Over") case
43
+} else if ( $_POST['A'] != "Get Image" ) {
44
+
45
+    // Note that this method of redirections discards all the
46
+    // configuration flags, which is intentional in this case.
47
+
48
+    $dest = curDirURL ();
49
+    header ( "Location: $dest" );
50
+
51
+    // This next "echo" should normally not be seen, because
52
+    // the "header" statement above should cause immediate
53
+    // redirection but just in case...
54
+
55
+    echo "Try this link: <a href=\"$dest\">$dest</a>";
56
+
57
+    exit ();
58
+}
59
+
60
+// OK, we're going to try to use whatever options have been set
61
+// to build an image.
62
+
63
+// Make sure at least $nic was supplied
64
+if ( ! isset ( $_POST['nic'] ) ) {
65
+    die ( "No NIC supplied!" );
66
+}
67
+if ( isset ( $nics[$_POST['nic']] ) ) {
68
+    $nic = $nics[$_POST['nic']];
69
+} else {
70
+    die ( "Invalid NIC \"${_POST['nic']}\" supplied!" );
71
+}
72
+
73
+// Fetch flags
74
+$flags = get_flags ();
75
+
76
+// Get requested format
77
+$ofmt = isset ( $_POST['ofmt'] ) ? $_POST['ofmt'] : "";
78
+$fmt_extension = isset ( $ofmts[$ofmt] ) ? $ofmts[$ofmt] : 'dsk';
79
+
80
+// Handle some special cases
81
+
82
+$pci_vendor_code = "";
83
+$pci_device_code = "";
84
+
85
+if ( $nic == 'undionly' && $fmt_extension == "pxe" ) {
86
+
87
+    // undionly.pxe can't work because it unloads the PXE stack
88
+    // that it needs to communicate with, so we set the extension
89
+    // to .kpxe, which has a chance of working. The extension
90
+    // .kkpxe is another option.
91
+
92
+    $fmt_extension = "kpxe";
93
+
94
+} else if ( $fmt_extension == "rom" ) {
95
+
96
+    if ( ! isset ( $_POST['pci_vendor_code'] )
97
+		 || ! isset ( $_POST['pci_device_code'] ) ) {
98
+		die ( "rom output format selected but PCI code(s) missing!" );
99
+	}
100
+
101
+	$pci_vendor_code = $_POST['pci_vendor_code'];
102
+	$pci_device_code = $_POST['pci_device_code'];
103
+
104
+    if ( $pci_vendor_code == ""
105
+		 || $pci_device_code == "" ) {
106
+		die ( "rom output format selected but PCI code(s) missing!" );
107
+	}
108
+
109
+	// Try to be forgiving of 0xAAAA format
110
+	if ( strtolower ( substr ( $pci_vendor_code, 0, 2 ) ) == "0x"
111
+		 && strlen ( $pci_vendor_code ) == 6 ) {
112
+		$pci_vendor_code = substr ( $pci_vendor_code, 2, 4 );
113
+	}
114
+	if ( strtolower ( substr ( $pci_device_code, 0, 2 ) ) == "0x"
115
+		 && strlen ( $pci_device_code ) == 6 ) {
116
+		$pci_device_code = substr ( $pci_device_code, 2, 4 );
117
+	}
118
+
119
+    // concatenate the pci codes to get the $nic part of the
120
+    // Make target
121
+    $pci_codes = strtolower (  $pci_vendor_code . $pci_device_code );
122
+
123
+    $nic = $pci_codes;
124
+    if ( ! isset ( $roms[$pci_codes] ) ) {
125
+        die (   "Sorry, no network driver supports PCI codes<br>"
126
+              . "${_POST['pci_vendor_code']}:"
127
+              . "${_POST['pci_device_code']}" );
128
+    }
129
+} else if ( $fmt_extension != "rom"
130
+            && ( $pci_vendor_code != "" || $pci_device_code != "" ) ) {
131
+    die (   "'$fmt_extension' format was selected but PCI IDs were"
132
+          . " also entered.<br>Did you mean to select 'rom' output format"
133
+          . " instead?" );
134
+}
135
+
136
+/**
137
+ * remove temporary build directory
138
+ *
139
+ * @return bool true if removal is successful, false otherwise
140
+ */
141
+function rm_build_dir ()
142
+{
143
+    global $build_dir;
144
+    global $keep_build_dir;
145
+
146
+    if ( $keep_build_dir !== true ) {
147
+        rm_file_or_dir ( $build_dir );
148
+    }
149
+}
150
+
151
+// Arrange for the build directory to always be removed on exit.
152
+$build_dir = "";
153
+$keep_build_dir = false;
154
+register_shutdown_function ( 'rm_build_dir' );
155
+
156
+// Make temporary copy of src directory
157
+$build_dir = mktempcopy ( "$src_dir", "/tmp", "MDCROM" );
158
+$config_dir = $build_dir . "/config";
159
+
160
+// Write config files with supplied flags
161
+write_gpxe_config_files ( $config_dir, $flags );
162
+
163
+// Handle a possible embedded script
164
+$emb_script_cmd = "";
165
+$embedded_script = isset ( $_POST['embedded_script'] ) ? $_POST['embedded_script'] : "";
166
+if ( $embedded_script != "" ) {
167
+    $emb_script_path = "$build_dir" . "/script0.gpxe";
168
+
169
+	if ( substr ( $embedded_script, 0, 5 ) != "#!gpxe" ) {
170
+		$embedded_script = "#!gpxe\n" . $embedded_script;
171
+	}
172
+
173
+    // gPXE 0.9.7 doesn't like '\r\n" in the shebang...
174
+    $embedded_script = str_replace ( "\r\n", "\n", $embedded_script );
175
+
176
+    write_file_from_string ( $emb_script_path, $embedded_script );
177
+    $emb_script_cmd = "EMBEDDED_IMAGE=${emb_script_path}";
178
+}
179
+
180
+// Make the requested image.  $status is set to 0 on success
181
+$make_target = "bin/${nic}.${fmt_extension}";
182
+$make_cmd = "make -C '$build_dir' '$make_target' $emb_script_cmd $2>&1";
183
+
184
+exec ( $make_cmd, $maketxt, $status );
185
+
186
+// Uncomment the following section for debugging
187
+
188
+/**
189
+
190
+echo "<h2>build.php:</h2>";
191
+echo "<h3>Begin debugging output</h3>";
192
+
193
+//echo "<h3>\$_POST variables</h3>";
194
+//echo "<pre>"; var_dump ( $_POST ); echo "</pre>";
195
+
196
+echo "<h3>Build options:</h3>";
197
+echo "<strong>Build directory is:</strong> $build_dir" . "<br><br>";
198
+echo "\$_POST['ofmt'] = " . "\"${_POST['ofmt']}\"" . "<br>";
199
+echo "\$_POST['nic'] = " . "\"${_POST['nic']}\"" .  "<br>";
200
+echo "\$_POST['pci_vendor_code'] = " . "\"${_POST['pci_vendor_code']}\"" . "<br>";
201
+echo "\$_POST['pci_device_code'] = " . "\"${_POST['pci_device_code']}\"" . "<br>";
202
+
203
+echo "<h3>Flags:</h3>";
204
+show_flags ( $flags );
205
+
206
+if ( $embedded_script != "" ) {
207
+    echo "<h3>Embedded script:</h3>";
208
+    echo "<blockquote>"."<pre>";
209
+    echo $embedded_script;
210
+    echo "</pre>"."</blockquote>";
211
+}
212
+
213
+echo "<h3>Make output:</h3>";
214
+echo "Make command: " . $make_cmd . "<br>";
215
+echo "Build status = <? echo $status ?>" . "<br>";
216
+echo "<blockquote>"."<pre>";
217
+echo htmlentities ( implode ("\n", $maketxt ) );
218
+echo "</pre>"."</blockquote>";
219
+// Uncomment the next line if you want to keep the
220
+// build directory around for inspection after building.
221
+$keep_build_dir = true;
222
+die ( "<h3>End debugging output</h3>" );
223
+
224
+**/ //   End debugging section
225
+
226
+// Send ROM to browser (with extreme prejudice)
227
+
228
+if ( $status == 0 ) {
229
+
230
+    $fp = fopen("${build_dir}/${make_target}", "rb" );
231
+    if ( $fp > 0 ) {
232
+
233
+        $len = filesize ( "${build_dir}/${make_target}" );
234
+        if ( $len > 0 ) {
235
+
236
+            $buf = fread ( $fp, $len );
237
+            fclose ( $fp );
238
+
239
+            // Delete build directory as soon as it is not needed
240
+            rm_build_dir ();
241
+
242
+            $output_filename = "gpxe-${version}-${nic}.${fmt_extension}";
243
+
244
+            // Try to force IE to handle downloading right.
245
+            Header ( "Cache-control: private");
246
+            Header ( "Content-Type: application/x-octet-stream; " .
247
+                     "name=$output_filename");
248
+            Header ( "Content-Disposition: attachment; " .
249
+                     "Filename=$output_filename");
250
+            Header ( "Content-Location: $output_filename");
251
+            Header ( "Content-Length: $len");
252
+
253
+            echo $buf;
254
+
255
+            exit ();
256
+        }
257
+    }
258
+}
259
+
260
+/*
261
+ * If we reach this point, the build has failed, and we provide
262
+ * debugging information for a potential bug report
263
+ *
264
+ */
265
+
266
+// Remove build directory
267
+rm_build_dir ();
268
+
269
+// Announce failure if $status from make was non-zero
270
+echo "<h2>Build failed.  Status = " . $status . "</h2>";
271
+echo "<h2>build.php:</h2>";
272
+echo "<h3>Build options:</h3>";
273
+echo "<strong>Build directory is:</strong> $build_dir" . "<br><br>";
274
+echo "\$_POST['ofmt'] = " . "\"${_POST['ofmt']}\"" . "<br>";
275
+echo "\$_POST['nic'] = " . "\"${_POST['nic']}\"" .  "<br>";
276
+echo "\$_POST['pci_vendor_code'] = " . "\"${_POST['pci_vendor_code']}\"" . "<br>";
277
+echo "\$_POST['pci_device_code'] = " . "\"${_POST['pci_device_code']}\"" . "<br>";
278
+
279
+echo "<h3>Flags:</h3>";
280
+show_flags ( $flags );
281
+
282
+if ( $embedded_script != "" ) {
283
+    echo "<h3>Embedded script:</h3>";
284
+    echo "<blockquote>"."<pre>";
285
+    echo $embedded_script;
286
+    echo "</pre>"."</blockquote>";
287
+}
288
+
289
+echo "<h3>Make output:</h3>";
290
+echo "Make command: " . $make_cmd . "<br>";
291
+echo "<blockquote>"."<pre>";
292
+echo htmlentities ( implode ("\n", $maketxt ) );
293
+echo "</pre>"."</blockquote>";
294
+
295
+echo "Please let us know that this happened, and paste the above output into your email message.<br>";
296
+
297
+include_once $bottom_inc;
298
+
299
+// For emacs:
300
+//  Local variables:
301
+//  c-basic-offset: 4
302
+//  c-indent-level: 4
303
+//  tab-width: 4
304
+//  End:
305
+
306
+?>

+ 69
- 0
contrib/rom-o-matic/customize-flags.php 파일 보기

@@ -0,0 +1,69 @@
1
+<?php // -*- Mode: PHP; -*-
2
+
3
+/**
4
+ * Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
5
+ * Copyright (C) 2009 Entity Cyber, Inc.
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License as
9
+ * published by the Free Software Foundation; either version 2 of the
10
+ * License, or any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful, but
13
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
+ */
21
+
22
+// Get utility functions and set globals
23
+require_once "utils.php";
24
+
25
+// Prepare settable compile options for presentation to user
26
+$flags = default_flags ();
27
+
28
+$build = "<input type=\"submit\" name=\"A\" value=\"Get Image\">";
29
+$restart = "<input type=\"submit\" name=\"A\" value=\"Start Over\">";
30
+
31
+// Begin html output
32
+include_once $top_inc;
33
+
34
+?>
35
+
36
+<form action="build.php" method=POST>
37
+  <input type="hidden" name="version" value = "<? echo $version ?>">
38
+  <input type="hidden" name="use_flags" value="1">
39
+  <h3>
40
+    Make changes below and press <? echo $build ?> to create an image, <br>
41
+    Or press <? echo $restart ?> to return to the main page.
42
+  </h3>
43
+  <hr>
44
+  <ul>
45
+  <? require ( "directions.php" ); ?>
46
+  </ul>
47
+  <hr>
48
+  <? echo_flags( $flags ); ?>
49
+  <hr>
50
+  <h3>Embedded Script:</h3>
51
+  <? echo textarea ( "embedded_script", "", "10", "50" ); ?>
52
+  <br><br>
53
+  <hr>
54
+  <center><table width="35%"><tr>
55
+  <td align="left"> <? echo $build; ?> </td>
56
+  <td align="right"> <? echo $restart ?></td>
57
+  </tr></table></center>
58
+</form>
59
+
60
+<? include_once $bottom_inc; ?>
61
+<?
62
+// For emacs:
63
+//
64
+// Local variables:
65
+//  c-basic-offset: 4
66
+//  c-indent-level: 4
67
+//  tab-width: 4
68
+// End:
69
+?>

+ 63
- 0
contrib/rom-o-matic/directions.php 파일 보기

@@ -0,0 +1,63 @@
1
+<?
2
+
3
+/**
4
+ * Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
5
+ * Copyright (C) 2009 Entity Cyber, Inc.
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License as
9
+ * published by the Free Software Foundation; either version 2 of the
10
+ * License, or any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful, but
13
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
+ */
21
+
22
+?>
23
+    <li>
24
+      Choose an output format: <? echo keys_menubox ( "ofmt", $ofmts,
25
+      isset ( $_POST['ofmt'] ) ? $_POST['ofmt'] : "") ?>
26
+      <br><br>
27
+    </li>
28
+    <li>
29
+      Choose a NIC type: <? echo keys_menubox ( "nic", $nics,
30
+      isset ( $_POST['nic'] ) ? $_POST['nic'] : "" ) ?>
31
+      <br><br>
32
+    </li>
33
+    <li>
34
+      <strong>( optional &mdash; for binary ROM image format only )</strong> <br><br>
35
+      If you choose <em>Binary ROM image</em> as your output format, you must<br>
36
+      enter <strong>4 hex digits</strong> below for
37
+      <em>PCI VENDOR CODE</em> and <em>PCI DEVICE CODE</em>  <br>
38
+      that match the NIC device for which you are making this image.<br><br>
39
+      Information on how to determine NIC PCI IDs may be found
40
+      <a href="http://etherboot.org/wiki/romburning"
41
+      target="_blank">here</a>.
42
+      <br><br>
43
+      PCI VENDOR CODE:  <? echo textbox ( "pci_vendor_code",
44
+      isset ( $_POST['pci_vendor_code'] ) ? $_POST['pci_vendor_code']
45
+              : "", 6 ); ?>
46
+      &nbsp;&nbsp;
47
+      PCI DEVICE CODE:  <? echo textbox ( "pci_device_code",
48
+      isset ( $_POST['pci_device_code'] ) ? $_POST['pci_device_code']
49
+              : "", 6 ); ?>
50
+      <h4>Please note for ROM images:</h4>
51
+      <ul>
52
+        <li>
53
+          If you enter PCI IDs, we will attempt to determine the correct<br>
54
+          driver to support them, and will ignore any NIC type entered
55
+          above.<br><br>
56
+        </li>
57
+        <li>
58
+          gPXE does not support all possible PCI IDs for supported
59
+          NICs.
60
+          <br><br>
61
+        </li>
62
+      </ul>
63
+    </li>

+ 1
- 0
contrib/rom-o-matic/doc/AUTOBOOT_CMD.html 파일 보기

@@ -0,0 +1 @@
1
+Automatic booting

+ 1
- 0
contrib/rom-o-matic/doc/BANNER_TIMEOUT.html 파일 보기

@@ -0,0 +1 @@
1
+Tenths of a second for which the shell banner should appear

+ 3
- 0
contrib/rom-o-matic/doc/COMCONSOLE.html 파일 보기

@@ -0,0 +1,3 @@
1
+Serial Console I/O port address.  Common addresses are:<br>
2
+COM1 =>	0x3f8, COM2 => 0x2f8, COM3 => 0x3e8, COM4 => 0x2e8
3
+

+ 1
- 0
contrib/rom-o-matic/doc/COMDATA.html 파일 보기

@@ -0,0 +1 @@
1
+Serial Console Data bits

+ 1
- 0
contrib/rom-o-matic/doc/COMPARITY.html 파일 보기

@@ -0,0 +1 @@
1
+Serial Console Parity: 0=None, 1=Odd, 2=Even

+ 1
- 0
contrib/rom-o-matic/doc/COMPRESERVE.html 파일 보기

@@ -0,0 +1 @@
1
+Keep settings from a previous user of the serial port

+ 1
- 0
contrib/rom-o-matic/doc/COMSPEED.html 파일 보기

@@ -0,0 +1 @@
1
+Serial Console Baud rate

+ 1
- 0
contrib/rom-o-matic/doc/COMSTOP.html 파일 보기

@@ -0,0 +1 @@
1
+Serial Console Stop bits

+ 1
- 0
contrib/rom-o-matic/doc/CONFIG_CMD.html 파일 보기

@@ -0,0 +1 @@
1
+Option configuration console

+ 1
- 0
contrib/rom-o-matic/doc/CONSOLE_PC_BIOS.html 파일 보기

@@ -0,0 +1 @@
1
+Enable Default BIOS console

+ 1
- 0
contrib/rom-o-matic/doc/CONSOLE_SERIAL.html 파일 보기

@@ -0,0 +1 @@
1
+Enable Serial port console

+ 1
- 0
contrib/rom-o-matic/doc/CRYPTO_80211_WEP.html 파일 보기

@@ -0,0 +1 @@
1
+Wireless WEP encryption support

+ 1
- 0
contrib/rom-o-matic/doc/CRYPTO_80211_WPA.html 파일 보기

@@ -0,0 +1 @@
1
+Wireless WPA encryption support

+ 1
- 0
contrib/rom-o-matic/doc/CRYPTO_80211_WPA2.html 파일 보기

@@ -0,0 +1 @@
1
+Wireless WPA2 encryption support

+ 1
- 0
contrib/rom-o-matic/doc/DHCP_CMD.html 파일 보기

@@ -0,0 +1 @@
1
+DHCP management commands

+ 1
- 0
contrib/rom-o-matic/doc/DNS_RESOLVER.html 파일 보기

@@ -0,0 +1 @@
1
+DNS resolver

+ 1
- 0
contrib/rom-o-matic/doc/DOWNLOAD_PROTO_FTP.html 파일 보기

@@ -0,0 +1 @@
1
+File Transfer Protocol

+ 1
- 0
contrib/rom-o-matic/doc/DOWNLOAD_PROTO_HTTP.html 파일 보기

@@ -0,0 +1 @@
1
+Hypertext Transfer Protocol

+ 1
- 0
contrib/rom-o-matic/doc/DOWNLOAD_PROTO_TFTP.html 파일 보기

@@ -0,0 +1 @@
1
+Trivial File Transfer Protocol

+ 1
- 0
contrib/rom-o-matic/doc/IFMGMT_CMD.html 파일 보기

@@ -0,0 +1 @@
1
+Interface management commands

+ 1
- 0
contrib/rom-o-matic/doc/IMAGE_BZIMAGE.html 파일 보기

@@ -0,0 +1 @@
1
+Linux bzImage image support

+ 1
- 0
contrib/rom-o-matic/doc/IMAGE_CMD.html 파일 보기

@@ -0,0 +1 @@
1
+Image management commands

+ 1
- 0
contrib/rom-o-matic/doc/IMAGE_ELF.html 파일 보기

@@ -0,0 +1 @@
1
+ELF image support

+ 1
- 0
contrib/rom-o-matic/doc/IMAGE_MULTIBOOT.html 파일 보기

@@ -0,0 +1 @@
1
+MultiBoot image support

+ 1
- 0
contrib/rom-o-matic/doc/IMAGE_NBI.html 파일 보기

@@ -0,0 +1 @@
1
+NBI image support

+ 1
- 0
contrib/rom-o-matic/doc/IMAGE_PXE.html 파일 보기

@@ -0,0 +1 @@
1
+PXE image support

+ 1
- 0
contrib/rom-o-matic/doc/IMAGE_SCRIPT.html 파일 보기

@@ -0,0 +1 @@
1
+gPXE script image support

+ 1
- 0
contrib/rom-o-matic/doc/IWMGMT_CMD.html 파일 보기

@@ -0,0 +1 @@
1
+Wireless interface management commands

+ 1
- 0
contrib/rom-o-matic/doc/NMB_RESOLVER.html 파일 보기

@@ -0,0 +1 @@
1
+NMB resolver

+ 1
- 0
contrib/rom-o-matic/doc/NVO_CMD.html 파일 보기

@@ -0,0 +1 @@
1
+Non-volatile option storage commands

+ 1
- 0
contrib/rom-o-matic/doc/ROUTE_CMD.html 파일 보기

@@ -0,0 +1 @@
1
+Routing table management commands

+ 1
- 0
contrib/rom-o-matic/doc/SANBOOT_CMD.html 파일 보기

@@ -0,0 +1 @@
1
+SAN boot commands

+ 498
- 0
contrib/rom-o-matic/flag-table.php 파일 보기

@@ -0,0 +1,498 @@
1
+<?php // -*- Mode: PHP; -*-
2
+
3
+/**
4
+ * Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
5
+ * Copyright (C) 2009 Entity Cyber, Inc.
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License as
9
+ * published by the Free Software Foundation; either version 2 of the
10
+ * License, or any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful, but
13
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
+ */
21
+
22
+$ofmts = array
23
+	( "Floppy bootable image (.dsk)" => "dsk",
24
+	  "SYSLINUX-based bootable floppy image (.sdsk)" => "sdsk",
25
+	  "ISO bootable image (.iso)" => "iso",
26
+	  "ISO bootable image with legacy floppy emulation (.liso)" => "liso",
27
+	  "Linux kernel (SYSLINUX/GRUB/LILO) loadable image (.lkrn)" => "lkrn",
28
+	  "USB Keychain disk image (.usb)" => "usb",
29
+	  "ROM binary (flashable) image (.rom)" => "rom",
30
+	  "PXE bootstrap loader image [Unload PXE stack] (.pxe)" => "pxe",
31
+	  "PXE bootstrap loader keep [Keep PXE stack method 1] (.kpxe)" => "kpxe",
32
+	  "PXE bootstrap loader keep [Keep PXE stack method 2] (.kkpxe)" => "kkpxe",
33
+	);
34
+
35
+$flag_table = array (
36
+
37
+	// Begin General Options:
38
+
39
+	"HDR_MISC_OPTIONS"
40
+	=> array (
41
+	   "flag" => "HDR_MISC_OPTIONS",
42
+	   "hide_from_user" => "yes",  // Hide even the header
43
+	   "type" => "header",
44
+	   "label" => "Miscellaneous Options"
45
+		),
46
+
47
+	"PRODUCT_NAME"
48
+	=> array (
49
+	   "flag" => "PRODUCT_NAME",
50
+	   "hide_from_user" => "yes",
51
+	   "type" => "string",
52
+	   "value" => "",
53
+	   "cfgsec" => "general"
54
+	   ),
55
+
56
+	"PRODUCT_SHORT_NAME"
57
+	=> array (
58
+	   "flag" => "PRODUCT_SHORT_NAME",
59
+	   "hide_from_user" => "yes",
60
+	   "type" => "string",
61
+	   "value" => "gPXE",
62
+	   "cfgsec" => "general"
63
+	   ),
64
+
65
+	// End General Options:
66
+
67
+	// Begin Console Options:
68
+
69
+	"HDR_CONSOLE_OPTIONS"
70
+	=> array (
71
+	   "flag" => "HDR_CONSOLE_OPTIONS",
72
+	   "type" => "header",
73
+	   "label" => "Console Options"
74
+		),
75
+
76
+	"CONSOLE_PCBIOS"
77
+	=> array (
78
+	   "flag" => "CONSOLE_PCBIOS",
79
+	   "type" => "on/off",
80
+	   "value" => "on",
81
+	   "cfgsec" => "console"
82
+	   ),
83
+
84
+	"CONSOLE_SERIAL"
85
+	=> array (
86
+	   "flag" => "CONSOLE_SERIAL",
87
+	   "type" => "on/off",
88
+	   "value" => "off",
89
+	   "cfgsec" => "console"
90
+	   ),
91
+
92
+	"BANNER_TIMEOUT"
93
+	=> array (
94
+	   "flag" => "BANNER_TIMEOUT",
95
+	   "type" => "integer",
96
+	   "value" => "20",
97
+	   "cfgsec" => "general"
98
+	   ),
99
+
100
+	// End Console Options
101
+
102
+	// Begin Network Protocol Options:
103
+
104
+	"HDR_NETWORK_PROTOCOL_OPTIONS"
105
+	=> array (
106
+	   "flag" => "HDR_NETWORK_PROTOCOL_OPTIONS",
107
+	   "hide_from_user" => "yes",  // Hide even the header
108
+	   "type" => "header",
109
+	   "label" => "Network Protocol Options"
110
+		),
111
+
112
+	"NET_PROTO_IPV4"
113
+	=> array (
114
+	   "flag" => "NET_PROTO_IPV4",
115
+	   "type" => "on/off",
116
+	   "value" => "on",
117
+	   "hide_from_user" => "yes",
118
+	   "cfgsec" => "general"
119
+	   ),
120
+
121
+	// End Network Protocol Options
122
+
123
+	// Begin Serial Port configuration
124
+
125
+	"HDR_SERIAL_PORT_OPTIONS"
126
+	=> array (
127
+	   "flag" => "HDR_SERIAL_PORT_OPTIONS",
128
+	   "type" => "header",
129
+	   "label" => "Serial Port Options"
130
+		),
131
+
132
+	"COMCONSOLE"
133
+	=> array (
134
+	   "flag" => "COMCONSOLE",
135
+	   "type" => "integer-hex", // e.g. 0x378
136
+	   "value" => "0x3F8",
137
+	   "cfgsec" => "serial"
138
+		),
139
+
140
+	"COMPRESERVE"
141
+	=> array (
142
+	   "flag" => "COMPRESERVE",
143
+	   "type" => "on/off",
144
+	   "value" => "off",
145
+	   "cfgsec" => "serial"
146
+	   ),
147
+
148
+	"COMSPEED"
149
+	=> array (
150
+	   "flag" => "COMSPEED",
151
+	   "type" => "integer",
152
+	   "value" => "115200",
153
+	   "cfgsec" => "serial"
154
+	   ),
155
+
156
+	"COMDATA"
157
+	=> array (
158
+	   "flag" => "COMDATA",
159
+	   "type" => "integer",
160
+	   "value" => "8",
161
+	   "cfgsec" => "serial"
162
+	   ),
163
+
164
+	"COMPARITY"
165
+	=> array (
166
+	   "flag" => "COMPARITY",
167
+	   "type" => "integer",
168
+	   "value" => "0",
169
+	   "cfgsec" => "serial"
170
+	   ),
171
+
172
+	"COMSTOP"
173
+	=> array (
174
+	   "flag" => "COMSTOP",
175
+	   "type" => "integer",
176
+	   "value" => "1",
177
+	   "cfgsec" => "serial"
178
+	   ),
179
+
180
+	// End Serial Options
181
+
182
+	// Begin Download Protocols
183
+
184
+	"HDR_DOWNLOAD_PROTOCOLS"
185
+	=> array (
186
+	   "flag" => "HDR_DOWNLOAD_PROTOCOLS",
187
+	   "type" => "header",
188
+	   "label" => "Download Protocols"
189
+		),
190
+
191
+	"DOWNLOAD_PROTO_TFTP"
192
+	=> array (
193
+	   "flag" => "DOWNLOAD_PROTO_TFTP",
194
+	   "type" => "on/off",
195
+	   "value" => "on",
196
+	   "cfgsec" => "general"
197
+	   ),
198
+
199
+	"DOWNLOAD_PROTO_HTTP"
200
+	=> array (
201
+	   "flag" => "DOWNLOAD_PROTO_HTTP",
202
+	   "type" => "on/off",
203
+	   "value" => "on",
204
+	   "cfgsec" => "general"
205
+	   ),
206
+
207
+	"DOWNLOAD_PROTO_HTTPS"
208
+	=> array (
209
+	   "flag" => "DOWNLOAD_PROTO_HTTPS",
210
+	   "type" => "on/off",
211
+	   "value" => "off",
212
+	   "cfgsec" => "general"
213
+	   ),
214
+
215
+	"DOWNLOAD_PROTO_FTP"
216
+	=> array (
217
+	   "flag" => "DOWNLOAD_PROTO_FTP",
218
+	   "type" => "on/off",
219
+	   "value" => "off",
220
+	   "cfgsec" => "general"
221
+	   ),
222
+
223
+	// End Download Protocols
224
+
225
+	// Begin SAN boot protocols
226
+
227
+	"HDR_SANBOOT_PROTOCOLS"
228
+	=> array (
229
+	   "flag" => "HDR_SANBOOT_PROTOCOLS",
230
+	   "type" => "header",
231
+	   "label" => "SAN Boot Protocols"
232
+		),
233
+
234
+	"SANBOOT_PROTO_ISCSI"
235
+	=> array (
236
+	   "flag" => "SANBOOT_PROTO_ISCSI",
237
+	   "type" => "on/off",
238
+	   "value" => "on",
239
+	   "cfgsec" => "general"
240
+	   ),
241
+
242
+	"SANBOOT_PROTO_AOE"
243
+	=> array (
244
+	   "flag" => "SANBOOT_PROTO_AOE",
245
+	   "type" => "on/off",
246
+	   "value" => "on",
247
+	   "cfgsec" => "general"
248
+	   ),
249
+
250
+	// End SAN boot protocols
251
+
252
+	// Begin Name resolution modules
253
+
254
+	"HDR_NAME_RESOLUTION_MODULES"
255
+	=> array (
256
+	   "flag" => "HDR_NAME_RESOLUTION_MODULES",
257
+	   "type" => "header",
258
+	   "label" => "Name Resolution Modules"
259
+	   ),
260
+
261
+	"DNS_RESOLVER"
262
+	=> array (
263
+	   "flag" => "DNS_RESOLVER",
264
+	   "type" => "on/off",
265
+	   "value" => "on",
266
+	   "cfgsec" => "general"
267
+		),
268
+
269
+	"NMB_RESOLVER"
270
+	=> array (
271
+	   "flag" => "NMB_RESOLVER",
272
+	   "type" => "on/off",
273
+	   "value" => "off",
274
+	   "hide_from_user" => "yes",
275
+	   "cfgsec" => "general"
276
+		),
277
+
278
+	// End Name resolution modules
279
+
280
+	// Begin Image types
281
+
282
+	"HDR_IMAGE_TYPES"
283
+	=> array (
284
+	   "flag" => "HDR_IMAGE_TYPES",
285
+	   "type" => "header",
286
+	   "label" => "Image Types",
287
+	   ),
288
+
289
+	"IMAGE_ELF"
290
+	=> array (
291
+	   "flag" => "IMAGE_ELF",
292
+	   "type" => "on/off",
293
+	   "value" => "on",
294
+	   "cfgsec" => "general"
295
+	   ),
296
+
297
+	"IMAGE_NBI"
298
+	=> array (
299
+	   "flag" => "IMAGE_NBI",
300
+	   "type" => "on/off",
301
+	   "value" => "on",
302
+	   "cfgsec" => "general"
303
+		),
304
+
305
+	"IMAGE_MULTIBOOT"
306
+	=> array (
307
+	   "flag" => "IMAGE_MULTIBOOT",
308
+	   "type" => "on/off",
309
+	   "value" => "on",
310
+	   "cfgsec" => "general"
311
+	   ),
312
+
313
+	"IMAGE_PXE"
314
+	=> array (
315
+	   "flag" => "IMAGE_PXE",
316
+	   "type" => "on/off",
317
+	   "value" => "on",
318
+	   "cfgsec" => "general"
319
+	   ),
320
+
321
+	"IMAGE_SCRIPT"
322
+	=> array (
323
+	   "flag" => "IMAGE_SCRIPT",
324
+	   "type" => "on/off",
325
+	   "value" => "on",
326
+	   "cfgsec" => "general"
327
+	   ),
328
+
329
+	"IMAGE_BZIMAGE"
330
+	=> array (
331
+	   "flag" => "IMAGE_BZIMAGE",
332
+	   "type" => "on/off",
333
+	   "value" => "on",
334
+	   "cfgsec" => "general"
335
+	   ),
336
+
337
+	"IMAGE_COMBOOT"
338
+	=> array (
339
+	   "flag" => "IMAGE_COMBOOT",
340
+	   "type" => "on/off",
341
+	   "value" => "on",
342
+	   "cfgsec" => "general"
343
+	   ),
344
+
345
+	// End Image types
346
+
347
+	// Begin Command-line commands to include
348
+
349
+	"HDR_COMMAND_LINE_OPTIONS"
350
+	=> array (
351
+	   "flag" => "HDR_COMMAND_LINE_OPTIONS",
352
+	   "type" => "header",
353
+	   "label" => "Command Line Options",
354
+	   ),
355
+
356
+	"AUTOBOOT_CMD"
357
+	=> array (
358
+	   "flag" => "AUTOBOOT_CMD",
359
+	   "type" => "on/off",
360
+	   "value" => "on",
361
+	   "cfgsec" => "general"
362
+	   ),
363
+
364
+	"NVO_CMD"
365
+	=> array (
366
+	   "flag" => "NVO_CMD",
367
+	   "type" => "on/off",
368
+	   "value" => "on",
369
+	   "cfgsec" => "general"
370
+	   ),
371
+
372
+	"CONFIG_CMD"
373
+	=> array (
374
+	   "flag" => "CONFIG_CMD",
375
+	   "type" => "on/off",
376
+	   "value" => "on",
377
+	   "cfgsec" => "general"
378
+	   ),
379
+
380
+	"IFMGMT_CMD"
381
+	=> array (
382
+	   "flag" => "IFMGMT_CMD",
383
+	   "type" => "on/off",
384
+	   "value" => "on",
385
+	   "cfgsec" => "general"
386
+	   ),
387
+
388
+	"IWMGMT_CMD"
389
+	=> array (
390
+	   "flag" => "IWMGMT_CMD",
391
+	   "type" => "on/off",
392
+	   "value" => "on",
393
+	   "cfgsec" => "general"
394
+	   ),
395
+
396
+	"ROUTE_CMD"
397
+	=> array (
398
+	   "flag" => "ROUTE_CMD",
399
+	   "type" => "on/off",
400
+	   "value" => "on",
401
+	   "cfgsec" => "general"
402
+	   ),
403
+
404
+	"IMAGE_CMD"
405
+	=> array (
406
+	   "flag" => "IMAGE_CMD",
407
+	   "type" => "on/off",
408
+	   "value" => "on",
409
+	   "cfgsec" => "general"
410
+	   ),
411
+
412
+	"DHCP_CMD"
413
+	=> array (
414
+	   "flag" => "DHCP_CMD",
415
+	   "type" => "on/off",
416
+	   "value" => "on",
417
+	   "cfgsec" => "general"
418
+		),
419
+
420
+	"SANBOOT_CMD"
421
+	=> array (
422
+	   "flag" => "SANBOOT_CMD",
423
+	   "type" => "on/off",
424
+	   "value" => "on",
425
+	   "cfgsec" => "general"
426
+		),
427
+
428
+	"LOGIN_CMD"
429
+	=> array (
430
+	   "flag" => "LOGIN_CMD",
431
+	   "type" => "on/off",
432
+	   "value" => "on",
433
+	   "cfgsec" => "general"
434
+		),
435
+
436
+	"TIME_CMD"
437
+	=> array (
438
+	   "flag" => "TIME_CMD",
439
+	   "type" => "on/off",
440
+	   "value" => "off",
441
+	   "cfgsec" => "general"
442
+		),
443
+
444
+	"DIGEST_CMD"
445
+	=> array (
446
+	   "flag" => "DIGEST_CMD",
447
+	   "type" => "on/off",
448
+	   "value" => "off",
449
+	   "cfgsec" => "general"
450
+		),
451
+
452
+	// End Command-line commands to include
453
+
454
+	// Begin Wireless options
455
+
456
+	"HDR_WIRELESS_OPTIONS"
457
+	=> array (
458
+	   "flag" => "HDR_WIRELESS_OPTIONS",
459
+	   "type" => "header",
460
+	   "label" => "Wireless Interface Options",
461
+	   ),
462
+
463
+	"CRYPTO_80211_WEP"
464
+	=> array (
465
+	   "flag" => "CRYPTO_80211_WEP",
466
+	   "type" => "on/off",
467
+	   "value" => "on",
468
+	   "cfgsec" => "general"
469
+	   ),
470
+
471
+	"CRYPTO_80211_WPA"
472
+	=> array (
473
+	   "flag" => "CRYPTO_80211_WPA",
474
+	   "type" => "on/off",
475
+	   "value" => "on",
476
+	   "cfgsec" => "general"
477
+	   ),
478
+
479
+	"CRYPTO_80211_WPA2"
480
+	=> array (
481
+	   "flag" => "CRYPTO_80211_WPA2",
482
+	   "type" => "on/off",
483
+	   "value" => "on",
484
+	   "cfgsec" => "general"
485
+	   ),
486
+
487
+	// End Wireless options
488
+
489
+);
490
+
491
+// For emacs:
492
+// Local variables:
493
+//	c-basic-offset: 4
494
+//	c-indent-level: 4
495
+//	tab-width: 4
496
+// End:
497
+
498
+?>

+ 51
- 0
contrib/rom-o-matic/globals.php 파일 보기

@@ -0,0 +1,51 @@
1
+<?php // -*- Mode: PHP; -*-
2
+
3
+/**
4
+ * Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
5
+ * Copyright (C) 2009 Entity Cyber, Inc.
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License as
9
+ * published by the Free Software Foundation; either version 2 of the
10
+ * License, or any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful, but
13
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
+ */
21
+
22
+// Directory containing gPXE source code tree
23
+$src_dir = "../../src";
24
+
25
+// Compute gPXE version based on source tree
26
+exec ( "make -C '$src_dir' version 2>&1", $make_output, $status );
27
+$version = ( $status == 0 && count ( $make_output  ) > 1 )
28
+           ? trim ( $make_output[count ( $make_output ) - 2] )
29
+           : "";
30
+
31
+// Email address of person responsible for this website
32
+$webmaster_email = "webmaster@example.com";
33
+
34
+// Files that header and footer text
35
+$top_inc = "top.php";
36
+$bottom_inc = "bottom.php";
37
+
38
+// Descriptive strings
39
+$header_title = "ROM-o-matic for gPXE $version";
40
+$html_tagline = "ROM-o-matic dynamically generates gPXE images";
41
+$html_title   = "ROM-o-matic for gPXE $version";
42
+$description  = "a dynamic gPXE image generator";
43
+
44
+// For emacs:
45
+// Local variables:
46
+//  c-basic-offset: 4
47
+//  c-indent-level: 4
48
+//  tab-width: 4
49
+// End:
50
+
51
+?>

+ 47
- 0
contrib/rom-o-matic/index.php 파일 보기

@@ -0,0 +1,47 @@
1
+<?php // -*- Mode: PHP; -*-
2
+
3
+/**
4
+ * Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
5
+ * Copyright (C) 2009 Entity Cyber, Inc.
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License as
9
+ * published by the Free Software Foundation; either version 2 of the
10
+ * License, or any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful, but
13
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
+ */
21
+
22
+// Get utility functions and set globals
23
+require_once "utils.php";
24
+
25
+// Begin html output
26
+include_once $top_inc;
27
+
28
+?>
29
+<form action="build.php" method=POST>
30
+  <input type="hidden" name="version" value = "<? echo $version ?>">
31
+  <h3>To create an image:</h3>
32
+  <ol>
33
+    <? require ( "directions.php" ); ?>
34
+    <li>
35
+      Generate and download an image:
36
+      <input type="submit" name="A" value="Get Image">
37
+      <br><br>
38
+    </li>
39
+    <li>
40
+      (optional) Customize image configuration options:
41
+      <input type="submit" name="A" value="Customize">
42
+      <br><br>
43
+    </li>
44
+  </ol>
45
+</form>
46
+
47
+<? include_once $bottom_inc ?>

+ 41
- 0
contrib/rom-o-matic/top.php 파일 보기

@@ -0,0 +1,41 @@
1
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+
3
+<?
4
+
5
+/**
6
+ * Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
7
+ * Copyright (C) 2009 Entity Cyber, Inc.
8
+ *
9
+ * This program is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU General Public License as
11
+ * published by the Free Software Foundation; either version 2 of the
12
+ * License, or any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful, but
15
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
+ * General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program; if not, write to the Free Software
21
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
+ */
23
+
24
+?>
25
+
26
+<html>
27
+<head>
28
+  <link rev="made" href="mailto:<? echo "${webmaster_email}" ?>">
29
+  <meta name="keywords" content="rom, etherboot, gpxe, open source, rom-o-matic.net">
30
+  <title><? echo $header_title ?></title>
31
+  <meta name="description" content="<? echo $description ?>">
32
+</head>
33
+<h1>
34
+<? echo "$html_title" ?>&nbsp;
35
+</h1>
36
+<hr>
37
+<h2>
38
+<? echo "$html_tagline" ?>
39
+</h2>
40
+</form>
41
+<hr>

+ 683
- 0
contrib/rom-o-matic/utils.php 파일 보기

@@ -0,0 +1,683 @@
1
+<? // -*- Mode: PHP; -*-
2
+
3
+/**
4
+ * Copyright (C) 2009 Marty Connor <mdc@etherboot.org>.
5
+ * Copyright (C) 2009 Entity Cyber, Inc.
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License as
9
+ * published by the Free Software Foundation; either version 2 of the
10
+ * License, or any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful, but
13
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
+ */
21
+
22
+// Include table of user-configurable gPXE options
23
+require_once "flag-table.php";
24
+
25
+// Include user-shadowable globals
26
+require_once "globals.php";
27
+
28
+// Allow user to shadow globals
29
+if ( is_file ( 'local-config.php' ) ) {
30
+    include_once "local-config.php";
31
+}
32
+
33
+////
34
+// General utility functions
35
+////
36
+
37
+/**
38
+ * Remove undesirable characters from a given string
39
+ *
40
+ * Certain characters have the potential to be used for
41
+ * malicious purposes by web-based attackers.  This routine
42
+ * filters out such characters.
43
+ *
44
+ * @param string $s supplied string
45
+ *
46
+ * @return string returned string with unwanted characters
47
+ *                removed
48
+ */
49
+function cleanstring ( $s )
50
+{
51
+    $len = strlen ( $s );
52
+    if ( $len > 80 ) {
53
+        $s = substr ( $s, 0, 80 );
54
+    }
55
+
56
+    $s      = trim ( $s );
57
+    $pos    = 0;
58
+    $result = "";
59
+
60
+    while ( $pos < $len ) {
61
+        $ltr = ord ( ucfirst ( $s[$pos] ) );
62
+        if ( ( $ltr >= ord ( "A" ) ) && ( $ltr <= ord ( "Z" ) ) ||
63
+             ( $ltr >= ord ( "0" ) ) && ( $ltr <= ord ( "9" ) ) ||
64
+             ( $ltr == ord ( "." ) ) && ( strlen ( $result ) > 0 ) ||
65
+             ( $ltr == ord ( "_" ) ) ||
66
+             ( $ltr == ord ( "+" ) ) ||
67
+             ( $ltr == ord ( ":" ) ) ||
68
+             ( $ltr == ord ( "/" ) ) ||
69
+             ( $ltr == ord ( "-" ) ) ) {
70
+            $result .= $s[$pos];
71
+        }
72
+        $pos++;
73
+    }
74
+    return $result;
75
+}
76
+
77
+/**
78
+ * Return URL of the currently running script, minus the filename
79
+ *
80
+ * @return string the URL of the currently running script, minus the filename
81
+ */
82
+function curDirURL ()
83
+{
84
+        $dir = dirname ( $_SERVER['PHP_SELF'] );
85
+
86
+        if ( $dir == "." || $dir == "/" ) {
87
+                $dir = "";
88
+        }
89
+
90
+        $isHTTPS = ( isset ( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" );
91
+        $port = ( isset($_SERVER["SERVER_PORT"] ) &&
92
+                          ( ( !$isHTTPS && $_SERVER["SERVER_PORT"] != "80" ) ||
93
+                                ( $isHTTPS  && $_SERVER["SERVER_PORT"] != "443" ) ) );
94
+
95
+        $port = ( $port ) ? ':' . $_SERVER["SERVER_PORT"] : '';
96
+
97
+        $dest = ( $isHTTPS ? 'https://' : 'http://' ) .
98
+                $_SERVER["SERVER_NAME"] . $dir . "/";
99
+
100
+        return $dest;
101
+}
102
+
103
+/**
104
+ * Extract NIC families and associated ROM PCI IDs from the src/bin/NIC file.
105
+ *
106
+ * $src_dir must contain the path of the gPXE src directory for this build
107
+ *
108
+ * @return array[0] array $new_nics
109
+ * @return array[1] array $roms
110
+ */
111
+function parse_nic_file ()
112
+{
113
+    global $src_dir;
114
+
115
+    $fd = fopen ( "$src_dir/bin/NIC", "r" );
116
+    if ( ! $fd ) {
117
+        die ( "Missing src/bin/NIC file.  'make bin/NIC'" );
118
+    }
119
+
120
+    $nics = array ();
121
+    $roms = array ();
122
+    $nic = "";
123
+
124
+    while ( !feof ( $fd ) ) {
125
+
126
+        $line = trim ( fgets ( $fd, 200 ) );
127
+
128
+        $first_eight_chars = substr ( $line, 0, 8 );
129
+        settype ( $first_eight_chars, "string" );
130
+
131
+        if ( strpos ( $first_eight_chars, "family" ) === 0 ) {
132
+
133
+            // get pathname of NIC driver
134
+            list ( $dummy, $nic ) = split( "[ \t]+", $line );
135
+            settype ( $nic, "string" );
136
+
137
+            // extract filename name of driver from pathname
138
+            $nic = substr ( $nic, strrpos ( $nic, "/" ) + 1,
139
+			   strlen ( $nic ) - strrpos ( $nic, "/" ) + 1 );
140
+
141
+            $nics[$nic] = $nic;
142
+
143
+            // For each ISA NIC, there can only be one ROM variant
144
+            $roms[$nic] = $nic;
145
+        }
146
+
147
+        // If the first 8 digits of the line are hex digits
148
+        // add this rom to the current nic family.
149
+
150
+        if (    ( strlen ( $first_eight_chars ) == 8 )
151
+             && ( ctype_xdigit ( $first_eight_chars ) )
152
+             && ( $nic != "" ) ) {
153
+
154
+            $roms[$first_eight_chars] = $nic;
155
+        }
156
+    }
157
+    fclose ( $fd );
158
+
159
+    // put most NICs in nice alpha order for menu
160
+    ksort ( $nics );
161
+
162
+    // add special cases to the top
163
+
164
+	$new_nics = array ( "all-drivers" => "gpxe",
165
+						"undionly" => "undionly",
166
+						"undi" => "undi",
167
+    );
168
+
169
+	foreach ( $nics as $key => $value ) {
170
+		// skip the undi driver
171
+		if ( $key != "undi" ) {
172
+			$new_nics[$key] = $value;
173
+		}
174
+	}
175
+
176
+	return array ( $new_nics, $roms );
177
+}
178
+
179
+////
180
+// HTML form utility functions
181
+////
182
+
183
+/**
184
+ * Return html code to create hidden form input fields
185
+ *
186
+ * @param string $flag  name of form variable to set
187
+ * @param string $value value to give form variable
188
+ *
189
+ * @return string html code for given hidden form input field
190
+ */
191
+function hidden ( $flag, $value )
192
+{
193
+    $value = htmlentities ( $value );
194
+    return "<input type=\"hidden\" value=\"$value\" name=\"$flag\"></input>";
195
+}
196
+
197
+/**
198
+ * Return html code to create checkbox form input fields
199
+ *
200
+ * @param string $flag  name of form variable to set
201
+ * @param string $value "on" means box should be checked
202
+ *
203
+ * @return string html code for given hidden form input field
204
+ */
205
+function checkbox ( $flag, $value )
206
+{
207
+    return "<input type=\"checkbox\" value=\"on\" name=\"$flag\"" .
208
+        ($value == "on" ? " checked>" : ">" );
209
+}
210
+
211
+/**
212
+ * Return html code to create text form input fields
213
+ *
214
+ * @param string $flag  name of form variable to set
215
+ * @param string $value initial contents of field
216
+ * @param string $size  size in characters of text box
217
+ *
218
+ * @return string html code for given text input field
219
+ */
220
+function textbox ( $flag, $value, $size )
221
+{
222
+    $value = htmlentities ( $value );
223
+    return "<input type=\"text\" size=\"$size\" value=\"$value\" name=\"$flag\">";
224
+}
225
+
226
+/**
227
+ * Return html code to create textarea form fields
228
+ *
229
+ * @param string $flag  name of form variable to set
230
+ * @param string $value initial contents of textarea
231
+ * @param string $rows  height of text area in rows
232
+ * @param string $cols  width of text area in columns
233
+ *
234
+ * @return string html code for given textarea input field
235
+ */
236
+function textarea ( $flag, $value, $rows, $cols )
237
+{
238
+    $value = htmlentities ( $value );
239
+    return "<textarea name=\"$flag\" rows=\"$rows\" cols=\"$cols\">"
240
+            . $value . "</textarea>";
241
+}
242
+
243
+/**
244
+ * Return html code to create select (menu) form fields
245
+ *
246
+ * Use array of strings as menu choices
247
+ *
248
+ * @param string $flag    name of form variable to set
249
+ * @param array  $options array of strings representing choices
250
+ * @param string $value   value of choice to select in menu
251
+ *
252
+ * @return string html code for given select (menu) input field
253
+ */
254
+function menubox ( $name, $options, $value )
255
+{
256
+    $s="<select name=\"$name\">";
257
+
258
+	foreach ( $options as $ignore => $option ) {
259
+        if ( !$value ) $value = $option;
260
+        $s .= "<option" . ( $option == $value ? " selected>" : ">" ) .
261
+            htmlentities ( $option ) . "</option>";
262
+    }
263
+    return $s . "</select>";
264
+}
265
+
266
+/**
267
+ * Return html code to create select (menu) form fields
268
+ *
269
+ * Use indices of array of strings as menu choices rather than
270
+ * the values pointed to by the indicies.
271
+ *
272
+ * @param string $flag    name of form variable to set
273
+ * @param array  $options array of strings representing choices
274
+ * @param string $value   value of choice to select in menu
275
+ *
276
+ * @return string html code for given select (menu) input field
277
+ */
278
+function keys_menubox ( $name, $options, $value )
279
+{
280
+    $s="<select name=\"$name\">";
281
+
282
+    foreach ( $options as $option => $ignore ) {
283
+        if ( !$value ) $value = $option;
284
+        $s .= "<option" . ( $option == $value ? " selected>" : ">" ) .
285
+            htmlentities ( $option ) . "</option>";
286
+    }
287
+    return $s . "</select>";
288
+}
289
+
290
+////
291
+// Flag (compile option) handling functions
292
+////
293
+
294
+/**
295
+ * Return default compile options (flags)
296
+ *
297
+ * Initial compile options are in a global called $flag_table.
298
+ * Create and return an array containing the ones we want.
299
+ *
300
+ * @return array default compile options (flags)
301
+ */
302
+function default_flags ()
303
+{
304
+    global $flag_table;
305
+
306
+    $flags = array ();
307
+
308
+    foreach ( $flag_table as $key => $props ) {
309
+
310
+        $flag  = $props["flag"];
311
+        $type  = $props["type"];
312
+
313
+        // Fields like headers have no "value" property
314
+        if ( isset ( $props["value"] ) ) {
315
+            $flags[$flag] = $props["value"];
316
+        }
317
+    }
318
+    return $flags;
319
+}
320
+
321
+/**
322
+ * Return combination of default and user compile options (flags)
323
+ *
324
+ * Initial compile options are in a global called $flag_table.
325
+ * Compile options may have been changed via form input. We return
326
+ * an array with either the default value of each option or a user
327
+ * supplied value from form input.
328
+ *
329
+ * @return array combined default and user supplied compile options (flags)
330
+ */
331
+function get_flags ()
332
+{
333
+    global $flag_table;
334
+
335
+    $flags = default_flags ();
336
+
337
+    if ( ! isset ( $_POST["use_flags"] ) )
338
+        return $flags;
339
+
340
+    foreach ( $flag_table as $key => $props ) {
341
+
342
+        $flag = $props["flag"];
343
+        $type = $props["type"];
344
+
345
+        if ( isset ( $_POST["$flag"] ) ) {
346
+            $flags[$flag] = $_POST["$flag"];
347
+            if ( $type == "integer-hex" ) {
348
+                if ( strtolower ( substr ( $flags[$flag], 0, 2 ) ) != "0x" ) {
349
+                    $flags[$flag] = "0x" . $flags[$flag];
350
+                }
351
+            }
352
+        } else if ( $type == "on/off" ) {
353
+			// Unchecked checkboxes don't pass any POST value
354
+			// so we must check for them specially.  At this
355
+			// point we know that there is no $_POST value set
356
+			// for this option.  If it is a checkbox, this means
357
+			// it is unchecked, so record that in $flags so we
358
+			// can later generate an #undef for this option.
359
+            $flags[$flag] = "off";
360
+        }
361
+    }
362
+    return $flags;
363
+}
364
+
365
+/**
366
+ * Output given value in appropriate format for gPXE config file
367
+ *
368
+ * gPXE config/*.h files use C pre-processor syntax.  Output the given
369
+ * compile option in a format appropriate to its type
370
+ *
371
+ * @param string $key   index into $flag_table for given compile option
372
+ * @param string $value value we wish to set compile option to
373
+ *
374
+ * @return string code to set compile option to given value
375
+ */
376
+function pprint_flag ( $key, $value )
377
+{
378
+    global $flag_table;
379
+
380
+    // Determine type of given compile option (flag)
381
+    $type = $flag_table[$key]["type"];
382
+    $s = "";
383
+
384
+    if ( $type == "on/off" && $value == "on" ) {
385
+        $s = "#define $key";
386
+    } else if ( $type == "on/off" && $value != "on" ) {
387
+        $s = "#undef $key";
388
+    } else if ( $type == "string" ) {
389
+        $s = ( "#define $key \"" . cleanstring ( $value ) . "\"" );
390
+    } else if ($type == "qstring" ) {
391
+        $s = ( "#define $key \\\"" . cleanstring ( $value ) . "\\\"" );
392
+    } else {
393
+        $s = "#define $key " . cleanstring ( $value );
394
+    }
395
+
396
+    return $s;
397
+}
398
+
399
+/**
400
+ * Output html code to display all compile options as a table
401
+ *
402
+ * @param array $flags array of compile options
403
+ *
404
+ * @return void
405
+ */
406
+function echo_flags ( $flags )
407
+{
408
+    global $flag_table;
409
+
410
+    echo "<table>\n";
411
+
412
+	foreach ( $flag_table as $key => $props ) {
413
+
414
+        // Hide parameters from users that should not be changed.
415
+        $hide_from_user = isset ( $props["hide_from_user"] ) ? $props["hide_from_user"] : "no";
416
+
417
+        $flag = $props["flag"];
418
+        $type = $props["type"];
419
+
420
+        $value = isset ( $flags[$flag] ) ? $flags[$flag] : '';
421
+
422
+        if ( $hide_from_user == "yes" ) {
423
+
424
+            // Hidden flags cannot not be set by the user.  We use hidden form
425
+            // fields to keep them at their default values.
426
+            if ( $type != "header" ) {
427
+                echo hidden ( $flag, $value );
428
+            }
429
+
430
+        } else {
431
+
432
+            // Flag (gPXE compile option) should be displayed to user
433
+
434
+            if ( $type == "header" ) {
435
+
436
+                $label = $props["label"];
437
+                echo "<td colspan=2><hr><h3>$label</h3><hr></td>";
438
+
439
+            } else if ($type == "on/off" ) {
440
+
441
+                echo "<td>", checkbox ( $flag, $value ), "</td><td><strong>$flag</strong></td>";
442
+
443
+            } else {   // don't display checkbox for non-on/off flags
444
+
445
+                echo "<td>&nbsp;</td><td><strong>$flag: </strong>";
446
+
447
+                if ($type == "choice" ) {
448
+                    $options = $props["options"];
449
+                    echo menubox($flag, $options, $value);
450
+
451
+                } else {
452
+
453
+                    echo textbox($flag, $value, ($type == "integer" ||
454
+                                                 $type == "integer-hex"
455
+                                                     ? 7 : 25));
456
+                }
457
+                echo "</td>";
458
+            }
459
+            echo "</tr>\n";
460
+
461
+            if ( $type != "header" ) {
462
+				echo "<tr><td>&nbsp;</td>";
463
+				echo "<td>\n";
464
+				if ( is_file ( "doc/$flag.html" ) ) {
465
+					include_once "doc/$flag.html";
466
+				}
467
+				echo "\n</td></tr>\n";
468
+            }
469
+        }
470
+    }
471
+    echo "</table>";
472
+}
473
+
474
+/**
475
+ * Return an array of configuration sections used in all compile options
476
+ *
477
+ * $flag_table, the global list of compile options contains a 'cfgsec'
478
+ * property for each flag we are interested in.  We return a list of
479
+ * all the unique cfgsec options we find in $flag_table.
480
+ *
481
+ * @return array an array of strings representing all unique cfgsec values
482
+ *               found in $flag_table
483
+ */
484
+function get_flag_cfgsecs ()
485
+{
486
+    global $flag_table;
487
+    $cfgsecs = array ();
488
+
489
+    foreach ( $flag_table as $key => $props ) {
490
+        if ( isset ( $props['cfgsec'] ) ) {
491
+            $cfgsec = $props["cfgsec"];
492
+            $cfgsecs[$cfgsec] = $cfgsec;
493
+        }
494
+    }
495
+    return $cfgsecs;
496
+}
497
+
498
+////
499
+// File and directory handling functions
500
+////
501
+
502
+/**
503
+ * Create a copy of a given source directory to a given destination
504
+ *
505
+ * Since we are going to modify the source directory, we create a copy
506
+ * of the directory with a unique name in the given destination directory.
507
+ * We supply a prefix for the tempnam call to prepend to the random filename
508
+ * it generates.
509
+ *
510
+ * @param string $src    source directory
511
+ * @param string $dst    destination directory
512
+ * @param string $prefix string to append to directory created
513
+ *
514
+ * @return string absolute path to destination directory
515
+ */
516
+function mktempcopy ( $src, $dst, $prefix )
517
+{
518
+    if ( $src[0] != "/" ) {
519
+        $src = dirname ( $_SERVER['SCRIPT_FILENAME'] ) . "/" . $src;
520
+    }
521
+
522
+    // Create a file in the given destination directory with a unique name
523
+    $dir = tempnam ( $dst, $prefix );
524
+
525
+    // Delete the file just created, since it would interfere with the copy we
526
+    // are about to do.  We only care that the dir name we copy to is unique.
527
+    unlink ( $dir );
528
+
529
+    exec ( "/bin/cp -a '$src' '$dir' 2>&1", $cpytxt, $status );
530
+
531
+    if ( $status != 0 ) {
532
+        die ( "src directory copy failed!" );
533
+    }
534
+    return $dir;
535
+}
536
+
537
+/**
538
+ * Write gPXE config files based on value of given flags
539
+ *
540
+ * gPXE compile options are stored in src/config/*.h .
541
+ * We write out a config file for each set of options.
542
+ *
543
+ * @param string $config_dir directory to write .h files to
544
+ * @param array  $flags array of compile options for this build
545
+ *
546
+ * @return void
547
+ */
548
+function write_gpxe_config_files ( $config_dir, $flags )
549
+{
550
+    global $flag_table;
551
+
552
+    $cfgsecs = get_flag_cfgsecs ();
553
+
554
+    foreach ( $cfgsecs as $cfgsec ) {
555
+
556
+        $fname = $config_dir . "/" . $cfgsec . ".h";
557
+
558
+        $fp = fopen ( $fname, "wb" );
559
+        if ( $fp <= 0 ) {
560
+            die ( "Unable to open $fname file for output!" );
561
+        }
562
+
563
+        $ifdef_secname = "CONFIG_" . strtoupper ( $cfgsec ) . "_H";
564
+
565
+        fwrite ( $fp, "#ifndef ${ifdef_secname}\n" );
566
+        fwrite ( $fp, "#define ${ifdef_secname}\n" );
567
+        fwrite ( $fp, "#include <config/defaults.h>\n" );
568
+
569
+        foreach ( $flags as $key => $value ) {
570
+            // When the flag matches this section name, write it out
571
+            if ( $flag_table[$key]["cfgsec"] == $cfgsec ) {
572
+                fwrite ( $fp, pprint_flag ( $key, $value ) . "\n" );
573
+            }
574
+        }
575
+        fwrite ( $fp, "#endif /* ${ifdef_secname} */\n" );
576
+        fclose ( $fp );
577
+    }
578
+}
579
+
580
+/**
581
+ * Output a string to a file
582
+ *
583
+ * Output a given string to a given pathname. The file will be created if
584
+ * necessary, and the string will replace the file's contents in all cases.
585
+ *
586
+ * @param string $fname pathname of file to output string to
587
+ * @param string $ftext text to output to file
588
+ *
589
+ * @return void
590
+ */
591
+function write_file_from_string ( $fname, $ftext )
592
+{
593
+        $fp = fopen ( $fname, "wb" );
594
+        if ( ! $fp ) {
595
+            die ( "Unable to open $fname file for output!" );
596
+        }
597
+        fwrite ( $fp, $ftext );
598
+        fclose ( $fp );
599
+}
600
+
601
+/**
602
+ * Delete a file or recursively delete a directory tree
603
+ *
604
+ * @param   string   $file_or_dir_name  name of file or directory to delete
605
+ * @return  bool     Returns TRUE on success, FALSE on failure
606
+ */
607
+function rm_file_or_dir ( $file_or_dir_name )
608
+{
609
+    if ( ! file_exists ( $file_or_dir_name ) ) {
610
+        return false;
611
+    }
612
+
613
+    if ( is_file ( $file_or_dir_name ) || is_link ( $file_or_dir_name ) ) {
614
+        return unlink ( $file_or_dir_name );
615
+    }
616
+
617
+    $dir = dir ( $file_or_dir_name );
618
+    while ( ( $dir_entry = $dir->read () ) !== false ) {
619
+
620
+        if ( $dir_entry == '.' || $dir_entry == '..') {
621
+            continue;
622
+        }
623
+        rm_file_or_dir ( $file_or_dir_name . '/' . $dir_entry );
624
+    }
625
+    $dir->close();
626
+
627
+    return rmdir ( $file_or_dir_name );
628
+}
629
+
630
+////
631
+// Debugging functions
632
+////
633
+
634
+/**
635
+ * Emit html code to display given array of compile options (flags)
636
+ *
637
+ * @param array  $flags array of compile options for this build
638
+ *
639
+ * @return void
640
+ */
641
+function show_flags ( $flags )
642
+{
643
+    echo ( "\$flags contains " . count ( $flags ) . " elements:" . "<br>" );
644
+
645
+	foreach ( $flags as $key => $flag ) {
646
+        echo ( "\$flags[" . $key . "]=" . "\"$flag\"" . "<br>" );
647
+    }
648
+}
649
+
650
+/**
651
+ * Emit HTML code to display default array of compile options (flags)
652
+ *
653
+ * $flag_table contains default compile options and properties.  This
654
+ * routine outputs HTML code to display all properties of $flag_table.
655
+ *
656
+ * @return void
657
+ */
658
+function dump_flag_table ()
659
+{
660
+    global $flag_table;
661
+
662
+    echo ( "\$flag_table contains " . count ( $flag_table ) . " elements:" . "<br>" );
663
+
664
+	foreach ( $flag_table as $key => $props ) {
665
+        print ( "flag_table[" . $key . "] = " . "<br>" );
666
+
667
+		foreach ( $props as $key2 => $props2 ) {
668
+            print ( "&nbsp;&nbsp;&nbsp;" . $key2 . " = " . $props2 . "<br>" );
669
+        }
670
+    }
671
+}
672
+
673
+// Parse src/bin/NIC file
674
+list ( $nics, $roms ) = parse_nic_file ();
675
+
676
+// For emacs:
677
+// Local variables:
678
+//  c-basic-offset: 4
679
+//  c-indent-level: 4
680
+//  tab-width: 4
681
+// End:
682
+
683
+?>

Loading…
취소
저장