radxa0: Create aml_install phony target
authorNolen Johnson <johnsonnolen@gmail.com>
Sun, 9 Jul 2023 19:34:00 +0000 (15:34 -0400)
committerNolen Johnson <johnsonnolen@gmail.com>
Sun, 9 Jul 2023 22:33:26 +0000 (18:33 -0400)
It's just a super slim package, containing a bootloader that
forces booting into recovery mode and a super_empty image.

Quicker, more reliable flashing process, plus solves the issue of
entering recovery without buttons.

Change-Id: I04fb916098006f9ac82ddaf379fdc1b357eef7c0

factory.mk

index 7bc3126678365a0958d04547abff2fafee07e758..701ddf04ec951c453ef57629d548db1f41ae7d1c 100644 (file)
 
 FACTORY_PATH := device/radxa/radxa0/factory
 
-PRODUCT_UPGRADE_OUT := $(PRODUCT_OUT)/upgrade
-PACKAGE_CONFIG_FILE := $(PRODUCT_UPGRADE_OUT)/image.cfg
+PRODUCT_INSTALL_OUT := $(PRODUCT_OUT)/aml_install
+PRODUCT_UPGRADE_OUT := $(PRODUCT_OUT)/aml_upgrade
+INSTALL_PACKAGE_CONFIG_FILE := $(PRODUCT_INSTALL_OUT)/image.cfg
+UPGRADE_PACKAGE_CONFIG_FILE := $(PRODUCT_UPGRADE_OUT)/image.cfg
 AML_IMAGE_TOOL := $(HOST_OUT_EXECUTABLES)/aml_image_packer$(HOST_EXECUTABLE_SUFFIX)
 
+INSTALLED_AML_INSTALL_PACKAGE_TARGET := $(PRODUCT_OUT)/aml_install_package.img
 INSTALLED_AML_UPGRADE_PACKAGE_TARGET := $(PRODUCT_OUT)/aml_upgrade_package.img
 
-define aml-copy-file
+define aml-copy-install-file
+       $(hide) $(ACP) $(1) $(PRODUCT_INSTALL_OUT)/$(strip $(if $(2), $(2), $(notdir $(1))))
+endef
+
+define aml-copy-upgrade-file
        $(hide) $(ACP) $(1) $(PRODUCT_UPGRADE_OUT)/$(strip $(if $(2), $(2), $(notdir $(1))))
 endef
 
@@ -32,28 +39,55 @@ NEEDED_IMAGES := \
     dtbo.img \
     vbmeta.img \
     super.img \
+    super_empty.img \
     logo.img
 
+$(INSTALLED_AML_INSTALL_PACKAGE_TARGET): $(addprefix $(PRODUCT_OUT)/,$(NEEDED_IMAGES)) $(ACP) $(AML_IMAGE_TOOL)
+       $(hide) mkdir -p $(PRODUCT_INSTALL_OUT)
+ifneq ("$(wildcard $(FACTORY_PATH)/u-boot.bin)","")
+       $(hide) $(call aml-copy-install-file, $(FACTORY_PATH)/u-boot.bin)
+else ifneq ("$(wildcard vendor/amlogic/radxa0/radio/bootloader-recovery.img)","")
+       $(hide) $(call aml-copy-install-file, vendor/amlogic/radxa0/radio/bootloader-recovery.img, u-boot.bin)
+else
+       $(error "no u-boot.bin found in $(FACTORY_PATH)")
+endif
+       $(hide) $(call aml-copy-install-file, $(PRODUCT_OUT)/logo.img)
+       $(hide) $(call aml-copy-install-file, $(FACTORY_PATH)/aml_sdc_burn.ini)
+       $(hide) $(call aml-copy-install-file, $(FACTORY_PATH)/image.cfg)
+       $(hide) $(call aml-copy-install-file, $(FACTORY_PATH)/platform.conf)
+       $(hide) $(call aml-copy-install-file, $(PRODUCT_OUT)/boot.img)
+       $(hide) $(call aml-copy-install-file, $(PRODUCT_OUT)/recovery.img)
+       $(hide) $(call aml-copy-install-file, $(INSTALLED_2NDBOOTLOADER_TARGET), dtb.img)
+       $(hide) $(call aml-copy-install-file, $(PRODUCT_OUT)/dtbo.img)
+       $(hide) $(call aml-copy-install-file, $(PRODUCT_OUT)/super_empty.img, super.img)
+       $(hide) $(call aml-copy-install-file, $(PRODUCT_OUT)/vbmeta.img)
+       $(hide) $(AML_IMAGE_TOOL) -r $(INSTALL_PACKAGE_CONFIG_FILE) $(PRODUCT_INSTALL_OUT)/ $@
+       $(hide) rm -rf $(PRODUCT_INSTALL_OUT)
+       $(hide) echo " $@ created"
+
+.PHONY: aml_install
+aml_install: $(INSTALLED_AML_INSTALL_PACKAGE_TARGET)
+
 $(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-copy-file, $(FACTORY_PATH)/u-boot.bin)
+       $(hide) $(call aml-copy-upgrade-file, $(FACTORY_PATH)/u-boot.bin)
 else ifneq ("$(wildcard vendor/amlogic/radxa0/radio/bootloader.img)","")
-       $(hide) $(call aml-copy-file, vendor/amlogic/radxa0/radio/bootloader.img, u-boot.bin)
+       $(hide) $(call aml-copy-upgrade-file, vendor/amlogic/radxa0/radio/bootloader.img, u-boot.bin)
 else
        $(error "no u-boot.bin found in $(FACTORY_PATH)")
 endif
-       $(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) $(call aml-copy-upgrade-file, $(PRODUCT_OUT)/logo.img)
+       $(hide) $(call aml-copy-upgrade-file, $(FACTORY_PATH)/aml_sdc_burn.ini)
+       $(hide) $(call aml-copy-upgrade-file, $(FACTORY_PATH)/image.cfg)
+       $(hide) $(call aml-copy-upgrade-file, $(FACTORY_PATH)/platform.conf)
+       $(hide) $(call aml-copy-upgrade-file, $(PRODUCT_OUT)/boot.img)
+       $(hide) $(call aml-copy-upgrade-file, $(PRODUCT_OUT)/recovery.img)
+       $(hide) $(call aml-copy-upgrade-file, $(INSTALLED_2NDBOOTLOADER_TARGET), dtb.img)
+       $(hide) $(call aml-copy-upgrade-file, $(PRODUCT_OUT)/dtbo.img)
+       $(hide) $(call aml-copy-upgrade-file, $(PRODUCT_OUT)/super.img)
+       $(hide) $(call aml-copy-upgrade-file, $(PRODUCT_OUT)/vbmeta.img)
+       $(hide) $(AML_IMAGE_TOOL) -r $(UPGRADE_PACKAGE_CONFIG_FILE) $(PRODUCT_UPGRADE_OUT)/ $@
        $(hide) rm -rf $(PRODUCT_UPGRADE_OUT)
        $(hide) echo " $@ created"