package/linux-firmware: add support to copy entire directories
authorYann E. MORIN <yann.morin.1998@free.fr>
Wed, 1 Apr 2015 21:54:57 +0000 (23:54 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 2 Apr 2015 08:15:42 +0000 (10:15 +0200)
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: David BARBION <david.barbion@ext.leroymerlin.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/linux-firmware/linux-firmware.mk

index 71c86117f188fec8cec4ca50ee165ea8e56c89f8..5a68138c8922acbf22e44e89b5923ace9123e840 100644 (file)
@@ -293,6 +293,23 @@ LINUX_FIRMWARE_ALL_LICENSE_FILES += LICENCE.broadcom_bcm43xx
 endif
 
 ifneq ($(LINUX_FIRMWARE_FILES),)
+define LINUX_FIRMWARE_INSTALL_FILES
+       $(TAR) c -C $(@D) $(sort $(LINUX_FIRMWARE_FILES)) | \
+               $(TAR) x -C $(TARGET_DIR)/lib/firmware
+endef
+endif
+
+ifneq ($(LINUX_FIRMWARE_DIRS),)
+# We need to rm-rf the destination directory to avoid copying
+# into it in itself, should we re-install the package.
+define LINUX_FIRMWARE_INSTALL_DIRS
+       $(foreach d,$(LINUX_FIRMWARE_DIRS), \
+               rm -rf $(TARGET_DIR)/lib/firmware/$(d); \
+               cp -a $(@D)/$(d) $(TARGET_DIR)/lib/firmware/$(d)$(sep))
+endef
+endif
+
+ifneq ($(LINUX_FIRMWARE_FILES)$(LINUX_FIRMWARE_DIRS),)
 
 # Most firmware files are under a proprietary license, so no need to
 # repeat it for every selections above. Those firmwares that have more
@@ -308,12 +325,12 @@ LINUX_FIRMWARE_ALL_LICENSE_FILES += WHENCE
 # duplicates
 LINUX_FIRMWARE_LICENSE_FILES = $(sort $(LINUX_FIRMWARE_ALL_LICENSE_FILES))
 
+endif
+
 define LINUX_FIRMWARE_INSTALL_TARGET_CMDS
        mkdir -p $(TARGET_DIR)/lib/firmware
-       $(TAR) c -C $(@D) $(sort $(LINUX_FIRMWARE_FILES)) | \
-               $(TAR) x -C $(TARGET_DIR)/lib/firmware
+       $(LINUX_FIRMWARE_INSTALL_FILES)
+       $(LINUX_FIRMWARE_INSTALL_DIRS)
 endef
 
-endif
-
 $(eval $(generic-package))