This solution describes the method to increase the maximum number of NAND partition on 9x15. Current partition is limit to 16 maximum, following changes will increase it to 22.
============================
Changes
============================
Boot loader:
1) boot_images\core\boot\secboot3\src\miparti.h: change following define to new max partition number, e.g.
#define FLASH_NUM_PART_ENTRIES 22
2) boot_images\core\boot\secboot3\src\mibib.h: change following define to new max partition number, make sure the value of MIBIB_DEFAULT_PARTI_SIZE is the same of FLASH_NUM_PART_ENTRIES, e.g.
#define MIBIB_DEFAULT_PARTI_SIZE 0x16
3) common\build\partition_nand_9x15.xml (old build: boot_images\core\storage\tools\nandbootmbn\ partition_nand_9x15.xml): insert new partitions, like this
<partition>
<name length="16" type="string">0:FAKE9</name>
<size_blks length="4">0x6</size_blks>
<pad_blks length="4">0x4</pad_blks>
<which_flash>0</which_flash>
<attr>0xFF</attr>
<attr>0xFF</attr>
<attr>0x00</attr>
<attr>0xFF</attr>
</partition>
Accordingly, recount the sequence of "system" partition, for example, if the original sequence of "system" partition is 8 (starting from MIBIB as 0), after the above "FAKE9" partition is inserted, the new sequence of "system" partition becomes 9, which will be used to change 9615-cdp-bootimg.inc later.
LK:
1) apps_proc\bootable\bootloader\lk\platform\msm_shared\smem_ptable.c: add a define for the new max partition number, e.g.
#define FLASH_NUM_PART_ENTRIES_SMEM 22
Then use FLASH_NUM_PART_ENTRIES_SMEM in following structure, e.g.
struct smem_ptable {
#define _SMEM_PTABLE_MAGIC_1 0x55ee73aa
#define _SMEM_PTABLE_MAGIC_2 0xe35ebddb
unsigned magic[2];
unsigned version;
unsigned len;
struct smem_ptn parts[FLASH_NUM_PART_ENTRIES_SMEM];
} __attribute__ ((__packed__));
Also use FLASH_NUM_PART_ENTRIES_SMEM in the for loop in the following functions:
static void dump_smem_ptable(void)
{
…
for (i = 0; i < FLASH_NUM_PART_ENTRIES_SMEM; i++) {
struct smem_ptn *p = &smem_ptable.parts[i];
if (p->name[0] == '\0')
continue;
…
}
}
void smem_add_modem_partitions(struct ptable *flash_ptable)
{
…
for (i = 0; i < FLASH_NUM_PART_ENTRIES_SMEM; i++) {
char *token;
char *pname = NULL;
struct smem_ptn *p = &smem_ptable.parts[i];
if (p->name[0] == '\0')
continue;
token = strtok(p->name, ":");
…
}
}
LE:
1) apps_proc\kernel\arch\arm\mach-msm\nand_partition.c: change following define to new max partition number, e.g.
#define MSM_MAX_PARTITIONS 22
2) apps_proc\build\recipes\recipes\images\9615-cdp-bootimg.inc (old build: make_bbimg.sh): in the following command line, change argumentroot=/dev/mtdblockXX, where XX is the new partition number for the "system" partition counted earlier in partition_nand_9x15.xml, e.g. XX=20
--cmdline "noinitrd root=/dev/mtdblock20 rw rootfstype=yaffs2 console=ttyHSL0,115200,n8 no_console_suspend=1 androidboot.hardware=qcom" \
============================
Build
============================
After above changes, compile boot loaders to generate new boot loaders, nand_tools; also make a clean APPS build on Linux to generate new LK and LE images.
============================
Verification
============================
1) Use HEX viewer to open partition.mbn, look for the newly added partitions.
2) Use HEX viewer to open boot-oe-msm9615.img, look for theroot=/dev/mtdblockXX
3) Use T32 to flash non-HLOS images, this will verify nand_tools is working fine with new max partition change
4) Use fastboot, flash APSS and boot images. Reboot to HLOS, and collect kernel log, look for the following messages:
[ 2.543934] yaffs: Attempting MTD mount of 31.20,"mtdblock20"
[ 4.802777] yaffs: yaffs_read_super: is_checkpointed 0
[ 4.802899] VFS: Mounted root (yaffs2 filesystem) on device 31:20.
This will verity Linux File System is still mounted correctly.
No comments:
Post a Comment