diff options
author | Michael Brown <mcb30@etherboot.org> | 2009-02-16 00:28:30 +0000 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2009-02-16 00:30:36 +0000 |
commit | 076154a1c6ca987f84450c0225c190c9cdd77c59 (patch) | |
tree | fbe8e2e7ccbd9de5f048894f9a58687df0c975de /src/Makefile.housekeeping | |
parent | f16668dd600c266ee573badc295745cbb0c0f879 (diff) | |
download | ipxe-076154a1c6ca987f84450c0225c190c9cdd77c59.zip ipxe-076154a1c6ca987f84450c0225c190c9cdd77c59.tar.gz ipxe-076154a1c6ca987f84450c0225c190c9cdd77c59.tar.bz2 |
[image] Allow multiple embedded images
This patch extends the embedded image feature to allow multiple
embedded images instead of just one.
gPXE now always boots the first embedded image on startup instead of
doing the hardcoded DHCP boot (aka autoboot).
Based heavily upon a patch by Stefan Hajnoczi <stefanha@gmail.com>.
Diffstat (limited to 'src/Makefile.housekeeping')
-rw-r--r-- | src/Makefile.housekeeping | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index ab6f29c..d841344 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -85,6 +85,13 @@ VERYCLEANUP += .toolcheck # Check for various tool workarounds # +# Make syntax does not allow use of comma or space in certain places. +# This ugly workaround is suggested in the manual. +# +COMMA := , +EMPTY := +SPACE := $(EMPTY) $(EMPTY) + # Check for an old version of gas (binutils 2.9.1) # OLDGAS := $(shell $(AS) --version | grep -q '2\.9\.1' && $(ECHO) -DGAS291) @@ -280,9 +287,9 @@ ASFLAGS += --fatal-warnings ASFLAGS += $(EXTRA_ASFLAGS) LDFLAGS += $(EXTRA_LDFLAGS) -# Embedded image, if present +# Embedded image(s), or default if not set # -EMBEDDED_IMAGE = /dev/null +EMBEDDED_IMAGE = image/default.gpxe # Inhibit -Werror if NO_WERROR is specified on make command line # @@ -406,13 +413,31 @@ drivers : roms : @$(ECHO) $(ROMS) -# Embedded binary -$(BIN)/embedimg.bin: $(EMBEDDED_IMAGE) - $(QM)$(ECHO) " [COPY] $@" - $(Q)$(CP) -f $(EMBEDDED_IMAGE) $@ +# List of embedded images included in the last build of embedded.o. +# This is needed in order to correctly rebuild embedded.o whenever the +# list of objects changes. +# +EMBEDDED_LIST := $(BIN)/.embedded.list +ifeq ($(wildcard $(EMBEDDED_LIST)),) +EMBEDDED_LIST_IMAGE := +else +EMBEDDED_LIST_IMAGE := $(shell cat $(EMBEDDED_LIST)) +endif +ifneq ($(EMBEDDED_LIST_IMAGE),$(EMBEDDED_IMAGE)) +$(shell $(ECHO) "$(EMBEDDED_IMAGE)" > $(EMBEDDED_LIST)) +endif + +$(EMBEDDED_LIST) : + +VERYCLEANUP += $(EMBEDDED_LIST) + +EMBEDDED_FILES := $(subst $(COMMA), ,$(EMBEDDED_IMAGE)) +EMBED_ALL := $(foreach i,$(shell seq 1 $(words $(EMBEDDED_FILES))),\ + EMBED ( $(i), \"$(word $(i), $(EMBEDDED_FILES))\",\ + \"$(notdir $(word $(i),$(EMBEDDED_FILES)))\" )) -$(BIN)/embed.o: $(BIN)/embedimg.bin -CFLAGS_embed = -DEMBEDIMG=\"$(BIN)/embedimg.bin\" +$(BIN)/embedded.o : $(EMBEDDED_FILES) $(EMBEDDED_LIST) +CFLAGS_embedded = -DEMBED_ALL="$(EMBED_ALL)" # Generate the NIC file from the parsed source files. The NIC file is # only for rom-o-matic. @@ -491,7 +516,6 @@ TGT_MAKEROM_FLAGS = $(strip $(MAKEROM_FLAGS_$(TGT_ROM_NAME)) \ # Calculate list of debugging versions of objects to be included in # the target. # -COMMA := , DEBUG_LIST = $(subst $(COMMA), ,$(DEBUG)) DEBUG_OBJ_LEVEL = $(firstword $(word 2,$(subst :, ,$(1))) 1) DEBUG_OBJ_BASE = $(word 1,$(subst :, ,$(1))).dbg$(call DEBUG_OBJ_LEVEL,$(1)) |