aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2008-10-08 00:37:40 +0100
committerMichael Brown <mcb30@etherboot.org>2008-10-08 02:17:32 +0100
commite817a347fb785f6fa8d2242604d6b6e7eff847be (patch)
tree2145fc502cf48755565702f09c9ea771d21aad5a
parenta2588547f913d5928f61ac30fd531a407925b4b5 (diff)
downloadipxe-e817a347fb785f6fa8d2242604d6b6e7eff847be.zip
ipxe-e817a347fb785f6fa8d2242604d6b6e7eff847be.tar.gz
ipxe-e817a347fb785f6fa8d2242604d6b6e7eff847be.tar.bz2
[makefile] Split config.h out into config/*.h and kill off mkconfig.pl
-rw-r--r--src/Makefile1
-rw-r--r--src/Makefile.housekeeping8
-rw-r--r--src/config/.gitignore1
-rw-r--r--src/config/general.h (renamed from src/config.h)92
-rw-r--r--src/config/isa.h15
-rw-r--r--src/config/serial.h28
-rwxr-xr-xsrc/util/mkconfig.pl205
7 files changed, 57 insertions, 293 deletions
diff --git a/src/Makefile b/src/Makefile
index 833d263..89f4357 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -33,7 +33,6 @@ NM := $(CROSS_COMPILE)nm
OBJDUMP := $(CROSS_COMPILE)objdump
PARSEROM := $(PERL) ./util/parserom.pl
MAKEROM := $(PERL) ./util/makerom.pl
-MKCONFIG := $(PERL) ./util/mkconfig.pl
SYMCHECK := $(PERL) ./util/symcheck.pl
SORTOBJDUMP := $(PERL) ./util/sortobjdump.pl
NRV2B := ./util/nrv2b
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index a4ccee1..0a41ae9 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -234,14 +234,6 @@ endif
###############################################################################
#
-# config/%.h files are generated from config.h using mkconfig.pl
-#
-config/%.h : config*.h
- $(MKCONFIG) config.h
-CLEANUP += config/*.h
-
-###############################################################################
-#
# Source file handling
# SRCDIRS lists all directories containing source files.
diff --git a/src/config/.gitignore b/src/config/.gitignore
index 499ae12..8e94f32 100644
--- a/src/config/.gitignore
+++ b/src/config/.gitignore
@@ -1,2 +1 @@
-*.h
.buildserial.*
diff --git a/src/config.h b/src/config/general.h
index ae39fb5..d47b767 100644
--- a/src/config.h
+++ b/src/config/general.h
@@ -1,15 +1,13 @@
-/*
- * This file defines the configuration for Etherboot.
+#ifndef CONFIG_GENERAL_H
+#define CONFIG_GENERAL_H
+
+/** @file
*
- * The build system splits this file into several individual header
- * files of the form config/%.h, so that changing one option doesn't
- * necessitate a rebuild of every single object. For this reason, it
- * is important to maintain the strict formatting in this file.
+ * General configuration
*
*/
-/* @BEGIN general.h
- *
+/*
* Console configuration
*
* These options specify the console types that Etherboot will use for
@@ -23,36 +21,7 @@
#undef CONSOLE_BTEXT /* Who knows what this does? */
#undef CONSOLE_PC_KBD /* Direct access to PC keyboard */
-/* @END general.h */
-
-/* @BEGIN serial.h
- *
- * Serial port configuration
- *
- * These options affect the operation of the serial console. They
- * take effect only if the serial console is included using the
- * CONSOLE_SERIAL option.
- *
- */
-
-#define COMCONSOLE 0x3f8 /* I/O port address */
-
-/* Keep settings from a previous user of the serial port (e.g. lilo or
- * LinuxBIOS), ignoring COMSPEED, COMDATA, COMPARITY and COMSTOP.
- */
-#undef COMPRESERVE
-
-#ifndef COMPRESERVE
-#define COMSPEED 115200 /* Baud rate */
-#define COMDATA 8 /* Data bits */
-#define COMPARITY 0 /* Parity: 0=None, 1=Odd, 2=Even */
-#define COMSTOP 1 /* Stop bits */
-#endif
-
-/* @END serial.h */
-
-/* @BEGIN general.h
- *
+/*
* Timer configuration
*
*/
@@ -61,33 +30,14 @@
#define BANNER_TIMEOUT 20 /* Tenths of a second for which the shell
banner should appear */
-/* @END general.h */
-
-/* @BEGIN isa.h
- *
- * ISA probe address configuration
- *
- * You can override the list of addresses that will be probed by any
- * ISA drivers.
- *
- */
-#undef ISA_PROBE_ADDRS /* e.g. 0x200, 0x300 */
-#undef ISA_PROBE_ONLY /* Do not probe any other addresses */
-
-/* @END isa.h */
-
-/* @BEGIN general.h
- *
+/*
* Network protocols
*
*/
#define NET_PROTO_IPV4 /* IPv4 protocol */
-/* @END general.h */
-
-/* @BEGIN general.h
- *
+/*
* Download protocols
*
*/
@@ -101,10 +51,7 @@
#undef DOWNLOAD_PROTO_SLAM /* Scalable Local Area Multicast */
#undef DOWNLOAD_PROTO_FSP /* FSP? */
-/* @END general.h */
-
-/* @BEGIN general.h
- *
+/*
* Name resolution modules
*
*/
@@ -112,10 +59,7 @@
#define DNS_RESOLVER /* DNS resolver */
#undef NMB_RESOLVER /* NMB resolver */
-/* @END general.h */
-
-/* @BEGIN general.h
- *
+/*
* Image types
*
* Etherboot supports various image formats. Select whichever ones
@@ -133,10 +77,7 @@
#define IMAGE_BZIMAGE /* Linux bzImage image support */
#define IMAGE_COMBOOT /* SYSLINUX COMBOOT image support */
-/* @END general.h */
-
-/* @BEGIN general.h
- *
+/*
* Command-line commands to include
*
*/
@@ -149,10 +90,7 @@
#define DHCP_CMD /* DHCP management commands */
#define SANBOOT_CMD /* SAN boot commands */
-/* @END general.h */
-
-/* @BEGIN general.h
- *
+/*
* Obscure configuration options
*
* You probably don't need to touch these.
@@ -170,6 +108,4 @@
#undef GDBUDP /* Remote GDB debugging over UDP
* (both may be set) */
-/* @END general.h */
-
-/* @TRYSOURCE config-local.h */
+#endif /* CONFIG_GENERAL_H */
diff --git a/src/config/isa.h b/src/config/isa.h
new file mode 100644
index 0000000..523be1c
--- /dev/null
+++ b/src/config/isa.h
@@ -0,0 +1,15 @@
+#ifndef CONFIG_ISA_H
+#define CONFIG_ISA_H
+
+/** @file
+ *
+ * ISA probe address configuration
+ *
+ * You can override the list of addresses that will be probed by any
+ * ISA drivers.
+ *
+ */
+#undef ISA_PROBE_ADDRS /* e.g. 0x200, 0x300 */
+#undef ISA_PROBE_ONLY /* Do not probe any other addresses */
+
+#endif /* CONFIG_ISA_H */
diff --git a/src/config/serial.h b/src/config/serial.h
new file mode 100644
index 0000000..984a7a9
--- /dev/null
+++ b/src/config/serial.h
@@ -0,0 +1,28 @@
+#ifndef CONFIG_SERIAL_H
+#define CONFIG_SERIAL_H
+
+/** @file
+ *
+ * Serial port configuration
+ *
+ * These options affect the operation of the serial console. They
+ * take effect only if the serial console is included using the
+ * CONSOLE_SERIAL option.
+ *
+ */
+
+#define COMCONSOLE 0x3f8 /* I/O port address */
+
+/* Keep settings from a previous user of the serial port (e.g. lilo or
+ * LinuxBIOS), ignoring COMSPEED, COMDATA, COMPARITY and COMSTOP.
+ */
+#undef COMPRESERVE
+
+#ifndef COMPRESERVE
+#define COMSPEED 115200 /* Baud rate */
+#define COMDATA 8 /* Data bits */
+#define COMPARITY 0 /* Parity: 0=None, 1=Odd, 2=Even */
+#define COMSTOP 1 /* Stop bits */
+#endif
+
+#endif /* CONFIG_SERIAL_H */
diff --git a/src/util/mkconfig.pl b/src/util/mkconfig.pl
deleted file mode 100755
index e55c2ca..0000000
--- a/src/util/mkconfig.pl
+++ /dev/null
@@ -1,205 +0,0 @@
-#!/usr/bin/perl -w
-
-use File::Spec::Functions qw ( :ALL );
-use File::stat;
-use strict;
-use warnings;
-
-my $cfgdir = "config";
-my $config_h = shift || "config.h";
-my @input_files;
-
-# Read in a whole file
-#
-sub read_file {
- my $file = shift;
-
- open my $fh, "<$file" or die "Could not open file $file: $!\n";
- local $/;
- my $data = <$fh>;
- close $fh;
- return $data;
-}
-
-# Write out a whole file
-#
-sub write_file {
- my $file = shift;
- my $data = shift;
-
- open my $fh, ">$file" or die "Could not write $file: $!\n";
- print $fh $data;
- close $fh;
-}
-
-# Delete a file
-#
-sub delete_file {
- my $file = shift;
-
- unlink $file or die "Could not delete $file: $!\n";
-}
-
-# Get a file modification time
-#
-sub file_mtime {
- my $file = shift;
-
- my $stat = stat ( $file ) or die "Could not stat $file: $!\n";
- return $stat->mtime;
-}
-
-# Read all the .h files in a directory
-#
-sub read_dir {
- my $dir = shift;
-
- opendir my $dh, $dir or die "Could not open directory $dir: $!\n";
- my @entries = grep { /\.h$/ } readdir $dh;
- closedir $dh;
- return @entries;
-}
-
-# Get the current configuration by reading the configuration file
-# fragments
-#
-sub current_config {
- my $dir = shift;
-
- my $cfg = {};
- foreach my $file ( read_dir ( $dir ) ) {
- $cfg->{$file} = read_file ( catfile ( $dir, $file ) );
- }
- return $cfg;
-}
-
-# Calculate guard name for a header file
-#
-sub guard {
- my $name = shift;
-
- $name =~ s/\W/_/g;
- return "CONFIG_".( uc $name );
-}
-
-# Calculate preamble for a header file
-#
-sub preamble {
- my $name = shift;
- my $master = shift;
-
- my $guard = guard ( $name );
- my $preamble = <<"EOF";
-/*
- * This file is automatically generated from $master. Do not edit this
- * file; edit $master instead.
- *
- */
-
-#ifndef $guard
-#define $guard
-EOF
- return $preamble;
-}
-
-# Calculate postamble for a header file
-#
-sub postamble {
- my $name = shift;
-
- my $guard = guard ( $name );
- return "\n#endif /* $guard */\n";
-}
-
-# Parse one config.h file into an existing configuration
-#
-sub parse_config {
- my $file = shift;
- my $cfg = shift;
- my $cursor = "";
-
- push ( @input_files, $file );
-
- open my $fh, "<$file" or die "Could not open $file: $!\n";
- while ( <$fh> ) {
- if ( ( my $newcursor, my $suffix ) = /\@BEGIN\s+(\w+\.h)(.*)$/ ) {
- die "Missing \"\@END $cursor\" before \"\@BEGIN $1\""
- ." at $file line $.\n" if $cursor;
- $cursor = $newcursor;
- $cfg->{$cursor} = preamble ( $cursor, $file )
- unless exists $cfg->{$cursor};
- $cfg->{$cursor} .= "\n/*".$suffix."\n";
- } elsif ( ( my $prefix, my $oldcursor ) = /^(.*)\@END\s+(\w+\.h)/ ) {
- die "Missing \"\@BEGIN $oldcursor\" before \"\@END $oldcursor\""
- ." at $file line $.\n" unless $cursor eq $oldcursor;
- $cfg->{$cursor} .= $prefix."*/\n";
- $cursor = "";
- } elsif ( ( my $newfile ) = /\@TRYSOURCE\s+([\w\-]+\.h)/ ) {
- die "Missing \"\@END $cursor\" before \"\@TRYSOURCE $newfile\""
- ." at $file line $.\n" if $cursor;
- parse_config ( $newfile, $cfg ) if -e $newfile;
- } else {
- $cfg->{$cursor} .= $_ if $cursor;
- }
- }
- close $fh;
- die "Missing \"\@END $cursor\" in $file\n" if $cursor;
-}
-
-# Get the new configuration by splitting config.h file using the
-# @BEGIN/@END tags
-#
-sub new_config {
- my $file = shift;
- my $cfg = {};
-
- parse_config ( $file, $cfg );
-
- foreach my $cursor ( keys %$cfg ) {
- $cfg->{$cursor} .= postamble ( $cursor );
- }
-
- return $cfg;
-}
-
-#############################################################################
-#
-# Main program
-
-# Read in current config file fragments
-#
-my $current = current_config ( $cfgdir );
-
-# Read in config.h and split it into fragments
-#
-my $new = new_config ( $config_h );
-
-# Delete any no-longer-wanted config file fragments
-#
-foreach my $file ( keys %$current ) {
- unlink catfile ( $cfgdir, $file ) unless exists $new->{$file};
-}
-
-# Write out any modified fragments, and find the oldest timestamp of
-# any unmodified fragments.
-#
-my $oldest = time ();
-foreach my $file ( keys %$new ) {
- if ( $current->{$file} && $new->{$file} eq $current->{$file} ) {
- # Unmodified
- my $time = file_mtime ( catfile ( $cfgdir, $file ) );
- $oldest = $time if $time < $oldest;
- } else {
- write_file ( catfile ( $cfgdir, $file ), $new->{$file} );
- }
-}
-
-# If we now have fragments that are older than config.h, set the
-# timestamp on each input file to match the oldest fragment, to
-# prevent make from always attempting to rebuild the fragments.
-#
-foreach my $file ( @input_files ) {
- if ( $oldest < file_mtime ( $file ) ) {
- utime time(), $oldest, $file or die "Could not touch $file: $!\n";
- }
-}