Add "make install_firmware" to the kbuild environment.

Signed-off-by: Jan Harkes <[EMAIL PROTECTED]>


 Makefile                    |   33 +++++++++++++++++++++++++++++++++
 drivers/usb/serial/Makefile |    5 +++++
 scripts/Makefile.fwinst     |   34 ++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+)

Index: linux/scripts/Makefile.fwinst
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ linux/scripts/Makefile.fwinst       2005-04-05 14:36:56.000000000 -0400
@@ -0,0 +1,34 @@
+# ==========================================================================
+# Installing firmware
+# ==========================================================================
+
+src := $(obj)
+
+.PHONY: __fwinst
+__fwinst:
+
+-include .config
+include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
+include scripts/Makefile.lib
+
+firmware       := $(fw-y) $(fw-m)
+firmware       := $(addprefix $(src)/, $(firmware))
+
+# =====================================================================
+
+.PHONY: $(firmware)
+__fwinst: $(firmware) $(subdir-ym)
+       @:
+
+quiet_cmd_firmware_install = INSTALL $@
+      cmd_firmware_install = mkdir -p $(2); cp $@ $(2)
+
+$(firmware):
+       $(call cmd,firmware_install,$(MODLIB)/firmware)
+
+# =====================================================================
+
+.PHONY: $(subdir-ym)
+$(subdir-ym):
+       $(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.fwinst 
obj=$@
+
Index: linux/Makefile
===================================================================
--- linux.orig/Makefile 2005-03-29 16:19:14.000000000 -0500
+++ linux/Makefile      2005-04-05 14:42:42.000000000 -0400
@@ -927,6 +927,21 @@ modules modules_install: FORCE
 
 endif # CONFIG_MODULES
 
+# ---------------------------------------------------------------------------
+# Firmware
+
+fwinst-dirs      := $(addprefix _fwinst_,$(vmlinux-dirs))
+
+.PHONY: $(fwinst-dirs) _fwinst_ firmware_install
+$(fwinst-dirs):
+       $(Q)$(MAKE) $(fwinst)=$(patsubst _fwinst_%,%,$@)
+
+_fwinst_:
+       @rm -rf $(MODLIB)/firmware
+       @mkdir -p $(MODLIB)/firmware
+
+firmware_install: _fwinst_ $(fwinst-dirs)
+
 # Generate asm-offsets.h 
 # ---------------------------------------------------------------------------
 
@@ -1042,6 +1057,7 @@ help:
        @echo  '* vmlinux         - Build the bare kernel'
        @echo  '* modules         - Build all modules'
        @echo  '  modules_install - Install all modules'
+       @echo  '  firmware_install- Install all firmware'
        @echo  '  dir/            - Build all files in dir and below'
        @echo  '  dir/file.[ois]  - Build specified target only'
        @echo  '  rpm             - Build a kernel as an RPM package'
@@ -1101,6 +1117,10 @@ else # KBUILD_EXTMOD
 # make M=dir modules_install
 #                      Install the modules build in the module directory
 #                      Assumes install directory is already created
+# make M=dir firmware_install
+#                      Install the firmware in the firmware directory
+#                      Assumes install directory is already created
+
 
 # We are always building modules
 KBUILD_MODULES := 1
@@ -1129,6 +1149,13 @@ modules: $(module-dirs)
 modules_install:
        $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
 
+fwinst-dirs := $(addprefix _fwinst_,$(KBUILD_EXTMOD))
+.PHONY: $(fwinst-dirs) firmware_install
+$(fwinst-dirs):
+       $(Q)$(MAKE) $(fwinst)=$(patsubst _fwinst_%,%,$@)
+
+firmware_install: $(fwinst-dirs)
+
 clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
 
 .PHONY: $(clean-dirs) clean
@@ -1149,6 +1176,7 @@ help:
        @echo  ''
        @echo  '  modules         - default target, build the module(s)'
        @echo  '  modules_install - install the module'
+       @echo  '  firmware_install- install firmware'
        @echo  '  clean           - remove generated files in module directory 
only'
        @echo  ''
 endif # KBUILD_EXTMOD
@@ -1346,6 +1374,11 @@ build := -f $(if $(KBUILD_SRC),$(srctree
 # $(Q)$(MAKE) $(clean)=dir
 clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
 
+# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.fwinst obj=dir
+# Usage:
+# $(Q)$(MAKE) $(fwinst)=dir
+fwinst := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.fwinst obj
+
 #      $(call descend,<dir>,<target>)
 #      Recursively call a sub-make in <dir> with target <target>
 # Usage is deprecated, because make does not see this as an invocation of make.
Index: linux/drivers/usb/serial/Makefile
===================================================================
--- linux.orig/drivers/usb/serial/Makefile      2005-03-10 16:01:14.000000000 
-0500
+++ linux/drivers/usb/serial/Makefile   2005-04-05 13:01:54.000000000 -0400
@@ -36,3 +36,8 @@ obj-$(CONFIG_USB_SERIAL_VISOR)                        += viso
 obj-$(CONFIG_USB_SERIAL_WHITEHEAT)             += whiteheat.o
 obj-$(CONFIG_USB_SERIAL_XIRCOM)                        += keyspan_pda.o
 
+fw-$(CONFIG_USB_SERIAL_KEYSPAN)                        += \
+       keyspan-mpr.fw     keyspan-usa18x.fw  keyspan-usa19.fw \
+       keyspan-usa19qi.fw keyspan-usa19qw.fw keyspan-usa19w.fw \
+       keyspan-usa28.fw   keyspan-usa28x.fw  keyspan-usa28xa.fw \
+       keyspan-usa28xb.fw keyspan-usa49w.fw  keyspan-usa49wlc.fw

--

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

Reply via email to