|
| 1 | +From 207d052c127ccf657320946e25111e62e84fe245 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Roman Stratiienko <r.stratiienko@gmail.com> |
| 3 | +Date: Sun, 13 Aug 2023 22:23:14 +0300 |
| 4 | +Subject: [PATCH 6/6] Allow overriding super partition size by product |
| 5 | + makefiles |
| 6 | + |
| 7 | +LineageOS is heavier, so set its default size to 2500MB. |
| 8 | + |
| 9 | +Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com> |
| 10 | +--- |
| 11 | + common/base/board.mk | 9 ++++++++- |
| 12 | + platform/uboot/bootscript.cpp | 2 +- |
| 13 | + platform/uboot/bootscript.h | 3 +++ |
| 14 | + platform/uboot/uboot.mk | 3 ++- |
| 15 | + 4 files changed, 14 insertions(+), 3 deletions(-) |
| 16 | + |
| 17 | +diff --git a/common/base/board.mk b/common/base/board.mk |
| 18 | +index 33e9493..82c4292 100644 |
| 19 | +--- a/common/base/board.mk |
| 20 | ++++ b/common/base/board.mk |
| 21 | +@@ -101,8 +101,15 @@ BOARD_BUILD_SYSTEM_ROOT_IMAGE := false |
| 22 | + |
| 23 | + BOARD_EXT4_SHARE_DUP_BLOCKS := true |
| 24 | + |
| 25 | ++# Default suprt partition size |
| 26 | ++ifeq ($(wildcard lineage),lineage) |
| 27 | ++GD_SUPER_PARTITION_SIZE_MB ?= 2500 |
| 28 | ++else |
| 29 | ++GD_SUPER_PARTITION_SIZE_MB ?= 2000 |
| 30 | ++endif |
| 31 | ++ |
| 32 | + # Dynamic partition 1800 MiB |
| 33 | +-BOARD_SUPER_PARTITION_SIZE := $(shell echo $$(( 2000 * 1024 * 1024 ))) |
| 34 | ++BOARD_SUPER_PARTITION_SIZE := $(shell echo $$(( $(GD_SUPER_PARTITION_SIZE_MB) * 1024 * 1024 ))) |
| 35 | + BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT := true |
| 36 | + BOARD_SUPER_PARTITION_GROUPS := glodroid_dynamic_partitions |
| 37 | + BOARD_GLODROID_DYNAMIC_PARTITIONS_SIZE := $(shell echo $$(( $(BOARD_SUPER_PARTITION_SIZE) - (10 * 1024 * 1024) ))) |
| 38 | +diff --git a/platform/uboot/bootscript.cpp b/platform/uboot/bootscript.cpp |
| 39 | +index de60224..a9674a4 100644 |
| 40 | +--- a/platform/uboot/bootscript.cpp |
| 41 | ++++ b/platform/uboot/bootscript.cpp |
| 42 | +@@ -39,7 +39,7 @@ EXTENV(partitions, ";name=vbmeta_a,size=512K,uuid=\${uuid_gpt_vbmeta_a}") |
| 43 | + EXTENV(partitions, ";name=vbmeta_b,size=512K,uuid=\${uuid_gpt_vbmeta_b}") |
| 44 | + EXTENV(partitions, ";name=vbmeta_system_a,size=512K,uuid=\${uuid_gpt_vbmeta_system_a}") |
| 45 | + EXTENV(partitions, ";name=vbmeta_system_b,size=512K,uuid=\${uuid_gpt_vbmeta_system_b}") |
| 46 | +-EXTENV(partitions, ";name=super,size=2000M,uuid=\${uuid_gpt_super}") |
| 47 | ++EXTENV(partitions, ";name=super,size="STR(__GD_SUPER_PARTITION_SIZE_MB__)"M,uuid=\${uuid_gpt_super}") |
| 48 | + EXTENV(partitions, ";name=metadata,size=16M,uuid=\${uuid_gpt_metadata}") |
| 49 | + EXTENV(partitions, ";name=userdata,size=-,uuid=\${uuid_gpt_userdata}") |
| 50 | + |
| 51 | +diff --git a/platform/uboot/bootscript.h b/platform/uboot/bootscript.h |
| 52 | +index 6b12ad4..811620d 100644 |
| 53 | +--- a/platform/uboot/bootscript.h |
| 54 | ++++ b/platform/uboot/bootscript.h |
| 55 | +@@ -6,6 +6,8 @@ |
| 56 | + #define N(...) __VA_ARGS__ |
| 57 | + #define Q() \" |
| 58 | + |
| 59 | ++#define q() " |
| 60 | ++ |
| 61 | + #define BO() "${ |
| 62 | + #define BOQ() "\${ |
| 63 | + #define BC() }" |
| 64 | +@@ -16,5 +18,6 @@ |
| 65 | + #define FUNC_BEGIN(name) setenv name ' |
| 66 | + #define FUNC_END() ' |
| 67 | + |
| 68 | ++#define STR(...) q()N(__VA_ARGS__)q() |
| 69 | + #define STRESC(...) Q()N(__VA_ARGS__)Q() |
| 70 | + |
| 71 | +diff --git a/platform/uboot/uboot.mk b/platform/uboot/uboot.mk |
| 72 | +index 9aef625..8f1338b 100644 |
| 73 | +--- a/platform/uboot/uboot.mk |
| 74 | ++++ b/platform/uboot/uboot.mk |
| 75 | +@@ -136,9 +136,10 @@ $(BOOTSCRIPT_GEN): $(GD_BOOTSCRIPT) $(BSP_UBOOT_PATH)/bootscript.h $(GD_BOOTSCRI |
| 76 | + cp $(BSP_UBOOT_PATH)/bootscript.h $(dir $(BOOTSCRIPT_GEN))/ |
| 77 | + cp $(GD_BOOTSCRIPT_OVERLAY_PLATFORM) $(dir $(BOOTSCRIPT_GEN))/platform.h |
| 78 | + cp $(GD_BOOTSCRIPT_OVERLAY_DEVICE) $(dir $(BOOTSCRIPT_GEN))/device.h |
| 79 | +- $(CLANG) -E -P -Wno-invalid-pp-token $(dir $(BOOTSCRIPT_GEN))/$(notdir $<) -o $@ \ |
| 80 | ++ $(CLANG) -E -P -Wno-invalid-pp-token -Wno-reserved-user-defined-literal $(dir $(BOOTSCRIPT_GEN))/$(notdir $<) -o $@ \ |
| 81 | + -D__SYSFS_MMC0_PATH__=$(SYSFS_MMC0_PATH) \ |
| 82 | + -D__SYSFS_MMC1_PATH__=$(SYSFS_MMC1_PATH) \ |
| 83 | ++ -D__GD_SUPER_PARTITION_SIZE_MB__=$(GD_SUPER_PARTITION_SIZE_MB) \ |
| 84 | + |
| 85 | + $(UBOOT_OUT)/boot.scr: $(BOOTSCRIPT_GEN) $(UBOOT_BINARY) |
| 86 | + $(UBOOT_OUT)/tools/mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d $< $@ |
| 87 | +-- |
| 88 | +2.39.2 |
| 89 | + |
0 commit comments