Hi all,
We can reduce the partitions size and remove cache partition by following two patches:
U-Boot:
diff -b --unified -Nr u-boot-aml-2015.01-20170107-orig/common/cmd_aml_mmc.c u-boot-aml-2015.01-20170107/common/cmd_aml_mmc.c
--- u-boot-aml-2015.01-20170107-orig/common/cmd_aml_mmc.c 2017-01-29 16:34:06.000000000 +0300
+++ u-boot-aml-2015.01-20170107/common/cmd_aml_mmc.c 2017-03-07 02:01:54.757376978 +0300
@@ -217,7 +217,6 @@
int dev;
u32 n=0;
bool is_part = false;//is argv[2] partition name
- bool protect_cache = false;
bool non_loader = false;
int blk_shift;
u64 cnt=0, blk =0,start_blk =0;
@@ -230,7 +229,6 @@
}else if(!strcmp(argv[2], "non_cache")){
name = "logo";
dev = find_dev_num_by_partition_name (name);
- protect_cache = true;
}
else if(!strcmp(argv[2], "non_loader")){
dev = 1;
@@ -318,12 +316,6 @@
}
if (n == 0) { // not error
// (2) erase all the area after reserve-partition
- if (protect_cache) {
- part_info = find_mmc_partition_by_name(MMC_CACHE_NAME);
- if (part_info == NULL) {
- return 1;
- }
- }
start_blk = (part_info->offset + part_info->size + PARTITION_RESERVED) >> blk_shift;
u64 erase_cnt = (mmc->capacity >> blk_shift) - 1 - start_blk;
n = mmc->block_dev.block_erase(dev, start_blk, erase_cnt);
diff -b --unified -Nr u-boot-aml-2015.01-20170107-orig/drivers/mmc/emmc_partitions.c u-boot-aml-2015.01-20170107/drivers/mmc/emmc_partitions.c
--- u-boot-aml-2015.01-20170107-orig/drivers/mmc/emmc_partitions.c 2016-11-24 09:48:28.000000000 +0300
+++ u-boot-aml-2015.01-20170107/drivers/mmc/emmc_partitions.c 2017-03-07 02:01:54.757376978 +0300
@@ -89,7 +89,7 @@
PARTITION_ELEMENT(MMC_RESERVED_NAME, MMC_RESERVED_SIZE, 0),
/* prior partitions, same partition name with dts*/
/* partition size will be overide by dts*/
- PARTITION_ELEMENT(MMC_CACHE_NAME, 0, 0),
+ // PARTITION_ELEMENT(MMC_CACHE_NAME, 0, 0),
// PARTITION_ELEMENT(MMC_KEY_NAME, MMC_KEY_SIZE, 0),
// PARTITION_ELEMENT(MMC_SECURE_NAME, MMC_SECURE_SIZE, 0),
PARTITION_ELEMENT(MMC_ENV_NAME, MMC_ENV_SIZE, 0),
diff -b --unified -Nr u-boot-aml-2015.01-20170107-orig/include/emmc_partitions.h u-boot-aml-2015.01-20170107/include/emmc_partitions.h
--- u-boot-aml-2015.01-20170107-orig/include/emmc_partitions.h 2016-11-24 09:48:38.000000000 +0300
+++ u-boot-aml-2015.01-20170107/include/emmc_partitions.h 2017-03-07 02:01:54.756376932 +0300
@@ -27,22 +27,22 @@
#define MAX_MMC_PART_NAME_LEN 16
#ifndef CONFIG_AML_MMC_INHERENT_PART
-#define PARTITION_RESERVED (8*SZ_1M) // 8MB
-#define MMC_BOOT_PARTITION_RESERVED (32*SZ_1M) // 32MB
+#define PARTITION_RESERVED (0) /* default 8MB: size reserver after each partition */
+#define MMC_BOOT_PARTITION_RESERVED (0x2*SZ_1M) /* default 32MB: size reserved after 'bootloader' partition */
#define MMC_BOOT_NAME "bootloader"
-#define MMC_BOOT_DEVICE_SIZE (0x4*SZ_1M)
+#define MMC_BOOT_DEVICE_SIZE (0x2*SZ_1M) /* currently U-Boot size is approximately 920K */
#define MMC_RESERVED_NAME "reserved"
#define MMC_RESERVED_SIZE (64*SZ_1M)
#define MMC_BOTTOM_RSV_SIZE (0)
#endif /* CONFIG_AML_MMC_INHERENT_PART */
-#define MMC_CACHE_NAME "cache"
+// #define MMC_CACHE_NAME "cache"
// #define MMC_CACHE_SIZE (512*SZ_1M) // this is not used and should be get from spl
#define MMC_ENV_NAME "env"
-#define MMC_ENV_SIZE (8*SZ_1M)
+#define MMC_ENV_SIZE (0x4*SZ_1M)
// #define MMC_KEY_NAME "key"
#define MMC_KEY_SIZE (256*1024)
Linux:
diff -b --unified -Nr linux-aml-3.14.29-20170119-orig/include/linux/mmc/emmc_partitions.h linux-aml-3.14.29-20170119/include/linux/mmc/emmc_partitions.h
--- linux-aml-3.14.29-20170119-orig/include/linux/mmc/emmc_partitions.h 2016-11-24 09:47:47.000000000 +0300
+++ linux-aml-3.14.29-20170119/include/linux/mmc/emmc_partitions.h 2017-03-07 02:00:29.391523283 +0300
@@ -25,10 +25,10 @@
#define SZ_1M 0x00100000
/* the size of bootloader partition */
-#define MMC_BOOT_PARTITION_SIZE (4*SZ_1M)
+#define MMC_BOOT_PARTITION_SIZE (2*SZ_1M)
/* the size of reserve space behind bootloader partition */
-#define MMC_BOOT_PARTITION_RESERVED (32*SZ_1M)
+#define MMC_BOOT_PARTITION_RESERVED (2*SZ_1M)
#define RESULT_OK 0
#define RESULT_FAIL 1
Reserved partition is strongly needed for DTB and u-boot partition table structures. I don’t known can we reduce the size of reserved partitions.
I didn’t made pull request because it is specific changed and only Gouwa can make decision about implementation of this into ubuntu branches of Linux and u-boot repositories.
Andrey K.