--- /dev/null
+#
+# Copyright (C) 2021 The LineageOS Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FACTORY_PATH := device/bananapi/m5/factory
+
+PRODUCT_UPGRADE_OUT := $(PRODUCT_OUT)/upgrade
+PACKAGE_CONFIG_FILE := $(PRODUCT_UPGRADE_OUT)/image.cfg
+AML_IMAGE_TOOL := $(HOST_OUT_EXECUTABLES)/aml_image_packer$(HOST_EXECUTABLE_SUFFIX)
+
+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))))
+endef
+
+NEEDED_IMAGES := \
+ boot.img \
+ recovery.img \
+ dtbo.img \
+ vbmeta.img \
+ super.img
+
+$(INSTALLED_AML_UPGRADE_PACKAGE_TARGET): $(addprefix $(PRODUCT_OUT)/,$(NEEDED_IMAGES)) $(AML_IMAGE_TOOL)
+ $(hide) mkdir -p $(PRODUCT_UPGRADE_OUT)
+ifeq ("$(wildcard $(FACTORY_PATH)/u-boot.bin)","")
+ $(error "no u-boot.bin found in $(FACTORY_PATH)")
+else
+ $(hide) $(call aml-symlink-file, $(FACTORY_PATH)/u-boot.bin)
+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) $(AML_IMAGE_TOOL) -r $(PACKAGE_CONFIG_FILE) $(PRODUCT_UPGRADE_OUT)/ $@
+ $(hide) rm -rf $(PRODUCT_UPGRADE_OUT)
+ $(hide) echo " $@ created"
+
+.PHONY: aml_upgrade
+aml_upgrade: $(INSTALLED_AML_UPGRADE_PACKAGE_TARGET)
--- /dev/null
+;
+;Amlogic sdcard burning configure script
+;This card burning script support both dos and unix file format, but don't edit in windows if not dos format
+;Except comment, all must readable ASCII letters
+;
+;Amlogic sdcard ÉÕ¼¾µÏñ½Å±¾
+;±¾½Å±¾Ö§³ÖdosºÍunixÁ½ÖÖ¸ñʽµÄ·½±ã£¬µ«ÊÇÍƼö±£Ò»Ö±±£´æΪdos¸ñʽµÄ
+;Èç¹ûÊÇ·Çdos¸ñʽµÄ£¬Çë²»ÔÚwindowsÏÂʹÓüÇʱ¾±à¼£¬·ñÔò±à¼ºó»á±ä³É²»¿É½âÎö
+;³ý×¢ÊÍÐÐÍâµÄ×Ö·û±ØÐëÊÇ¿Éʶ±ðµÄASCII
+
+[common]
+erase_bootloader = 1
+erase_flash = 0
+reboot = 0
+
+;package will filled by sdacard burning tool
+[burn_ex]
+package = aml_upgrade_package.img
+;media =
--- /dev/null
+[LIST_NORMAL]
+file="u-boot.bin" main_type="USB" sub_type="DDR"
+file="u-boot.bin" main_type="USB" sub_type="UBOOT"
+file="u-boot.bin" main_type="UBOOT" sub_type="aml_sdc_burn"
+file="aml_sdc_burn.ini" main_type="ini" sub_type="aml_sdc_burn"
+file="dtb.img" main_type="dtb" sub_type="meson1"
+file="platform.conf" main_type="conf" sub_type="platform"
+
+[LIST_VERIFY]
+file="dtb.img" main_type="PARTITION" sub_type="_aml_dtb"
+file="boot.img" main_type="PARTITION" sub_type="boot"
+file="u-boot.bin" main_type="PARTITION" sub_type="bootloader"
+file="dtbo.img" main_type="PARTITION" sub_type="dtbo"
+file="logo.img" main_type="PARTITION" sub_type="logo"
+file="recovery.img" main_type="PARTITION" sub_type="recovery"
+file="super.img" main_type="PARTITION" sub_type="super"
+file="vbmeta.img" main_type="PARTITION" sub_type="vbmeta"