[PATCH 3/5] firmware: enable usage of mkcis

From: Dmitry Eremin-Solenikov
Date: Thu Sep 23 2010 - 11:20:29 EST


Enable usage of mkcis for generation of cis files

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@xxxxxxxxx>
---
firmware/Makefile | 44 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/firmware/Makefile b/firmware/Makefile
index 9c2d194..04ecf8c 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -156,6 +156,9 @@ quiet_cmd_ihex2fw = IHEX2FW $@
quiet_cmd_h16tofw = H16TOFW $@
cmd_h16tofw = $(objtree)/$(obj)/ihex2fw -w $< $@

+quiet_cmd_mkcis = MKCIS $@
+ cmd_mkcis = $(objtree)/$(obj)/mkcis -o $@ $<
+
quiet_cmd_fwbin = MK_FW $@
cmd_fwbin = FWNAME="$(patsubst firmware/%.gen.S,%,$@)"; \
FWSTR="$(subst /,_,$(subst .,_,$(subst -,_,$(patsubst \
@@ -224,6 +227,11 @@ ihex2fw_dep :=
else
ihex2fw_dep := $(obj)/ihex2fw
endif
+ifeq ($(INSTALL):$(wildcard $(obj)/mkcis),install:$(obj)/mkcis)
+mkcis_dep :=
+else
+mkcis_dep := $(obj)/mkcis
+endif

# .HEX is also Intel HEX, but where the offset and length in each record
# is actually meaningful, because the firmware has to be loaded in a certain
@@ -236,6 +244,10 @@ $(obj)/%.fw: $(obj)/%.HEX $(ihex2fw_dep) | $(objtree)/$(obj)/$$(dir %)
$(obj)/%.fw: $(obj)/%.H16 $(ihex2fw_dep) | $(objtree)/$(obj)/$$(dir %)
$(call cmd,h16tofw)

+# .ct is a text representation of CIS files, as originally developed by pcmcia-cs
+$(obj)/%.cis: $(obj)/%.ct $(mkcis_dep) | $(objtree)/$(obj)/$$(dir %)
+ $(call cmd,mkcis)
+
$(firmware-dirs):
$(call cmd,mkdir)

@@ -251,4 +263,34 @@ targets := $(fw-shipped-) $(patsubst $(obj)/%,%, \
# final vmlinux link will fail.
obj-n := dummy

-hostprogs-y := ihex2fw
+hostprogs-y := ihex2fw mkcis
+
+mkcis-objs := mkcis.o mkcis-lexer.lex.o mkcis-parser.tab.o
+$(obj)/mkcis-parser.tab.o: $(obj)/mkcis-parser.tab.c $(obj)/mkcis-parser.tab.h
+$(obj)/mkcis-lexer.lex.o: $(obj)/mkcis-lexer.lex.c $(obj)/mkcis-parser.tab.h
+HOSTCFLAGS_mkcis.o += -Iinclude/pcmcia
+HOSTCFLAGS_mkcis-lexer.lex.o += -Iinclude/pcmcia -Ifirmware/
+HOSTCFLAGS_mkcis-parser.tab.o += -Iinclude/pcmcia -Ifirmware/
+HOSTLOADLIBES_mkcis := -lm
+
+# GENERATE_PARSER := 1 # Uncomment to rebuild flex/bison output
+
+ifdef GENERATE_PARSER
+
+BISON = bison
+FLEX = flex
+
+quiet_cmd_bison = BISON $@
+ cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped
+quiet_cmd_flex = FLEX $@
+ cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped
+
+$(obj)/mkcis-parser.tab.c: $(src)/mkcis-parser.y FORCE
+ $(call if_changed,bison)
+
+$(obj)/mkcis-parser.tab.h: $(obj)/mkcis-parser.tab.c
+
+$(obj)/mkcis-lexer.lex.c: $(src)/mkcis-lexer.l FORCE
+ $(call if_changed,flex)
+
+endif
--
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/