RM6785: Split product makefile for the sake of recovery

Change-Id: I18a91e51b9d6440787afb1a1d1b1c063e2a1ecc6
diff --git a/Android.mk b/Android.mk
index d7eb0e3..7938126 100644
--- a/Android.mk
+++ b/Android.mk
@@ -6,7 +6,7 @@
 
 LOCAL_PATH := $(call my-dir)
 
-ifeq ($(TARGET_DEVICE),RM6785)
+ifneq ($(filter RMX2001 RMX2151,$(TARGET_DEVICE)),)
   subdir_makefiles=$(call first-makefiles-under,$(LOCAL_PATH))
   $(foreach mk,$(subdir_makefiles),$(info including $(mk) ...)$(eval include $(mk)))
 
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index 98bcb0a..63dd64c 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -5,4 +5,5 @@
 #
 
 PRODUCT_MAKEFILES := \
-    $(LOCAL_DIR)/lineage_RM6785.mk
+    $(LOCAL_DIR)/lineage_RMX2001.mk \
+    $(LOCAL_DIR)/lineage_RMX2151.mk
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 9b1d2db..e0a2739 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -72,7 +72,6 @@
 BOARD_BOOTIMAGE_PARTITION_SIZE := 33554432
 BOARD_CACHEIMAGE_PARTITION_SIZE := 452984832
 BOARD_DTBOIMG_PARTITION_SIZE := 8388608
-BOARD_RECOVERYIMAGE_PARTITION_SIZE := 67108864
 ifneq ($(TARGET_RO_FILE_SYSTEM_TYPE),erofs)
 ifneq ($(WITH_GMS),true)
 BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 1073741824
diff --git a/RMX2001/BoardConfig.mk b/RMX2001/BoardConfig.mk
new file mode 100644
index 0000000..3468153
--- /dev/null
+++ b/RMX2001/BoardConfig.mk
@@ -0,0 +1,10 @@
+#
+# Copyright (C) 2022 The LineageOS Project
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+# Partitions
+BOARD_RECOVERYIMAGE_PARTITION_SIZE := 67108864
+
+include device/realme/RM6785/BoardConfig.mk
diff --git a/RMX2151/BoardConfig.mk b/RMX2151/BoardConfig.mk
new file mode 100644
index 0000000..7931fb1
--- /dev/null
+++ b/RMX2151/BoardConfig.mk
@@ -0,0 +1,10 @@
+#
+# Copyright (C) 2022 The LineageOS Project
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+# Partitions
+BOARD_RECOVERYIMAGE_PARTITION_SIZE := 102760448
+
+include device/realme/RM6785/BoardConfig.mk
diff --git a/lineage_RM6785.mk b/lineage_RM6785.mk
index 4e37901..6306000 100644
--- a/lineage_RM6785.mk
+++ b/lineage_RM6785.mk
@@ -16,8 +16,6 @@
 $(call inherit-product, vendor/lineage/config/common_full_phone.mk)
 
 # Device identifier. This must come after all inclusions.
-PRODUCT_NAME := lineage_RM6785
-PRODUCT_DEVICE := RM6785
 PRODUCT_BRAND := realme
 PRODUCT_MODEL := RM6785
 PRODUCT_MANUFACTURER := realme
diff --git a/lineage_RMX2001.mk b/lineage_RMX2001.mk
new file mode 100644
index 0000000..fede4a5
--- /dev/null
+++ b/lineage_RMX2001.mk
@@ -0,0 +1,9 @@
+#
+# Copyright (C) 2022 The LineageOS Project
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+$(call inherit-product, device/realme/RM6785/lineage_RM6785.mk)
+
+PRODUCT_DEVICE := RMX2001
+PRODUCT_NAME := lineage_RMX2001
diff --git a/lineage_RMX2151.mk b/lineage_RMX2151.mk
new file mode 100644
index 0000000..921a28d
--- /dev/null
+++ b/lineage_RMX2151.mk
@@ -0,0 +1,9 @@
+#
+# Copyright (C) 2022 The LineageOS Project
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+$(call inherit-product, device/realme/RM6785/lineage_RM6785.mk)
+
+PRODUCT_DEVICE := RMX2151
+PRODUCT_NAME := lineage_RMX2151
diff --git a/setup-makefiles.sh b/setup-makefiles.sh
index 5e996a7..9ade905 100755
--- a/setup-makefiles.sh
+++ b/setup-makefiles.sh
@@ -28,7 +28,7 @@
 setup_vendor "${DEVICE}" "${VENDOR}" "${LINEAGE_ROOT}"
 
 # Copyright headers and common guards
-write_headers
+write_headers "RMX2001 RMX2151"
 
 # The standard blobs
 write_makefiles "${MY_DIR}/proprietary-files.txt" true