mirror of https://github.com/ipxe/ipxe.git
Merge branch 'master' into 3leaf-rewrite
commit
5f6439c828
45
src/Makefile
45
src/Makefile
|
@ -42,30 +42,31 @@ include arch/$(ARCH)/Config
|
|||
# message.
|
||||
#
|
||||
noargs : blib $(BIN)/NIC $(BIN)/gpxe.dsk $(BIN)/gpxe.iso $(BIN)/gpxe.usb
|
||||
@echo '==========================================================='
|
||||
@echo
|
||||
@echo 'To create a bootable floppy, type'
|
||||
@echo ' cat $(BIN)/gpxe.dsk > /dev/fd0'
|
||||
@echo 'where /dev/fd0 is your floppy drive. This will erase any'
|
||||
@echo 'data already on the disk.'
|
||||
@echo
|
||||
@echo 'To create a bootable USB key, type'
|
||||
@echo ' cat $(BIN)/gpxe.usb > /dev/sdX'
|
||||
@echo 'where /dev/sdX is your USB key, and is *not* a real hard'
|
||||
@echo 'disk on your system. This will erase any data already on'
|
||||
@echo 'the USB key.'
|
||||
@echo
|
||||
@echo 'To create a bootable CD-ROM, burn the ISO image '
|
||||
@echo '$(BIN)/gpxe.iso to a blank CD-ROM.'
|
||||
@echo
|
||||
@echo 'These images contain drivers for all supported cards. You'
|
||||
@echo 'can build more customised images, and ROM images, using'
|
||||
@echo ' make bin/<rom-name>.<output-format>'
|
||||
@echo
|
||||
@echo '==========================================================='
|
||||
@$(ECHO) '==========================================================='
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'To create a bootable floppy, type'
|
||||
@$(ECHO) ' cat $(BIN)/gpxe.dsk > /dev/fd0'
|
||||
@$(ECHO) 'where /dev/fd0 is your floppy drive. This will erase any'
|
||||
@$(ECHO) 'data already on the disk.'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'To create a bootable USB key, type'
|
||||
@$(ECHO) ' cat $(BIN)/gpxe.usb > /dev/sdX'
|
||||
@$(ECHO) 'where /dev/sdX is your USB key, and is *not* a real hard'
|
||||
@$(ECHO) 'disk on your system. This will erase any data already on'
|
||||
@$(ECHO) 'the USB key.'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'To create a bootable CD-ROM, burn the ISO image '
|
||||
@$(ECHO) '$(BIN)/gpxe.iso to a blank CD-ROM.'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'These images contain drivers for all supported cards. You'
|
||||
@$(ECHO) 'can build more customised images, and ROM images, using'
|
||||
@$(ECHO) ' make bin/<rom-name>.<output-format>'
|
||||
@$(ECHO)
|
||||
@$(ECHO) '==========================================================='
|
||||
|
||||
# Locations of utilities
|
||||
#
|
||||
ECHO ?= /bin/echo -e
|
||||
HOST_CC ?= gcc
|
||||
CPP ?= gcc -E -Wp,-Wall
|
||||
RM ?= rm -f
|
||||
|
@ -120,7 +121,7 @@ OBJECT = $(firstword $(subst ., ,$(@F)))
|
|||
#
|
||||
OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
|
||||
$(BIN)/%.flags :
|
||||
@echo $(OBJ_CFLAGS)
|
||||
@$(ECHO) $(OBJ_CFLAGS)
|
||||
|
||||
# Rules for specific object types.
|
||||
#
|
||||
|
|
|
@ -20,33 +20,25 @@ CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) \
|
|||
-DVERSION=\"$(VERSION)\"
|
||||
IDENT = '$(@F) $(VERSION) (GPL) etherboot.org'
|
||||
version :
|
||||
@echo $(VERSION)
|
||||
@$(ECHO) $(VERSION)
|
||||
|
||||
# Check for tools that can cause failed builds
|
||||
#
|
||||
.toolcheck : Makefile Config
|
||||
@if $(CC) -v 2>&1 | grep -is 'gcc version 2\.96' > /dev/null; then \
|
||||
echo 'gcc 2.96 is unsuitable for compiling Etherboot'; \
|
||||
echo 'Use gcc 2.95 or gcc 3.x instead'; \
|
||||
$(ECHO) 'gcc 2.96 is unsuitable for compiling Etherboot'; \
|
||||
$(ECHO) 'Use gcc 2.95 or gcc 3.x instead'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if [ `perl -e 'use bytes; print chr(255)' | wc -c` = 2 ]; then \
|
||||
echo 'Your Perl version has a Unicode handling bug'; \
|
||||
echo 'Execute this command before compiling Etherboot:'; \
|
||||
echo 'export LANG=$${LANG%.UTF-8}'; \
|
||||
$(ECHO) 'Your Perl version has a Unicode handling bug'; \
|
||||
$(ECHO) 'Execute this command before compiling Etherboot:'; \
|
||||
$(ECHO) 'export LANG=$${LANG%.UTF-8}'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@$(TOUCH) $@
|
||||
VERYCLEANUP += .toolcheck
|
||||
|
||||
# Check for correct syntax for echo -e
|
||||
#
|
||||
ifeq ($(shell echo '\0101'),A)
|
||||
ECHO_E = echo
|
||||
else
|
||||
ECHO_E = echo -e
|
||||
endif
|
||||
|
||||
# Build verbosity
|
||||
#
|
||||
ifeq ($(V),1)
|
||||
|
@ -59,10 +51,10 @@ endif
|
|||
|
||||
# Check for an old version of gas (binutils 2.9.1)
|
||||
#
|
||||
OLDGAS := $(shell $(AS) --version | grep -q '2\.9\.1' && echo -DGAS291)
|
||||
OLDGAS := $(shell $(AS) --version | grep -q '2\.9\.1' && $(ECHO) -DGAS291)
|
||||
CFLAGS += $(OLDGAS)
|
||||
oldgas :
|
||||
@echo $(oldgas)
|
||||
@$(ECHO) $(oldgas)
|
||||
|
||||
# compiler.h is needed for our linking and debugging system
|
||||
#
|
||||
|
@ -75,14 +67,14 @@ CLEANUP += config/*.h
|
|||
|
||||
# SRCDIRS lists all directories containing source files.
|
||||
srcdirs :
|
||||
@echo $(SRCDIRS)
|
||||
@$(ECHO) $(SRCDIRS)
|
||||
|
||||
# SRCS lists all .c or .S files found in any SRCDIR
|
||||
#
|
||||
SRCS += $(wildcard $(patsubst %,%/*.c,$(SRCDIRS)))
|
||||
SRCS += $(wildcard $(patsubst %,%/*.S,$(SRCDIRS)))
|
||||
srcs :
|
||||
@echo $(SRCS)
|
||||
@$(ECHO) $(SRCS)
|
||||
|
||||
# AUTO_SRCS lists all files in SRCS that are not mentioned in
|
||||
# NON_AUTO_SRCS. Files should be added to NON_AUTO_SRCS if they
|
||||
|
@ -90,7 +82,7 @@ srcs :
|
|||
#
|
||||
AUTO_SRCS = $(filter-out $(NON_AUTO_SRCS),$(SRCS))
|
||||
autosrcs :
|
||||
@echo $(AUTO_SRCS)
|
||||
@$(ECHO) $(AUTO_SRCS)
|
||||
|
||||
# We automatically generate rules for any file mentioned in AUTO_SRCS
|
||||
# using the following set of templates. It would be cleaner to use
|
||||
|
@ -105,7 +97,7 @@ autosrcs :
|
|||
#
|
||||
define src_template
|
||||
|
||||
@echo "Generating Makefile rules for $(1)"
|
||||
@$(ECHO) "Generating Makefile rules for $(1)"
|
||||
@$(MKDIR) -p $(dir $(2))
|
||||
@$(RM) $(2)
|
||||
@$(TOUCH) $(2)
|
||||
|
@ -129,14 +121,14 @@ define obj_template
|
|||
@$(CPP) $(CFLAGS) $(CFLAGS_$(3)) $(CFLAGS_$(4)) -DOBJECT=$(4) \
|
||||
-Wno-error -M $(1) -MT "$(4)_DEPS" -MG -MP | \
|
||||
sed 's/_DEPS\s*:/_DEPS =/' >> $(2)
|
||||
@$(ECHO_E) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
|
||||
'\n\t$$(QM)echo " [BUILD] $$@"\n' \
|
||||
@$(ECHO) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
|
||||
'\n\t$$(QM)$(ECHO) " [BUILD] $$@"\n' \
|
||||
'\n\t$$(RULE_$(3))\n' \
|
||||
'\nBOBJS += $$(BIN)/$(4).o\n' \
|
||||
$(foreach TGT,$(DEBUG_TARGETS), \
|
||||
$(if $(RULE_$(3)_to_$(TGT)), \
|
||||
'\n$$(BIN)/$(4).$(TGT) : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
|
||||
'\n\t$$(QM)echo " [BUILD] $$@"\n' \
|
||||
'\n\t$$(QM)$(ECHO) " [BUILD] $$@"\n' \
|
||||
'\n\t$$(RULE_$(3)_to_$(TGT))\n' \
|
||||
'\n$(TGT)_OBJS += $$(BIN)/$(4).$(TGT)\n' ) ) \
|
||||
'\n$(2) : $$($(4)_DEPS)\n' \
|
||||
|
@ -148,34 +140,34 @@ endef
|
|||
# Rule to generate the Makefile rules files to be included
|
||||
#
|
||||
$(BIN)/deps/%.d : % $(MAKEDEPS) $(PARSEROM)
|
||||
$(if $(filter $(AUTO_SRCS),$<),$(call src_template,$<,$@,$(subst .,,$(suffix $<)),$(basename $(notdir $<))),@echo 'ERROR: $< is not an AUTO_SRC' ; exit 1)
|
||||
$(if $(filter $(AUTO_SRCS),$<),$(call src_template,$<,$@,$(subst .,,$(suffix $<)),$(basename $(notdir $<))),@$(ECHO) 'ERROR: $< is not an AUTO_SRC' ; exit 1)
|
||||
|
||||
# Calculate and include the list of Makefile rules files
|
||||
#
|
||||
AUTO_DEPS = $(patsubst %,$(BIN)/deps/%.d,$(AUTO_SRCS))
|
||||
include $(AUTO_DEPS)
|
||||
autodeps :
|
||||
@echo $(AUTO_DEPS)
|
||||
@$(ECHO) $(AUTO_DEPS)
|
||||
VERYCLEANUP += $(BIN)/deps
|
||||
|
||||
# The following variables are created by the Makefile rules files
|
||||
#
|
||||
bobjs :
|
||||
@echo $(BOBJS)
|
||||
@$(ECHO) $(BOBJS)
|
||||
drivers :
|
||||
@echo $(DRIVERS)
|
||||
@$(ECHO) $(DRIVERS)
|
||||
.PHONY : drivers
|
||||
roms :
|
||||
@echo $(ROMS)
|
||||
@$(ECHO) $(ROMS)
|
||||
|
||||
# Generate the NIC file from the parsed source files. The NIC file is
|
||||
# only for rom-o-matic.
|
||||
#
|
||||
$(BIN)/NIC : $(AUTO_DEPS)
|
||||
@echo '# This is an automatically generated file, do not edit' > $@
|
||||
@echo '# It does not affect anything in the build, ' \
|
||||
@$(ECHO) '# This is an automatically generated file, do not edit' > $@
|
||||
@$(ECHO) '# It does not affect anything in the build, ' \
|
||||
'it is only for rom-o-matic' >> $@
|
||||
@echo >> $@
|
||||
@$(ECHO) >> $@
|
||||
@perl -ne 'chomp; print "$$1\n" if /\# NIC\t(.*)$$/' $^ >> $@
|
||||
CLEANUP += $(BIN)/NIC
|
||||
|
||||
|
@ -258,25 +250,25 @@ BLIB_OBJS = $(DEBUG_OBJS) $(filter-out $(DEBUG_ORIG_OBJS),$(BOBJS))
|
|||
# Print out all derived information for a given target.
|
||||
#
|
||||
$(BIN)/%.info :
|
||||
@echo 'Elements : $(TGT_ELEMENTS)'
|
||||
@echo 'Prefix : $(TGT_PREFIX)'
|
||||
@echo 'Drivers : $(TGT_DRIVERS)'
|
||||
@echo 'ROM name : $(TGT_ROM_NAME)'
|
||||
@echo 'Media : $(TGT_MEDIA)'
|
||||
@echo
|
||||
@echo 'PCI vendor : $(TGT_PCI_VENDOR)'
|
||||
@echo 'PCI device : $(TGT_PCI_DEVICE)'
|
||||
@echo
|
||||
@echo 'LD driver symbols : $(TGT_LD_DRIVERS)'
|
||||
@echo 'LD prefix symbols : $(TGT_LD_PREFIX)'
|
||||
@echo 'LD ID symbols : $(TGT_LD_IDS)'
|
||||
@echo
|
||||
@echo 'LD target flags : $(TGT_LD_FLAGS)'
|
||||
@echo
|
||||
@echo 'makerom target flags : $(TGT_MAKEROM_FLAGS)'
|
||||
@echo
|
||||
@echo 'Debugging objects : $(DEBUG_OBJS)'
|
||||
@echo 'Replaced objects : $(DEBUG_ORIG_OBJS)'
|
||||
@$(ECHO) 'Elements : $(TGT_ELEMENTS)'
|
||||
@$(ECHO) 'Prefix : $(TGT_PREFIX)'
|
||||
@$(ECHO) 'Drivers : $(TGT_DRIVERS)'
|
||||
@$(ECHO) 'ROM name : $(TGT_ROM_NAME)'
|
||||
@$(ECHO) 'Media : $(TGT_MEDIA)'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'PCI vendor : $(TGT_PCI_VENDOR)'
|
||||
@$(ECHO) 'PCI device : $(TGT_PCI_DEVICE)'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'LD driver symbols : $(TGT_LD_DRIVERS)'
|
||||
@$(ECHO) 'LD prefix symbols : $(TGT_LD_PREFIX)'
|
||||
@$(ECHO) 'LD ID symbols : $(TGT_LD_IDS)'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'LD target flags : $(TGT_LD_FLAGS)'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'makerom target flags : $(TGT_MAKEROM_FLAGS)'
|
||||
@$(ECHO)
|
||||
@$(ECHO) 'Debugging objects : $(DEBUG_OBJS)'
|
||||
@$(ECHO) 'Replaced objects : $(DEBUG_ORIG_OBJS)'
|
||||
|
||||
# List of objects included in the last build of blib. This is needed
|
||||
# in order to correctly rebuild blib whenever the list of objects
|
||||
|
@ -284,7 +276,7 @@ $(BIN)/%.info :
|
|||
#
|
||||
BLIB_LIST = $(BIN)/.blib.list
|
||||
ifneq ($(shell cat $(BLIB_LIST)),$(BLIB_OBJS))
|
||||
$(shell echo "$(BLIB_OBJS)" > $(BLIB_LIST))
|
||||
$(shell $(ECHO) "$(BLIB_OBJS)" > $(BLIB_LIST))
|
||||
endif
|
||||
|
||||
$(BLIB_LIST) :
|
||||
|
@ -296,7 +288,7 @@ VERYCLEANUP += $(BLIB_LIST)
|
|||
BLIB = $(BIN)/blib.a
|
||||
$(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
|
||||
$(Q)$(RM) $(BLIB)
|
||||
$(QM)echo " [AR] $@"
|
||||
$(QM)$(ECHO) " [AR] $@"
|
||||
$(Q)$(AR) r $@ $(BLIB_OBJS)
|
||||
$(Q)$(RANLIB) $@
|
||||
blib : $(BLIB)
|
||||
|
@ -305,7 +297,7 @@ blib : $(BLIB)
|
|||
# specified target.
|
||||
#
|
||||
$(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
|
||||
$(QM)echo " [LD] $@"
|
||||
$(QM)$(ECHO) " [LD] $@"
|
||||
$(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $(BLIB) -o $@ \
|
||||
-Map $(BIN)/$*.tmp.map
|
||||
$(Q)$(OBJDUMP) -ht $@ | $(SORTOBJDUMP) >> $(BIN)/$*.tmp.map
|
||||
|
@ -318,19 +310,19 @@ $(BIN)/%.map : $(BIN)/%.tmp
|
|||
# Extract compression information from intermediate object file
|
||||
#
|
||||
$(BIN)/%.zinfo : $(BIN)/%.tmp
|
||||
$(QM)echo " [ZINFO] $@"
|
||||
$(QM)$(ECHO) " [ZINFO] $@"
|
||||
$(Q)$(OBJCOPY) -O binary -j .zinfo $< $@
|
||||
|
||||
# Build raw binary file from intermediate object file
|
||||
#
|
||||
$(BIN)/%.bin : $(BIN)/%.tmp
|
||||
$(QM)echo " [BIN] $@"
|
||||
$(QM)$(ECHO) " [BIN] $@"
|
||||
$(Q)$(OBJCOPY) -O binary -R .zinfo $< $@
|
||||
|
||||
# Compress raw binary file
|
||||
#
|
||||
$(BIN)/%.zbin : $(BIN)/%.bin $(BIN)/%.zinfo $(ZBIN)
|
||||
$(QM)echo " [ZBIN] $@"
|
||||
$(QM)$(ECHO) " [ZBIN] $@"
|
||||
$(Q)$(ZBIN) $(BIN)/$*.bin $(BIN)/$*.zinfo > $@
|
||||
|
||||
# Build bochs symbol table
|
||||
|
@ -359,11 +351,11 @@ $(BIN)/%.bxs : $(BIN)/%.tmp
|
|||
# much difference to the overall build time.
|
||||
|
||||
media :
|
||||
@echo $(MEDIA)
|
||||
@$(ECHO) $(MEDIA)
|
||||
|
||||
AUTO_MEDIA = $(filter-out $(NON_AUTO_MEDIA),$(MEDIA))
|
||||
automedia :
|
||||
@echo $(AUTO_MEDIA)
|
||||
@$(ECHO) $(AUTO_MEDIA)
|
||||
|
||||
# media_template : create Makefile rules for specified media
|
||||
#
|
||||
|
@ -372,12 +364,12 @@ automedia :
|
|||
#
|
||||
define media_template
|
||||
|
||||
@echo "Generating Makefile rules for $(1) media"
|
||||
@$(ECHO) "Generating Makefile rules for $(1) media"
|
||||
@$(MKDIR) -p $(dir $(2))
|
||||
@$(RM) $(2)
|
||||
@$(TOUCH) $(2)
|
||||
@$(ECHO_E) '$$(BIN)/%$(1) : $$(BIN)/%$(1).zbin' \
|
||||
'\n\t$$(QM)echo " [FINISH] $$@"' \
|
||||
@$(ECHO) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
|
||||
'\n\t$$(QM)$(ECHO) " [FINISH] $$@"' \
|
||||
'\n\t$$(Q)$$(CP) $$< $$@' \
|
||||
'\n\t$$(Q)$$(FINALISE_$(1))' \
|
||||
> $(2)
|
||||
|
@ -389,35 +381,45 @@ endef
|
|||
$(BIN)/deps/%.media.d : $(MAKEDEPS)
|
||||
$(if $(filter $(AUTO_MEDIA),$*), \
|
||||
$(call media_template,$*,$@), \
|
||||
@echo 'ERROR: $* is not an AUTO_MEDIA' ; exit 1)
|
||||
@$(ECHO) 'ERROR: $* is not an AUTO_MEDIA' ; exit 1)
|
||||
|
||||
# Calculate and include the list of Makefile rules files
|
||||
#
|
||||
MEDIA_DEPS = $(patsubst %,$(BIN)/deps/%.media.d,$(AUTO_MEDIA))
|
||||
mediadeps :
|
||||
@echo $(MEDIA_DEPS)
|
||||
@$(ECHO) $(MEDIA_DEPS)
|
||||
include $(MEDIA_DEPS)
|
||||
|
||||
# The "allXXXs" targets for each suffix
|
||||
#
|
||||
allall: allroms allzroms allpxes allisos alldsks
|
||||
allroms allzroms : all%s : $(foreach ROM,$(ROMS),$(BIN)/$(ROM).%)
|
||||
all%s : $(foreach DRIVER,$(DRIVERS),$(BIN)/$(DRIVER).%)
|
||||
allpxes allisos alldsks : all%s : $(foreach DRIVER,$(DRIVERS),$(BIN)/$(DRIVER).%)
|
||||
|
||||
# Alias for gpxe.%
|
||||
#
|
||||
$(BIN)/etherboot.% : $(BIN)/gpxe.%
|
||||
ln -sf $(notdir $<) $@
|
||||
|
||||
# Wrap up binary blobs
|
||||
#
|
||||
$(BIN)/%.o : payload/%.img
|
||||
$(QM)echo " [WRAP] $@"
|
||||
$(Q)$(LD) -b binary -r -o $@ $< --undefined obj_payload \
|
||||
--defsym obj_$*=0
|
||||
|
||||
BOBJS += $(patsubst payload/%.img,$(BIN)/%.o,$(wildcard payload/*.img))
|
||||
|
||||
# The compression utilities
|
||||
#
|
||||
$(NRV2B) : util/nrv2b.c $(MAKEDEPS)
|
||||
$(QM)echo " [HOSTCC] $@"
|
||||
$(QM)$(ECHO) " [HOSTCC] $@"
|
||||
$(Q)$(HOST_CC) -O2 -DENCODE -DDECODE -DMAIN -DVERBOSE -DNDEBUG \
|
||||
-DBITSIZE=32 -DENDIAN=0 -o $@ $<
|
||||
CLEANUP += $(NRV2B)
|
||||
|
||||
$(ZBIN) : util/zbin.c util/nrv2b.c $(MAKEDEPS)
|
||||
$(QM)echo " [HOSTCC] $@"
|
||||
$(QM)$(ECHO) " [HOSTCC] $@"
|
||||
$(Q)$(HOST_CC) -O2 -o $@ $<
|
||||
CLEANUP += $(ZBIN)
|
||||
|
||||
|
@ -430,10 +432,10 @@ BUILDSERIAL_NOW = config/.buildserial.now
|
|||
BUILDSERIAL_NEXT = config/.buildserial.next
|
||||
|
||||
$(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) :
|
||||
echo 1 > $@
|
||||
$(ECHO) 1 > $@
|
||||
|
||||
$(BUILDSERIAL_H) : $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT)
|
||||
echo '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@
|
||||
$(ECHO) '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@
|
||||
|
||||
ifeq ($(filter bs,$(MAKECMDGOALS)),bs)
|
||||
$(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \
|
||||
|
@ -441,18 +443,18 @@ $(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \
|
|||
endif
|
||||
|
||||
bs : $(BUILDSERIAL_NOW)
|
||||
@echo $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT)
|
||||
@echo "Build serial number is $(shell cat $<)"
|
||||
@$(ECHO) $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT)
|
||||
@$(ECHO) "Build serial number is $(shell cat $<)"
|
||||
|
||||
# List of available architectures
|
||||
#
|
||||
ARCHS = $(filter-out CVS,$(patsubst arch/%,%,$(wildcard arch/*)))
|
||||
archs :
|
||||
@echo $(ARCHS)
|
||||
@$(ECHO) $(ARCHS)
|
||||
|
||||
OTHER_ARCHS = $(filter-out $(ARCH),$(ARCHS))
|
||||
otherarchs :
|
||||
@echo $(OTHER_ARCHS)
|
||||
@$(ECHO) $(OTHER_ARCHS)
|
||||
|
||||
# Build the TAGS file for emacs
|
||||
#
|
||||
|
@ -502,7 +504,7 @@ docview :
|
|||
@if [ -n "$$BROWSER" ] ; then \
|
||||
( $$BROWSER $(BIN)/doc/html/index.html & ) ; \
|
||||
else \
|
||||
echo "Documentation index in $(BIN)/doc/html/index.html" ; \
|
||||
$(ECHO) "Documentation index in $(BIN)/doc/html/index.html" ; \
|
||||
fi
|
||||
|
||||
# Clean-up
|
||||
|
@ -516,7 +518,7 @@ veryclean : clean
|
|||
# Make clean tarballs for release
|
||||
|
||||
gpxe-tarball : ../VERSION
|
||||
(echo -n $(VERSION) ''; date -u +'%Y-%m-%d') > ../VERSION
|
||||
($(ECHO) -n $(VERSION) ''; date -u +'%Y-%m-%d') > ../VERSION
|
||||
$(RM) -r /tmp/gpxe/gpxe-$(VERSION)
|
||||
mkdir -p /tmp/gpxe/gpxe-$(VERSION)
|
||||
cp -rP .. /tmp/gpxe/gpxe-$(VERSION)
|
||||
|
|
|
@ -38,6 +38,7 @@ LDSCRIPT = arch/i386/scripts/i386.lds
|
|||
#
|
||||
MEDIA += rom
|
||||
MEDIA += pxe
|
||||
MEDIA += kpxe
|
||||
MEDIA += elf
|
||||
MEDIA += elfd
|
||||
MEDIA += lmelf
|
||||
|
|
|
@ -28,41 +28,6 @@
|
|||
|
||||
/* *** FROM string.c *** */
|
||||
|
||||
#ifndef __HAVE_ARCH_STRNICMP
|
||||
/**
|
||||
* strnicmp - Case insensitive, length-limited string comparison
|
||||
* @s1: One string
|
||||
* @s2: The other string
|
||||
* @len: the maximum number of characters to compare
|
||||
*/
|
||||
int strnicmp(const char *s1, const char *s2, size_t len)
|
||||
{
|
||||
/* Yes, Virginia, it had better be unsigned */
|
||||
unsigned char c1, c2;
|
||||
|
||||
c1 = 0; c2 = 0;
|
||||
if (len) {
|
||||
do {
|
||||
c1 = *s1; c2 = *s2;
|
||||
s1++; s2++;
|
||||
if (!c1)
|
||||
break;
|
||||
if (!c2)
|
||||
break;
|
||||
if (c1 == c2)
|
||||
continue;
|
||||
c1 = tolower(c1);
|
||||
c2 = tolower(c2);
|
||||
if (c1 != c2)
|
||||
break;
|
||||
} while (--len);
|
||||
}
|
||||
return (int)c1 - (int)c2;
|
||||
}
|
||||
#endif
|
||||
|
||||
char * ___strtok;
|
||||
|
||||
#ifndef __HAVE_ARCH_STRCPY
|
||||
/**
|
||||
* strcpy - Copy a %NUL terminated string
|
||||
|
@ -120,35 +85,6 @@ char * strcat(char * dest, const char * src)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRNCAT
|
||||
/**
|
||||
* strncat - Append a length-limited, %NUL-terminated string to another
|
||||
* @dest: The string to be appended to
|
||||
* @src: The string to append to it
|
||||
* @count: The maximum numbers of bytes to copy
|
||||
*
|
||||
* Note that in contrast to strncpy, strncat ensures the result is
|
||||
* terminated.
|
||||
*/
|
||||
char * strncat(char *dest, const char *src, size_t count)
|
||||
{
|
||||
char *tmp = dest;
|
||||
|
||||
if (count) {
|
||||
while (*dest)
|
||||
dest++;
|
||||
while ((*dest++ = *src++)) {
|
||||
if (--count == 0) {
|
||||
*dest = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRCMP
|
||||
/**
|
||||
* strcmp - Compare two strings
|
||||
|
@ -260,135 +196,6 @@ size_t strnlen(const char * s, size_t count)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRSPN
|
||||
/**
|
||||
* strspn - Calculate the length of the initial substring of @s which only
|
||||
* contain letters in @accept
|
||||
* @s: The string to be searched
|
||||
* @accept: The string to search for
|
||||
*/
|
||||
size_t strspn(const char *s, const char *accept)
|
||||
{
|
||||
const char *p;
|
||||
const char *a;
|
||||
size_t count = 0;
|
||||
|
||||
for (p = s; *p != '\0'; ++p) {
|
||||
for (a = accept; *a != '\0'; ++a) {
|
||||
if (*p == *a)
|
||||
break;
|
||||
}
|
||||
if (*a == '\0')
|
||||
return count;
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRCSPN
|
||||
/**
|
||||
* strcspn - Calculate the length of the initial substring of @s which only
|
||||
* contain letters not in @reject
|
||||
* @s: The string to be searched
|
||||
* @accept: The string to search for
|
||||
*/
|
||||
size_t strcspn(const char *s, const char *reject)
|
||||
{
|
||||
const char *p;
|
||||
const char *r;
|
||||
size_t count = 0;
|
||||
|
||||
for (p = s; *p != '\0'; ++p) {
|
||||
for (r = reject; *r != '\0'; ++r) {
|
||||
if (*p == *r)
|
||||
return count;
|
||||
}
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRPBRK
|
||||
/**
|
||||
* strpbrk - Find the first occurrence of a set of characters
|
||||
* @cs: The string to be searched
|
||||
* @ct: The characters to search for
|
||||
*/
|
||||
char * strpbrk(const char * cs,const char * ct)
|
||||
{
|
||||
const char *sc1,*sc2;
|
||||
|
||||
for( sc1 = cs; *sc1 != '\0'; ++sc1) {
|
||||
for( sc2 = ct; *sc2 != '\0'; ++sc2) {
|
||||
if (*sc1 == *sc2)
|
||||
return (char *) sc1;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRTOK
|
||||
/**
|
||||
* strtok - Split a string into tokens
|
||||
* @s: The string to be searched
|
||||
* @ct: The characters to search for
|
||||
*
|
||||
* WARNING: strtok is deprecated, use strsep instead.
|
||||
*/
|
||||
char * strtok(char * s,const char * ct)
|
||||
{
|
||||
char *sbegin, *send;
|
||||
|
||||
sbegin = s ? s : ___strtok;
|
||||
if (!sbegin) {
|
||||
return NULL;
|
||||
}
|
||||
sbegin += strspn(sbegin,ct);
|
||||
if (*sbegin == '\0') {
|
||||
___strtok = NULL;
|
||||
return( NULL );
|
||||
}
|
||||
send = strpbrk( sbegin, ct);
|
||||
if (send && *send != '\0')
|
||||
*send++ = '\0';
|
||||
___strtok = send;
|
||||
return (sbegin);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRSEP
|
||||
/**
|
||||
* strsep - Split a string into tokens
|
||||
* @s: The string to be searched
|
||||
* @ct: The characters to search for
|
||||
*
|
||||
* strsep() updates @s to point after the token, ready for the next call.
|
||||
*
|
||||
* It returns empty tokens, too, behaving exactly like the libc function
|
||||
* of that name. In fact, it was stolen from glibc2 and de-fancy-fied.
|
||||
* Same semantics, slimmer shape. ;)
|
||||
*/
|
||||
char * strsep(char **s, const char *ct)
|
||||
{
|
||||
char *sbegin = *s, *end;
|
||||
|
||||
if (sbegin == NULL)
|
||||
return NULL;
|
||||
|
||||
end = strpbrk(sbegin, ct);
|
||||
if (end)
|
||||
*end++ = '\0';
|
||||
*s = end;
|
||||
|
||||
return sbegin;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_MEMSET
|
||||
/**
|
||||
* memset - Fill a region of memory with the given value
|
||||
|
@ -409,30 +216,6 @@ void * memset(void * s,int c,size_t count)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_BCOPY
|
||||
/**
|
||||
* bcopy - Copy one area of memory to another
|
||||
* @src: Where to copy from
|
||||
* @dest: Where to copy to
|
||||
* @count: The size of the area.
|
||||
*
|
||||
* Note that this is the same as memcpy(), with the arguments reversed.
|
||||
* memcpy() is the standard, bcopy() is a legacy BSD function.
|
||||
*
|
||||
* You should not use this function to access IO space, use memcpy_toio()
|
||||
* or memcpy_fromio() instead.
|
||||
*/
|
||||
char * bcopy(const char * src, char * dest, int count)
|
||||
{
|
||||
char *tmp = dest;
|
||||
|
||||
while (count--)
|
||||
*tmp++ = *src++;
|
||||
|
||||
return dest;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_MEMCPY
|
||||
/**
|
||||
* memcpy - Copy one area of memory to another
|
||||
|
@ -503,30 +286,6 @@ int memcmp(const void * cs,const void * ct,size_t count)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_MEMSCAN
|
||||
/**
|
||||
* memscan - Find a character in an area of memory.
|
||||
* @addr: The memory area
|
||||
* @c: The byte to search for
|
||||
* @size: The size of the area.
|
||||
*
|
||||
* returns the address of the first occurrence of @c, or 1 byte past
|
||||
* the area if @c is not found
|
||||
*/
|
||||
void * memscan(void * addr, int c, size_t size)
|
||||
{
|
||||
unsigned char * p = (unsigned char *) addr;
|
||||
|
||||
while (size) {
|
||||
if (*p == c)
|
||||
return (void *) p;
|
||||
p++;
|
||||
size--;
|
||||
}
|
||||
return (void *) p;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRSTR
|
||||
/**
|
||||
* strstr - Find the first substring in a %NUL terminated string
|
||||
|
@ -576,17 +335,17 @@ void * memchr(const void *s, int c, size_t n)
|
|||
|
||||
char * strndup(const char *s, size_t n)
|
||||
{
|
||||
size_t len = strlen(s);
|
||||
char *new;
|
||||
size_t len = strlen(s);
|
||||
char *new;
|
||||
|
||||
if (len>n)
|
||||
len = n;
|
||||
new = malloc(len+1);
|
||||
if (new) {
|
||||
new[len] = '\0';
|
||||
memcpy(new,s,len);
|
||||
}
|
||||
return new;
|
||||
if (len>n)
|
||||
len = n;
|
||||
new = malloc(len+1);
|
||||
if (new) {
|
||||
new[len] = '\0';
|
||||
memcpy(new,s,len);
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
||||
char * strdup(const char *s) {
|
||||
|
|
|
@ -0,0 +1,273 @@
|
|||
/*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
* Copyright (C) 2004 Tobias Lorenz
|
||||
*
|
||||
* string handling functions
|
||||
* based on linux/lib/string.c
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
/*
|
||||
* stupid library routines.. The optimized versions should generally be found
|
||||
* as inline code in <asm-xx/string.h>
|
||||
*
|
||||
* These are buggy as well..
|
||||
*
|
||||
* * Fri Jun 25 1999, Ingo Oeser <ioe@informatik.tu-chemnitz.de>
|
||||
* - Added strsep() which will replace strtok() soon (because strsep() is
|
||||
* reentrant and should be faster). Use only strsep() in new code, please.
|
||||
*/
|
||||
|
||||
/*
|
||||
* these are the standard string functions that are currently not used by
|
||||
* any code in etherboot. put into a separate file to avoid linking them in
|
||||
* with the rest of string.o
|
||||
* if anything ever does want to use a function of these, consider moving
|
||||
* the function in question back into string.c
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* *** FROM string.c *** */
|
||||
|
||||
#ifndef __HAVE_ARCH_STRNICMP
|
||||
/**
|
||||
* strnicmp - Case insensitive, length-limited string comparison
|
||||
* @s1: One string
|
||||
* @s2: The other string
|
||||
* @len: the maximum number of characters to compare
|
||||
*/
|
||||
int strnicmp(const char *s1, const char *s2, size_t len)
|
||||
{
|
||||
/* Yes, Virginia, it had better be unsigned */
|
||||
unsigned char c1, c2;
|
||||
|
||||
c1 = 0; c2 = 0;
|
||||
if (len) {
|
||||
do {
|
||||
c1 = *s1; c2 = *s2;
|
||||
s1++; s2++;
|
||||
if (!c1)
|
||||
break;
|
||||
if (!c2)
|
||||
break;
|
||||
if (c1 == c2)
|
||||
continue;
|
||||
c1 = tolower(c1);
|
||||
c2 = tolower(c2);
|
||||
if (c1 != c2)
|
||||
break;
|
||||
} while (--len);
|
||||
}
|
||||
return (int)c1 - (int)c2;
|
||||
}
|
||||
#endif
|
||||
|
||||
char * ___strtok;
|
||||
|
||||
#ifndef __HAVE_ARCH_STRNCAT
|
||||
/**
|
||||
* strncat - Append a length-limited, %NUL-terminated string to another
|
||||
* @dest: The string to be appended to
|
||||
* @src: The string to append to it
|
||||
* @count: The maximum numbers of bytes to copy
|
||||
*
|
||||
* Note that in contrast to strncpy, strncat ensures the result is
|
||||
* terminated.
|
||||
*/
|
||||
char * strncat(char *dest, const char *src, size_t count)
|
||||
{
|
||||
char *tmp = dest;
|
||||
|
||||
if (count) {
|
||||
while (*dest)
|
||||
dest++;
|
||||
while ((*dest++ = *src++)) {
|
||||
if (--count == 0) {
|
||||
*dest = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRSPN
|
||||
/**
|
||||
* strspn - Calculate the length of the initial substring of @s which only
|
||||
* contain letters in @accept
|
||||
* @s: The string to be searched
|
||||
* @accept: The string to search for
|
||||
*/
|
||||
size_t strspn(const char *s, const char *accept)
|
||||
{
|
||||
const char *p;
|
||||
const char *a;
|
||||
size_t count = 0;
|
||||
|
||||
for (p = s; *p != '\0'; ++p) {
|
||||
for (a = accept; *a != '\0'; ++a) {
|
||||
if (*p == *a)
|
||||
break;
|
||||
}
|
||||
if (*a == '\0')
|
||||
return count;
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRCSPN
|
||||
/**
|
||||
* strcspn - Calculate the length of the initial substring of @s which only
|
||||
* contain letters not in @reject
|
||||
* @s: The string to be searched
|
||||
* @accept: The string to search for
|
||||
*/
|
||||
size_t strcspn(const char *s, const char *reject)
|
||||
{
|
||||
const char *p;
|
||||
const char *r;
|
||||
size_t count = 0;
|
||||
|
||||
for (p = s; *p != '\0'; ++p) {
|
||||
for (r = reject; *r != '\0'; ++r) {
|
||||
if (*p == *r)
|
||||
return count;
|
||||
}
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRPBRK
|
||||
/**
|
||||
* strpbrk - Find the first occurrence of a set of characters
|
||||
* @cs: The string to be searched
|
||||
* @ct: The characters to search for
|
||||
*/
|
||||
char * strpbrk(const char * cs,const char * ct)
|
||||
{
|
||||
const char *sc1,*sc2;
|
||||
|
||||
for( sc1 = cs; *sc1 != '\0'; ++sc1) {
|
||||
for( sc2 = ct; *sc2 != '\0'; ++sc2) {
|
||||
if (*sc1 == *sc2)
|
||||
return (char *) sc1;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRTOK
|
||||
/**
|
||||
* strtok - Split a string into tokens
|
||||
* @s: The string to be searched
|
||||
* @ct: The characters to search for
|
||||
*
|
||||
* WARNING: strtok is deprecated, use strsep instead.
|
||||
*/
|
||||
char * strtok(char * s,const char * ct)
|
||||
{
|
||||
char *sbegin, *send;
|
||||
|
||||
sbegin = s ? s : ___strtok;
|
||||
if (!sbegin) {
|
||||
return NULL;
|
||||
}
|
||||
sbegin += strspn(sbegin,ct);
|
||||
if (*sbegin == '\0') {
|
||||
___strtok = NULL;
|
||||
return( NULL );
|
||||
}
|
||||
send = strpbrk( sbegin, ct);
|
||||
if (send && *send != '\0')
|
||||
*send++ = '\0';
|
||||
___strtok = send;
|
||||
return (sbegin);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRSEP
|
||||
/**
|
||||
* strsep - Split a string into tokens
|
||||
* @s: The string to be searched
|
||||
* @ct: The characters to search for
|
||||
*
|
||||
* strsep() updates @s to point after the token, ready for the next call.
|
||||
*
|
||||
* It returns empty tokens, too, behaving exactly like the libc function
|
||||
* of that name. In fact, it was stolen from glibc2 and de-fancy-fied.
|
||||
* Same semantics, slimmer shape. ;)
|
||||
*/
|
||||
char * strsep(char **s, const char *ct)
|
||||
{
|
||||
char *sbegin = *s, *end;
|
||||
|
||||
if (sbegin == NULL)
|
||||
return NULL;
|
||||
|
||||
end = strpbrk(sbegin, ct);
|
||||
if (end)
|
||||
*end++ = '\0';
|
||||
*s = end;
|
||||
|
||||
return sbegin;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_BCOPY
|
||||
/**
|
||||
* bcopy - Copy one area of memory to another
|
||||
* @src: Where to copy from
|
||||
* @dest: Where to copy to
|
||||
* @count: The size of the area.
|
||||
*
|
||||
* Note that this is the same as memcpy(), with the arguments reversed.
|
||||
* memcpy() is the standard, bcopy() is a legacy BSD function.
|
||||
*
|
||||
* You should not use this function to access IO space, use memcpy_toio()
|
||||
* or memcpy_fromio() instead.
|
||||
*/
|
||||
char * bcopy(const char * src, char * dest, int count)
|
||||
{
|
||||
return memmove(dest,src,count);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_MEMSCAN
|
||||
/**
|
||||
* memscan - Find a character in an area of memory.
|
||||
* @addr: The memory area
|
||||
* @c: The byte to search for
|
||||
* @size: The size of the area.
|
||||
*
|
||||
* returns the address of the first occurrence of @c, or 1 byte past
|
||||
* the area if @c is not found
|
||||
*/
|
||||
void * memscan(const void * addr, int c, size_t size)
|
||||
{
|
||||
unsigned char * p = (unsigned char *) addr;
|
||||
|
||||
while (size) {
|
||||
if (*p == c)
|
||||
return (void *) p;
|
||||
p++;
|
||||
size--;
|
||||
}
|
||||
return (void *) p;
|
||||
}
|
||||
#endif
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
static bigint *bi_int_multiply(BI_CTX *ctx, bigint *bi, comp i);
|
||||
static bigint *bi_int_divide(BI_CTX *ctx, bigint *biR, comp denom);
|
||||
static bigint *alloc(BI_CTX *ctx, int size);
|
||||
static bigint __malloc *alloc(BI_CTX *ctx, int size);
|
||||
static bigint *trim(bigint *bi);
|
||||
static void more_comps(bigint *bi, int n);
|
||||
#if defined(CONFIG_BIGINT_KARATSUBA) || defined(CONFIG_BIGINT_BARRETT) || \
|
||||
|
|
|
@ -31,7 +31,7 @@ typedef void psPool_t;
|
|||
|
||||
#define sslAssert( ... ) assert ( __VA_ARGS__ )
|
||||
|
||||
static inline __attribute__ (( always_inline )) void *
|
||||
static inline __attribute__ (( always_inline )) void * __malloc
|
||||
psMalloc ( psPool_t *pool __unused, size_t len ) {
|
||||
return malloc ( len );
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ static struct mii_chip_info {
|
|||
} mii_chip_table[] = {
|
||||
{"SiS 900 Internal MII PHY", 0x001d, 0x8000, sis900_read_mode},
|
||||
{"SiS 7014 Physical Layer Solution", 0x0016, 0xf830,sis900_read_mode},
|
||||
{"SiS 900 on Foxconn 661 7MI", 0x0143, 0xBC70, sis900_read_mode},
|
||||
{"AMD 79C901 10BASE-T PHY", 0x0000, 0x6B70, amd79c901_read_mode},
|
||||
{"AMD 79C901 HomePNA PHY", 0x0000, 0x6B90, amd79c901_read_mode},
|
||||
{"ICS 1893 Integrated PHYceiver" , 0x0015, 0xf440,ics1893_read_mode},
|
||||
|
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
static void insert_delete ( struct edit_string *string, size_t delete_len,
|
||||
const char *insert_text )
|
||||
__attribute__ (( nonnull (1) ));
|
||||
static void insert_character ( struct edit_string *string,
|
||||
unsigned int character ) __nonnull;
|
||||
static void delete_character ( struct edit_string *string ) __nonnull;
|
||||
static void backspace ( struct edit_string *string ) __nonnull;
|
||||
static void kill_eol ( struct edit_string *string ) __nonnull;
|
||||
|
||||
/**
|
||||
* Insert and/or delete text within an editable string
|
||||
*
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
#include <curses.h>
|
||||
#include <console.h>
|
||||
|
||||
static void ansiscr_reset(struct _curses_screen *scr) __nonnull;
|
||||
static void ansiscr_movetoyx(struct _curses_screen *scr,
|
||||
unsigned int y, unsigned int x) __nonnull;
|
||||
static void ansiscr_putc(struct _curses_screen *scr, chtype c) __nonnull;
|
||||
|
||||
unsigned short _COLS = 80;
|
||||
unsigned short _LINES = 24;
|
||||
|
||||
|
|
|
@ -8,6 +8,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
static void _wupdcurs ( WINDOW *win ) __nonnull;
|
||||
void _wputch ( WINDOW *win, chtype ch, int wrap ) __nonnull;
|
||||
void _wputc ( WINDOW *win, char c, int wrap ) __nonnull;
|
||||
void _wcursback ( WINDOW *win ) __nonnull;
|
||||
void _wputchstr ( WINDOW *win, const chtype *chstr, int wrap, int n ) __nonnull;
|
||||
void _wputstr ( WINDOW *win, const char *str, int wrap, int n ) __nonnull;
|
||||
int wmove ( WINDOW *win, int y, int x ) __nonnull;
|
||||
|
||||
WINDOW _stdscr = {
|
||||
.attrs = A_DEFAULT,
|
||||
.ori_y = 0,
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
|
||||
extern SCREEN _ansi_screen;
|
||||
|
||||
extern void _wputch ( WINDOW *win, chtype ch, int wrap );
|
||||
extern void _wputc ( WINDOW *win, char c, int wrap );
|
||||
extern void _wputchstr ( WINDOW *win, const chtype *chstr, int wrap, int n );
|
||||
extern void _wputstr ( WINDOW *win, const char *str, int wrap, int n );
|
||||
extern void _wcursback ( WINDOW *win );
|
||||
extern void _wputch ( WINDOW *win, chtype ch, int wrap ) __nonnull;
|
||||
extern void _wputc ( WINDOW *win, char c, int wrap ) __nonnull;
|
||||
extern void _wputchstr ( WINDOW *win, const chtype *chstr, int wrap, int n ) __nonnull;
|
||||
extern void _wputstr ( WINDOW *win, const char *str, int wrap, int n ) __nonnull;
|
||||
extern void _wcursback ( WINDOW *win ) __nonnull;
|
||||
|
||||
#endif /* _MUCURSES_H */
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
#define READLINE_MAX 256
|
||||
|
||||
static void sync_console ( struct edit_string *string ) __nonnull;
|
||||
|
||||
/**
|
||||
* Synchronise console with edited string
|
||||
*
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <gpxe/nvo.h>
|
||||
extern struct nvo_block *ugly_nvo_hack;
|
||||
|
||||
|
||||
/* Colour pairs */
|
||||
#define CPAIR_NORMAL 1
|
||||
#define CPAIR_SELECT 2
|
||||
|
@ -88,6 +87,24 @@ static struct config_setting config_settings_end[0]
|
|||
__table_end ( struct config_setting, config_settings );
|
||||
#define NUM_SETTINGS ( ( unsigned ) ( config_settings_end - config_settings ) )
|
||||
|
||||
static void load_setting ( struct setting_widget *widget ) __nonnull;
|
||||
static int save_setting ( struct setting_widget *widget ) __nonnull;
|
||||
static void init_setting ( struct setting_widget *widget,
|
||||
struct config_context *context,
|
||||
struct config_setting *setting,
|
||||
unsigned int row, unsigned int col ) __nonnull;
|
||||
static void draw_setting ( struct setting_widget *widget ) __nonnull;
|
||||
static int edit_setting ( struct setting_widget *widget, int key ) __nonnull;
|
||||
static void init_setting_index ( struct setting_widget *widget,
|
||||
struct config_context *context,
|
||||
unsigned int index ) __nonnull;
|
||||
static void vmsg ( unsigned int row, const char *fmt, va_list args ) __nonnull;
|
||||
static void msg ( unsigned int row, const char *fmt, ... ) __nonnull;
|
||||
static void valert ( const char *fmt, va_list args ) __nonnull;
|
||||
static void alert ( const char *fmt, ... ) __nonnull;
|
||||
static void draw_info_row ( struct config_setting *setting ) __nonnull;
|
||||
static int main_loop ( struct config_context *context ) __nonnull;
|
||||
|
||||
/**
|
||||
* Load setting widget value from configuration context
|
||||
*
|
||||
|
|
|
@ -279,6 +279,31 @@ extern void dbg_hex_dump_da ( unsigned long dispaddr,
|
|||
/** Apply standard C calling conventions */
|
||||
#define __cdecl __attribute__ (( cdecl , regparm(0) ))
|
||||
|
||||
/**
|
||||
* Declare a function as pure - i.e. without side effects
|
||||
*/
|
||||
#define __pure __attribute__ (( pure ))
|
||||
|
||||
/**
|
||||
* Declare a function as const - i.e. it does not access global memory
|
||||
* (including dereferencing pointers passed to it) at all.
|
||||
* Must also not call any non-const functions.
|
||||
*/
|
||||
#define __const __attribute__ (( const ))
|
||||
|
||||
/**
|
||||
* Declare a function's pointer parameters as non-null - i.e. force
|
||||
* compiler to check pointers at compile time and enable possible
|
||||
* optimizations based on that fact
|
||||
*/
|
||||
#define __nonnull __attribute__ (( nonnull ))
|
||||
|
||||
/**
|
||||
* Declare a pointer returned by a function as a unique memory address
|
||||
* as returned by malloc-type functions.
|
||||
*/
|
||||
#define __malloc __attribute__ (( malloc ))
|
||||
|
||||
/**
|
||||
* Declare a function as used.
|
||||
*
|
||||
|
|
|
@ -213,13 +213,13 @@ extern int beep ( void );
|
|||
//extern void bkgdset ( chtype );
|
||||
/*extern int border ( chtype, chtype, chtype, chtype, chtype, chtype, chtype,
|
||||
chtype );*/
|
||||
extern int box ( WINDOW *, chtype, chtype );
|
||||
extern int box ( WINDOW *, chtype, chtype ) __nonnull;
|
||||
//extern bool can_change_colour ( void );
|
||||
#define can_change_color() can_change_colour()
|
||||
extern int cbreak ( void );
|
||||
//extern int clrtobot ( void );
|
||||
//extern int clrtoeol ( void );
|
||||
extern int colour_content ( short, short *, short *, short * );
|
||||
extern int colour_content ( short, short *, short *, short * ) __nonnull;
|
||||
#define color_content( c, r, g, b ) colour_content( (c), (r), (g), (b) )
|
||||
//extern int colour_set ( short, void * );
|
||||
#define color_set( cpno, opts ) colour_set( (cpno), (opts) )
|
||||
|
@ -232,10 +232,10 @@ extern int delay_output ( int );
|
|||
//extern int delch ( void );
|
||||
//extern int deleteln ( void );
|
||||
extern void delscreen ( SCREEN * );
|
||||
extern int delwin ( WINDOW * );
|
||||
extern WINDOW *derwin ( WINDOW *, int, int, int, int );
|
||||
extern int delwin ( WINDOW * ) __nonnull;
|
||||
extern WINDOW *derwin ( WINDOW *, int, int, int, int ) __nonnull;
|
||||
//extern int doupdate ( void );
|
||||
extern WINDOW *dupwin ( WINDOW * );
|
||||
extern WINDOW *dupwin ( WINDOW * ) __nonnull;
|
||||
extern int echo ( void );
|
||||
extern int echochar ( const chtype );
|
||||
extern int endwin ( void );
|
||||
|
@ -244,7 +244,7 @@ extern char erasechar ( void );
|
|||
extern void filter ( void );
|
||||
extern int flash ( void );
|
||||
extern int flushinp ( void );
|
||||
extern chtype getbkgd ( WINDOW * );
|
||||
extern __pure chtype getbkgd ( WINDOW * ) __nonnull;
|
||||
//extern int getch ( void );
|
||||
//extern int getnstr ( char *, int );
|
||||
//extern int getstr ( char * );
|
||||
|
@ -312,7 +312,7 @@ extern int mvderwin ( WINDOW *, int, int );
|
|||
//extern int mvwgetnstr ( WINDOW *, int, int, char *, int );
|
||||
//extern int mvwgetstr ( WINDOW *, int, int, char * );
|
||||
//extern int mvwhline ( WINDOW *, int, int, chtype, int );
|
||||
extern int mvwin ( WINDOW *, int, int );
|
||||
extern int mvwin ( WINDOW *, int, int ) __nonnull;
|
||||
//extern chtype mvwinch ( WINDOW *, int, int );
|
||||
//extern int mvwinchnstr ( WINDOW *, int, int, chtype *, int );
|
||||
//extern int mvwinchstr ( WINDOW *, int, int, chtype * );
|
||||
|
@ -337,7 +337,7 @@ extern int noraw ( void );
|
|||
extern int notimeout ( WINDOW *, bool );
|
||||
extern int overlay ( const WINDOW *, WINDOW * );
|
||||
extern int overwrite ( const WINDOW *, WINDOW * );
|
||||
extern int pair_content ( short, short *, short * );
|
||||
extern int pair_content ( short, short *, short * ) __nonnull;
|
||||
//extern int pechochar ( WINDOW *, chtype );
|
||||
//extern int pnoutrefresh ( WINDOW *, int, int, int, int, int, int );
|
||||
//extern int prefresh ( WINDOW *, int, int, int, int, int, int );
|
||||
|
@ -373,14 +373,14 @@ extern char *slk_label ( int );
|
|||
extern int slk_noutrefresh ( void );
|
||||
//extern int slk_refresh ( void );
|
||||
extern int slk_restore ( void );
|
||||
extern int slk_set ( int, const char *, int );
|
||||
extern int slk_set ( int, const char *, int ) __nonnull;
|
||||
extern int slk_touch ( void );
|
||||
extern int standend ( void );
|
||||
extern int standout ( void );
|
||||
//extern int start_colour ( void );
|
||||
#define start_color() start_colour()
|
||||
//extern WINDOW *subpad ( WINDOW *, int, int, int, int );
|
||||
extern WINDOW *subwin ( WINDOW *, int, int, int, int );
|
||||
extern WINDOW *subwin ( WINDOW *, int, int, int, int ) __nonnull;
|
||||
extern int syncok ( WINDOW *, bool );
|
||||
extern chtype termattrs ( void );
|
||||
extern attr_t term_attrs ( void );
|
||||
|
@ -403,37 +403,41 @@ extern int vid_puts ( attr_t, short, void *, int ( *) ( int) );
|
|||
extern int vidputs ( chtype, int ( *) ( int) );
|
||||
//extern int vline ( chtype, int );
|
||||
//extern int vwprintw ( WINDOW *, const char *, va_list );
|
||||
extern int vw_printw ( WINDOW *, const char *, va_list );
|
||||
extern int vw_printw ( WINDOW *, const char *, va_list ) __nonnull;
|
||||
//extern int vwscanw ( WINDOW *, char *, va_list );
|
||||
//extern int vw_scanw ( WINDOW *, char *, va_list );
|
||||
extern int waddch ( WINDOW *, const chtype );
|
||||
extern int waddchnstr ( WINDOW *, const chtype *, int );
|
||||
extern int waddch ( WINDOW *, const chtype ) __nonnull;
|
||||
extern int waddchnstr ( WINDOW *, const chtype *, int ) __nonnull;
|
||||
//extern int waddchstr ( WINDOW *, const chtype * );
|
||||
extern int waddnstr ( WINDOW *, const char *, int );
|
||||
extern int waddnstr ( WINDOW *, const char *, int ) __nonnull;
|
||||
//extern int waddstr ( WINDOW *, const char * );
|
||||
extern int wattroff ( WINDOW *, int );
|
||||
extern int wattron ( WINDOW *, int );
|
||||
extern int wattrset ( WINDOW *, int );
|
||||
extern int wattr_get ( WINDOW *, attr_t *, short *, void * );
|
||||
extern int wattr_off ( WINDOW *, attr_t, void * );
|
||||
extern int wattr_on ( WINDOW *, attr_t, void * );
|
||||
extern int wattr_set ( WINDOW *, attr_t, short, void * );
|
||||
extern int wattroff ( WINDOW *, int ) __nonnull;
|
||||
extern int wattron ( WINDOW *, int ) __nonnull;
|
||||
extern int wattrset ( WINDOW *, int ) __nonnull;
|
||||
extern int wattr_get ( WINDOW *, attr_t *, short *, void * )
|
||||
__attribute__ (( nonnull (1, 2, 3)));
|
||||
extern int wattr_off ( WINDOW *, attr_t, void * )
|
||||
__attribute__ (( nonnull (1)));
|
||||
extern int wattr_on ( WINDOW *, attr_t, void * )
|
||||
__attribute__ (( nonnull (1)));
|
||||
extern int wattr_set ( WINDOW *, attr_t, short, void * )
|
||||
__attribute__ (( nonnull (1)));
|
||||
//extern void wbkgdset ( WINDOW *, chtype );
|
||||
extern int wborder ( WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype,
|
||||
chtype, chtype );
|
||||
extern int wclrtobot ( WINDOW * );
|
||||
extern int wclrtoeol ( WINDOW * );
|
||||
chtype, chtype ) __nonnull;
|
||||
extern int wclrtobot ( WINDOW * ) __nonnull;
|
||||
extern int wclrtoeol ( WINDOW * ) __nonnull;
|
||||
extern void wcursyncup ( WINDOW * );
|
||||
extern int wcolour_set ( WINDOW *, short, void * );
|
||||
extern int wcolour_set ( WINDOW *, short, void * ) __nonnull;
|
||||
#define wcolor_set(w,s,v) wcolour_set((w),(s),(v))
|
||||
extern int wdelch ( WINDOW * );
|
||||
extern int wdeleteln ( WINDOW * );
|
||||
extern int wdelch ( WINDOW * ) __nonnull;
|
||||
extern int wdeleteln ( WINDOW * ) __nonnull;
|
||||
extern int wechochar ( WINDOW *, const chtype );
|
||||
extern int werase ( WINDOW * );
|
||||
extern int werase ( WINDOW * ) __nonnull;
|
||||
extern int wgetch ( WINDOW * );
|
||||
extern int wgetnstr ( WINDOW *, char *, int );
|
||||
//extern int wgetstr ( WINDOW *, char * );
|
||||
extern int whline ( WINDOW *, chtype, int );
|
||||
extern int whline ( WINDOW *, chtype, int ) __nonnull;
|
||||
//extern chtype winch ( WINDOW * );
|
||||
//extern int winchnstr ( WINDOW *, chtype *, int );
|
||||
//extern int winchstr ( WINDOW *, chtype * );
|
||||
|
@ -444,7 +448,7 @@ extern int whline ( WINDOW *, chtype, int );
|
|||
//extern int winstr ( WINDOW *, char * );
|
||||
extern int wmove ( WINDOW *, int, int );
|
||||
//extern int wnoutrefresh ( WINDOW * );
|
||||
extern int wprintw ( WINDOW *, const char *, ... );
|
||||
extern int wprintw ( WINDOW *, const char *, ... ) __nonnull;
|
||||
//extern int wredrawln ( WINDOW *, int, int );
|
||||
//extern int wrefresh ( WINDOW * );
|
||||
//extern int wscanw ( WINDOW *, char *, ... );
|
||||
|
@ -456,7 +460,7 @@ extern void wsyncup ( WINDOW * );
|
|||
extern void wsyncdown ( WINDOW * );
|
||||
extern void wtimeout ( WINDOW *, int );
|
||||
//extern int wtouchln ( WINDOW *, int, int, int );
|
||||
extern int wvline ( WINDOW *, chtype, int );
|
||||
extern int wvline ( WINDOW *, chtype, int ) __nonnull;
|
||||
|
||||
/*
|
||||
* There is frankly a ridiculous amount of redundancy within the
|
||||
|
|
|
@ -507,7 +507,7 @@ extern void register_dhcp_options ( struct dhcp_option_block *options );
|
|||
extern void unregister_dhcp_options ( struct dhcp_option_block *options );
|
||||
extern void init_dhcp_options ( struct dhcp_option_block *options,
|
||||
void *data, size_t max_len );
|
||||
extern struct dhcp_option_block * alloc_dhcp_options ( size_t max_len );
|
||||
extern struct dhcp_option_block * __malloc alloc_dhcp_options ( size_t max_len );
|
||||
extern struct dhcp_option *
|
||||
set_dhcp_option ( struct dhcp_option_block *options, unsigned int tag,
|
||||
const void *data, size_t len );
|
||||
|
|
|
@ -28,8 +28,10 @@ struct edit_box {
|
|||
|
||||
extern void init_editbox ( struct edit_box *box, char *buf, size_t len,
|
||||
WINDOW *win, unsigned int row, unsigned int col,
|
||||
unsigned int width );
|
||||
extern void draw_editbox ( struct edit_box *box );
|
||||
unsigned int width )
|
||||
__attribute__ (( nonnull (1, 2) ));
|
||||
extern void draw_editbox ( struct edit_box *box ) __nonnull;
|
||||
static inline int __pure edit_editbox ( struct edit_box *box, int key ) __nonnull;
|
||||
|
||||
/**
|
||||
* Edit text box widget
|
||||
|
|
|
@ -26,6 +26,6 @@ struct edit_string {
|
|||
unsigned int mod_end;
|
||||
};
|
||||
|
||||
extern int edit_string ( struct edit_string *string, int key );
|
||||
extern int edit_string ( struct edit_string *string, int key ) __nonnull;
|
||||
|
||||
#endif /* _GPXE_EDITSTRING_H */
|
||||
|
|
|
@ -161,7 +161,7 @@ static inline size_t iob_tailroom ( struct io_buffer *iobuf ) {
|
|||
return ( iobuf->end - iobuf->tail );
|
||||
}
|
||||
|
||||
extern struct io_buffer * alloc_iob ( size_t len );
|
||||
extern struct io_buffer * __malloc alloc_iob ( size_t len );
|
||||
extern void free_iob ( struct io_buffer *iobuf );
|
||||
extern void iob_pad ( struct io_buffer *iobuf, size_t min_len );
|
||||
extern int iob_ensure_headroom ( struct io_buffer *iobuf, size_t len );
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
extern size_t freemem;
|
||||
|
||||
extern void * alloc_memblock ( size_t size, size_t align );
|
||||
extern void * __malloc alloc_memblock ( size_t size, size_t align );
|
||||
extern void free_memblock ( void *ptr, size_t size );
|
||||
extern void mpopulate ( void *start, size_t len );
|
||||
extern void mdumpfree ( void );
|
||||
|
@ -35,7 +35,7 @@ extern void mdumpfree ( void );
|
|||
*
|
||||
* @c align must be a power of two. @c size may not be zero.
|
||||
*/
|
||||
static inline void * malloc_dma ( size_t size, size_t phys_align ) {
|
||||
static inline void * __malloc malloc_dma ( size_t size, size_t phys_align ) {
|
||||
return alloc_memblock ( size, phys_align );
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
struct config_context;
|
||||
|
||||
extern int settings_ui ( struct config_context *context );
|
||||
extern int settings_ui ( struct config_context *context ) __nonnull;
|
||||
|
||||
#endif /* _GPXE_SETTINGS_UI_H */
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
extern char * readline ( const char *prompt );
|
||||
extern char * __malloc readline ( const char *prompt );
|
||||
|
||||
#endif /* _READLINE_H */
|
||||
|
|
|
@ -20,10 +20,10 @@ extern unsigned long strtoul ( const char *p, char **endp, int base );
|
|||
****************************************************************************
|
||||
*/
|
||||
|
||||
extern void * malloc ( size_t size );
|
||||
extern void * __malloc malloc ( size_t size );
|
||||
extern void * realloc ( void *old_ptr, size_t new_size );
|
||||
extern void free ( void *ptr );
|
||||
extern void * zalloc ( size_t len );
|
||||
extern void * __malloc zalloc ( size_t len );
|
||||
|
||||
/**
|
||||
* Allocate cleared memory
|
||||
|
@ -38,7 +38,7 @@ extern void * zalloc ( size_t len );
|
|||
* function in zalloc(), since in most cases @c nmemb will be 1 and
|
||||
* doing the multiply is just wasteful.
|
||||
*/
|
||||
static inline void * calloc ( size_t nmemb, size_t size ) {
|
||||
static inline void * __malloc calloc ( size_t nmemb, size_t size ) {
|
||||
return zalloc ( nmemb * size );
|
||||
}
|
||||
|
||||
|
|
|
@ -17,33 +17,33 @@
|
|||
#include <stddef.h>
|
||||
#include <bits/string.h>
|
||||
|
||||
int strnicmp(const char *s1, const char *s2, size_t len);
|
||||
char * strcpy(char * dest,const char *src);
|
||||
char * strncpy(char * dest,const char *src,size_t count);
|
||||
char * strcat(char * dest, const char * src);
|
||||
char * strncat(char *dest, const char *src, size_t count);
|
||||
int __attribute__ (( pure )) strcmp(const char * cs,const char * ct);
|
||||
int __attribute__ (( pure )) strncmp(const char * cs,const char * ct,
|
||||
size_t count);
|
||||
char * strchr(const char * s, int c);
|
||||
char * strrchr(const char * s, int c);
|
||||
size_t strlen(const char * s);
|
||||
size_t strnlen(const char * s, size_t count);
|
||||
size_t strspn(const char *s, const char *accept);
|
||||
size_t strcspn(const char *s, const char *reject);
|
||||
char * strpbrk(const char * cs,const char * ct);
|
||||
char * strtok(char * s,const char * ct);
|
||||
char * strsep(char **s, const char *ct);
|
||||
void * memset(void * s,int c,size_t count);
|
||||
void * memmove(void * dest,const void *src,size_t count);
|
||||
int __attribute__ (( pure )) memcmp(const void * cs,const void * ct,
|
||||
size_t count);
|
||||
void * memscan(void * addr, int c, size_t size);
|
||||
char * strstr(const char * s1,const char * s2);
|
||||
void * memchr(const void *s, int c, size_t n);
|
||||
char * strdup(const char *s);
|
||||
char * strndup(const char *s, size_t n);
|
||||
int __pure strnicmp(const char *s1, const char *s2, size_t len) __nonnull;
|
||||
char * strcpy(char * dest,const char *src) __nonnull;
|
||||
char * strncpy(char * dest,const char *src,size_t count) __nonnull;
|
||||
char * strcat(char * dest, const char * src) __nonnull;
|
||||
char * strncat(char *dest, const char *src, size_t count) __nonnull;
|
||||
int __pure strcmp(const char * cs,const char * ct) __nonnull;
|
||||
int __pure strncmp(const char * cs,const char * ct,
|
||||
size_t count) __nonnull;
|
||||
char * __pure strchr(const char * s, int c) __nonnull;
|
||||
char * __pure strrchr(const char * s, int c) __nonnull;
|
||||
size_t __pure strlen(const char * s) __nonnull;
|
||||
size_t __pure strnlen(const char * s, size_t count) __nonnull;
|
||||
size_t __pure strspn(const char *s, const char *accept) __nonnull;
|
||||
size_t __pure strcspn(const char *s, const char *reject) __nonnull;
|
||||
char * __pure strpbrk(const char * cs,const char * ct) __nonnull;
|
||||
char * strtok(char * s,const char * ct) __nonnull;
|
||||
char * strsep(char **s, const char *ct) __nonnull;
|
||||
void * memset(void * s,int c,size_t count) __nonnull;
|
||||
void * memmove(void * dest,const void *src,size_t count) __nonnull;
|
||||
int __pure memcmp(const void * cs,const void * ct,
|
||||
size_t count) __nonnull;
|
||||
void * __pure memscan(const void * addr, int c, size_t size) __nonnull;
|
||||
char * __pure strstr(const char * s1,const char * s2) __nonnull;
|
||||
void * __pure memchr(const void *s, int c, size_t n) __nonnull;
|
||||
char * __malloc strdup(const char *s) __nonnull;
|
||||
char * __malloc strndup(const char *s, size_t n) __nonnull;
|
||||
|
||||
extern const char * strerror ( int errno );
|
||||
extern const char * __pure strerror ( int errno );
|
||||
|
||||
#endif /* ETHERBOOT_STRING */
|
||||
|
|
|
@ -39,10 +39,9 @@ static LIST_HEAD ( frag_buffers );
|
|||
* @v gateway Gateway address (or @c INADDR_NONE for no gateway)
|
||||
* @ret miniroute Routing table entry, or NULL
|
||||
*/
|
||||
static struct ipv4_miniroute * add_ipv4_miniroute ( struct net_device *netdev,
|
||||
struct in_addr address,
|
||||
struct in_addr netmask,
|
||||
struct in_addr gateway ) {
|
||||
static struct ipv4_miniroute * __malloc
|
||||
add_ipv4_miniroute ( struct net_device *netdev, struct in_addr address,
|
||||
struct in_addr netmask, struct in_addr gateway ) {
|
||||
struct ipv4_miniroute *miniroute;
|
||||
|
||||
DBG ( "IPv4 add %s", inet_ntoa ( address ) );
|
||||
|
|
|
@ -52,11 +52,10 @@ static LIST_HEAD ( miniroutes );
|
|||
* @v gateway Gateway address (or ::0 for no gateway)
|
||||
* @ret miniroute Routing table entry, or NULL
|
||||
*/
|
||||
static struct ipv6_miniroute * add_ipv6_miniroute ( struct net_device *netdev,
|
||||
struct in6_addr prefix,
|
||||
int prefix_len,
|
||||
struct in6_addr address,
|
||||
struct in6_addr gateway ) {
|
||||
static struct ipv6_miniroute * __malloc
|
||||
add_ipv6_miniroute ( struct net_device *netdev, struct in6_addr prefix,
|
||||
int prefix_len, struct in6_addr address,
|
||||
struct in6_addr gateway ) {
|
||||
struct ipv6_miniroute *miniroute;
|
||||
|
||||
miniroute = malloc ( sizeof ( *miniroute ) );
|
||||
|
|
|
@ -1044,7 +1044,7 @@ static void tls_hmac ( struct tls_session *tls __unused,
|
|||
* @ret plaintext_len Length of plaintext record
|
||||
* @ret plaintext Allocated plaintext record
|
||||
*/
|
||||
static void * tls_assemble_stream ( struct tls_session *tls,
|
||||
static void * __malloc tls_assemble_stream ( struct tls_session *tls,
|
||||
const void *data, size_t len,
|
||||
void *digest, size_t *plaintext_len ) {
|
||||
size_t mac_len = tls->tx_cipherspec.digest->digestsize;
|
||||
|
|
|
@ -415,7 +415,7 @@ static int tftp_rx_oack ( struct tftp_request *tftp, void *buf, size_t len ) {
|
|||
static int tftp_rx_data ( struct tftp_request *tftp,
|
||||
struct io_buffer *iobuf ) {
|
||||
struct tftp_data *data = iobuf->data;
|
||||
unsigned int block;
|
||||
int block;
|
||||
size_t data_len;
|
||||
int rc;
|
||||
|
||||
|
@ -432,6 +432,14 @@ static int tftp_rx_data ( struct tftp_request *tftp,
|
|||
iob_pull ( iobuf, sizeof ( *data ) );
|
||||
data_len = iob_len ( iobuf );
|
||||
|
||||
/* Check for correct block */
|
||||
if ( block != ( tftp->state + 1 ) ) {
|
||||
DBGC ( tftp, "TFTP %p received out-of-order block %d "
|
||||
"(expecting %d)\n", tftp, block, ( tftp->state + 1 ) );
|
||||
free_iob ( iobuf );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Deliver data */
|
||||
if ( ( rc = xfer_deliver_iob ( &tftp->xfer, iobuf ) ) != 0 ) {
|
||||
DBGC ( tftp, "TFTP %p could not deliver data: %s\n",
|
||||
|
@ -645,6 +653,7 @@ int tftp_open ( struct xfer_interface *xfer, struct uri *uri ) {
|
|||
xfer_init ( &tftp->xfer, &tftp_xfer_operations, &tftp->refcnt );
|
||||
tftp->uri = uri_get ( uri );
|
||||
xfer_init ( &tftp->socket, &tftp_socket_operations, &tftp->refcnt );
|
||||
tftp->blksize = TFTP_DEFAULT_BLKSIZE;
|
||||
tftp->state = -1;
|
||||
tftp->timer.expired = tftp_timer_expired;
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
hello world!
|
Loading…
Reference in New Issue