Browse Source

qcacld-3.0: Use $(call symlink-file) to create symlinks

Currently Android.mk uses $(shell) to create symlinks. Due to the way
this is used these commands will run for every build, even if the
symlinks are already present. Per the Hermetic Build feature we should
not execute any unnecessary commands, especially for incremental
builds where no changes are present from the prior build. Therefore
change the symlink logic to use the Android symlink-file rule-based
mechanism.

Change-Id: I47b9de34eec0faa193263765a0a86befb5e92ced
CRs-Fixed: 2907684
Jeff Johnson 4 years ago
parent
commit
a2f607aa0b
1 changed files with 28 additions and 21 deletions
  1. 28 21
      Android.mk

+ 28 - 21
Android.mk

@@ -141,7 +141,15 @@ ifneq ($(WLAN_KBUILD_OPTIONS_$(LOCAL_DEV_NAME)),)
 KBUILD_OPTIONS += "$(WLAN_KBUILD_OPTIONS_$(LOCAL_DEV_NAME))"
 endif
 
+ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
+TARGET_FW_PATH := $(TARGET_OUT_VENDOR)/$(TARGET_FW_DIR)
+else
+TARGET_FW_PATH := $(TARGET_OUT_ETC)/$(TARGET_FW_DIR)
+endif
+
 include $(CLEAR_VARS)
+
+# Create the module
 LOCAL_MODULE              := $(WLAN_CHIPSET)_$(LOCAL_DEV_NAME).ko
 LOCAL_MODULE_KBUILD_NAME  := $(LOCAL_MOD_NAME).ko
 LOCAL_MODULE_DEBUG_ENABLE := true
@@ -155,43 +163,42 @@ else
     LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules/$(WLAN_CHIPSET)
 endif
 
-ifeq ($(TARGET_PRODUCT), taro)
-    include $(DLKM_DIR)/Build_external_kernelmodule.mk
-else
-    include $(DLKM_DIR)/AndroidKernelModule.mk
-endif
-###########################################################
+# Create wlan_mac.bin symbolic link as part of the module
+$(call symlink-file,,$(TARGET_MAC_BIN_PATH)/wlan_mac.bin,$(TARGET_FW_PATH)/wlan_mac.bin)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_FW_PATH)/wlan_mac.bin
 
-# Create Symbolic link
+# Conditionally create module symbolic link
 ifneq ($(findstring $(WLAN_CHIPSET),$(WIFI_DRIVER_DEFAULT)),)
 ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
 ifneq ($(WIFI_DRIVER_INSTALL_TO_KERNEL_OUT),true)
-$(shell mkdir -p $(TARGET_OUT_VENDOR)/lib/modules; \
-	ln -sf /$(TARGET_COPY_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT_VENDOR)/lib/modules/$(LOCAL_MODULE))
+$(call symlink-file,,$(TARGET_COPY_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE),$(TARGET_OUT_VENDOR)/lib/modules/$(LOCAL_MODULE))
+LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_VENDOR)/lib/modules/$(LOCAL_MODULE)
 endif
 else
-$(shell mkdir -p $(TARGET_OUT)/lib/modules; \
-	ln -sf /system/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT)/lib/modules/$(LOCAL_MODULE))
+$(call symlink-file,,/system/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE),$(TARGET_OUT)/lib/modules/$(LOCAL_MODULE))
+LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT)/lib/modules/$(LOCAL_MODULE)
 endif
 endif
 
-ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
-TARGET_FW_PATH := $(TARGET_OUT_VENDOR)/$(TARGET_FW_DIR)
-else
-TARGET_FW_PATH := $(TARGET_OUT_ETC)/$(TARGET_FW_DIR)
-endif
-
-$(shell mkdir -p $(TARGET_FW_PATH); \
-	ln -sf $(TARGET_MAC_BIN_PATH)/wlan_mac.bin $(TARGET_FW_PATH)/wlan_mac.bin)
+# Conditionally create ini symbolic link
 ifeq ($(TARGET_BOARD_AUTO),true)
-$(shell ln -sf $(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini)
+$(call symlink-file,,$(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini,$(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini)
+LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini
 $(call wlog,"generate soft link because TARGET_BOARD_AUTO true")
 else
 ifneq ($(GENERIC_ODM_IMAGE),true)
-$(shell ln -sf $(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini)
+$(call symlink-file,,$(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini,$(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini)
+LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini
 $(call wlog,"generate soft link because GENERIC_ODM_IMAGE not true")
 endif
 endif
+
+ifeq ($(TARGET_PRODUCT), taro)
+    include $(DLKM_DIR)/Build_external_kernelmodule.mk
+else
+    include $(DLKM_DIR)/AndroidKernelModule.mk
+endif
+
 endif # Multi-ko check
 endif # DLKM check
 endif # supported target check