Created git repository for rom-o-matic source
authorMarty Connor <mdc@etherboot.org>
Thu, 3 Jul 2008 13:06:56 +0000 (09:06 -0400)
committerMarty Connor <mdc@etherboot.org>
Thu, 3 Jul 2008 13:06:56 +0000 (09:06 -0400)
35 files changed:
bottom.php [new file with mode: 0644]
build.php [new file with mode: 0644]
configinfo.php [new file with mode: 0644]
doc-git/AUTOBOOT_CMD.html [new file with mode: 0644]
doc-git/COMCONSOLE.html [new file with mode: 0644]
doc-git/COMDATA.html [new file with mode: 0644]
doc-git/COMPARITY.html [new file with mode: 0644]
doc-git/COMPRESERVE.html [new file with mode: 0644]
doc-git/COMSPEED.html [new file with mode: 0644]
doc-git/COMSTOP.html [new file with mode: 0644]
doc-git/CONFIG_CMD.html [new file with mode: 0644]
doc-git/CONSOLE_FIRMWARE.html [new file with mode: 0644]
doc-git/CONSOLE_SERIAL.html [new file with mode: 0644]
doc-git/DHCP_CMD.html [new file with mode: 0644]
doc-git/DNS_RESOLVER.html [new file with mode: 0644]
doc-git/DOWNLOAD_PROTO_FTP.html [new file with mode: 0644]
doc-git/DOWNLOAD_PROTO_HTTP.html [new file with mode: 0644]
doc-git/DOWNLOAD_PROTO_TFTP.html [new file with mode: 0644]
doc-git/IFMGMT_CMD.html [new file with mode: 0644]
doc-git/IMAGE_BZIMAGE.html [new file with mode: 0644]
doc-git/IMAGE_CMD.html [new file with mode: 0644]
doc-git/IMAGE_ELF.html [new file with mode: 0644]
doc-git/IMAGE_MULTIBOOT.html [new file with mode: 0644]
doc-git/IMAGE_NBI.html [new file with mode: 0644]
doc-git/IMAGE_PXE.html [new file with mode: 0644]
doc-git/IMAGE_SCRIPT.html [new file with mode: 0644]
doc-git/NMB_RESOLVER.html [new file with mode: 0644]
doc-git/NVO_CMD.html [new file with mode: 0644]
doc-git/ROUTE_CMD.html [new file with mode: 0644]
doc-git/SANBOOT_CMD.html [new file with mode: 0644]
flag_table.php [new file with mode: 0644]
flags.php [new file with mode: 0644]
index.php [new file with mode: 0644]
local-config.php [new file with mode: 0644]
top.php [new file with mode: 0644]

diff --git a/bottom.php b/bottom.php
new file mode 100644 (file)
index 0000000..e14c339
--- /dev/null
@@ -0,0 +1,56 @@
+<hr>\r
+\r
+<h4>\r
+Notes:\r
+</h4>\r
+\r
+<ul>\r
+  <li>\r
+    For help and information about getting your OS loaded with gPXE or Etherboot,<br>\r
+    Visit the Etherboot Home Page at \r
+    <a href="http://www.etherboot.org/" target="_blank">http://www.etherboot.org/</a><br>\r
+    and join the Etherboot-Discuss mailing list.<br>\r
+    Sign up at: <a href="http://lists.sourceforge.net/lists/listinfo/etherboot-discuss" \r
+    target="_blank">http://lists.sourceforge.net/lists/listinfo/etherboot-discuss</a>\r
+    <br><br>\r
+  </li>\r
+\r
+  <li>\r
+    Real-time help is often available on IRC on the #etherboot channel of\r
+    irc.freenode.net.\r
+    <br><br>\r
+  </li>\r
+\r
+<!--\r
+  <li>\r
+    For help and information with what goes on <strong>after</strong> your kernel is loaded<br>\r
+    Visit the LTSP Home Page at <a href="http://www.ltsp.org/" \r
+    target="_blank">http://www.ltsp.org/</a><br>\r
+    and join the LTSP-discuss mailing list<br>\r
+    Sign up at: <a href="http://lists.sourceforge.net/lists/listinfo/ltsp-discuss" target="_blank">\r
+    http://lists.sourceforge.net/lists/listinfo/ltsp-discuss</a>\r
+    <br><br>\r
+  </li>\r
+\r
+  <li>\r
+    Source code for gPXE and Etherboot images is available at \r
+    <a href="http://www.etherboot.org/" target="_blank">\r
+    http://www.etherboot.org/</a>\r
+    <br><br>\r
+  </li>\r
+-->\r
+\r
+</ul>\r
+\r
+<hr>\r
+  <font size="-1">\r
+    <br>\r
+    Please email <a href="mailto:webmaster@etherboot.org">webmaster@etherboot.org</a>\r
+    with questions or comments about this website.\r
+  </font>\r
+\r
+<br>\r
+\r
+</body>\r
+\r
+</html>\r
diff --git a/build.php b/build.php
new file mode 100644 (file)
index 0000000..2637b1a
--- /dev/null
+++ b/build.php
@@ -0,0 +1,145 @@
+<?php // -*- Mode: PHP; -*-
+
+// If user chose "Configure" option on form
+if ( $_GET['A'] == "Configure" ) {
+
+  // Enable  more extensive customization of options
+  include "flags.php";
+
+  exit ();
+
+//  The next conditional  includes all other cases except "Get ROM"
+//    particularly the explicit ($A == "Start Over") case
+
+} elseif ( $_GET['A'] != "Get ROM" ) { 
+
+  // Note that this method of redirections discards all the configuration 
+  // flags, which is what I want to happen.
+  // ( To pass through all the flags, we could just 'include ( "index.php" );' here )
+
+  $dir = dirname ( $_SERVER['PHP_SELF'] );
+
+  if ( $dir == "." || $dir == "/" ) {
+    $dir = "";
+  }
+
+  $isHTTPS = ( isset ( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" );
+  $port = ( isset($_SERVER["SERVER_PORT"] ) && 
+           ( ( !$isHTTPS && $_SERVER["SERVER_PORT"] != "80" ) || 
+             ( $isHTTPS  && $_SERVER["SERVER_PORT"] != "443" ) ) );
+
+  $port = ( $port ) ? ':' . $_SERVER["SERVER_PORT"] : '';
+
+  $dest = ( $isHTTPS ? 'https://' : 'http://' ) .
+          $_SERVER["SERVER_NAME"] . $dir . "/";
+
+  header ( "Location: $dest" );
+
+  // This should normally not be seen, but just in case...
+  echo "Try this: <a href=\"$dest\">$dest</a>";
+
+  exit (); 
+
+}
+
+// OK, we're going to try to use whatever options have been set
+// to build an image.
+
+include "configinfo.php";
+
+$flags = get_flags ();
+
+// (debug) show flags
+//echo "<p>Flags: </p>";
+//showflags ( $flags );
+//exit ();
+
+/*
+** Make temporary copy of src directory
+*/
+$dir = mktempcopy ( "$src_dir", "/tmp" );
+
+// $dir = "/var/romtmp/src";
+
+/*
+** Create a config.h file for this build
+*/
+write_config_file ( "$dir/config.h", "all", $flags );
+// exec ( "/bin/touch '$dir/config.h' 2>&1", $touchtxt, $status );
+
+// (debug) show flags
+// echo "<p>Flags: </p>";
+// showflags ( $flags );
+// exit ();
+
+$nicfile = get_nicfile();
+$nicfilename = "gpxe-$version-$nicfile";
+$target = "bin/$nicfile";
+
+// Make the requested image.  $status is set to 0 on success
+exec ( "make -C '$dir' '$target' 2>&1", $maketxt, $status );
+
+// (debugging) take a look at the Make output
+// deltempdir ( $dir );
+// echo "<blockquote>"."<pre>";
+// echo htmlentities ( implode("\n", $maketxt ) );
+// echo "</pre>"."</blockquote>";
+// exit ();
+
+/*
+** Send ROM to browser (with extreme prejudice)
+*/
+
+if ( $status == 0 ) {
+
+  $fp = fopen("$dir/$target", "rb" );
+  if ( $fp > 0 ) {
+
+    $len = filesize ( "$dir/$target" );
+    if ( $len > 0 ) {
+
+      $buf = fread ( $fp, $len );
+      fclose ( $fp );
+      deltempdir ( $dir );
+
+      // Try to force IE to handle downloading right.
+      Header ( "Cache-control: private");
+      Header ( "Content-Type: application/x-octet-stream; " .
+            "name=$nicfilename");
+      Header ( "Content-Disposition: attachment; " .
+            "Filename=$nicfilename");
+      Header ( "Content-Location: $nicfilename");
+      Header ( "Content-Length: $len");
+
+      echo $buf;
+
+      exit ();
+    }
+  }
+}
+
+// Remove build directory
+deltempdir ( $dir );
+
+$header_title = "ROM-o-matic.net: $nicfile Build Failed";
+$html_title   = "$nicfile Build Failed";
+$description  = "$nicfile ROM driver build failed";
+
+include ( $top_inc );
+
+?>
+
+Build failed.  Status = <? echo $status ?>.
+<br><br>
+Following is the output from <code>make</code>:
+<br><br>
+
+<blockquote>
+<pre>
+<? echo htmlentities ( implode ( "\n", $maketxt ) ); ?>
+</pre>
+</blockquote>
+
+Please let us know that this happened.
+
+<? include $bottom_inc ?>
diff --git a/configinfo.php b/configinfo.php
new file mode 100644 (file)
index 0000000..57e245f
--- /dev/null
@@ -0,0 +1,597 @@
+<? // -*- Mode: PHP; -*-
+
+$version = "git";
+$src_dir = "../../../gpxe.git/src"; // TODO temporary hack to work around symlink git
+
+include ( "flag_table.php" );
+
+$top_inc = "top.php";
+$bottom_inc = "bottom.php";
+
+$flag_codes = array ();
+
+reset($flag_table);
+$i = 1;
+
+while ( list ( $key, $props ) = each ( $flag_table ) ) {
+  $is = (string) $i;
+  if ( $i < 10 ) {
+    $is = "0" . $is;
+  }
+
+  $props["code"] = $is;
+  $props["flag"] = $key;
+
+  $flag_table[$key] = $props;
+  $flag_codes[$is] = $props;
+  $i = $i + 1;
+}
+
+// dump_flag_table();
+// dump_flag_codes();
+// dump_flag_table_keys_sorted();
+// exit ();
+
+$ofmts = array (
+  "Floppy bootable ROM Image (.dsk)" => "dsk",
+  "Binary ROM Image(.rom)" => "rom",
+  "ISO bootable image (.iso)" => "iso",
+  "ISO bootable image with legacy floppy emulation (.liso)" => "liso",
+  "LILO/GRUB/SYSLINUX loadable Linux kernel format (.lkrn)" => "lkrn",
+  "PXE bootstrap loader format ROM Image (.pxe)" => "pxe",
+  "USB Keychain Disk Image (.usb)" => "usb",
+  "HD Disk Image (.hd)" => "hd",
+);
+
+function value_key ($ofmt) 
+{
+  // No LinuxBIOS support in gpxe right now
+  //  return (strpos ($ofmt, "LinuxBIOS" ) === false ? "value" : "valuelnx" );
+  return ( "value" );
+}
+
+function snarf_file ( $fname ) 
+{
+  $len = filesize ( $fname );
+  if ( $len > 0 ) {
+    $fp = fopen ( $fname, "rb" );
+    if ( $fp > 0 ) {
+      $buf = fread ( $fp, $len );
+      fclose ( $fp );
+      if ( $buf ) 
+       return ($buf);
+    }
+  }
+  die ( "Unable to get $fname" );
+  return 0;
+}
+
+function get_nics () 
+{
+  global $version, $src_dir;
+  $nic = ( isset ( $_GET['nic'] ) ? $_GET['nic'] : '' );
+
+  $fd = fopen( "$src_dir/bin/NIC", "r" );
+  if ( $fd < 1 ) {
+    trigger_error ( "Missing NIC Config Info" );
+    exit ();
+  }
+  $nics = array ();
+  $family = "";
+  while ( !feof ( $fd ) ) {
+    $line = trim ( fgets ( $fd, 200 ) );
+    if ( strpos ( $line, "family" ) === 0 ) {
+      list ( $dummy, $family ) = split( "[ \t]+", $line );
+      settype ( $family, "string" );
+    } elseif ( $line != "" && $line[0] != '#' ) {
+      list ( $rom, $pci_ids ) = split ( "[ \t]+", $line );
+      settype ( $rom, "string" );
+      if ( $pci_ids == "-" ) $pci_ids = "";
+      $fam_name = substr ( $family, strrpos ( $family, "/" ) + 1, 
+                          strlen ( $family ) - strrpos ( $family, "/" ) + 1 );
+      $option = ( $pci_ids ? "$fam_name:$rom -- [$pci_ids]" : "$fam_name:$rom" );
+      // * Kludge - fix incoming $nic if any.
+      if ( $nic == $rom ) $nic = $option;
+      // ISA drivers are per-family, PCI are per-ROM. If ever decide
+      // to cache the drivers, can use this key.
+      $nics[$option] = ( $pci_ids ? "PCI:" . $rom : "ISA:" . $family );
+      // echo $nics array for debugging
+      //      echo "\$nics[$option] "." -> ".$nics[$option]."<br>";
+    }
+  }
+  $nics["gpxe:all-drivers"] = "PCI:gpxe";
+  fclose ( $fd );
+  ksort ( $nics );
+  return( $nics );
+}
+
+function get_nicfile () 
+{
+  global $ofmts;
+
+  $nic = $_GET['nic'];
+  $ofmt = $_GET['ofmt'];
+
+  $n = strpos ( $nic, " " );
+  $family = substr ( $nic, 0, strpos ( $nic,":" ) );
+
+  $rom = ( $n > 0 ? 
+          substr ( $nic, strpos ( $nic, ":" ) + 1, 
+                   $n - ( strlen ( $family ) + 1 ) ) :  
+          $family );
+
+  $ftype = $ofmts[$ofmt];
+  if ( $ftype == "" ) $ftype = "dsk"; 
+
+  // if .rom format is requested, return rom name,
+  //   since .rom images are PCI ID specific, and 
+  //   rules only exist to build bin/$rom for Binary
+  //    ROM images types
+  if ( $ftype == "rom" )
+    $retval = cleanstring ( $rom . "." . $ftype );
+  else
+    $retval = cleanstring ( $family . "." . $ftype );
+
+  // Let's take a look at what was chosen.
+  //  echo "strpos ( \$nic, \":\" ) ->" . strpos ( $nic, ":" ) . "<br>";
+  //  echo "\$n ->" . "$n" . "<br>";
+  //  echo "\$nic ->" . "|$nic|" . "<br>";
+  //  echo "\$rom ->" . "|$rom|" . "<br>";
+  //  echo "\$family ->" . "|$family|" . "<br>";
+  //  echo "\$ftype ->" . "|$ftype|" . "<br>";
+  //  echo "\$retval ->" . "|$retval|" . "<br>";
+  //  exit();
+
+  return ( $retval );
+}
+
+function checkbox ( $flag, $value ) {
+  return "<input type=\"checkbox\" value=\"on\" name=\"$flag\"" .
+    ($value == "on" ? " checked>" : ">" );
+}
+
+function textbox ( $flag, $value, $size ) {
+  $value = htmlentities ( $value );
+  return "<input type=\"text\" size=\"$size\" value=\"$value\" name=\"$flag\">";
+}
+function menubox ( $name, $options, $value ) {
+  $s="<select name=\"$name\">";
+  reset ( $options );
+  while ( list ( $ignore, $option ) = each ( $options ) ) {
+    $s .= "<option" . ( $option == $value ? " selected>" : ">" ) .
+      htmlentities ( $option ) . "</option>";
+  }
+  return $s . "</select>";
+}
+
+function keys_menubox ( $name, $options, $value ) 
+{
+  $s="<select name=\"$name\">";
+  reset ( $options );
+  while ( list ( $option, $ignore ) = each ( $options ) ) {
+    if ( !$value ) $value = $option;
+    $s .= "<option" . ( $option == $value ? " selected>" : ">" ) .
+      htmlentities ( $option ) . "</option>";
+  }
+  return $s . "</select>";
+}  
+
+// Encode flags to keep size down, so can use GET's instead of POST's...
+// Note that the value may need to be urlencoded.
+function encode_flags ( $flags ) 
+{
+  global $flag_table;
+
+  $s = "";
+  reset ( $flags );
+  while ( list ( $flag, $value ) = each ( $flags ) ) {
+    $prop = $flag_table[$flag];
+    $type = $prop["type"];
+    $s .= $prop["code"];
+    if ( $type != "on/off" ) {
+      $n = strlen ( $value );
+      $nstr = strval ( $n );
+      if ( $n < 10 ) $nstr = "0" . $nstr;
+      if ( $n >= 80 ) die ( "Value too long!" );
+      $s .= $nstr . $value;
+    }
+  }
+  return $s;
+}
+
+function decode_flags_into ( $s, $flags ) 
+{
+  global $flag_codes;
+  $len = strlen ( $s );
+
+  $pos = 0;
+  while ( $pos < $len ) {
+    $code = substr ( $s, $pos, 2 );
+    $pos += 2;
+    $prop = $flag_codes[$code];
+    $flag = $prop["flag"];
+    $value = "on";
+    $type = $prop["type"];
+    if ( $prop["type"] != "on/off" ) {
+      $n = intval ( substr ( $s, $pos, 2 ) );
+      $pos += 2;
+      $value = substr ( $s, $pos, $n );
+      $pos += $n;
+    }
+    $flags[$flag] = $value;
+  }
+  return $flags;
+}
+
+function default_flags () 
+{
+  global $flag_table;
+
+  if ( isset ( $_GET["F"] ) )
+    $F = $_GET["F"];
+  if ( isset ( $_GET["nic"] ) )
+    $nic = $_GET["nic"];
+  if ( isset ( $_GET["nicfile"] ) )
+    $nicfile = $_GET["nicfile"];
+  if ( isset ( $_GET["ofmt"] ) )
+    $ofmt = $_GET["ofmt"];
+  if ( isset ( $_GET["arch"] ) )
+    $arch = $_GET["arch"];
+
+  $flags = array ();
+  if ( isset ( $F ) && $F != "ignore" && isset ( $arch ) &&
+       ( ( isset ( $nic ) && isset ( $ofmt ) ) || isset ( $nicfile ) ) ) {
+    $vkey = value_key($ofmt);
+
+    reset($flag_table);
+    while ( list ( $key, $props ) = each ( $flag_table ) ) {
+
+      $farch = isset ( $props["arch"] ) ? $props["arch"] : "";
+
+      if ( isset ( $arch ) && ( $farch == "all" || $farch == $arch ) ) {
+       $flag = $props["flag"];
+       $type = $props["type"];
+       $value = ( isset ( $props[$vkey] ) ? $props[$vkey] : $props["value"] );
+       if ( $type != "on/off" || $value == "on" ) {
+         $flags[$flag] = $value;
+       }
+      }
+    }
+    $flags = decode_flags_into ( $F, $flags );
+  }
+  return $flags;
+}
+
+function get_flags () 
+{
+  global $flag_table;
+  $flags = default_flags();
+
+  // echo "<p>Flags in get_flags(): </p>";
+  // show_flags($flags);
+
+  reset ( $flag_table );
+  while ( list ( $key, $props ) = each ( $flag_table ) ) {
+    $flag = $props["flag"];
+    if ( isset ( $_GET["$flag"] ) ) {
+      $flags[$flag] = $_GET["$flag"];
+    }
+  }
+  return $flags;
+}
+
+function echo_flags ( $flags ) {
+
+  global $version;
+  global $flag_table;
+
+  $arch = isset ( $_GET['arch'] ) ? $_GET['arch'] : '';
+
+  echo "<table>\n";
+
+  reset($flag_table);
+  while ( list ( $index, $props ) = each ( $flag_table ) ) {
+
+    $farch = isset ( $props["arch"] ) ? $props["arch"] : "";
+
+    // Hide parameters from users that should not be changed.
+
+    $hide_from_user = isset ( $props["hide_from_user"] ) ? $props["hide_from_user"] : "no";
+
+    $flag = $props["flag"];
+    $type = $props["type"];
+
+    $value = isset ( $flags[$flag] ) ? $flags[$flag] : '';
+
+    if ( ( $hide_from_user != "yes" ) && ($type == "header" || $farch == "all" 
+                                         || $farch == $arch ) ) {
+      
+      if ( $type == "header" ) {
+
+        $label = $props["label"];
+       echo "<td colspan=2><hr><h3>$label</h3><hr></td>";
+
+      } elseif ($type == "on/off" ) {
+
+       echo "<td>", checkbox($flag, $value), "</td><td><b>$flag</b></td>";
+
+      } else {         // no checkbox
+
+       echo "<td>&nbsp;</td><td><b>$flag: </b>";
+
+       if ($type == "choice" ) {
+         $options = $props["options"];
+         echo menubox($flag, $options, $value);
+       }
+
+       else {
+         echo textbox($flag, $value, ($type == "integer" ? 5 : 25));
+       }
+
+       echo "</td>";
+
+      }
+
+      echo "</tr>\n";
+
+      if ( $type != "header" ) {
+       echo "<tr><td>&nbsp;</td>";
+       echo "<td>\n";
+       include "doc-$version/$flag.html";
+       echo "\n</td></tr>\n";
+      }
+    }
+  }
+  echo "</table>";
+}
+
+function pprint_flag ( $key, $value ) {
+
+  global $flag_table;
+
+  $type = $flag_table[$key]["type"];
+  $s = "";
+
+  if ( $type == "on/off" && $value == "on" ) {
+    $s = "#define $key";
+  } elseif ( $type == "on/off" && $value != "on" ) {
+    $s = "#undef $key";
+  } elseif ( $type == "string" ) {
+    if ( $value != "" ) $s = ( "#define $key \"" . cleanstring($value) . "\"" );
+  } elseif ($type == "qstring" ) {
+    if ( $value != "" ) $s = ( "#define $key \\\"" . cleanstring($value) . "\\\"" );
+  } else {
+    $s = "#define $key " . cleanstring($value);
+  }
+  //  print ($s . "<br>" );
+
+  return $s;
+}
+
+function pprint_flags ( $flags ) 
+{
+  $s = "";
+  reset ($flags);
+
+  while (list($key, $value) = each($flags)) {
+    $f = pprint_flag($key, $value);
+    if ($f != "" )
+      $s .= $f . " ";
+  }
+  return $s;
+}
+
+function get_cfgsecs ()
+{
+  global $flag_table;
+  $cfgsecs = array ();
+
+  foreach ( $flag_table as $key => $props ) {
+    if ( isset ( $props['cfgsec'] ) ) {
+      $cfgsec = $props["cfgsec"];
+      $cfgsecs[$cfgsec] = $cfgsec;
+    }
+  }
+  return ( $cfgsecs );
+}
+
+function write_config_file ( $fname, $arch, $flags ) 
+{
+  global $flag_table;
+
+  $cfgsecs = get_cfgsecs ();
+
+  $fp = fopen ( $fname, "wb" );
+  if ( $fp <= 0 ) {
+    die ( "Unable to open $fname file for output!" );
+  }
+
+  foreach ( $cfgsecs as $cfgsec ) {
+
+    fwrite ( $fp, "/* @BEGIN ${cfgsec}.h \n*/ \n\n" );
+
+    foreach ( $flags as $key => $value ) {
+
+      // When the flag matches this section name, write it out
+      if ( $flag_table[$key]["cfgsec"] == $cfgsec ) {
+       fwrite ( $fp, pprint_flag ( $key, $value ) . "\n" );
+      }        
+
+    }
+    fwrite ( $fp, "\n/* @END ${cfgsec}.h \n*/ \n\n" );
+  }
+  fclose($fp);
+}
+
+function cleanstring ($s) {
+  $len = strlen($s);
+  if ($len > 80) {
+    $s = substr ($s, 0, 80);
+  }
+  $s = trim($s);
+  $pos = 0;
+  $result = "";
+  while($pos < $len) {
+    $ltr = ord( ucfirst( $s[$pos]));
+    if ( ($ltr >= ord( "A" )) && ($ltr <= ord( "Z" )) || 
+         ($ltr >= ord( "0" )) && ($ltr <= ord( "9" )) || 
+         ($ltr == ord( "." )) && (strlen($result) > 0) ||
+         ($ltr == ord( "_" )) ||
+         ($ltr == ord( "+" )) ||
+         ($ltr == ord( ":" )) ||
+         ($ltr == ord( "/" )) ||
+        ($ltr == ord( "-" )) ) {
+      $result .= $s[$pos];
+    }
+    $pos++;
+  }
+  return $result;
+}
+
+function copydir ( $src, $dst ) 
+{
+  if ( !mkdir ( $dst, 0700 ) ) {
+    die ( "mkdir failed" );
+  }
+
+  $dp = opendir ( $src );
+  if ( $dp < 1 ) {
+    die ( "opendir failed" );
+  }
+
+  while ( $file = readdir ( $dp ) ) {
+    if ( is_dir ( "$src/$file" ) ) {
+      if ($file[0] != "." ) {
+       copydir ( "$src/$file", "$dst/$file" );
+      }
+    } else {
+      copy ( "$src/$file", "$dst/$file" );
+    }
+  }
+  closedir ( $dp );
+}
+
+function mktempcopy ( $src, $dst ) 
+{
+  if ( $src[0] != "/" ) {
+    $src = dirname($_SERVER['SCRIPT_FILENAME']) . "/" . $src;
+  }
+
+  $dir = tempnam ( $dst, "ROM" );
+  unlink( $dir );
+
+  //  copydir ( $src, $dir );
+
+  exec ( "/bin/cp -a '$src' '$dir' 2>&1", $cpytxt, $status );  
+
+  if ( $status != 0 ) {
+    die ( "src directory copy failed!" );
+  }
+
+  return ( $dir );
+}
+
+function deltempdir ($dir) 
+{
+  $dp = opendir ( $dir );
+  if ($dp < 1) {
+    die ( "opendir failed" );
+  }
+
+  while ( $file = readdir ( $dp ) ) {
+
+    if ( is_dir ( "$dir/$file" ) ) {
+      if ($file[0] != "." ) {
+       deltempdir ( "$dir/$file" );
+      }
+    } else {
+      unlink( "$dir/$file" );
+    }
+  }
+  closedir ( $dp );
+
+  if ( !rmdir ( "$dir" ) ) {
+    die ( "rmdir failed" );
+  }
+}
+
+function debug_info () 
+{
+
+  $F = $_GET['F'];
+  $nic = $_GET['nic'];
+  $ofmt = $_GET['ofmt'];
+
+  $s = "F=\"" . htmlentities($F) . "\"<br>\n";
+  $s .= "nic=\"" . htmlentities($nic) . "\"<br>\n";
+  $s .= "ofmt=\"" . htmlentities($ofmt) . "\"<br>\n";
+
+  return $s;
+}
+
+function showflags ($flags) 
+{
+   reset($flags);
+   while (list ($key, $flag) = each ($flags)) {
+     print ( "flag[".$key."]="."\"$flag\""."<br>" );
+   }
+}
+
+function dump_flag_table () 
+{
+  global $flag_table;
+  reset ( $flag_table );
+
+  while ( list ( $key, $props ) = each ( $flag_table ) ) {
+    print ( "flag_table[" . $key . "] = " . "<br>" );
+
+    while ( list ( $key2, $props2 ) = each ( $props ) ) {
+      print ( "&nbsp;&nbsp;&nbsp;" . $key2 . " = " . $props2 . "<br>" );
+    }
+
+  }
+}
+
+function dump_flag_table_keys_sorted () 
+{
+  global $flag_table;
+  reset ( $flag_table );
+  ksort ( $flag_table );
+
+  while ( list ( $key, $props ) = each ( $flag_table ) ) {
+    print ( $key . ".html<br>" );
+  }
+}
+
+function dump_flag_codes () 
+{
+  global $flag_codes;
+  reset ( $flag_codes );
+
+  while ( list ( $key, $props ) = each ( $flag_codes ) ) {
+    print ( "flag_codes[" . $key . "] = " . "<br>" );
+
+    while ( list ( $key2, $props2 ) = each ( $props ) ) {
+      print ( "&nbsp;&nbsp;&nbsp;" . $key2 . " = " . $props2 . "<br>" );
+    }
+  }
+}
+
+function curPageURL () 
+{
+  $isHTTPS = ( isset ( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" );
+
+  $port = ( isset($_SERVER["SERVER_PORT"] ) && 
+           ( ( !$isHTTPS && $_SERVER["SERVER_PORT"] != "80" ) || 
+             ( $isHTTPS  && $_SERVER["SERVER_PORT"] != "443" ) ) );
+
+  $port = ( $port ) ? ':' . $_SERVER["SERVER_PORT"] : '';
+
+  $url = ( $isHTTPS ? 'https://' : 'http://' ) .
+         $_SERVER["SERVER_NAME"] . $port.$_SERVER["REQUEST_URI"];
+
+  return $url;
+}
+
+?>
diff --git a/doc-git/AUTOBOOT_CMD.html b/doc-git/AUTOBOOT_CMD.html
new file mode 100644 (file)
index 0000000..444c5e6
--- /dev/null
@@ -0,0 +1 @@
+Automatic booting
diff --git a/doc-git/COMCONSOLE.html b/doc-git/COMCONSOLE.html
new file mode 100644 (file)
index 0000000..684603c
--- /dev/null
@@ -0,0 +1 @@
+Serial Console I/O port address
\ No newline at end of file
diff --git a/doc-git/COMDATA.html b/doc-git/COMDATA.html
new file mode 100644 (file)
index 0000000..a27e275
--- /dev/null
@@ -0,0 +1 @@
+Serial Console Data bits
diff --git a/doc-git/COMPARITY.html b/doc-git/COMPARITY.html
new file mode 100644 (file)
index 0000000..14f3595
--- /dev/null
@@ -0,0 +1 @@
+Serial Console Parity: 0=None, 1=Odd, 2=Even
diff --git a/doc-git/COMPRESERVE.html b/doc-git/COMPRESERVE.html
new file mode 100644 (file)
index 0000000..6e41a10
--- /dev/null
@@ -0,0 +1 @@
+Keep settings from a previous user of the serial port
\ No newline at end of file
diff --git a/doc-git/COMSPEED.html b/doc-git/COMSPEED.html
new file mode 100644 (file)
index 0000000..32b6859
--- /dev/null
@@ -0,0 +1 @@
+Serial Console Baud rate
diff --git a/doc-git/COMSTOP.html b/doc-git/COMSTOP.html
new file mode 100644 (file)
index 0000000..ae3fd24
--- /dev/null
@@ -0,0 +1 @@
+Serial Console Stop bits
diff --git a/doc-git/CONFIG_CMD.html b/doc-git/CONFIG_CMD.html
new file mode 100644 (file)
index 0000000..1256c06
--- /dev/null
@@ -0,0 +1 @@
+Option configuration console
diff --git a/doc-git/CONSOLE_FIRMWARE.html b/doc-git/CONSOLE_FIRMWARE.html
new file mode 100644 (file)
index 0000000..144eea3
--- /dev/null
@@ -0,0 +1 @@
+Enable Default BIOS console
diff --git a/doc-git/CONSOLE_SERIAL.html b/doc-git/CONSOLE_SERIAL.html
new file mode 100644 (file)
index 0000000..f35e2ff
--- /dev/null
@@ -0,0 +1 @@
+Enable Serial port console
diff --git a/doc-git/DHCP_CMD.html b/doc-git/DHCP_CMD.html
new file mode 100644 (file)
index 0000000..a0c31c7
--- /dev/null
@@ -0,0 +1 @@
+DHCP management commands
diff --git a/doc-git/DNS_RESOLVER.html b/doc-git/DNS_RESOLVER.html
new file mode 100644 (file)
index 0000000..1029b9c
--- /dev/null
@@ -0,0 +1 @@
+DNS resolver
diff --git a/doc-git/DOWNLOAD_PROTO_FTP.html b/doc-git/DOWNLOAD_PROTO_FTP.html
new file mode 100644 (file)
index 0000000..7686d5d
--- /dev/null
@@ -0,0 +1 @@
+File Transfer Protocol
diff --git a/doc-git/DOWNLOAD_PROTO_HTTP.html b/doc-git/DOWNLOAD_PROTO_HTTP.html
new file mode 100644 (file)
index 0000000..c28d888
--- /dev/null
@@ -0,0 +1 @@
+Hypertext Transfer Protocol
diff --git a/doc-git/DOWNLOAD_PROTO_TFTP.html b/doc-git/DOWNLOAD_PROTO_TFTP.html
new file mode 100644 (file)
index 0000000..f2b31b1
--- /dev/null
@@ -0,0 +1 @@
+Trivial File Transfer Protocol
diff --git a/doc-git/IFMGMT_CMD.html b/doc-git/IFMGMT_CMD.html
new file mode 100644 (file)
index 0000000..0e2b2a5
--- /dev/null
@@ -0,0 +1 @@
+Interface management commands
diff --git a/doc-git/IMAGE_BZIMAGE.html b/doc-git/IMAGE_BZIMAGE.html
new file mode 100644 (file)
index 0000000..d85e5d0
--- /dev/null
@@ -0,0 +1 @@
+Linux bzImage image support
diff --git a/doc-git/IMAGE_CMD.html b/doc-git/IMAGE_CMD.html
new file mode 100644 (file)
index 0000000..6f5acb5
--- /dev/null
@@ -0,0 +1 @@
+Image management commands
diff --git a/doc-git/IMAGE_ELF.html b/doc-git/IMAGE_ELF.html
new file mode 100644 (file)
index 0000000..5e39e8b
--- /dev/null
@@ -0,0 +1 @@
+ELF image support
diff --git a/doc-git/IMAGE_MULTIBOOT.html b/doc-git/IMAGE_MULTIBOOT.html
new file mode 100644 (file)
index 0000000..6a092a2
--- /dev/null
@@ -0,0 +1 @@
+MultiBoot image support
diff --git a/doc-git/IMAGE_NBI.html b/doc-git/IMAGE_NBI.html
new file mode 100644 (file)
index 0000000..eb78e03
--- /dev/null
@@ -0,0 +1 @@
+NBI image support
diff --git a/doc-git/IMAGE_PXE.html b/doc-git/IMAGE_PXE.html
new file mode 100644 (file)
index 0000000..bdca384
--- /dev/null
@@ -0,0 +1 @@
+PXE image support
diff --git a/doc-git/IMAGE_SCRIPT.html b/doc-git/IMAGE_SCRIPT.html
new file mode 100644 (file)
index 0000000..1f7bed7
--- /dev/null
@@ -0,0 +1 @@
+gPXE script image support
diff --git a/doc-git/NMB_RESOLVER.html b/doc-git/NMB_RESOLVER.html
new file mode 100644 (file)
index 0000000..a0bdc17
--- /dev/null
@@ -0,0 +1 @@
+NMB resolver
diff --git a/doc-git/NVO_CMD.html b/doc-git/NVO_CMD.html
new file mode 100644 (file)
index 0000000..5346f3f
--- /dev/null
@@ -0,0 +1 @@
+Non-volatile option storage commands
diff --git a/doc-git/ROUTE_CMD.html b/doc-git/ROUTE_CMD.html
new file mode 100644 (file)
index 0000000..8114c26
--- /dev/null
@@ -0,0 +1 @@
+Routing table management commands
diff --git a/doc-git/SANBOOT_CMD.html b/doc-git/SANBOOT_CMD.html
new file mode 100644 (file)
index 0000000..2e9d840
--- /dev/null
@@ -0,0 +1 @@
+SAN boot commands
diff --git a/flag_table.php b/flag_table.php
new file mode 100644 (file)
index 0000000..4c14d25
--- /dev/null
@@ -0,0 +1,370 @@
+<?php // -*- Mode: PHP; -*-
+
+$flag_table = array (
+
+// Begin Console Options:
+
+       "HDR_CONSOLE_OPTIONS"
+       => array ( 
+                 "flag" => "HDR_CONSOLE_OPTIONS",
+                 "type" => "header",
+                 "label" => "Console Options" 
+                 ),
+
+       "CONSOLE_FIRMWARE"
+       => array (
+                 "flag" => "CONSOLE_FIRMWARE",
+                 "arch" => "all",
+                 "type" => "on/off",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "CONSOLE_SERIAL"
+       => array (
+                 "flag" => "CONSOLE_SERIAL",
+                 "arch" => "all",
+                 "type" => "on/off",
+                 "value" => "off",
+                 "cfgsec" => "general"
+                 ),
+       
+// End Console Options
+
+// Begin Timer Options:
+
+       "HDR_TIMER_OPTIONS"
+       => array ( 
+                 "flag" => "HDR_TIMER_OPTIONS",
+                 "hide_from_user" => "yes",  /* Hide even the header */
+                 "type" => "header",
+                 "label" => "Timer Options" 
+                 ),
+
+       "TIMER_BIOS"
+       => array (
+                 "flag" => "TIMER_BIOS",
+                 "arch" => "all",
+                 "type" => "on/off",
+                 "value" => "on",
+                 "hide_from_user" => "yes",
+                 "cfgsec" => "general"
+                 ),
+
+       "TIMER_RDTSC"
+       => array (
+                 "flag" => "TIMER_RDTSC",
+                 "arch" => "all",
+                 "type" => "on/off",
+                 "value" => "on",
+                 "hide_from_user" => "yes",
+                 "cfgsec" => "general"
+                 ),
+
+// End Timer Options
+
+// Begin Network Protocol Options:
+
+       "HDR_NETWORK_PROTOCOL_OPTIONS"
+       => array ( 
+                 "flag" => "HDR_NETWORK_PROTOCOL_OPTIONS",
+                 "hide_from_user" => "yes",  /* Hide even the header */
+                 "type" => "header",
+                 "label" => "Network Protocol Options" 
+                 ),
+
+       "NET_PROTO_IPV4"
+       => array (
+                 "flag" => "NET_PROTO_IPV4",
+                 "arch" => "all",
+                 "type" => "on/off",
+                 "value" => "on",
+                 "hide_from_user" => "yes",
+                 "cfgsec" => "general"
+                 ),
+
+// End Network Protocol Options
+
+// Begin Serial Port configuration
+
+       "HDR_SERIAL_PORT_OPTIONS"
+       => array ( 
+                 "flag" => "HDR_SERIAL_PORT_OPTIONS",
+                 "type" => "header",
+                 "label" => "Serial Port Options" 
+                 ),
+
+       "COMCONSOLE"
+       => array ( 
+                 "flag" => "COMCONSOLE",
+                 "arch" => "all",
+                 "type" => "integer", // usually hex, e.g. 0x378
+                 "value" => "0x3F8",
+                 "cfgsec" => "serial"
+                 ),
+
+        "COMPRESERVE"
+       => array (
+                 "flag" => "COMPRESERVE",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "off",
+                 "cfgsec" => "serial"
+                 ),
+
+       "COMSPEED"
+       => array (
+                 "flag" => "COMSPEED",
+                 "type" => "integer",
+                 "arch" => "all",
+                 "value" => "9600",
+                 "cfgsec" => "serial"
+                 ),
+
+       "COMDATA"
+       => array (
+                 "flag" => "COMDATA",
+                 "type" => "integer",
+                 "arch" => "all",
+                 "value" => "8",
+                 "cfgsec" => "serial"
+                 ),
+
+       "COMPARITY"
+       => array (
+                 "flag" => "COMPARITY",
+                 "type" => "integer",
+                 "arch" => "all",
+                 "value" => "0",
+                 "cfgsec" => "serial"
+                 ),
+
+       "COMSTOP"
+       => array (
+                 "flag" => "COMSTOP",
+                 "type" => "integer",
+                 "arch" => "all",
+                 "value" => "1",
+                 "cfgsec" => "serial"
+                 ),
+
+// End Serial Options
+
+// Begin Download Protocols
+
+       "HDR_DOWNLOAD_PROTOCOLS"
+       => array ( 
+                 "flag" => "HDR_DOWNLOAD_PROTOCOLS",
+                 "type" => "header",
+                 "label" => "Download Protocols"
+                 ),
+
+       "DOWNLOAD_PROTO_TFTP"
+       => array (
+                 "flag" => "DOWNLOAD_PROTO_TFTP",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+       
+       "DOWNLOAD_PROTO_HTTP"
+       => array (
+                 "flag" => "DOWNLOAD_PROTO_HTTP",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "DOWNLOAD_PROTO_FTP"
+       => array (
+                 "flag" => "DOWNLOAD_PROTO_FTP",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "off",
+                 "cfgsec" => "general"
+                 ),
+
+// End Download Protocols
+
+// Begin Name resolution modules
+
+       "HDR_NAME_RESOLUTION_MODULES"
+       => array (
+                 "flag" => "HDR_NAME_RESOLUTION_MODULES",
+                 "type" => "header",
+                 "label" => "Name Resolution Modules"
+                 ),
+       
+       "DNS_RESOLVER"
+       => array ( 
+                 "flag" => "DNS_RESOLVER",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+//     "NMB_RESOLVER"
+//     => array (
+//               "flag" => "NMB_RESOLVER",
+//               "type" => "on/off",
+//               "arch" => "all",
+//               "value" => "off",
+//               "cfgsec" => "general"
+//               ),
+
+// End Name resolution modules
+
+// Begin Image types
+
+       "HDR_IMAGE_TYPES"
+       => array (
+                 "flag" => "HDR_IMAGE_TYPES",
+                 "type" => "header",
+                 "label" => "Image Types",
+                 ),
+
+       "IMAGE_ELF"
+       => array (
+                 "flag" => "IMAGE_ELF",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "IMAGE_NBI"
+       => array ( 
+                 "flag" => "IMAGE_NBI",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "IMAGE_MULTIBOOT"
+       => array (
+                 "flag" => "IMAGE_MULTIBOOT",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "IMAGE_PXE"
+       => array (
+                 "flag" => "IMAGE_PXE",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "IMAGE_SCRIPT"
+       => array (
+                 "flag" => "IMAGE_SCRIPT",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "IMAGE_BZIMAGE"
+       => array (
+                 "flag" => "IMAGE_BZIMAGE",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+// End Image types
+
+// Begin Command-line commands to include
+
+       "HDR_COMMAND_LINE_OPTIONS"
+       => array (
+                 "flag" => "HDR_COMMAND_LINE_OPTIONS",
+                 "type" => "header",
+                 "label" => "Command Line Options",
+                 ),
+
+       "IMAGE_CMD"
+       => array (
+                 "flag" => "IMAGE_CMD",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "AUTOBOOT_CMD"
+        => array (
+                  "flag" => "AUTOBOOT_CMD",
+                  "type" => "on/off",
+                  "arch" => "all",
+                  "value" => "on",
+                  "cfgsec" => "general"
+                  ),
+
+       "NVO_CMD"
+       => array (
+                 "flag" => "NVO_CMD",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "CONFIG_CMD"
+       => array (
+                 "flag" => "CONFIG_CMD",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "IFMGMT_CMD"
+       => array (
+                 "flag" => "IFMGMT_CMD",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "ROUTE_CMD"
+       => array (
+                 "flag" => "ROUTE_CMD",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+
+       "DHCP_CMD"
+       => array ( 
+                 "flag" => "DHCP_CMD",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+       
+       "SANBOOT_CMD"
+       => array ( 
+                 "flag" => "SANBOOT_CMD",
+                 "type" => "on/off",
+                 "arch" => "all",
+                 "value" => "on",
+                 "cfgsec" => "general"
+                 ),
+       
+// End Command-line commands to include
+
+);
+
+?>
diff --git a/flags.php b/flags.php
new file mode 100644 (file)
index 0000000..1a35ed9
--- /dev/null
+++ b/flags.php
@@ -0,0 +1,76 @@
+<?php // -*- Mode: PHP; -*-
+
+include "configinfo.php";
+
+$nics = get_nics();
+$flags = get_flags();
+$nicfile = get_nicfile();
+$arch = cleanstring($_GET['arch']);
+
+$header_title = "ROM-o-matic.net: gpxe-$version ($arch)";
+$html_title   = "<a href=\"http://rom-o-matic.net/\">ROM-o-matic.net</a> for gPXE version $version ($arch)";
+$description = "Configuration flags";
+
+include $top_inc;
+
+?>
+
+<form action="build.php" method=GET>
+ <input type="hidden" name="version" value = "<? echo $version ?>">
+ <? /* Set F to keep build.php from using flag defaults, since we've
+       already done that. */ ?>
+ <input type="hidden" name="F" value="ignore">
+
+ <? /* Just pass thru other values we don't touch: */ ?>
+ <input type="hidden" name="nic" value="<? echo htmlentities($_GET['nic']) ?>">
+ <input type="hidden" name="ofmt" 
+  value="<? echo htmlentities ( isset ( $_GET['ofmt'] ) ? $_GET['ofmt'] : '' ) ?>">
+ <input type="hidden" name="arch" value="<? echo $arch ?>">
+
+<? $build = "<input type=\"submit\" name=\"A\" value=\"Get ROM\">";
+   $restart = "<input type=\"submit\" name=\"A\" value=\"Start Over\">";
+?>
+
+<h3>
+Make configuration changes and press <? echo $build ?> <br>
+to generate and download the ROM image, or <? echo $restart ?> <br>
+to return to the main page.
+</h3>
+
+<p></p>
+<hr>
+
+<ul>
+
+<li>Choose NIC/ROM type: 
+<? echo keys_menubox("nic", $nics, isset($_GET['nic']) ? $_GET['nic'] : "") ?>
+  <p>
+  PCI IDs for available NICs are documented
+  <a href="<? echo $src_dir ?>/bin/NIC" target="_blank">here.</a>
+  <br>You need to know this if you are going to burn/flash a ROM image because
+  <br> PCI IDs on the NIC and ROM must match. If you are making any other
+  <br> kind of image, you only need to match the family (<strong>family</strong>:rom_name)
+  <br> part of the identifier.
+  </p>
+</li>
+
+<li>Choose ROM output format:
+<? echo keys_menubox("ofmt", $ofmts, isset($_GET['ofmt']) ? $_GET['ofmt'] : "") ?>
+<p></p>
+</li>
+
+</ul>
+
+<hr>
+
+<? echo_flags($flags); ?>
+
+<hr>
+<center><table width="35%"><tr>
+<td align="left"> <? echo $build; ?> </td>
+<td align="right"> <? echo $restart ?></td>
+</tr></table></center>
+
+</form>
+
+<? include $bottom_inc ?>
diff --git a/index.php b/index.php
new file mode 100644 (file)
index 0000000..7855053
--- /dev/null
+++ b/index.php
@@ -0,0 +1,81 @@
+<?php // -*- Mode: PHP; -*-
+
+  include "configinfo.php";
+  $nics = get_nics();
+  $flags = get_flags();
+  $encoded_flags = encode_flags($flags);
+
+  $header_title = "ROM-o-matic.net: for gPXE version $version";
+  $html_title   = "<a href=\"http://rom-o-matic.net/\">ROM-o-matic.net</a> for gPXE version $version";
+  $description  = "a dynamic gPXE and Etherboot image generator";
+
+  // Begin html output
+  include $top_inc;
+
+?>
+
+<form action="build.php" method=GET>
+  <input type="hidden" name="version" value = "<? echo $version ?>">
+  <input type="hidden" name="F" value="<? echo $encoded_flags ?>">
+  <input type="hidden" name="arch" value="<? echo (isset($_GET['arch']) ? cleanstring($_GET['arch']) : "i386")?>">
+
+<h3>
+ROM-o-matic.net dynamically generates gPXE and Etherboot ROM images.
+</h3>
+
+<h4>
+Supporting <? echo count($nics) ?> NIC variations and <? echo count($ofmts) ?> output formats.
+</h4>
+
+To create and download a gPXE ROM image:
+
+<ol>
+
+<li>
+
+  Choose NIC/ROM type: <? echo keys_menubox("nic", $nics, isset($_GET['nic']) ? $_GET['nic'] : "") ?>
+  <br><br>
+
+  PCI IDs for available NICs are documented
+  <a href="<? echo $src_dir ?>/bin/NIC" target="_blank">here.</a>
+  <br> You need to know this if you are going to burn/flash a ROM image because
+  <br> PCI IDs on the NIC and ROM must match. If you are making any other
+  <br> kind of image, you only need to match the family (<strong>family</strong>:rom_name)
+  <br> part of the identifier.
+  <br><br>
+
+</li>
+
+<li>
+
+  Choose ROM output format: <? echo keys_menubox("ofmt", $ofmts, isset($_GET['ofmt']) ? $_GET['ofmt'] : "") ?>
+  <br><br>
+  
+</li>
+
+<li>
+
+  (optional) To customize ROM configuration press: <input type="submit" name="A" value="Configure">
+  <br><br>
+
+</li>
+
+<li>
+
+  To generate and download a ROM image press:  <input type="submit" name="A" value="Get ROM">
+  <br><br>
+  
+</li>
+
+<li>
+
+  Take a look at the <a href="../../README" target="_blank">README</a> for <? echo "gpxe-$version"; ?>
+  <br><br>
+
+</li>
+
+</ol>
+
+</form>
+
+<? include $bottom_inc ?>
diff --git a/local-config.php b/local-config.php
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/top.php b/top.php
new file mode 100644 (file)
index 0000000..c73ec97
--- /dev/null
+++ b/top.php
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+
+<head>
+  <link rev="made" href="mailto:webaster@etherboot.org">
+  <meta name="keywords" content="rom, etherboot, gpxe, open source, rom-o-matic.net">
+  <title><? echo $header_title ?></title>
+  <meta name="description" content="<? echo $description ?>">
+</head>
+
+<h2><? echo $html_title ?></h2>
+
+<hr>