Merge "include: target: remove macros for old vb runtime naming convention."
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index cc34f7a..c04b504 100755
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -1011,11 +1011,7 @@
return 0;
}
-
BUF_DMA_ALIGN(buf, BOOT_IMG_MAX_PAGE_SIZE); //Equal to max-supported pagesize
-#if DEVICE_TREE
-BUF_DMA_ALIGN(dt_buf, BOOT_IMG_MAX_PAGE_SIZE);
-#endif
static void verify_signed_bootimg(uint32_t bootimg_addr, uint32_t bootimg_size)
{
@@ -1700,6 +1696,7 @@
}
}
+ /* Read boot.img header from flash */
if (flash_read(ptn, offset, buf, page_size)) {
dprintf(CRITICAL, "ERROR: Cannot read boot image header\n");
return -1;
@@ -1781,38 +1778,41 @@
}
#endif
+ /* Read full boot.img from flash */
+ dprintf(INFO, "Loading (%s) image (%d): start\n",
+ (!boot_into_recovery ? "boot" : "recovery"),imagesize_actual);
+ bs_set_timestamp(BS_KERNEL_LOAD_START);
+
+ if (UINT_MAX - page_size < imagesize_actual)
+ {
+ dprintf(CRITICAL,"Integer overflow detected in bootimage header fields %u %s\n", __LINE__,__func__);
+ return -1;
+ }
+
+ /*Check the availability of RAM before reading boot image + max signature length from flash*/
+ if (target_get_max_flash_size() < (imagesize_actual + page_size))
+ {
+ dprintf(CRITICAL, "bootimage size is greater than DDR can hold\n");
+ return -1;
+ }
+
+ offset = page_size;
+ /* Read image without signature and header */
+ if (flash_read(ptn, offset, (void *)(image_addr + offset), imagesize_actual - page_size))
+ {
+ dprintf(CRITICAL, "ERROR: Cannot read boot image\n");
+ return -1;
+ }
+
+ dprintf(INFO, "Loading (%s) image (%d): done\n",
+ (!boot_into_recovery ? "boot" : "recovery"), imagesize_actual);
+ bs_set_timestamp(BS_KERNEL_LOAD_DONE);
+
/* Authenticate Kernel */
if(target_use_signed_kernel() && (!device.is_unlocked))
{
- dprintf(INFO, "Loading (%s) image (%d): start\n",
- (!boot_into_recovery ? "boot" : "recovery"),imagesize_actual);
- bs_set_timestamp(BS_KERNEL_LOAD_START);
-
- if (UINT_MAX - page_size < imagesize_actual)
- {
- dprintf(CRITICAL,"Integer overflow detected in bootimage header fields %u %s\n", __LINE__,__func__);
- return -1;
- }
-
- /*Check the availability of RAM before reading boot image + max signature length from flash*/
- if (target_get_max_flash_size() < (imagesize_actual + page_size))
- {
- dprintf(CRITICAL, "bootimage size is greater than DDR can hold\n");
- return -1;
- }
- offset = page_size;
- /* Read image without signature and header*/
- if (flash_read(ptn, offset, (void *)(image_addr + offset), imagesize_actual - page_size))
- {
- dprintf(CRITICAL, "ERROR: Cannot read boot image\n");
- return -1;
- }
-
- dprintf(INFO, "Loading (%s) image (%d): done\n",
- (!boot_into_recovery ? "boot" : "recovery"), imagesize_actual);
- bs_set_timestamp(BS_KERNEL_LOAD_DONE);
-
offset = imagesize_actual;
+
/* Read signature */
if (flash_read(ptn, offset, (void *)(image_addr + offset), page_size))
{
@@ -1821,59 +1821,74 @@
}
verify_signed_bootimg((uint32_t)image_addr, imagesize_actual);
-
- /* Move kernel and ramdisk to correct address */
- memmove((void*) hdr->kernel_addr, (char*) (image_addr + page_size), hdr->kernel_size);
- memmove((void*) hdr->ramdisk_addr, (char*) (image_addr + page_size + kernel_actual), hdr->ramdisk_size);
-#if DEVICE_TREE
- if(dt_size != 0) {
-
- dt_table_offset = ((uint32_t)image_addr + page_size + kernel_actual + ramdisk_actual + second_actual);
-
- table = (struct dt_table*) dt_table_offset;
-
- if (dev_tree_validate(table, hdr->page_size, &dt_hdr_size) != 0){
- dprintf(CRITICAL, "ERROR: Cannot validate Device Tree Table \n");
- return -1;
- }
-
- /* Its Error if, dt_hdr_size (table->num_entries * dt_entry size + Dev_Tree Header)
- goes beyound hdr->dt_size*/
- if (dt_hdr_size > ROUND_TO_PAGE(dt_size, hdr->page_size)) {
- dprintf(CRITICAL, "ERROR: Invalid Device Tree size \n");
- return -1;
- }
-
- /* Find index of device tree within device tree table */
- if(dev_tree_get_entry_info(table, &dt_entry) != 0){
- dprintf(CRITICAL, "ERROR: Getting device tree address failed\n");
- return -1;
- }
-
- /* Validate and Read device device tree in the "tags_add */
- if (check_aboot_addr_range_overlap(hdr->tags_addr, dt_entry.size) ||
- check_ddr_addr_range_bound(hdr->tags_addr, dt_entry.size)){
- dprintf(CRITICAL, "Device tree addresses are not valid.\n");
- return -1;
- }
-
- if(dt_entry.offset > (UINT_MAX - dt_entry.size)) {
- dprintf(CRITICAL, "ERROR: Device tree contents are Invalid\n");
- return -1;
- }
-
- /* Ensure we are not overshooting dt_size with the dt_entry selected */
- if ((dt_entry.offset + dt_entry.size) > dt_size) {
- dprintf(CRITICAL, "ERROR: Device tree contents are Invalid\n");
- return -1;
- }
-
- best_match_dt_addr = (unsigned char *)table + dt_entry.offset;
- dtb_size = dt_entry.size;
- memmove((void *)hdr->tags_addr, (char *)best_match_dt_addr, dtb_size);
+ }
+ offset = page_size;
+ if(hdr->second_size != 0) {
+ if (UINT_MAX - offset < second_actual)
+ {
+ dprintf(CRITICAL, "ERROR: Integer overflow in boot image header %s\t%d\n",__func__,__LINE__);
+ return -1;
}
-#endif
+ offset += second_actual;
+ /* Second image loading not implemented. */
+ ASSERT(0);
+ }
+ /* Move kernel and ramdisk to correct address */
+ memmove((void*) hdr->kernel_addr, (char*) (image_addr + page_size), hdr->kernel_size);
+ memmove((void*) hdr->ramdisk_addr, (char*) (image_addr + page_size + kernel_actual), hdr->ramdisk_size);
+
+#if DEVICE_TREE
+ if(dt_size != 0) {
+
+ dt_table_offset = ((uint32_t)image_addr + page_size + kernel_actual + ramdisk_actual + second_actual);
+
+ table = (struct dt_table*) dt_table_offset;
+
+ if (dev_tree_validate(table, hdr->page_size, &dt_hdr_size) != 0) {
+ dprintf(CRITICAL, "ERROR: Cannot validate Device Tree Table \n");
+ return -1;
+ }
+
+ /* Its Error if, dt_hdr_size (table->num_entries * dt_entry size + Dev_Tree Header)
+ goes beyound hdr->dt_size*/
+ if (dt_hdr_size > ROUND_TO_PAGE(dt_size,hdr->page_size)) {
+ dprintf(CRITICAL, "ERROR: Invalid Device Tree size \n");
+ return -1;
+ }
+
+ /* Find index of device tree within device tree table */
+ if(dev_tree_get_entry_info(table, &dt_entry) != 0){
+ dprintf(CRITICAL, "ERROR: Getting device tree address failed\n");
+ return -1;
+ }
+
+ /* Validate and Read device device tree in the "tags_add */
+ if (check_aboot_addr_range_overlap(hdr->tags_addr, dt_entry.size) ||
+ check_ddr_addr_range_bound(hdr->tags_addr, dt_entry.size))
+ {
+ dprintf(CRITICAL, "Device tree addresses are not valid.\n");
+ return -1;
+ }
+
+ if(dt_entry.offset > (UINT_MAX - dt_entry.size)) {
+ dprintf(CRITICAL, "ERROR: Device tree contents are Invalid\n");
+ return -1;
+ }
+
+ /* Ensure we are not overshooting dt_size with the dt_entry selected */
+ if ((dt_entry.offset + dt_entry.size) > dt_size) {
+ dprintf(CRITICAL, "ERROR: Device tree contents are Invalid\n");
+ return -1;
+ }
+
+ best_match_dt_addr = (unsigned char *)table + dt_entry.offset;
+ dtb_size = dt_entry.size;
+ memmove((void *)hdr->tags_addr, (char *)best_match_dt_addr, dtb_size);
+ }
+#endif
+ if(target_use_signed_kernel() && (!device.is_unlocked))
+ {
/* Make sure everything from scratch address is read before next step!*/
if(device.is_tampered)
{
@@ -1883,121 +1898,7 @@
set_tamper_flag(device.is_tampered);
#endif
}
- else
- {
- dprintf(INFO, "Loading (%s) image (%d): start\n",
- (!boot_into_recovery ? "boot" : "recovery"), kernel_actual + ramdisk_actual);
- bs_set_timestamp(BS_KERNEL_LOAD_START);
-
- offset = page_size;
- if (UINT_MAX - offset < kernel_actual)
- {
- dprintf(CRITICAL, "ERROR: Integer overflow in boot image header %s\t%d\n",__func__,__LINE__);
- return -1;
- }
- if (flash_read(ptn, offset, (void *)hdr->kernel_addr, kernel_actual)) {
- dprintf(CRITICAL, "ERROR: Cannot read kernel image\n");
- return -1;
- }
- offset += kernel_actual;
- if (UINT_MAX - offset < ramdisk_actual)
- {
- dprintf(CRITICAL, "ERROR: Integer overflow in boot image header %s\t%d\n",__func__,__LINE__);
- return -1;
- }
- if (flash_read(ptn, offset, (void *)hdr->ramdisk_addr, ramdisk_actual)) {
- dprintf(CRITICAL, "ERROR: Cannot read ramdisk image\n");
- return -1;
- }
-
- offset += ramdisk_actual;
-
- dprintf(INFO, "Loading (%s) image (%d): done\n",
- (!boot_into_recovery ? "boot" : "recovery"), kernel_actual + ramdisk_actual);
-
- bs_set_timestamp(BS_KERNEL_LOAD_DONE);
-
- if(hdr->second_size != 0) {
- if (UINT_MAX - offset < second_actual)
- {
- dprintf(CRITICAL, "ERROR: Integer overflow in boot image header %s\t%d\n",__func__,__LINE__);
- return -1;
- }
- offset += second_actual;
- /* Second image loading not implemented. */
- ASSERT(0);
- }
-
-#if DEVICE_TREE
- if(dt_size != 0) {
-
- /* Read the device tree table into buffer */
- if(flash_read(ptn, offset, (void *) dt_buf, page_size)) {
- dprintf(CRITICAL, "ERROR: Cannot read the Device Tree Table\n");
- return -1;
- }
-
- table = (struct dt_table*) dt_buf;
-
- if (dev_tree_validate(table, hdr->page_size, &dt_hdr_size) != 0) {
- dprintf(CRITICAL, "ERROR: Cannot validate Device Tree Table \n");
- return -1;
- }
-
- /* Its Error if, dt_hdr_size (table->num_entries * dt_entry size + Dev_Tree Header)
- goes beyound hdr->dt_size*/
- if (dt_hdr_size > ROUND_TO_PAGE(dt_size,hdr->page_size)) {
- dprintf(CRITICAL, "ERROR: Invalid Device Tree size \n");
- return -1;
- }
-
- table = (void *) target_get_scratch_address();
- /*Check the availability of RAM before reading boot image + max signature length from flash*/
- if (target_get_max_flash_size() < dt_actual)
- {
- dprintf(CRITICAL, "ERROR: dt_image size is greater than DDR can hold\n");
- return -1;
- }
-
- /* Read the entire device tree table into buffer */
- if(flash_read(ptn, offset, (void *)table, dt_actual)) {
- dprintf(CRITICAL, "ERROR: Cannot read the Device Tree Table\n");
- return -1;
- }
-
- /* Find index of device tree within device tree table */
- if(dev_tree_get_entry_info(table, &dt_entry) != 0){
- dprintf(CRITICAL, "ERROR: Getting device tree address failed\n");
- return -1;
- }
-
- /* Validate and Read device device tree in the "tags_add */
- if (check_aboot_addr_range_overlap(hdr->tags_addr, dt_entry.size) ||
- check_ddr_addr_range_bound(hdr->tags_addr, dt_entry.size))
- {
- dprintf(CRITICAL, "Device tree addresses are not valid.\n");
- return -1;
- }
-
- if(dt_entry.offset > (UINT_MAX - dt_entry.size)) {
- dprintf(CRITICAL, "ERROR: Device tree contents are Invalid\n");
- return -1;
- }
-
- /* Ensure we are not overshooting dt_size with the dt_entry selected */
- if ((dt_entry.offset + dt_entry.size) > dt_size) {
- dprintf(CRITICAL, "ERROR: Device tree contents are Invalid\n");
- return -1;
- }
-
- best_match_dt_addr = (unsigned char *)table + dt_entry.offset;
- dtb_size = dt_entry.size;
- memmove((void *)hdr->tags_addr, (char *)best_match_dt_addr, dtb_size);
- }
-#endif
-
- }
continue_boot:
/* TODO: create/pass atags to kernel */
diff --git a/app/aboot/fastboot.c b/app/aboot/fastboot.c
index d82f3e5..d605efb 100644
--- a/app/aboot/fastboot.c
+++ b/app/aboot/fastboot.c
@@ -720,7 +720,7 @@
fastboot_register("upload", cmd_upload);
fastboot_publish("version", "0.5");
- thr = thread_create("fastboot", fastboot_handler, 0, DEFAULT_PRIORITY, 4096);
+ thr = thread_create("fastboot", fastboot_handler, 0, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
if (!thr)
{
goto fail_alloc_in;
diff --git a/arch/arm/crt0.S b/arch/arm/crt0.S
index be6d4d6..51c9a2e 100644
--- a/arch/arm/crt0.S
+++ b/arch/arm/crt0.S
@@ -191,5 +191,5 @@
* dynamically allocated stack, so we don't need it for very long
*/
abort_stack:
- .skip 2048
+ .skip 4096
abort_stack_top:
diff --git a/include/kernel/thread.h b/include/kernel/thread.h
index 6c25712..5f8b42b 100644
--- a/include/kernel/thread.h
+++ b/include/kernel/thread.h
@@ -92,8 +92,8 @@
#define DEFAULT_PRIORITY (NUM_PRIORITIES / 2)
#define HIGH_PRIORITY ((NUM_PRIORITIES / 4) * 3)
-/* stack size */
-#define DEFAULT_STACK_SIZE 8192
+/* stack size - 12kb per thread (12 * 1024) */
+#define DEFAULT_STACK_SIZE 12288
/* functions */
void thread_init_early(void);
diff --git a/platform/msm_shared/crypto5_eng.c b/platform/msm_shared/crypto5_eng.c
index 933d30b..b7c9e7b 100644
--- a/platform/msm_shared/crypto5_eng.c
+++ b/platform/msm_shared/crypto5_eng.c
@@ -361,16 +361,18 @@
crypto_SHA1_ctx *sha1_ctx = (crypto_SHA1_ctx *) ctx_ptr;
uint32_t i = 0;
uint32_t iv_len = 0;
- uint32_t *auth_iv = sha1_ctx->auth_iv;
+ uint32_t *auth_iv = NULL;
uint32_t seg_cfg_val;
if(auth_alg == CRYPTO_AUTH_ALG_SHA1)
{
iv_len = SHA1_INIT_VECTOR_SIZE;
+ auth_iv = sha1_ctx->auth_iv;
}
else if(auth_alg == CRYPTO_AUTH_ALG_SHA256)
{
iv_len = SHA256_INIT_VECTOR_SIZE;
+ auth_iv = sha256_ctx->auth_iv;
}
seg_cfg_val = crypto5_get_sha_cfg(ctx_ptr, auth_alg);
diff --git a/project/msm8909.mk b/project/msm8909.mk
index f7525f9..07815f2 100644
--- a/project/msm8909.mk
+++ b/project/msm8909.mk
@@ -14,6 +14,11 @@
EMMC_BOOT := 1
+ifeq ($(ENABLE_DISPLAY),1)
+DEFINES += ENABLE_DISPLAY=1
+DEFINES += DISPLAY_SPLASH_SCREEN=1
+endif
+
ifeq ($(VERIFIED_BOOT),1)
ENABLE_SECAPP_LOADER := 1
ENABLE_RPMB_SUPPORT := 1
diff --git a/target/msm8909/rules.mk b/target/msm8909/rules.mk
index 5dbd21a..1550990 100644
--- a/target/msm8909/rules.mk
+++ b/target/msm8909/rules.mk
@@ -11,10 +11,6 @@
BASE_ADDR := 0x80000000
SCRATCH_ADDR := 0x90100000
-ifeq ($(ENABLE_DISPLAY),1)
-DEFINES += ENABLE_DISPLAY=1
-DEFINES += DISPLAY_SPLASH_SCREEN=1
-endif
DEFINES += DISPLAY_TYPE_MIPI=1
DEFINES += DISPLAY_TYPE_DSI6G=1
DEFINES += NO_ALARM_DISPLAY=0
diff --git a/target/msm8953/rules.mk b/target/msm8953/rules.mk
index 1957d9c..aef1150 100644
--- a/target/msm8953/rules.mk
+++ b/target/msm8953/rules.mk
@@ -9,7 +9,7 @@
PLATFORM := msm8953
MEMBASE := 0x8F600000 # SDRAM
-MEMSIZE := 0x00400000 # 1MB
+MEMSIZE := 0x00600000 # 6MB
BASE_ADDR := 0x80000000
SCRATCH_ADDR := 0xA0100000