By using lndir, the .ko files are kept separate from the src directory
and building multiple architectures can be supported

Signed-off-by: Jon Ringle <[email protected]>
---
 rules/templates/template-src-linux-driver-in   |    1 +
 rules/templates/template-src-linux-driver-make |   39 ++++++++++++++++--------
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/rules/templates/template-src-linux-driver-in 
b/rules/templates/template-src-linux-driver-in
index 7cb61c8..6edb6bc 100644
--- a/rules/templates/template-src-linux-driver-in
+++ b/rules/templates/template-src-linux-driver-in
@@ -3,6 +3,7 @@
 config @PACKAGE@
        tristate
        select KERNEL
+       select HOST_LNDIR
        prompt "@package@"
        help
          FIXME
diff --git a/rules/templates/template-src-linux-driver-make 
b/rules/templates/template-src-linux-driver-make
index 6d6b385..dfe35eb 100644
--- a/rules/templates/template-src-linux-driver-make
+++ b/rules/templates/template-src-linux-driver-make
@@ -18,7 +18,7 @@ PACKAGES-$(PTXCONF_@PACKAGE@) += @package@
 #
 @PACKAGE@_VERSION      := @VERSION@
 @PACKAGE@              := @package@-$(@PACKAGE@_VERSION)
-@PACKAGE@_SRCDIR               := $(PTXDIST_WORKSPACE)/local_src/$(@PACKAGE@)
+@PACKAGE@_URL          := lndir://$(PTXDIST_WORKSPACE)/local_src/$(@PACKAGE@)
 @PACKAGE@_DIR          := $(BUILDDIR)/$(@PACKAGE@)
 @PACKAGE@_LICENSE      := unknown
 
@@ -48,14 +48,7 @@ $(STATEDIR)/@[email protected]:
 
 $(STATEDIR)/@[email protected]:
        @$(call targetinfo)
-#      # The kernel cannot build an out-of-tree driver out-of-tree :-)
-#      # So we make a local copy.
-       rm -fr $(@PACKAGE@_DIR)
-       cp -a $(@PACKAGE@_SRCDIR) $(@PACKAGE@_DIR)
-       $(KERNEL_PATH) $(KERNEL_ENV) $(MAKE) $(KERNEL_MAKEVARS) \
-               -C $(KERNEL_DIR) \
-               M=$(@PACKAGE@_DIR) \
-               modules
+       cd $(@PACKAGE@_DIR) && $(KERNEL_PATH) $(KERNEL_ENV) $(MAKE) 
$(KERNEL_MAKEVARS)
        @$(call touch)
 
 # ----------------------------------------------------------------------------
@@ -64,6 +57,11 @@ $(STATEDIR)/@[email protected]:
 
 $(STATEDIR)/@[email protected]:
        @$(call targetinfo)
+       @$(call clean, $(@PACKAGE@_PKGDIR))
+       cd $(@PACKAGE@_DIR) && $(KERNEL_PATH) $(KERNEL_ENV) $(MAKE) \
+               $(filter-out INSTALL_MOD_PATH=%,$(KERNEL_MAKEVARS)) \
+               INSTALL_MOD_PATH=$(@PACKAGE@_PKGDIR) \
+               modules_install
        @$(call touch)
 
 # ----------------------------------------------------------------------------
@@ -72,10 +70,25 @@ $(STATEDIR)/@[email protected]:
 
 $(STATEDIR)/@[email protected]:
        @$(call targetinfo)
-       $(KERNEL_PATH) $(KERNEL_ENV) $(MAKE) $(KERNEL_MAKEVARS) \
-               -C $(KERNEL_DIR) \
-               M=$(@PACKAGE@_DIR) \
-               modules_install
+       @$(call install_init, @package@)
+       @$(call install_fixup, @package@, PACKAGE, @package@)
+       @$(call install_fixup, @package@, PRIORITY, optional)
+       @$(call install_fixup, @package@, VERSION, $(@PACKAGE@_VERSION))
+       @$(call install_fixup, @package@, SECTION, base)
+       @$(call install_fixup, @package@, AUTHOR, "@AUTHOR@")
+       @$(call install_fixup, @package@, DEPENDS,)
+       @$(call install_fixup, @package@, DESCRIPTION, missing)
+
+       @cd $(@PACKAGE@_PKGDIR) && \
+       find lib -type d | while read dir; do \
+               $(call install_copy, @package@, 0, 0, 0755, /$${dir}); \
+       done
+
+       @cd $(@PACKAGE@_PKGDIR) && \
+       find lib -name "*.ko" | while read file; do \
+               $(call install_copy, @package@, 0, 0, 0644, -, /$${file}, k); \
+       done
+
        @$(call touch)
 
 # ----------------------------------------------------------------------------
-- 
1.7.0.4


-- 
ptxdist mailing list
[email protected]

Reply via email to