m5: fix factory image creation
authorJan Altensen <info@stricted.net>
Thu, 16 Sep 2021 19:56:35 +0000 (21:56 +0200)
committerNolen Johnson <johnsonnolen@gmail.com>
Thu, 16 Sep 2021 20:47:54 +0000 (16:47 -0400)
 * if the source and $OUT are on different drives hardlinking fails, copy instead
 * fix bootloader path while at it

Change-Id: I425a7c4bb0fe7e2408abcda8d0993320416c015f

factory.mk

index 158614252bf3327d5a75746c17a004dc019b85c2..2f1239861dd3f35215043e4fdde44885bfe5ee4f 100644 (file)
@@ -22,8 +22,8 @@ AML_IMAGE_TOOL := $(HOST_OUT_EXECUTABLES)/aml_image_packer$(HOST_EXECUTABLE_SUFF
 
 INSTALLED_AML_UPGRADE_PACKAGE_TARGET := $(PRODUCT_OUT)/aml_upgrade_package.img
 
-define aml-symlink-file
-       $(hide) ln -f $(1) $(PRODUCT_UPGRADE_OUT)/$(strip $(if $(2), $(2), $(notdir $(1))))
+define aml-copy-file
+       $(hide) $(ACP) $(1) $(PRODUCT_UPGRADE_OUT)/$(strip $(if $(2), $(2), $(notdir $(1))))
 endef
 
 NEEDED_IMAGES := \
@@ -33,25 +33,25 @@ NEEDED_IMAGES := \
     vbmeta.img \
     super.img
 
-$(INSTALLED_AML_UPGRADE_PACKAGE_TARGET): $(addprefix $(PRODUCT_OUT)/,$(NEEDED_IMAGES)) $(AML_IMAGE_TOOL)
+$(INSTALLED_AML_UPGRADE_PACKAGE_TARGET): $(addprefix $(PRODUCT_OUT)/,$(NEEDED_IMAGES)) $(ACP) $(AML_IMAGE_TOOL)
        $(hide) mkdir -p $(PRODUCT_UPGRADE_OUT)
 ifneq ("$(wildcard $(FACTORY_PATH)/u-boot.bin)","")
-       $(hide) $(call aml-symlink-file, $(FACTORY_PATH)/u-boot.bin)
-else ifneq ("$(wildcard vendor/firmware/m5/bootloader.img)","")
-       $(hide) $(call aml-symlink-file, vendor/firmware/m5/bootloader.img, u-boot.bin)
+       $(hide) $(call aml-copy-file, $(FACTORY_PATH)/u-boot.bin)
+else ifneq ("$(wildcard vendor/firmware/m5/radio/bootloader.img)","")
+       $(hide) $(call aml-copy-file, vendor/firmware/m5/radio/bootloader.img, u-boot.bin)
 else
        $(error "no u-boot.bin found in $(FACTORY_PATH)")
 endif
-       $(hide) $(call aml-symlink-file, $(PRODUCT_OUT)/logo.img)
-       $(hide) $(call aml-symlink-file, $(FACTORY_PATH)/aml_sdc_burn.ini)
-       $(hide) $(call aml-symlink-file, $(FACTORY_PATH)/image.cfg)
-       $(hide) $(call aml-symlink-file, $(FACTORY_PATH)/platform.conf)
-       $(hide) $(call aml-symlink-file, $(PRODUCT_OUT)/boot.img)
-       $(hide) $(call aml-symlink-file, $(PRODUCT_OUT)/recovery.img)
-       $(hide) $(call aml-symlink-file, $(INSTALLED_2NDBOOTLOADER_TARGET), dtb.img)
-       $(hide) $(call aml-symlink-file, $(PRODUCT_OUT)/dtbo.img)
-       $(hide) $(call aml-symlink-file, $(PRODUCT_OUT)/super.img)
-       $(hide) $(call aml-symlink-file, $(PRODUCT_OUT)/vbmeta.img)
+       $(hide) $(call aml-copy-file, $(PRODUCT_OUT)/logo.img)
+       $(hide) $(call aml-copy-file, $(FACTORY_PATH)/aml_sdc_burn.ini)
+       $(hide) $(call aml-copy-file, $(FACTORY_PATH)/image.cfg)
+       $(hide) $(call aml-copy-file, $(FACTORY_PATH)/platform.conf)
+       $(hide) $(call aml-copy-file, $(PRODUCT_OUT)/boot.img)
+       $(hide) $(call aml-copy-file, $(PRODUCT_OUT)/recovery.img)
+       $(hide) $(call aml-copy-file, $(INSTALLED_2NDBOOTLOADER_TARGET), dtb.img)
+       $(hide) $(call aml-copy-file, $(PRODUCT_OUT)/dtbo.img)
+       $(hide) $(call aml-copy-file, $(PRODUCT_OUT)/super.img)
+       $(hide) $(call aml-copy-file, $(PRODUCT_OUT)/vbmeta.img)
        $(hide) $(AML_IMAGE_TOOL) -r $(PACKAGE_CONFIG_FILE) $(PRODUCT_UPGRADE_OUT)/ $@
        $(hide) rm -rf $(PRODUCT_UPGRADE_OUT)
        $(hide) echo " $@ created"