Przeglądaj źródła

Fix BUILD_SERIAL.

Change from using #if to #ifdef, since #if can't cope with string
constants.
tags/v0.9.3
Michael Brown 19 lat temu
rodzic
commit
cf79681b80
5 zmienionych plików z 111 dodań i 65 usunięć
  1. 0
    18
      src/Config
  2. 12
    14
      src/Makefile.housekeeping
  3. 43
    12
      src/config.h
  4. 42
    17
      src/core/config.c
  5. 14
    4
      src/drivers/bus/isa.c

+ 0
- 18
src/Config Wyświetl plik

@@ -221,18 +221,6 @@
221 221
 #			which saves power while waiting for user interaction.
222 222
 #			Good for compute clusters and VMware emulation.
223 223
 #			But may not work for all CPUs.
224
-#	-DBUILD_SERIAL
225
-#			Include an auto-incrementing build number in
226
-#			the Etherboot welcome message.  Useful when
227
-#			developing, to be sure that the file you
228
-#			compiled is the one you're currently testing.
229
-#	-DBUILD_ID
230
-#			Include a build ID string in the Etherboot
231
-#			welcome message.  Useful when developing, if
232
-#			you have multiple builds with different
233
-#			configurations and want to check you're
234
-#			running the one you think you are.  Requires
235
-#			-DBUILD_SERIAL.
236 224
 #
237 225
 # @/OptionDescription@
238 226
 
@@ -365,12 +353,6 @@ CFLAGS+=	-DPXE_IMAGE -DPXE_EXPORT
365 353
 # via pxeboot, use only with DOWNLOAD_PROTO_NFS
366 354
 # CFLAGS+=	-DFREEBSD_PXEEMU
367 355
 
368
-# Include an auto-incrementing build serial number and optional build
369
-# ID string
370
-# CFLAGS+=	-DBUILD_SERIAL
371
-# CFLAGS+=	-DBUILD_SERIAL -DBUILD_ID=\"testing\"
372
-
373
-
374 356
 
375 357
 
376 358
 # Garbage from Makefile.main temporarily placed here until a home can

+ 12
- 14
src/Makefile.housekeeping Wyświetl plik

@@ -359,26 +359,24 @@ CLEANUP	+= $(NRV2B)
359 359
 # build targets to get a serial number printed at the end of the
360 360
 # build.  Enable -DBUILD_SERIAL in order to see it when the code runs.
361 361
 #
362
-BUILDSERIAL_H = include/.buildserial.h
362
+BUILDSERIAL_H		= config/.buildserial.h
363
+BUILDSERIAL_NOW		= config/.buildserial.now
364
+BUILDSERIAL_NEXT	= config/.buildserial.next
363 365
 
364
-$(BUILDSERIAL_H) :
365
-	@if [ ! -s $@ ]; then echo '#define BUILD_SERIAL_NUM 0' > $@; fi
366
-	@perl -pi -e 's/(BUILD_SERIAL_NUM)\s+(\d+)/"$${1} ".($${2}+1)/e' $@
366
+$(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) :
367
+	echo 1 > $@
367 368
 
368
-bs : $(BUILDSERIAL_H)
369
-	@perl -n -e '/BUILD_SERIAL_NUM\s+(\d+)/ && ' \
370
-		-e 'print "Build serial number is $$1\n";' $<
369
+$(BUILDSERIAL_H) : $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT)
370
+	echo '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@
371 371
 
372 372
 ifeq ($(filter bs,$(MAKECMDGOALS)),bs)
373
-.PHONY : $(BUILDSERIAL_H)
373
+$(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \
374
+	cp -f $(BUILDSERIAL_NEXT) $(BUILDSERIAL_NOW))
374 375
 endif
375 376
 
376
-# Ensure that include/.buildserial.h always exists, to solve the
377
-# problem of bootstrapping a BUILD_SERIAL-enabled build.
378
-#
379
-ifeq ($(wildcard $(BUILDSERIAL_H)),)
380
-$(shell $(TOUCH) $(BUILDSERIAL_H))
381
-endif
377
+bs : $(BUILDSERIAL_NOW)
378
+	@echo $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT)
379
+	@echo "Build serial number is $(shell cat $<)"
382 380
 
383 381
 # List of available architectures
384 382
 #

+ 43
- 12
src/config.h Wyświetl plik

@@ -17,11 +17,11 @@
17 17
  *
18 18
  */
19 19
 
20
-#define CONSOLE_FIRMWARE	1	/* Default BIOS console */
21
-#define CONSOLE_SERIAL		0	/* Serial port */
22
-#define CONSOLE_DIRECT_VGA	0	/* Direct access to VGA card */
23
-#define CONSOLE_BTEXT		0	/* Who knows what this does? */
24
-#define CONSOLE_PC_KBD		0	/* Direct access to PC keyboard */
20
+#define	CONSOLE_FIRMWARE	/* Default BIOS console */
21
+#undef	CONSOLE_SERIAL		/* Serial port */
22
+#undef	CONSOLE_DIRECT_VGA	/* Direct access to VGA card */
23
+#undef	CONSOLE_BTEXT		/* Who knows what this does? */
24
+#undef	CONSOLE_PC_KBD		/* Direct access to PC keyboard */
25 25
 
26 26
 /* @END general.h */
27 27
 
@@ -35,18 +35,49 @@
35 35
  *
36 36
  */
37 37
 
38
-#define COMCONSOLE	0x3f8		/* I/O port address */
38
+#define	COMCONSOLE	0x3f8		/* I/O port address */
39 39
 
40 40
 /* Keep settings from a previous user of the serial port (e.g. lilo or
41 41
  * LinuxBIOS), ignoring COMSPEED, COMDATA, COMPARITY and COMSTOP.
42 42
  */
43
-#define COMPRESERVE	0
43
+#undef	COMPRESERVE
44 44
 
45
-#if ! COMPRESERVE
46
-#define COMSPEED	9600		/* Baud rate */
47
-#define COMDATA		8		/* Data bits */ 
48
-#define COMPARITY	0		/* Parity: 0=None, 1=Odd, 2=Even */
49
-#define COMSTOP		1		/* Stop bits */
45
+#ifdef COMPRESERVE
46
+#define	COMSPEED	9600		/* Baud rate */
47
+#define	COMDATA		8		/* Data bits */ 
48
+#define	COMPARITY	0		/* Parity: 0=None, 1=Odd, 2=Even */
49
+#define	COMSTOP		1		/* Stop bits */
50 50
 #endif
51 51
 
52 52
 /* @END serial.h */
53
+
54
+/* @BEGIN isa.h
55
+ *
56
+ * ISA probe address configuration
57
+ *
58
+ * You can override the list of addresses that will be probed by any
59
+ * ISA drivers.
60
+ *
61
+ */
62
+#undef	ISA_PROBE_ADDRS		/* e.g. 0x200, 0x300 */
63
+#undef	ISA_PROBE_ONLY		/* Do not probe any other addresses */
64
+
65
+/* @END isa.h */
66
+
67
+/* @BEGIN general.h
68
+ *
69
+ * Obscure configuration options
70
+ *
71
+ * You probably don't need to touch these.
72
+ *
73
+ */
74
+
75
+#define	RELOCATE		/* Relocate to high memory */
76
+#undef	BUILD_SERIAL		/* Include an automatic build serial
77
+				 * number.  Add "bs" to the list of
78
+				 * make targets.  For example:
79
+				 * "make bin/rtl8139.dsk bs" */
80
+#undef	BUILD_ID		/* Include a custom build ID string,
81
+				 * e.g "test-foo" */
82
+
83
+/* @END general.h */

+ 42
- 17
src/core/config.c Wyświetl plik

@@ -11,21 +11,46 @@
11 11
 
12 12
 #include "config/general.h"
13 13
 
14
+/*
15
+ * Build ID string calculations
16
+ *
17
+ */
18
+#undef XSTR
19
+#undef STR
20
+#define XSTR(s) STR(s)
21
+#define STR(s) #s
22
+
14 23
 #ifdef BUILD_SERIAL
15
-#include ".buildserial.h"
16
-#define xstr(s) str(s)
17
-#define str(s) #s
24
+#include "config/.buildserial.h"
25
+#define BUILD_SERIAL_STR "#" XSTR(BUILD_SERIAL_NUM)
26
+#else
27
+#define BUILD_SERIAL_STR ""
18 28
 #endif
19 29
 
20
-void print_config ( void ) {
21
-	printf( "Etherboot " VERSION
22
-#ifdef BUILD_SERIAL
23
-		" [build " 
24 30
 #ifdef BUILD_ID
25
-		BUILD_ID " "
31
+#define BUILD_ID_STR BUILD_ID
32
+#else
33
+#define BUILD_ID_STR ""
26 34
 #endif
27
-		"#" xstr(BUILD_SERIAL_NUM) "]"
28
-#endif /* BUILD_SERIAL */
35
+
36
+#if defined(BUILD_ID) && defined(BUILD_SERIAL)
37
+#define BUILD_SPACER " "
38
+#else
39
+#define BUILD_SPACER ""
40
+#endif
41
+
42
+#if defined(BUILD_ID) || defined(BUILD_SERIAL)
43
+#define BUILD_STRING " [build " BUILD_ID_STR BUILD_SPACER BUILD_SERIAL_STR "]"
44
+#else
45
+#define BUILD_STRING ""
46
+#endif
47
+
48
+/*
49
+ * Print out configuration
50
+ *
51
+ */
52
+void print_config ( void ) {
53
+	printf( "Etherboot " VERSION BUILD_STRING
29 54
 		" (GPL) http://etherboot.org\n"
30 55
 		"Drivers: " );
31 56
 	print_drivers();
@@ -115,30 +140,30 @@ void print_config ( void ) {
115 140
  *
116 141
  */
117 142
 
118
-#if	CONSOLE_DUAL
143
+#ifdef	CONSOLE_DUAL
119 144
 #undef	CONSOLE_FIRMWARE
120 145
 #define	CONSOLE_FIRMWARE	1
121 146
 #undef	CONSOLE_SERIAL
122 147
 #define	CONSOLE_SERIAL		1
123 148
 #endif
124 149
 
125
-#if CONSOLE_FIRMWARE
150
+#ifdef CONSOLE_FIRMWARE
126 151
 REQUIRE_OBJECT ( bios_console );
127 152
 #endif
128 153
 
129
-#if CONSOLE_SERIAL
154
+#ifdef CONSOLE_SERIAL
130 155
 REQUIRE_OBJECT ( serial );
131 156
 #endif
132 157
 
133
-#if CONSOLE_DIRECT_VGA
158
+#ifdef CONSOLE_DIRECT_VGA
134 159
 REQUIRE_OBJECT ( video_subr );
135 160
 #endif
136 161
 
137
-#if CONSOLE_BTEXT
162
+#ifdef CONSOLE_BTEXT
138 163
 REQUIRE_OBJECT ( btext );
139 164
 #endif
140 165
 
141
-#if CONSOLE_PC_KBD
166
+#ifdef CONSOLE_PC_KBD
142 167
 REQUIRE_OBJECT ( pc_kbd );
143 168
 #endif
144 169
 
@@ -147,6 +172,6 @@ REQUIRE_OBJECT ( pc_kbd );
147 172
  *
148 173
  */
149 174
 
150
-#if RELOCATE
175
+#ifdef RELOCATE
151 176
 REQUIRE_OBJECT ( relocate );
152 177
 #endif

+ 14
- 4
src/drivers/bus/isa.c Wyświetl plik

@@ -32,11 +32,21 @@ static char isa_magic[0]; /* guaranteed unique symbol */
32 32
  * User-supplied probe address list
33 33
  *
34 34
  */
35
-static isa_probe_addr_t isa_extra_probe_addrs[] = {
36
-	ISA_PROBE_ADDRS
37
-#if ISA_PROBE_ONLY
38
-	, 0
35
+#ifdef ISA_PROBE_ADDRS
36
+#  ifdef ISA_PROBE_ONLY
37
+#    define			HAVE_ISA_PROBE_ADDRS	1
38
+#    define			ISA_PROBE_ADDR_LIST	ISA_PROBE_ADDRS, 0
39
+#  else
40
+#    define			HAVE_ISA_PROBE_ADDRS	1
41
+#    define			ISA_PROBE_ADDR_LIST	ISA_PROBE_ADDRS
42
+#  endif
43
+#else
44
+#  define			HAVE_ISA_PROBE_ADDRS	0
45
+#  define			ISA_PROBE_ADDR_LIST	
39 46
 #endif
47
+
48
+static isa_probe_addr_t isa_extra_probe_addrs[] = {
49
+	ISA_PROBE_ADDR_LIST
40 50
 };
41 51
 #define isa_extra_probe_addr_count \
42 52
      ( sizeof ( isa_extra_probe_addrs ) / sizeof ( isa_extra_probe_addrs[0] ) )

Ładowanie…
Anuluj
Zapisz