summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2008-10-08 01:37:40 +0200
committerMichael Brown2008-10-08 03:17:32 +0200
commite817a347fb785f6fa8d2242604d6b6e7eff847be (patch)
tree2145fc502cf48755565702f09c9ea771d21aad5a /src
parent[makefile] Add support for multiple build platforms (diff)
downloadipxe-e817a347fb785f6fa8d2242604d6b6e7eff847be.tar.gz
ipxe-e817a347fb785f6fa8d2242604d6b6e7eff847be.tar.xz
ipxe-e817a347fb785f6fa8d2242604d6b6e7eff847be.zip
[makefile] Split config.h out into config/*.h and kill off mkconfig.pl
Diffstat (limited to 'src')
-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 833d2631..89f43577 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 a4ccee1e..0a41ae92 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 499ae122..8e94f32f 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 ae39fb55..d47b7677 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 00000000..523be1c0
--- /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 00000000..984a7a9c
--- /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 e55c2ca8..00000000
--- 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";
- }
-}