浏览代码

Merge branch 'master' of rom.etherboot.org:/pub/scm/gpxe

tags/v0.9.3
Michael Brown 17 年前
父节点
当前提交
98de16befd
共有 3 个文件被更改,包括 97 次插入96 次删除
  1. 23
    22
      src/Makefile
  2. 65
    73
      src/Makefile.housekeeping
  3. 9
    1
      src/net/udp/tftp.c

+ 23
- 22
src/Makefile 查看文件

@@ -42,30 +42,31 @@ include arch/$(ARCH)/Config
42 42
 # message.
43 43
 #
44 44
 noargs : blib $(BIN)/NIC $(BIN)/gpxe.dsk $(BIN)/gpxe.iso $(BIN)/gpxe.usb
45
-	@echo '==========================================================='
46
-	@echo
47
-	@echo 'To create a bootable floppy, type'
48
-	@echo '    cat $(BIN)/gpxe.dsk > /dev/fd0'
49
-	@echo 'where /dev/fd0 is your floppy drive.  This will erase any'
50
-	@echo 'data already on the disk.'
51
-	@echo
52
-	@echo 'To create a bootable USB key, type'
53
-	@echo '    cat $(BIN)/gpxe.usb > /dev/sdX'
54
-	@echo 'where /dev/sdX is your USB key, and is *not* a real hard'
55
-	@echo 'disk on your system.  This will erase any data already on'
56
-	@echo 'the USB key.'
57
-	@echo
58
-	@echo 'To create a bootable CD-ROM, burn the ISO image '
59
-	@echo '$(BIN)/gpxe.iso to a blank CD-ROM.'
60
-	@echo
61
-	@echo 'These images contain drivers for all supported cards.  You'
62
-	@echo 'can build more customised images, and ROM images, using'
63
-	@echo '    make bin/<rom-name>.<output-format>'
64
-	@echo
65
-	@echo '==========================================================='
45
+	@$(ECHO) '==========================================================='
46
+	@$(ECHO)
47
+	@$(ECHO) 'To create a bootable floppy, type'
48
+	@$(ECHO) '    cat $(BIN)/gpxe.dsk > /dev/fd0'
49
+	@$(ECHO) 'where /dev/fd0 is your floppy drive.  This will erase any'
50
+	@$(ECHO) 'data already on the disk.'
51
+	@$(ECHO)
52
+	@$(ECHO) 'To create a bootable USB key, type'
53
+	@$(ECHO) '    cat $(BIN)/gpxe.usb > /dev/sdX'
54
+	@$(ECHO) 'where /dev/sdX is your USB key, and is *not* a real hard'
55
+	@$(ECHO) 'disk on your system.  This will erase any data already on'
56
+	@$(ECHO) 'the USB key.'
57
+	@$(ECHO)
58
+	@$(ECHO) 'To create a bootable CD-ROM, burn the ISO image '
59
+	@$(ECHO) '$(BIN)/gpxe.iso to a blank CD-ROM.'
60
+	@$(ECHO)
61
+	@$(ECHO) 'These images contain drivers for all supported cards.  You'
62
+	@$(ECHO) 'can build more customised images, and ROM images, using'
63
+	@$(ECHO) '    make bin/<rom-name>.<output-format>'
64
+	@$(ECHO)
65
+	@$(ECHO) '==========================================================='
66 66
 
67 67
 # Locations of utilities
68 68
 #
69
+ECHO		?= /bin/echo -e
69 70
 HOST_CC		?= gcc
70 71
 CPP		?= gcc -E -Wp,-Wall
71 72
 RM		?= rm -f
@@ -120,7 +121,7 @@ OBJECT		= $(firstword $(subst ., ,$(@F)))
120 121
 #
121 122
 OBJ_CFLAGS	= $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
122 123
 $(BIN)/%.flags :
123
-	@echo $(OBJ_CFLAGS)
124
+	@$(ECHO) $(OBJ_CFLAGS)
124 125
 
125 126
 # Rules for specific object types.
126 127
 #

+ 65
- 73
src/Makefile.housekeeping 查看文件

@@ -20,33 +20,25 @@ CFLAGS		+= -DVERSION_MAJOR=$(VERSION_MAJOR) \
20 20
 		   -DVERSION=\"$(VERSION)\"
21 21
 IDENT		= '$(@F) $(VERSION) (GPL) etherboot.org'
22 22
 version :
23
-	@echo $(VERSION)
23
+	@$(ECHO) $(VERSION)
24 24
 
25 25
 # Check for tools that can cause failed builds
26 26
 #
27 27
 .toolcheck : Makefile Config
28 28
 	@if $(CC) -v 2>&1 | grep -is 'gcc version 2\.96' > /dev/null; then \
29
-		echo 'gcc 2.96 is unsuitable for compiling Etherboot'; \
30
-		echo 'Use gcc 2.95 or gcc 3.x instead'; \
29
+		$(ECHO) 'gcc 2.96 is unsuitable for compiling Etherboot'; \
30
+		$(ECHO) 'Use gcc 2.95 or gcc 3.x instead'; \
31 31
 		exit 1; \
32 32
 	fi
33 33
 	@if [ `perl -e 'use bytes; print chr(255)' | wc -c` = 2 ]; then \
34
-		echo 'Your Perl version has a Unicode handling bug'; \
35
-		echo 'Execute this command before compiling Etherboot:'; \
36
-		echo 'export LANG=$${LANG%.UTF-8}'; \
34
+		$(ECHO) 'Your Perl version has a Unicode handling bug'; \
35
+		$(ECHO) 'Execute this command before compiling Etherboot:'; \
36
+		$(ECHO) 'export LANG=$${LANG%.UTF-8}'; \
37 37
 		exit 1; \
38 38
 	fi
39 39
 	@$(TOUCH) $@
40 40
 VERYCLEANUP	+= .toolcheck
41 41
 
42
-# Check for correct syntax for echo -e
43
-#
44
-ifeq ($(shell echo '\0101'),A)
45
-ECHO_E = echo
46
-else
47
-ECHO_E = echo -e
48
-endif
49
-
50 42
 # Build verbosity
51 43
 #
52 44
 ifeq ($(V),1)
@@ -59,10 +51,10 @@ endif
59 51
 
60 52
 # Check for an old version of gas (binutils 2.9.1)
61 53
 #
62
-OLDGAS	:= $(shell $(AS) --version | grep -q '2\.9\.1' && echo -DGAS291)
54
+OLDGAS	:= $(shell $(AS) --version | grep -q '2\.9\.1' && $(ECHO) -DGAS291)
63 55
 CFLAGS	+= $(OLDGAS)
64 56
 oldgas :
65
-	@echo $(oldgas)
57
+	@$(ECHO) $(oldgas)
66 58
 
67 59
 # compiler.h is needed for our linking and debugging system
68 60
 #
@@ -75,14 +67,14 @@ CLEANUP	+= config/*.h
75 67
 
76 68
 # SRCDIRS lists all directories containing source files.
77 69
 srcdirs :
78
-	@echo $(SRCDIRS)
70
+	@$(ECHO) $(SRCDIRS)
79 71
 
80 72
 # SRCS lists all .c or .S files found in any SRCDIR
81 73
 #
82 74
 SRCS	+= $(wildcard $(patsubst %,%/*.c,$(SRCDIRS)))
83 75
 SRCS	+= $(wildcard $(patsubst %,%/*.S,$(SRCDIRS)))
84 76
 srcs :
85
-	@echo $(SRCS)
77
+	@$(ECHO) $(SRCS)
86 78
 
87 79
 # AUTO_SRCS lists all files in SRCS that are not mentioned in
88 80
 # NON_AUTO_SRCS.  Files should be added to NON_AUTO_SRCS if they
@@ -90,7 +82,7 @@ srcs :
90 82
 #
91 83
 AUTO_SRCS = $(filter-out $(NON_AUTO_SRCS),$(SRCS))
92 84
 autosrcs :
93
-	@echo $(AUTO_SRCS)
85
+	@$(ECHO) $(AUTO_SRCS)
94 86
 
95 87
 # We automatically generate rules for any file mentioned in AUTO_SRCS
96 88
 # using the following set of templates.  It would be cleaner to use
@@ -105,7 +97,7 @@ autosrcs :
105 97
 #
106 98
 define src_template
107 99
 
108
-	@echo "Generating Makefile rules for $(1)"
100
+	@$(ECHO) "Generating Makefile rules for $(1)"
109 101
 	@$(MKDIR) -p $(dir $(2))
110 102
 	@$(RM) $(2)
111 103
 	@$(TOUCH) $(2)
@@ -129,14 +121,14 @@ define obj_template
129 121
 	@$(CPP) $(CFLAGS) $(CFLAGS_$(3)) $(CFLAGS_$(4)) -DOBJECT=$(4) \
130 122
 		-Wno-error -M $(1) -MT "$(4)_DEPS" -MG -MP | \
131 123
 		sed 's/_DEPS\s*:/_DEPS =/' >> $(2)
132
-	@$(ECHO_E) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
133
-		 '\n\t$$(QM)echo "  [BUILD] $$@"\n' \
124
+	@$(ECHO) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
125
+		 '\n\t$$(QM)$(ECHO) "  [BUILD] $$@"\n' \
134 126
 		 '\n\t$$(RULE_$(3))\n' \
135 127
 		 '\nBOBJS += $$(BIN)/$(4).o\n' \
136 128
 		 $(foreach TGT,$(DEBUG_TARGETS), \
137 129
 		    $(if $(RULE_$(3)_to_$(TGT)), \
138 130
 		    '\n$$(BIN)/$(4).$(TGT) : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
139
-		    '\n\t$$(QM)echo "  [BUILD] $$@"\n' \
131
+		    '\n\t$$(QM)$(ECHO) "  [BUILD] $$@"\n' \
140 132
 		    '\n\t$$(RULE_$(3)_to_$(TGT))\n' \
141 133
 		    '\n$(TGT)_OBJS += $$(BIN)/$(4).$(TGT)\n' ) ) \
142 134
 		 '\n$(2) : $$($(4)_DEPS)\n' \
@@ -148,34 +140,34 @@ endef
148 140
 # Rule to generate the Makefile rules files to be included
149 141
 #
150 142
 $(BIN)/deps/%.d : % $(MAKEDEPS) $(PARSEROM)
151
-	$(if $(filter $(AUTO_SRCS),$<),$(call src_template,$<,$@,$(subst .,,$(suffix $<)),$(basename $(notdir $<))),@echo 'ERROR: $< is not an AUTO_SRC' ; exit 1)
143
+	$(if $(filter $(AUTO_SRCS),$<),$(call src_template,$<,$@,$(subst .,,$(suffix $<)),$(basename $(notdir $<))),@$(ECHO) 'ERROR: $< is not an AUTO_SRC' ; exit 1)
152 144
 
153 145
 # Calculate and include the list of Makefile rules files
154 146
 #
155 147
 AUTO_DEPS	= $(patsubst %,$(BIN)/deps/%.d,$(AUTO_SRCS))
156 148
 include $(AUTO_DEPS)
157 149
 autodeps :
158
-	@echo $(AUTO_DEPS)
150
+	@$(ECHO) $(AUTO_DEPS)
159 151
 VERYCLEANUP	+= $(BIN)/deps
160 152
 
161 153
 # The following variables are created by the Makefile rules files
162 154
 #
163 155
 bobjs :
164
-	@echo $(BOBJS)
156
+	@$(ECHO) $(BOBJS)
165 157
 drivers :
166
-	@echo $(DRIVERS)
158
+	@$(ECHO) $(DRIVERS)
167 159
 .PHONY : drivers
168 160
 roms :
169
-	@echo $(ROMS)
161
+	@$(ECHO) $(ROMS)
170 162
 
171 163
 # Generate the NIC file from the parsed source files.  The NIC file is
172 164
 # only for rom-o-matic.
173 165
 #
174 166
 $(BIN)/NIC : $(AUTO_DEPS)
175
-	@echo '# This is an automatically generated file, do not edit' > $@
176
-	@echo '# It does not affect anything in the build, ' \
167
+	@$(ECHO) '# This is an automatically generated file, do not edit' > $@
168
+	@$(ECHO) '# It does not affect anything in the build, ' \
177 169
 	     'it is only for rom-o-matic' >> $@
178
-	@echo >> $@
170
+	@$(ECHO) >> $@
179 171
 	@perl -ne 'chomp; print "$$1\n" if /\# NIC\t(.*)$$/' $^ >> $@
180 172
 CLEANUP		+= $(BIN)/NIC
181 173
 
@@ -258,25 +250,25 @@ BLIB_OBJS	= $(DEBUG_OBJS) $(filter-out $(DEBUG_ORIG_OBJS),$(BOBJS))
258 250
 # Print out all derived information for a given target.
259 251
 #
260 252
 $(BIN)/%.info :
261
-	@echo 'Elements             : $(TGT_ELEMENTS)'
262
-	@echo 'Prefix               : $(TGT_PREFIX)'
263
-	@echo 'Drivers              : $(TGT_DRIVERS)'
264
-	@echo 'ROM name             : $(TGT_ROM_NAME)'
265
-	@echo 'Media                : $(TGT_MEDIA)'
266
-	@echo
267
-	@echo 'PCI vendor           : $(TGT_PCI_VENDOR)'
268
-	@echo 'PCI device           : $(TGT_PCI_DEVICE)'
269
-	@echo
270
-	@echo 'LD driver symbols    : $(TGT_LD_DRIVERS)'
271
-	@echo 'LD prefix symbols    : $(TGT_LD_PREFIX)'
272
-	@echo 'LD ID symbols        : $(TGT_LD_IDS)'
273
-	@echo
274
-	@echo 'LD target flags      : $(TGT_LD_FLAGS)'
275
-	@echo
276
-	@echo 'makerom target flags : $(TGT_MAKEROM_FLAGS)'
277
-	@echo
278
-	@echo 'Debugging objects    : $(DEBUG_OBJS)'
279
-	@echo 'Replaced objects     : $(DEBUG_ORIG_OBJS)'
253
+	@$(ECHO) 'Elements             : $(TGT_ELEMENTS)'
254
+	@$(ECHO) 'Prefix               : $(TGT_PREFIX)'
255
+	@$(ECHO) 'Drivers              : $(TGT_DRIVERS)'
256
+	@$(ECHO) 'ROM name             : $(TGT_ROM_NAME)'
257
+	@$(ECHO) 'Media                : $(TGT_MEDIA)'
258
+	@$(ECHO)
259
+	@$(ECHO) 'PCI vendor           : $(TGT_PCI_VENDOR)'
260
+	@$(ECHO) 'PCI device           : $(TGT_PCI_DEVICE)'
261
+	@$(ECHO)
262
+	@$(ECHO) 'LD driver symbols    : $(TGT_LD_DRIVERS)'
263
+	@$(ECHO) 'LD prefix symbols    : $(TGT_LD_PREFIX)'
264
+	@$(ECHO) 'LD ID symbols        : $(TGT_LD_IDS)'
265
+	@$(ECHO)
266
+	@$(ECHO) 'LD target flags      : $(TGT_LD_FLAGS)'
267
+	@$(ECHO)
268
+	@$(ECHO) 'makerom target flags : $(TGT_MAKEROM_FLAGS)'
269
+	@$(ECHO)
270
+	@$(ECHO) 'Debugging objects    : $(DEBUG_OBJS)'
271
+	@$(ECHO) 'Replaced objects     : $(DEBUG_ORIG_OBJS)'
280 272
 
281 273
 # List of objects included in the last build of blib.  This is needed
282 274
 # in order to correctly rebuild blib whenever the list of objects
@@ -284,7 +276,7 @@ $(BIN)/%.info :
284 276
 #
285 277
 BLIB_LIST	= $(BIN)/.blib.list
286 278
 ifneq ($(shell cat $(BLIB_LIST)),$(BLIB_OBJS))
287
-$(shell echo "$(BLIB_OBJS)" > $(BLIB_LIST))
279
+$(shell $(ECHO) "$(BLIB_OBJS)" > $(BLIB_LIST))
288 280
 endif
289 281
 
290 282
 $(BLIB_LIST) :
@@ -296,7 +288,7 @@ VERYCLEANUP	+= $(BLIB_LIST)
296 288
 BLIB		= $(BIN)/blib.a
297 289
 $(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
298 290
 	$(Q)$(RM) $(BLIB)
299
-	$(QM)echo "  [AR] $@"
291
+	$(QM)$(ECHO) "  [AR] $@"
300 292
 	$(Q)$(AR) r $@ $(BLIB_OBJS)
301 293
 	$(Q)$(RANLIB) $@
302 294
 blib : $(BLIB)
@@ -305,7 +297,7 @@ blib : $(BLIB)
305 297
 # specified target.
306 298
 #
307 299
 $(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT) 
308
-	$(QM)echo "  [LD] $@"
300
+	$(QM)$(ECHO) "  [LD] $@"
309 301
 	$(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $(BLIB) -o $@ \
310 302
 		-Map $(BIN)/$*.tmp.map
311 303
 	$(Q)$(OBJDUMP) -ht $@ | $(SORTOBJDUMP) >> $(BIN)/$*.tmp.map
@@ -318,19 +310,19 @@ $(BIN)/%.map : $(BIN)/%.tmp
318 310
 # Extract compression information from intermediate object file
319 311
 #
320 312
 $(BIN)/%.zinfo : $(BIN)/%.tmp
321
-	$(QM)echo "  [ZINFO] $@"
313
+	$(QM)$(ECHO) "  [ZINFO] $@"
322 314
 	$(Q)$(OBJCOPY) -O binary -j .zinfo $< $@
323 315
 
324 316
 # Build raw binary file from intermediate object file
325 317
 #
326 318
 $(BIN)/%.bin : $(BIN)/%.tmp
327
-	$(QM)echo "  [BIN] $@"
319
+	$(QM)$(ECHO) "  [BIN] $@"
328 320
 	$(Q)$(OBJCOPY) -O binary -R .zinfo $< $@
329 321
 
330 322
 # Compress raw binary file
331 323
 #
332 324
 $(BIN)/%.zbin : $(BIN)/%.bin $(BIN)/%.zinfo $(ZBIN)
333
-	$(QM)echo "  [ZBIN] $@"
325
+	$(QM)$(ECHO) "  [ZBIN] $@"
334 326
 	$(Q)$(ZBIN) $(BIN)/$*.bin $(BIN)/$*.zinfo > $@
335 327
 
336 328
 # Build bochs symbol table
@@ -359,11 +351,11 @@ $(BIN)/%.bxs : $(BIN)/%.tmp
359 351
 # much difference to the overall build time.
360 352
 
361 353
 media :
362
-	@echo $(MEDIA)
354
+	@$(ECHO) $(MEDIA)
363 355
 
364 356
 AUTO_MEDIA	= $(filter-out $(NON_AUTO_MEDIA),$(MEDIA))
365 357
 automedia :
366
-	@echo $(AUTO_MEDIA)
358
+	@$(ECHO) $(AUTO_MEDIA)
367 359
 
368 360
 # media_template : create Makefile rules for specified media
369 361
 #
@@ -372,12 +364,12 @@ automedia :
372 364
 #
373 365
 define media_template
374 366
 
375
-	@echo "Generating Makefile rules for $(1) media"
367
+	@$(ECHO) "Generating Makefile rules for $(1) media"
376 368
 	@$(MKDIR) -p $(dir $(2))
377 369
 	@$(RM) $(2)
378 370
 	@$(TOUCH) $(2)
379
-	@$(ECHO_E) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
380
-		  '\n\t$$(QM)echo "  [FINISH] $$@"' \
371
+	@$(ECHO) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
372
+		  '\n\t$$(QM)$(ECHO) "  [FINISH] $$@"' \
381 373
 		  '\n\t$$(Q)$$(CP) $$< $$@' \
382 374
 		  '\n\t$$(Q)$$(FINALISE_$(1))' \
383 375
 		> $(2)
@@ -389,13 +381,13 @@ endef
389 381
 $(BIN)/deps/%.media.d : $(MAKEDEPS)
390 382
 	$(if $(filter $(AUTO_MEDIA),$*), \
391 383
 		$(call media_template,$*,$@), \
392
-		@echo 'ERROR: $* is not an AUTO_MEDIA' ; exit 1)
384
+		@$(ECHO) 'ERROR: $* is not an AUTO_MEDIA' ; exit 1)
393 385
 
394 386
 # Calculate and include the list of Makefile rules files
395 387
 #
396 388
 MEDIA_DEPS		= $(patsubst %,$(BIN)/deps/%.media.d,$(AUTO_MEDIA))
397 389
 mediadeps :
398
-	@echo $(MEDIA_DEPS)
390
+	@$(ECHO) $(MEDIA_DEPS)
399 391
 include $(MEDIA_DEPS)
400 392
 
401 393
 # The "allXXXs" targets for each suffix
@@ -421,13 +413,13 @@ BOBJS += $(patsubst payload/%.img,$(BIN)/%.o,$(wildcard payload/*.img))
421 413
 # The compression utilities
422 414
 #
423 415
 $(NRV2B) : util/nrv2b.c $(MAKEDEPS)
424
-	$(QM)echo "  [HOSTCC] $@"
416
+	$(QM)$(ECHO) "  [HOSTCC] $@"
425 417
 	$(Q)$(HOST_CC) -O2 -DENCODE -DDECODE -DMAIN -DVERBOSE -DNDEBUG \
426 418
 		       -DBITSIZE=32 -DENDIAN=0 -o $@ $<
427 419
 CLEANUP	+= $(NRV2B)
428 420
 
429 421
 $(ZBIN) : util/zbin.c util/nrv2b.c $(MAKEDEPS)
430
-	$(QM)echo "  [HOSTCC] $@"
422
+	$(QM)$(ECHO) "  [HOSTCC] $@"
431 423
 	$(Q)$(HOST_CC) -O2 -o $@ $<
432 424
 CLEANUP += $(ZBIN)
433 425
 
@@ -440,10 +432,10 @@ BUILDSERIAL_NOW		= config/.buildserial.now
440 432
 BUILDSERIAL_NEXT	= config/.buildserial.next
441 433
 
442 434
 $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) :
443
-	echo 1 > $@
435
+	$(ECHO) 1 > $@
444 436
 
445 437
 $(BUILDSERIAL_H) : $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT)
446
-	echo '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@
438
+	$(ECHO) '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@
447 439
 
448 440
 ifeq ($(filter bs,$(MAKECMDGOALS)),bs)
449 441
 $(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \
@@ -451,18 +443,18 @@ $(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \
451 443
 endif
452 444
 
453 445
 bs : $(BUILDSERIAL_NOW)
454
-	@echo $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT)
455
-	@echo "Build serial number is $(shell cat $<)"
446
+	@$(ECHO) $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT)
447
+	@$(ECHO) "Build serial number is $(shell cat $<)"
456 448
 
457 449
 # List of available architectures
458 450
 #
459 451
 ARCHS	= $(filter-out CVS,$(patsubst arch/%,%,$(wildcard arch/*)))
460 452
 archs :
461
-	@echo $(ARCHS)
453
+	@$(ECHO) $(ARCHS)
462 454
 
463 455
 OTHER_ARCHS	= $(filter-out $(ARCH),$(ARCHS))
464 456
 otherarchs :
465
-	@echo $(OTHER_ARCHS)
457
+	@$(ECHO) $(OTHER_ARCHS)
466 458
 
467 459
 # Build the TAGS file for emacs
468 460
 #
@@ -512,7 +504,7 @@ docview :
512 504
 	@if [ -n "$$BROWSER" ] ; then \
513 505
 		( $$BROWSER $(BIN)/doc/html/index.html & ) ; \
514 506
 	else \
515
-		echo "Documentation index in $(BIN)/doc/html/index.html" ; \
507
+		$(ECHO) "Documentation index in $(BIN)/doc/html/index.html" ; \
516 508
 	fi
517 509
 
518 510
 # Clean-up
@@ -526,7 +518,7 @@ veryclean : clean
526 518
 # Make clean tarballs for release
527 519
 
528 520
 gpxe-tarball : ../VERSION
529
-	(echo -n $(VERSION) ''; date -u +'%Y-%m-%d') > ../VERSION
521
+	($(ECHO) -n $(VERSION) ''; date -u +'%Y-%m-%d') > ../VERSION
530 522
 	$(RM) -r /tmp/gpxe/gpxe-$(VERSION)
531 523
 	mkdir -p /tmp/gpxe/gpxe-$(VERSION)
532 524
 	cp -rP .. /tmp/gpxe/gpxe-$(VERSION)

+ 9
- 1
src/net/udp/tftp.c 查看文件

@@ -415,7 +415,7 @@ static int tftp_rx_oack ( struct tftp_request *tftp, void *buf, size_t len ) {
415 415
 static int tftp_rx_data ( struct tftp_request *tftp,
416 416
 			  struct io_buffer *iobuf ) {
417 417
 	struct tftp_data *data = iobuf->data;
418
-	unsigned int block;
418
+	int block;
419 419
 	size_t data_len;
420 420
 	int rc;
421 421
 
@@ -432,6 +432,14 @@ static int tftp_rx_data ( struct tftp_request *tftp,
432 432
 	iob_pull ( iobuf, sizeof ( *data ) );
433 433
 	data_len = iob_len ( iobuf );
434 434
 
435
+	/* Check for correct block */
436
+	if ( block != ( tftp->state + 1 ) ) {
437
+		DBGC ( tftp, "TFTP %p received out-of-order block %d "
438
+		       "(expecting %d)\n", tftp, block, ( tftp->state + 1 ) );
439
+		free_iob ( iobuf );
440
+		return 0;
441
+	}
442
+
435 443
 	/* Deliver data */
436 444
 	if ( ( rc = xfer_deliver_iob ( &tftp->xfer, iobuf ) ) != 0 ) {
437 445
 		DBGC ( tftp, "TFTP %p could not deliver data: %s\n",

正在加载...
取消
保存