m5: Add aml_upgrade build target
authorJan Altensen <info@stricted.net>
Sat, 3 Jul 2021 00:50:53 +0000 (02:50 +0200)
committerNolen Johnson <johnsonnolen@gmail.com>
Tue, 27 Jul 2021 15:37:39 +0000 (11:37 -0400)
* Will be neded for initial flashing.

Change-Id: Ife02f48a7b07421079470e06c05d459556b68930

Android.mk
device.mk
factory.mk [new file with mode: 0644]
factory/aml_sdc_burn.ini [new file with mode: 0644]
factory/image.cfg [new file with mode: 0644]
factory/platform.conf [new file with mode: 0644]

index 427bb460914240312163014e5a7506a9a98d3ceb..e229612dea8526c2c1444b9fc4401642e9254909 100644 (file)
@@ -9,5 +9,8 @@ ifeq ($(TARGET_DEVICE), m5)
 LOCAL_PATH := $(call my-dir)
 include $(call all-makefiles-under,$(LOCAL_PATH))
 
+include $(LOCAL_PATH)/factory.mk
+
 include external/wpa_supplicant_8/wpa_supplicant/wpa_supplicant_conf.mk
+
 endif
index fcd6c9a2d643c37d034dd4984593e612260caef3..5cd67a9ac9f575a33db28545723391933e8b1de2 100644 (file)
--- a/device.mk
+++ b/device.mk
@@ -12,6 +12,10 @@ $(call inherit-product, device/amlogic/g12-common/g12.mk)
 BOARD_HAVE_BLUETOOTH_RTK_TV := true
 include hardware/realtek/rtkbt/rtkbt.mk
 
+## Factory
+PRODUCT_HOST_PACKAGES += \
+    aml_image_packer
+
 ## Init-Files
 PRODUCT_COPY_FILES += \
     $(DEVICE_PATH)/init-files/init.amlogic.wifi_buildin.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.amlogic.wifi_buildin.rc
diff --git a/factory.mk b/factory.mk
new file mode 100644 (file)
index 0000000..fc5d7f2
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# 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)
diff --git a/factory/aml_sdc_burn.ini b/factory/aml_sdc_burn.ini
new file mode 100644 (file)
index 0000000..abd7d5b
--- /dev/null
@@ -0,0 +1,19 @@
+;
+;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       =
diff --git a/factory/image.cfg b/factory/image.cfg
new file mode 100644 (file)
index 0000000..e4a9045
--- /dev/null
@@ -0,0 +1,17 @@
+[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"
diff --git a/factory/platform.conf b/factory/platform.conf
new file mode 100644 (file)
index 0000000..d238f9b
--- /dev/null
@@ -0,0 +1,8 @@
+Platform:0x0811
+DDRLoad:0xfffa0000
+DDRRun:0xfffa0000
+DDRSize:0x10000
+Control0=0xfffa0000:0x000000b1
+Control1=0xfffa0000:0x00005183
+Encrypt_reg:0xff800228
+