From e817a347fb785f6fa8d2242604d6b6e7eff847be Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 8 Oct 2008 00:37:40 +0100 Subject: [makefile] Split config.h out into config/*.h and kill off mkconfig.pl --- src/Makefile | 1 - src/Makefile.housekeeping | 8 -- src/config.h | 175 --------------------------------------- src/config/.gitignore | 1 - src/config/general.h | 111 +++++++++++++++++++++++++ src/config/isa.h | 15 ++++ src/config/serial.h | 28 +++++++ src/util/mkconfig.pl | 205 ---------------------------------------------- 8 files changed, 154 insertions(+), 390 deletions(-) delete mode 100644 src/config.h create mode 100644 src/config/general.h create mode 100644 src/config/isa.h create mode 100644 src/config/serial.h delete mode 100755 src/util/mkconfig.pl (limited to 'src') diff --git a/src/Makefile b/src/Makefile index 833d2631f..89f435770 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 a4ccee1e5..0a41ae927 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -232,14 +232,6 @@ ifdef ARCH include arch/$(ARCH)/Makefile 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 diff --git a/src/config.h b/src/config.h deleted file mode 100644 index ae39fb550..000000000 --- a/src/config.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * This file defines the configuration for Etherboot. - * - * 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. - * - */ - -/* @BEGIN general.h - * - * Console configuration - * - * These options specify the console types that Etherboot will use for - * interaction with the user. - * - */ - -#define CONSOLE_FIRMWARE /* Default BIOS console */ -#undef CONSOLE_SERIAL /* Serial port */ -#undef CONSOLE_DIRECT_VGA /* Direct access to VGA card */ -#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 - * - */ -#define TIMER_BIOS /* 18Hz BIOS timer */ -#define TIMER_RDTSC /* CPU TimeStamp Counter timer */ -#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 - * - */ - -#define DOWNLOAD_PROTO_TFTP /* Trivial File Transfer Protocol */ -#undef DOWNLOAD_PROTO_NFS /* Network File System */ -#define DOWNLOAD_PROTO_HTTP /* Hypertext Transfer Protocol */ -#undef DOWNLOAD_PROTO_HTTPS /* Secure Hypertext Transfer Protocol */ -#undef DOWNLOAD_PROTO_FTP /* File Transfer Protocol */ -#undef DOWNLOAD_PROTO_TFTM /* Multicast Trivial File Transfer Protocol */ -#undef DOWNLOAD_PROTO_SLAM /* Scalable Local Area Multicast */ -#undef DOWNLOAD_PROTO_FSP /* FSP? */ - -/* @END general.h */ - -/* @BEGIN general.h - * - * Name resolution modules - * - */ - -#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 - * you want to use. - * - */ -#undef IMAGE_NBI /* NBI image support */ -#define IMAGE_ELF /* ELF image support */ -#undef IMAGE_FREEBSD /* FreeBSD kernel image support */ -#define IMAGE_MULTIBOOT /* MultiBoot image support */ -#undef IMAGE_AOUT /* a.out image support */ -#undef IMAGE_WINCE /* WinCE image support */ -#define IMAGE_PXE /* PXE image support */ -#define IMAGE_SCRIPT /* gPXE script image support */ -#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 - * - */ -#define AUTOBOOT_CMD /* Automatic booting */ -#define NVO_CMD /* Non-volatile option storage commands */ -#define CONFIG_CMD /* Option configuration console */ -#define IFMGMT_CMD /* Interface management commands */ -#define ROUTE_CMD /* Routing table management commands */ -#define IMAGE_CMD /* Image management commands */ -#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. - * - */ - -#undef BUILD_SERIAL /* Include an automatic build serial - * number. Add "bs" to the list of - * make targets. For example: - * "make bin/rtl8139.dsk bs" */ -#undef BUILD_ID /* Include a custom build ID string, - * e.g "test-foo" */ -#undef NULL_TRAP /* Attempt to catch NULL function calls */ -#undef GDBSERIAL /* Remote GDB debugging over serial */ -#undef GDBUDP /* Remote GDB debugging over UDP - * (both may be set) */ - -/* @END general.h */ - -/* @TRYSOURCE config-local.h */ diff --git a/src/config/.gitignore b/src/config/.gitignore index 499ae1229..8e94f32fe 100644 --- a/src/config/.gitignore +++ b/src/config/.gitignore @@ -1,2 +1 @@ -*.h .buildserial.* diff --git a/src/config/general.h b/src/config/general.h new file mode 100644 index 000000000..d47b76771 --- /dev/null +++ b/src/config/general.h @@ -0,0 +1,111 @@ +#ifndef CONFIG_GENERAL_H +#define CONFIG_GENERAL_H + +/** @file + * + * General configuration + * + */ + +/* + * Console configuration + * + * These options specify the console types that Etherboot will use for + * interaction with the user. + * + */ + +#define CONSOLE_FIRMWARE /* Default BIOS console */ +#undef CONSOLE_SERIAL /* Serial port */ +#undef CONSOLE_DIRECT_VGA /* Direct access to VGA card */ +#undef CONSOLE_BTEXT /* Who knows what this does? */ +#undef CONSOLE_PC_KBD /* Direct access to PC keyboard */ + +/* + * Timer configuration + * + */ +#define TIMER_BIOS /* 18Hz BIOS timer */ +#define TIMER_RDTSC /* CPU TimeStamp Counter timer */ +#define BANNER_TIMEOUT 20 /* Tenths of a second for which the shell + banner should appear */ + +/* + * Network protocols + * + */ + +#define NET_PROTO_IPV4 /* IPv4 protocol */ + +/* + * Download protocols + * + */ + +#define DOWNLOAD_PROTO_TFTP /* Trivial File Transfer Protocol */ +#undef DOWNLOAD_PROTO_NFS /* Network File System */ +#define DOWNLOAD_PROTO_HTTP /* Hypertext Transfer Protocol */ +#undef DOWNLOAD_PROTO_HTTPS /* Secure Hypertext Transfer Protocol */ +#undef DOWNLOAD_PROTO_FTP /* File Transfer Protocol */ +#undef DOWNLOAD_PROTO_TFTM /* Multicast Trivial File Transfer Protocol */ +#undef DOWNLOAD_PROTO_SLAM /* Scalable Local Area Multicast */ +#undef DOWNLOAD_PROTO_FSP /* FSP? */ + +/* + * Name resolution modules + * + */ + +#define DNS_RESOLVER /* DNS resolver */ +#undef NMB_RESOLVER /* NMB resolver */ + +/* + * Image types + * + * Etherboot supports various image formats. Select whichever ones + * you want to use. + * + */ +#undef IMAGE_NBI /* NBI image support */ +#define IMAGE_ELF /* ELF image support */ +#undef IMAGE_FREEBSD /* FreeBSD kernel image support */ +#define IMAGE_MULTIBOOT /* MultiBoot image support */ +#undef IMAGE_AOUT /* a.out image support */ +#undef IMAGE_WINCE /* WinCE image support */ +#define IMAGE_PXE /* PXE image support */ +#define IMAGE_SCRIPT /* gPXE script image support */ +#define IMAGE_BZIMAGE /* Linux bzImage image support */ +#define IMAGE_COMBOOT /* SYSLINUX COMBOOT image support */ + +/* + * Command-line commands to include + * + */ +#define AUTOBOOT_CMD /* Automatic booting */ +#define NVO_CMD /* Non-volatile option storage commands */ +#define CONFIG_CMD /* Option configuration console */ +#define IFMGMT_CMD /* Interface management commands */ +#define ROUTE_CMD /* Routing table management commands */ +#define IMAGE_CMD /* Image management commands */ +#define DHCP_CMD /* DHCP management commands */ +#define SANBOOT_CMD /* SAN boot commands */ + +/* + * Obscure configuration options + * + * You probably don't need to touch these. + * + */ + +#undef BUILD_SERIAL /* Include an automatic build serial + * number. Add "bs" to the list of + * make targets. For example: + * "make bin/rtl8139.dsk bs" */ +#undef BUILD_ID /* Include a custom build ID string, + * e.g "test-foo" */ +#undef NULL_TRAP /* Attempt to catch NULL function calls */ +#undef GDBSERIAL /* Remote GDB debugging over serial */ +#undef GDBUDP /* Remote GDB debugging over UDP + * (both may be set) */ + +#endif /* CONFIG_GENERAL_H */ diff --git a/src/config/isa.h b/src/config/isa.h new file mode 100644 index 000000000..523be1c0a --- /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 000000000..984a7a9c0 --- /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 e55c2ca82..000000000 --- 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"; - } -} -- cgit v1.2.3-55-g7522