From cc400c211a35e9d5c9a8fbe76c27df17c4092584 Mon Sep 17 00:00:00 2001 From: Chandan Uddaraju Date: Fri, 22 Jan 2010 17:19:09 -0800 Subject: [target/[msm7627,msm7630,qsd8250]: Increase system partition size needed for Android 2.1 upgrade. Increase the system partition size to 85MB for msm7627_surf, msm7627_ffa, qsd8250_surf and qsd8250_ffa targets. Increase the system partition size to 95MB for msm7630 target. Add code to select the userdata size dynamically during run time for qsd8250_surf and qsd8250_ffa targets. --- target/msm7627_ffa/init.c | 12 +++++------ target/msm7627_surf/init.c | 10 ++++----- target/msm7630_surf/init.c | 6 +++--- target/qsd8250_ffa/init.c | 54 +++++++++++++++++++++++++++++++++++----------- target/qsd8250_surf/init.c | 52 +++++++++++++++++++++++++++++++++----------- 5 files changed, 95 insertions(+), 39 deletions(-) diff --git a/target/msm7627_ffa/init.c b/target/msm7627_ffa/init.c index 16c3c8a7..38da52df 100644 --- a/target/msm7627_ffa/init.c +++ b/target/msm7627_ffa/init.c @@ -56,21 +56,21 @@ static struct ptable flash_ptable; static struct ptentry board_part_list[] = { { .start = 0, - .length = 40, + .length = 40 /* 5MB */, .name = "boot", }, { - .start = 56, - .length = 608 /* 76MB */, + .start = 40, + .length =680 /* 85MB */, .name = "system", }, { - .start = 664, - .length = 40 /* 5MB */, + .start = 720, + .length = 40 /* 5MB */, .name = "cache", }, { - .start = 704, + .start = 760, .length = VARIABLE_LENGTH, .name = "userdata", }, diff --git a/target/msm7627_surf/init.c b/target/msm7627_surf/init.c index 0d56db56..4fa811fd 100644 --- a/target/msm7627_surf/init.c +++ b/target/msm7627_surf/init.c @@ -56,21 +56,21 @@ static struct ptable flash_ptable; static struct ptentry board_part_list[] = { { .start = 0, - .length = 40, + .length = 40 /* 5MB */, .name = "boot", }, { - .start = 56, - .length = 608 /* 76MB */, + .start = 40, + .length =680 /* 85MB */, .name = "system", }, { - .start = 664, + .start = 720, .length = 40 /* 5MB */, .name = "cache", }, { - .start = 704, + .start = 760, .length = VARIABLE_LENGTH, .name = "userdata", }, diff --git a/target/msm7630_surf/init.c b/target/msm7630_surf/init.c index 2ad8fb2d..42e83ddc 100644 --- a/target/msm7630_surf/init.c +++ b/target/msm7630_surf/init.c @@ -73,16 +73,16 @@ static struct ptentry board_part_list[] = { }, { .start = 20, - .length = 340 /* 85MB */, + .length = 380 /* 95MB */, .name = "system", }, { - .start = 360, + .start = 400, .length = 20 /* 5MB */, .name = "cache", }, { - .start = 380, + .start = 420, .length = VARIABLE_LENGTH, .name = "userdata", }, diff --git a/target/qsd8250_ffa/init.c b/target/qsd8250_ffa/init.c index ecb5b890..938676d3 100644 --- a/target/qsd8250_ffa/init.c +++ b/target/qsd8250_ffa/init.c @@ -39,6 +39,10 @@ #define LINUX_MACHTYPE 1008002 +#define VARIABLE_LENGTH 0x10101010 +#define DIFF_START_ADDR 0xF0F0F0F0 +#define NUM_PAGES_PER_BLOCK 0x40 + static struct ptable flash_ptable; /* for these partitions, start will be offset by either what we get from @@ -52,28 +56,28 @@ static struct ptable flash_ptable; static struct ptentry board_part_list[] = { { .start = 0, - .length = 40, + .length = 40 /* 5MB */, .name = "boot", }, { - .start = 56, - .length = 608 /* 76MB */, + .start = 40, + .length = 680 /* 85MB */, .name = "system", }, { - .start = 664, - .length = 40 /* 5MB */, + .start = 720, + .length = 40 /* 5MB */, .name = "cache", }, { - .start = 704, - .length = 40 /* 5MB */, - .name = "recovery", + .start = 760, + .length = VARIABLE_LENGTH, + .name = "userdata", }, { - .start = 744, - .length = 720 /* 90MB */, - .name = "userdata", + .start = DIFF_START_ADDR, + .length = 40 /* 5MB */, + .name = "recovery", }, }; static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry); @@ -87,6 +91,9 @@ void target_init(void) { unsigned offset; struct flash_info *flash_info; + unsigned total_num_of_blocks; + bool start_addr_changed = false; + unsigned next_ptr_start_adr = 0; int i; dprintf(INFO, "target_init()\n"); @@ -107,12 +114,33 @@ void target_init(void) if (offset == 0xffffffff) while(1); + total_num_of_blocks = (flash_info->block_size)/NUM_PAGES_PER_BLOCK; + for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ptn->length; - if ((len == 0) && (i == num_parts - 1)) - len = flash_info->num_blocks - offset - ptn->start; + if(len == VARIABLE_LENGTH) + { + start_addr_changed = true; + unsigned length_for_prt = 0; + unsigned j; + for (j = i+1; j < num_parts; j++) + { + struct ptentry *temp_ptn = &board_part_list[j]; + ASSERT(temp_ptn->length != VARIABLE_LENGTH); + length_for_prt += temp_ptn->length; + } + len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt); + ASSERT(len >= 0); + next_ptr_start_adr = ptn->start + len; + } + if((ptn->start == DIFF_START_ADDR) && (start_addr_changed)) + { + ASSERT(next_ptr_start_adr); + ptn->start = next_ptr_start_adr; + next_ptr_start_adr = ptn->start + ptn->length; + } ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags); } diff --git a/target/qsd8250_surf/init.c b/target/qsd8250_surf/init.c index dd937a23..03ddf235 100644 --- a/target/qsd8250_surf/init.c +++ b/target/qsd8250_surf/init.c @@ -39,6 +39,10 @@ #define LINUX_MACHTYPE 1008000 +#define VARIABLE_LENGTH 0x10101010 +#define DIFF_START_ADDR 0xF0F0F0F0 +#define NUM_PAGES_PER_BLOCK 0x40 + static struct ptable flash_ptable; /* for these partitions, start will be offset by either what we get from @@ -52,28 +56,28 @@ static struct ptable flash_ptable; static struct ptentry board_part_list[] = { { .start = 0, - .length = 40, + .length = 40 /* 5MB */, .name = "boot", }, { - .start = 56, - .length = 608 /* 76MB */, + .start = 40, + .length = 680 /* 85MB */, .name = "system", }, { - .start = 664, + .start = 720, .length = 40 /* 5MB */, .name = "cache", }, { - .start = 704, - .length = 40 /* 5MB */, - .name = "recovery", + .start = 760, + .length = VARIABLE_LENGTH, + .name = "userdata", }, { - .start = 744, - .length = 720 /* 90MB */, - .name = "userdata", + .start = DIFF_START_ADDR, + .length = 40 /* 5MB */, + .name = "recovery", }, }; static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry); @@ -87,6 +91,9 @@ void target_init(void) { unsigned offset; struct flash_info *flash_info; + unsigned total_num_of_blocks; + bool start_addr_changed = false; + unsigned next_ptr_start_adr = 0; int i; dprintf(INFO, "target_init()\n"); @@ -106,12 +113,33 @@ void target_init(void) if (offset == 0xffffffff) while(1); + total_num_of_blocks = (flash_info->block_size)/NUM_PAGES_PER_BLOCK; + for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ptn->length; - if ((len == 0) && (i == num_parts - 1)) - len = flash_info->num_blocks - offset - ptn->start; + if(len == VARIABLE_LENGTH) + { + start_addr_changed = true; + unsigned length_for_prt = 0; + unsigned j; + for (j = i+1; j < num_parts; j++) + { + struct ptentry *temp_ptn = &board_part_list[j]; + ASSERT(temp_ptn->length != VARIABLE_LENGTH); + length_for_prt += temp_ptn->length; + } + len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt); + ASSERT(len >= 0); + next_ptr_start_adr = ptn->start + len; + } + if((ptn->start == DIFF_START_ADDR) && (start_addr_changed)) + { + ASSERT(next_ptr_start_adr); + ptn->start = next_ptr_start_adr; + next_ptr_start_adr = ptn->start + ptn->length; + } ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags); } -- cgit v1.2.3