From: Seung-Woo Kim Date: Fri, 10 Feb 2017 04:59:26 +0000 (+0900) Subject: tizen: fix to load kernel image with partition information X-Git-Tag: accepted/tizen/mobile/20170306.102415~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F17%2F114117%2F1;p=profile%2Fmobile%2Fplatform%2Fkernel%2Fu-boot-tm1.git tizen: fix to load kernel image with partition information This patch fixes to load kernel image with partition information instead of hard coded block offset of emmc. Change-Id: I4026c517a272e358acbd018473549c15689300ec Signed-off-by: Seung-Woo Kim --- diff --git a/include/configs/tizen_tm1.h b/include/configs/tizen_tm1.h index 4830323..c815126 100644 --- a/include/configs/tizen_tm1.h +++ b/include/configs/tizen_tm1.h @@ -60,7 +60,7 @@ //#define CONFIG_YAFFS2 1 //#define BOOT_PART "boot" -#define BOOT_PART "KERNEL" +#define BOOT_PART "kernel" #define RECOVERY_PART "recovery" #define UBIPAC_PART "ubipac" diff --git a/property/normal_emc_mode.c b/property/normal_emc_mode.c index e364956..cba588b 100644 --- a/property/normal_emc_mode.c +++ b/property/normal_emc_mode.c @@ -519,16 +519,24 @@ LOCAL int _boot_load_kernel_ramdisk_image(block_dev_desc_t * dev, char *bootmode uint32 size, offset; uint32 dt_img_adr; uint32 secure_boot_offset = 0; + disk_partition_t info; if (0 == memcmp(bootmode, RECOVERY_PART, strlen(RECOVERY_PART))) { partition = L"recovery"; debugf("enter recovery mode!\n"); } else { - partition = BOOT_PART; - debugf("Enter boot mode (partition name: %s)\n", partition); + partition = L""BOOT_PART; + debugf("Enter boot mode (partition name: %s)\n", w2c(partition)); } - if (!blk_data_read(0x2C00000, sizeof(*hdr), hdr)) { + if (get_partition_info_by_name(dev, partition, &info)) { + debugf("get partition %s info failed!\n", w2c(partition)); + return 0; + } + + offset = info.start * info.blksz; + + if (!blk_data_read(offset, sizeof(*hdr), hdr)) { debugf("%s:%s read error!\n", __FUNCTION__, w2c(partition)); return 0; } @@ -547,7 +555,7 @@ LOCAL int _boot_load_kernel_ramdisk_image(block_dev_desc_t * dev, char *bootmode debugf("bzImage size: %x\n", size); - if (!blk_data_read(0x2C00000, size, KERNEL_ADR - roundup(sizeof(*hdr), ALIGN_SIZE))) { + if (!blk_data_read(offset, size, KERNEL_ADR - roundup(sizeof(*hdr), ALIGN_SIZE))) { debugf("%s:%s kernel read error!\n", __FUNCTION__, w2c(partition)); return 0; }