mirror of
				https://github.com/xcat2/xNBA.git
				synced 2025-11-04 05:12:33 +00:00 
			
		
		
		
	Fix BUILD_SERIAL.
Change from using #if to #ifdef, since #if can't cope with string constants.
This commit is contained in:
		
							
								
								
									
										18
									
								
								src/Config
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/Config
									
									
									
									
									
								
							@@ -221,18 +221,6 @@
 | 
			
		||||
#			which saves power while waiting for user interaction.
 | 
			
		||||
#			Good for compute clusters and VMware emulation.
 | 
			
		||||
#			But may not work for all CPUs.
 | 
			
		||||
#	-DBUILD_SERIAL
 | 
			
		||||
#			Include an auto-incrementing build number in
 | 
			
		||||
#			the Etherboot welcome message.  Useful when
 | 
			
		||||
#			developing, to be sure that the file you
 | 
			
		||||
#			compiled is the one you're currently testing.
 | 
			
		||||
#	-DBUILD_ID
 | 
			
		||||
#			Include a build ID string in the Etherboot
 | 
			
		||||
#			welcome message.  Useful when developing, if
 | 
			
		||||
#			you have multiple builds with different
 | 
			
		||||
#			configurations and want to check you're
 | 
			
		||||
#			running the one you think you are.  Requires
 | 
			
		||||
#			-DBUILD_SERIAL.
 | 
			
		||||
#
 | 
			
		||||
# @/OptionDescription@
 | 
			
		||||
 | 
			
		||||
@@ -365,12 +353,6 @@ CFLAGS+=	-DPXE_IMAGE -DPXE_EXPORT
 | 
			
		||||
# via pxeboot, use only with DOWNLOAD_PROTO_NFS
 | 
			
		||||
# CFLAGS+=	-DFREEBSD_PXEEMU
 | 
			
		||||
 | 
			
		||||
# Include an auto-incrementing build serial number and optional build
 | 
			
		||||
# ID string
 | 
			
		||||
# CFLAGS+=	-DBUILD_SERIAL
 | 
			
		||||
# CFLAGS+=	-DBUILD_SERIAL -DBUILD_ID=\"testing\"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Garbage from Makefile.main temporarily placed here until a home can
 | 
			
		||||
 
 | 
			
		||||
@@ -359,26 +359,24 @@ CLEANUP	+= $(NRV2B)
 | 
			
		||||
# build targets to get a serial number printed at the end of the
 | 
			
		||||
# build.  Enable -DBUILD_SERIAL in order to see it when the code runs.
 | 
			
		||||
#
 | 
			
		||||
BUILDSERIAL_H = include/.buildserial.h
 | 
			
		||||
BUILDSERIAL_H		= config/.buildserial.h
 | 
			
		||||
BUILDSERIAL_NOW		= config/.buildserial.now
 | 
			
		||||
BUILDSERIAL_NEXT	= config/.buildserial.next
 | 
			
		||||
 | 
			
		||||
$(BUILDSERIAL_H) :
 | 
			
		||||
	@if [ ! -s $@ ]; then echo '#define BUILD_SERIAL_NUM 0' > $@; fi
 | 
			
		||||
	@perl -pi -e 's/(BUILD_SERIAL_NUM)\s+(\d+)/"$${1} ".($${2}+1)/e' $@
 | 
			
		||||
$(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) :
 | 
			
		||||
	echo 1 > $@
 | 
			
		||||
 | 
			
		||||
bs : $(BUILDSERIAL_H)
 | 
			
		||||
	@perl -n -e '/BUILD_SERIAL_NUM\s+(\d+)/ && ' \
 | 
			
		||||
		-e 'print "Build serial number is $$1\n";' $<
 | 
			
		||||
$(BUILDSERIAL_H) : $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT)
 | 
			
		||||
	echo '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@
 | 
			
		||||
 | 
			
		||||
ifeq ($(filter bs,$(MAKECMDGOALS)),bs)
 | 
			
		||||
.PHONY : $(BUILDSERIAL_H)
 | 
			
		||||
$(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \
 | 
			
		||||
	cp -f $(BUILDSERIAL_NEXT) $(BUILDSERIAL_NOW))
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Ensure that include/.buildserial.h always exists, to solve the
 | 
			
		||||
# problem of bootstrapping a BUILD_SERIAL-enabled build.
 | 
			
		||||
#
 | 
			
		||||
ifeq ($(wildcard $(BUILDSERIAL_H)),)
 | 
			
		||||
$(shell $(TOUCH) $(BUILDSERIAL_H))
 | 
			
		||||
endif
 | 
			
		||||
bs : $(BUILDSERIAL_NOW)
 | 
			
		||||
	@echo $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT)
 | 
			
		||||
	@echo "Build serial number is $(shell cat $<)"
 | 
			
		||||
 | 
			
		||||
# List of available architectures
 | 
			
		||||
#
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										55
									
								
								src/config.h
									
									
									
									
									
								
							
							
						
						
									
										55
									
								
								src/config.h
									
									
									
									
									
								
							@@ -17,11 +17,11 @@
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define CONSOLE_FIRMWARE	1	/* Default BIOS console */
 | 
			
		||||
#define CONSOLE_SERIAL		0	/* Serial port */
 | 
			
		||||
#define CONSOLE_DIRECT_VGA	0	/* Direct access to VGA card */
 | 
			
		||||
#define CONSOLE_BTEXT		0	/* Who knows what this does? */
 | 
			
		||||
#define CONSOLE_PC_KBD		0	/* Direct access to PC keyboard */
 | 
			
		||||
#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 */
 | 
			
		||||
 | 
			
		||||
@@ -35,18 +35,49 @@
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define COMCONSOLE	0x3f8		/* I/O port address */
 | 
			
		||||
#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.
 | 
			
		||||
 */
 | 
			
		||||
#define COMPRESERVE	0
 | 
			
		||||
#undef	COMPRESERVE
 | 
			
		||||
 | 
			
		||||
#if ! COMPRESERVE
 | 
			
		||||
#define COMSPEED	9600		/* Baud rate */
 | 
			
		||||
#define COMDATA		8		/* Data bits */ 
 | 
			
		||||
#define COMPARITY	0		/* Parity: 0=None, 1=Odd, 2=Even */
 | 
			
		||||
#define COMSTOP		1		/* Stop bits */
 | 
			
		||||
#ifdef COMPRESERVE
 | 
			
		||||
#define	COMSPEED	9600		/* 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 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
 | 
			
		||||
 *
 | 
			
		||||
 * Obscure configuration options
 | 
			
		||||
 *
 | 
			
		||||
 * You probably don't need to touch these.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define	RELOCATE		/* Relocate to high memory */
 | 
			
		||||
#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" */
 | 
			
		||||
 | 
			
		||||
/* @END general.h */
 | 
			
		||||
 
 | 
			
		||||
@@ -11,21 +11,46 @@
 | 
			
		||||
 | 
			
		||||
#include "config/general.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Build ID string calculations
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
#undef XSTR
 | 
			
		||||
#undef STR
 | 
			
		||||
#define XSTR(s) STR(s)
 | 
			
		||||
#define STR(s) #s
 | 
			
		||||
 | 
			
		||||
#ifdef BUILD_SERIAL
 | 
			
		||||
#include ".buildserial.h"
 | 
			
		||||
#define xstr(s) str(s)
 | 
			
		||||
#define str(s) #s
 | 
			
		||||
#include "config/.buildserial.h"
 | 
			
		||||
#define BUILD_SERIAL_STR "#" XSTR(BUILD_SERIAL_NUM)
 | 
			
		||||
#else
 | 
			
		||||
#define BUILD_SERIAL_STR ""
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void print_config ( void ) {
 | 
			
		||||
	printf( "Etherboot " VERSION
 | 
			
		||||
#ifdef BUILD_SERIAL
 | 
			
		||||
		" [build " 
 | 
			
		||||
#ifdef BUILD_ID
 | 
			
		||||
		BUILD_ID " "
 | 
			
		||||
#define BUILD_ID_STR BUILD_ID
 | 
			
		||||
#else
 | 
			
		||||
#define BUILD_ID_STR ""
 | 
			
		||||
#endif
 | 
			
		||||
		"#" xstr(BUILD_SERIAL_NUM) "]"
 | 
			
		||||
#endif /* BUILD_SERIAL */
 | 
			
		||||
 | 
			
		||||
#if defined(BUILD_ID) && defined(BUILD_SERIAL)
 | 
			
		||||
#define BUILD_SPACER " "
 | 
			
		||||
#else
 | 
			
		||||
#define BUILD_SPACER ""
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(BUILD_ID) || defined(BUILD_SERIAL)
 | 
			
		||||
#define BUILD_STRING " [build " BUILD_ID_STR BUILD_SPACER BUILD_SERIAL_STR "]"
 | 
			
		||||
#else
 | 
			
		||||
#define BUILD_STRING ""
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Print out configuration
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void print_config ( void ) {
 | 
			
		||||
	printf( "Etherboot " VERSION BUILD_STRING
 | 
			
		||||
		" (GPL) http://etherboot.org\n"
 | 
			
		||||
		"Drivers: " );
 | 
			
		||||
	print_drivers();
 | 
			
		||||
@@ -115,30 +140,30 @@ void print_config ( void ) {
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if	CONSOLE_DUAL
 | 
			
		||||
#ifdef	CONSOLE_DUAL
 | 
			
		||||
#undef	CONSOLE_FIRMWARE
 | 
			
		||||
#define	CONSOLE_FIRMWARE	1
 | 
			
		||||
#undef	CONSOLE_SERIAL
 | 
			
		||||
#define	CONSOLE_SERIAL		1
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if CONSOLE_FIRMWARE
 | 
			
		||||
#ifdef CONSOLE_FIRMWARE
 | 
			
		||||
REQUIRE_OBJECT ( bios_console );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if CONSOLE_SERIAL
 | 
			
		||||
#ifdef CONSOLE_SERIAL
 | 
			
		||||
REQUIRE_OBJECT ( serial );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if CONSOLE_DIRECT_VGA
 | 
			
		||||
#ifdef CONSOLE_DIRECT_VGA
 | 
			
		||||
REQUIRE_OBJECT ( video_subr );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if CONSOLE_BTEXT
 | 
			
		||||
#ifdef CONSOLE_BTEXT
 | 
			
		||||
REQUIRE_OBJECT ( btext );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if CONSOLE_PC_KBD
 | 
			
		||||
#ifdef CONSOLE_PC_KBD
 | 
			
		||||
REQUIRE_OBJECT ( pc_kbd );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -147,6 +172,6 @@ REQUIRE_OBJECT ( pc_kbd );
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if RELOCATE
 | 
			
		||||
#ifdef RELOCATE
 | 
			
		||||
REQUIRE_OBJECT ( relocate );
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -32,11 +32,21 @@ static char isa_magic[0]; /* guaranteed unique symbol */
 | 
			
		||||
 * User-supplied probe address list
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
static isa_probe_addr_t isa_extra_probe_addrs[] = {
 | 
			
		||||
	ISA_PROBE_ADDRS
 | 
			
		||||
#if ISA_PROBE_ONLY
 | 
			
		||||
	, 0
 | 
			
		||||
#ifdef ISA_PROBE_ADDRS
 | 
			
		||||
#  ifdef ISA_PROBE_ONLY
 | 
			
		||||
#    define			HAVE_ISA_PROBE_ADDRS	1
 | 
			
		||||
#    define			ISA_PROBE_ADDR_LIST	ISA_PROBE_ADDRS, 0
 | 
			
		||||
#  else
 | 
			
		||||
#    define			HAVE_ISA_PROBE_ADDRS	1
 | 
			
		||||
#    define			ISA_PROBE_ADDR_LIST	ISA_PROBE_ADDRS
 | 
			
		||||
#  endif
 | 
			
		||||
#else
 | 
			
		||||
#  define			HAVE_ISA_PROBE_ADDRS	0
 | 
			
		||||
#  define			ISA_PROBE_ADDR_LIST	
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static isa_probe_addr_t isa_extra_probe_addrs[] = {
 | 
			
		||||
	ISA_PROBE_ADDR_LIST
 | 
			
		||||
};
 | 
			
		||||
#define isa_extra_probe_addr_count \
 | 
			
		||||
     ( sizeof ( isa_extra_probe_addrs ) / sizeof ( isa_extra_probe_addrs[0] ) )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user