summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-10-24 07:08:01 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-10-24 07:08:01 +0000
commitb9ae7cabaeb9b36a5836d909810504927b758922 (patch)
tree64c82c13a1c6e9937c69860c0e9ccfeb6ad0e918
parent69554e2d9ad098dec5cfd2146895d8129fb367a1 (diff)
parent1f5ec8bc765066e8b9492c3b01d879962cf7e9f7 (diff)
downloadkoi-uboot-pie-wear-dr.tar.gz
Snap for 5087602 from 1f5ec8bc765066e8b9492c3b01d879962cf7e9f7 to pi-wear-dr-kingyo-releasepie-wear-dr
Change-Id: I25fbde2f89bc67660b86a02335ec9ac404bedb75
-rw-r--r--arch/arm/cpu/armv7/exynos/movi_partition.c20
-rw-r--r--arch/arm/include/asm/arch-exynos/movi_partition.h20
-rw-r--r--board/samsung/koi/koi.c258
-rw-r--r--common/cmd_fastboot.c438
-rw-r--r--common/cmd_movi.c50
-rw-r--r--common/main.c10
-rw-r--r--disk/part_efi.c2
-rw-r--r--drivers/video/display.c51
-rw-r--r--include/configs/koi.h52
-rw-r--r--tools/mkblimg.c7
10 files changed, 365 insertions, 543 deletions
diff --git a/arch/arm/cpu/armv7/exynos/movi_partition.c b/arch/arm/cpu/armv7/exynos/movi_partition.c
index 80229bbce..036822c72 100644
--- a/arch/arm/cpu/armv7/exynos/movi_partition.c
+++ b/arch/arm/cpu/armv7/exynos/movi_partition.c
@@ -87,24 +87,6 @@ int init_raw_area_table(block_dev_desc_t * dev_desc, int location)
image[part_num].start_blk = image[part_num].start_blk + 1;
part_num++;
- /* image 5 should be kernel */
- image[part_num].start_blk = image[part_num - 1].start_blk + MOVI_ENV_BLKCNT;
- image[part_num].used_blk = MOVI_ZIMAGE_BLKCNT;
- image[part_num].size = PART_SIZE_KERNEL;
- image[part_num].attribute = 0x5;
- strcpy(image[part_num].description, "kernel");
- dbg("knl: %d\n", image[part_num].start_blk);
- part_num++;
-
- /* image 6 should be RFS */
- image[part_num].start_blk = image[part_num - 1].start_blk + MOVI_ZIMAGE_BLKCNT;
- image[part_num].used_blk = MOVI_ROOTFS_BLKCNT;
- image[part_num].size = PART_SIZE_ROOTFS;
- image[part_num].attribute = 0x6;
- strcpy(image[part_num].description, "rfs");
- dbg("rfs: %d\n", image[part_num].start_blk);
- part_num++;
-
#ifdef CONFIG_CHARGER_LOGO
/* image 7 should be Charger */
image[part_num].start_blk = image[part_num - 1].start_blk + MOVI_ROOTFS_BLKCNT;
@@ -120,7 +102,7 @@ int init_raw_area_table(block_dev_desc_t * dev_desc, int location)
#ifdef CONFIG_CHARGER_LOGO
image[part_num].start_blk = image[part_num - 1].start_blk + MOVI_CHARGER_LOGO_BLKCNT;
#else
- image[part_num].start_blk = image[part_num - 1].start_blk + MOVI_ROOTFS_BLKCNT;
+ image[part_num].start_blk = MOVI_BOOT_LOGO_START_BLK;
#endif
image[part_num].used_blk = MOVI_BOOT_LOGO_BLKCNT;
image[part_num].size = PART_SIZE_BOOT_LOGO;
diff --git a/arch/arm/include/asm/arch-exynos/movi_partition.h b/arch/arm/include/asm/arch-exynos/movi_partition.h
index debcf5394..1414d7066 100644
--- a/arch/arm/include/asm/arch-exynos/movi_partition.h
+++ b/arch/arm/include/asm/arch-exynos/movi_partition.h
@@ -27,20 +27,6 @@
#define PART_SIZE_BL2 (16 * 1024)
#define PART_SIZE_UBOOT (328 * 1024)
-#if defined(CONFIG_CPU_EXYNOS5260) || defined(CONFIG_CPU_EXYNOS3250)
-#define PART_SIZE_KERNEL (8 * 1024 * 1024)
-#elif defined(CONFIG_CPU_EXYNOS5430) || defined(CONFIG_CPU_EXYNOS5412)
-#define PART_SIZE_KERNEL (5 * 1024 * 1024)
-#else
-#define PART_SIZE_KERNEL (4 * 1024 * 1024)
-#endif
-
-#if defined(CONFIG_CPU_EXYNOS3250)
-#define PART_SIZE_ROOTFS (1 * 1024 * 1024)
-#else
-#define PART_SIZE_ROOTFS (26 * 1024 * 1024)
-#endif
-
#if defined(CONFIG_EXYNOS4X12) || defined(CONFIG_CPU_EXYNOS5250) || defined(CONFIG_CPU_EXYNOS3250)
#define PART_SIZE_TZSW (156 * 1024)
#else
@@ -48,7 +34,7 @@
#endif
#if defined(CONFIG_BOOT_LOGO)
-#define PART_SIZE_BOOT_LOGO (4 * 1024 * 1024)
+#define PART_SIZE_BOOT_LOGO (640 * 1024)
#endif
#if defined(CONFIG_CHARGER_LOGO)
@@ -71,8 +57,6 @@
#define MOVI_BL2_BLKCNT (PART_SIZE_BL2 / MOVI_BLKSIZE)
#define MOVI_ENV_BLKCNT (CONFIG_ENV_SIZE / MOVI_BLKSIZE) /* 16KB */
#define MOVI_UBOOT_BLKCNT (PART_SIZE_UBOOT / MOVI_BLKSIZE) /* 328KB */
-#define MOVI_ZIMAGE_BLKCNT (PART_SIZE_KERNEL / MOVI_BLKSIZE) /* 4MB */
-#define MOVI_ROOTFS_BLKCNT (PART_SIZE_ROOTFS / MOVI_BLKSIZE) /* 26MB */
#define MOVI_TZSW_BLKCNT (PART_SIZE_TZSW / MOVI_BLKSIZE) /* 160KB */
#if defined(CONFIG_CHARGER_LOGO)
@@ -80,6 +64,8 @@
#endif
#if defined(CONFIG_BOOT_LOGO)
+#define MOVI_BOOT_LOGO_START_OLD_BLK 0x4c27
+#define MOVI_BOOT_LOGO_START_BLK 0x800
#define MOVI_BOOT_LOGO_BLKCNT (PART_SIZE_BOOT_LOGO / MOVI_BLKSIZE)
#endif
diff --git a/board/samsung/koi/koi.c b/board/samsung/koi/koi.c
index 4ba7c151e..31f4cd416 100644
--- a/board/samsung/koi/koi.c
+++ b/board/samsung/koi/koi.c
@@ -53,6 +53,10 @@ static unsigned long part_blknum[MAX_GPT_PART] = {
};
#endif
+void Lcd_copy_old_logo(void);
+void Lcd_read_bootlogo(void);
+int s5p_lcd_draw_bootlogo(void);
+
#define DEV_NUM 0
DECLARE_GLOBAL_DATA_PTR;
@@ -334,15 +338,8 @@ static void set_dieid(char *buf)
setenv("dieid#", &dieid);
}
-#define INFO_ENTRY_NUM 7
-/*
- * return:
- * 0: all information was already written
- * -1: empty
- * 1=<: information is insufficient
- */
-static int get_bootarg_from_info_partition(char *buf)
+static int get_bootarg_from_nvinfo_partition(char *buf)
{
unsigned long start, count;
unsigned char pid;
@@ -351,9 +348,8 @@ static int get_bootarg_from_info_partition(char *buf)
char startstr[20];
char arg[50];
char *p;
- int entry_num = INFO_ENTRY_NUM;
- get_boot_part_info(dev_num, 7, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_NVINFO, &start, &count, &pid);
if (pid != 0x83 && pid != 0xee)
return -1;
@@ -381,31 +377,25 @@ static int get_bootarg_from_info_partition(char *buf)
strncat(buf, p, 16);
/* also set the die-id based on serial no */
set_dieid(p);
- --entry_num;
} else {
- return -1;
+ strcat(buf, " androidboot.serialno=0123456789abcdef");
}
if (strncmp("btmac", (char *)0x48000018, 5) == 0) {
p = (char *)0x4800001e;
strcat(buf, " board_shiri_bluetooth.btmac=");
strncat(buf, p, 17);
- --entry_num;
}
if (strncmp("wifimac", (char *)0x48000030, 7) == 0) {
p = (char *)0x48000038;
strcat(buf, " board_wifi_bcm.wifimac=");
strncat(buf, p, 17);
- --entry_num;
- }
- if (strncmp("mfprocno", (char *)0x4800004a, 8) == 0) {
- --entry_num;
- }
- if (strncmp("mfchkunit", (char *)0x48000059, 9) == 0) {
- --entry_num;
- }
- if (strncmp("mfchkdate", (char *)0x48000073, 9) == 0) {
- --entry_num;
}
+// if (strncmp("mfprocno", (char *)0x4800004a, 8) == 0) {
+// }
+// if (strncmp("mfchkunit", (char *)0x48000059, 9) == 0) {
+// }
+// if (strncmp("mfchkdate", (char *)0x48000073, 9) == 0) {
+// }
if (strncmp("micgain", (char *)0x480000b7, 7) == 0) {
p = (char *)0x480000bf;
strcat(buf, " snd_soc_koi_ak4678.MicGain=");
@@ -417,23 +407,8 @@ static int get_bootarg_from_info_partition(char *buf)
sprintf(startstr, "%d", tmp);
strcat(buf, " snd_soc_koi_ak4678.IDVol=");
strcat(buf, startstr);
- --entry_num;
- }
- return entry_num;
-}
-
-static int copy_info_partition(void)
-{
- char arg[50];
-
- strcpy(arg, "mmc read 0 0x48000000 0x72AD10 0x1");
- run_command(arg, 0);
- if (strncmp("serial", (char *)0x48000000, 6) == 0) {
- strcpy(arg, "mmc write 0 0x48000000 0x72C000 0x1");
- run_command(arg, 0);
- return 0;
}
- return -1;
+ return 0;
}
@@ -450,50 +425,61 @@ static void get_bootarg_from_img_hdr(char *buf)
}
}
+static int restore_recovery(void)
+{
+ struct fastboot_boot_img_hdr *fb_hdr = (struct fastboot_boot_img_hdr *)mkbootimg_hdr;
+ char arg[50];
+
+ if (memcmp(fb_hdr->magic, (void *)FASTBOOT_BOOT_MAGIC, 8) == 0)
+ return 0;
+
+ sprintf(arg, "mmc read 0 0x48000000 0x%x 0xA000", CONFIG_RECOVERY_PARTITION_OLD_BLK);
+ run_command(arg, 0);
+ if (memcmp((void *)0x48000000, (void *)FASTBOOT_BOOT_MAGIC, 8)) {
+ printf("There is no valid recovery\n");
+ return 0;
+ }
+ sprintf(arg, "mmc write 0 0x48000000 0x%x 0xA000", CONFIG_RECOVERY_PARTITION_BLK);
+ run_command(arg, 0);
+ memcpy(mkbootimg_hdr, (void *)0x48000000, CFG_FASTBOOT_MKBOOTIMAGE_PAGE_SIZE);
+
+ return 1;
+}
+
static void rw_img_hdr(int recovery, char *rw)
{
char arg[50];
- char str[20];
- int partition_blk;
+ int partition_blk = recovery ? CONFIG_RECOVERY_PARTITION_BLK : CONFIG_BOOT_PARTITION_BLK;
- sprintf(arg, "mmc %s 0 0x%x ", rw, mkbootimg_hdr);
- if (recovery)
- partition_blk = CONFIG_RECOVERY_PARTITION_BLK;
- else
- partition_blk = CONFIG_BOOT_PARTITION_BLK;
- sprintf(str, "0x%x 0x4", partition_blk);
- strcat(arg, str);
+ sprintf(arg, "mmc %s 0 0x%x 0x%x 0x4", rw, mkbootimg_hdr, partition_blk);
run_command(arg, 0);
}
-void check_update_bootloader(void)
+static int check_update_bootloader(void)
{
unsigned long start, count;
unsigned char pid;
int dev_num = 0;
- char startstr[20];
char arg[50];
- get_boot_part_info(dev_num, 8, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_BLOADER, &start, &count, &pid);
if (pid != 0x83 && pid != 0xee)
- return;
+ return 0;
- strcpy(arg, "mmc read 0 0x48000000 ");
- sprintf(startstr, "0x%x ", start);
- strcat(arg, startstr);
- strcat(arg, "0x1000");
+ sprintf(arg, "mmc read 0 0x48000000 0x%x 0x1000", start);
run_command(arg, 0);
- if (memcmp(FASTBOOT_BOOTLOADER_MAGIC, (char *)0x48000000, 8) == 0) {
- write_bootloader_img((unsigned char *)0x48000000);
- /* zero-out the first byte of bootloader partition */
- memset((void *)0x48000000, 0, 4);
- strcpy(arg, "mmc write 0 0x48000000 ");
- sprintf(startstr, "0x%x ", start);
- strcat(arg, startstr);
- strcat(arg, "0x1");
- run_command(arg, 0);
- }
+ if (memcmp(FASTBOOT_BOOTLOADER_MAGIC, (char *)0x48000000, 8))
+ return 0;
+
+ write_bootloader_img((unsigned char *)0x48000000);
+
+ /* zero-out the first byte of bootloader partition */
+ memset((void *)0x48000000, 0, 8);
+ sprintf(arg, "mmc write 0 0x48000000 0x%x 0x1", start);
+ run_command(arg, 0);
+
+ return 1;
}
static int rw_raw_kernel(int recovery, unsigned char *buffer, char *rw)
@@ -547,6 +533,7 @@ void boot_kernel(int recovery)
struct fastboot_boot_img_hdr *fb_hdr = (struct fastboot_boot_img_hdr *)mkbootimg_hdr;
char ramdisk_size[32];
+ printf("boot_kernel %d\n", recovery);
/* write protect boot(u-boot, bl1, ...) partition */
run_command("mmc_wp 0x0 1 0", 0);
rw_raw_kernel(recovery, NULL, "read");
@@ -723,20 +710,18 @@ static int check_recovery_in_misc(void)
unsigned long start, count;
unsigned char pid;
int dev_num = 0;
- char startstr[20];
char arg[50];
- get_boot_part_info(dev_num, 5, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_MISC, &start, &count, &pid);
if (pid != 0x83 && pid != 0xee)
return 0;
- strcpy(arg, "mmc read 0 0x48000000 ");
- sprintf(startstr, "0x%x ", start);
- strcat(arg, startstr);
- strcat(arg, "0x1");
+ sprintf(arg, "mmc read 0 0x48000000 0x%x 0x1", start);
run_command(arg, 0);
- if (strncmp("boot-recovery", (char *)0x48000000, 13) == 0)
+ if (strncmp("boot-recovery", (char *)0x48000000, 13) == 0) {
+ printf("found boot-recovery\n");
return 1;
+ }
return 0;
}
@@ -787,48 +772,32 @@ int board_late_init(void)
pmic_set_ldo2_voltage();
}
-#ifdef CONFIG_RECOVERY_MODE
- u32 second_boot_info = readl(CONFIG_SECONDARY_BOOT_INFORM_BASE);
+ if (OmPin != BOOT_MMCSD) {
+ run_command("lcd 0", 0);
- if (second_boot_info == 1) {
- printf("###Recovery Mode(SDMMC)###\n");
- writel(0x0, CONFIG_SECONDARY_BOOT_INFORM_BASE);
- setenv("bootcmd", CONFIG_RECOVERYCOMMAND_SDMMC);
- }
-#ifdef CONFIG_EXYNOS_DA
- second_boot_info = readl(CONFIG_SECONDARY_BOOT_INFORM_BASE);
- if (second_boot_info == 2) {
- printf("###USB Download### om:%d\n", readl(&pmu->inform3));
- writel(0x0, CONFIG_SECONDARY_BOOT_INFORM_BASE);
- writel(BOOT_EMMC_4_4, &pmu->inform3);
- run_command(CFG_DNW_AUTO_CFG_PARTITION, 0); // make partition
- setenv("bootcmd", "dnw v05");
- printf("###USB Download### om:%d\n", readl(&pmu->inform3));
- }
-#endif
-#endif
- if (OmPin != BOOT_MMCSD) {
- run_command("lcd 0", 0);
-
- mode = readl(&pmu->inform4);
- if (mode == 0) { // normal boot
- pressed_key = check_key();
- if (pressed_key & 1) { // Volume up
- if (select_mode() == 0) {
- mode = CONFIG_FASTBOOT_MODE;
- show_selected(0, 1);
- } else {
- mode = CONFIG_FACTORY_RESET_MODE;
- show_selected(1, 1);
+ Lcd_read_bootlogo();
+ if (s5p_lcd_draw_bootlogo()) {
+ Lcd_copy_old_logo();
+ s5p_lcd_draw_bootlogo();
+ }
+
+ mode = readl(&pmu->inform4);
+ if (mode == 0) { // normal boot
+ pressed_key = check_key();
+ if (pressed_key & 1) { // Volume up
+ if (select_mode() == 0) {
+ mode = CONFIG_FASTBOOT_MODE;
+ show_selected(0, 1);
+ } else {
+ mode = CONFIG_FACTORY_RESET_MODE;
+ show_selected(1, 1);
+ }
}
+ } else if (mode == CONFIG_FASTBOOT_MODE) {
+ show_selected(0, 1);
}
- } else if (mode == CONFIG_FASTBOOT_MODE) {
- show_selected(0, 1);
- } else if (mode == CONFIG_FACTORY_RESET_MODE) {
- Lcd_read_bootlogo();
- s5p_lcd_draw_bootlogo();
}
- }
+
memset(tmp_buf,0,sizeof(tmp_buf));
if (OmPin == BOOT_MMCSD) {
@@ -846,42 +815,14 @@ int board_late_init(void)
} else {
int create_gpt = 0;
- if (find_gpt_part_name("recovery") != 0
- || find_gpt_part_name("boot") != 0
- || find_gpt_part_name("info") != 0
- || find_gpt_part_name("bootloader") != 0) {
+ if (find_gpt_part_name("nvinfo") != 0 ||
+ find_gpt_part_name("bloader") != 0) {
create_gpt = 1;
} else if (model && find_gpt_part_name("oem") != 0) {
create_gpt = 1;
} else if (model == 0 && find_gpt_part_name("oem") == 0) {
create_gpt = 1;
}
- #if 0
- else {
- unsigned long start, count;
- unsigned char pid;
- int i;
-
- /* check if partitions are aligned with the partition
- * information obtained from the partition table.
- */
- for (i = 0; i < MAX_GPT_PART; i++) {
- get_boot_part_info(DEV_NUM, i+1, &start, &count, &pid);
- if (i == 0 && start != CONFIG_GPT_RECOVERY_START_BLK) {
- create_gpt = 1;
- break;
- } else if (pid != 0xee) {
- printf("Part%d: NOT GPT PARTITION ERROR !!\n", i);
- create_gpt = 1;
- break;
- } else if (count != part_blknum[i]) {
- printf("Part%d: Block Number differ!!\n", i);
- create_gpt = 1;
- break;
- }
- }
- }
- #endif
if (create_gpt) {
run_command("env default -f",0);
// run_command("run make_gpt_part",0);
@@ -899,37 +840,36 @@ int board_late_init(void)
else
strcat(tmp_buf, "androidboot.hardware=koi");
- if ((ret = get_bootarg_from_info_partition(tmp_buf)) < 0) {
- if (copy_info_partition() == 0) // copy from old location
- ret = get_bootarg_from_info_partition(tmp_buf); // retry
- }
+ ret = get_bootarg_from_nvinfo_partition(tmp_buf);
if (ret == 0) {
/* power-on write protect info partition */
run_command("mmc_wp 0x72c000 1 1", 0);
}
- if (check_recovery_in_misc())
- mode = CONFIG_FACTORY_RESET_MODE;
- rw_img_hdr(mode==CONFIG_FACTORY_RESET_MODE ? 1:0, "read");
- get_bootarg_from_img_hdr(tmp_buf);
- setenv("bootargs", tmp_buf);
-
- if (mode == CONFIG_FACTORY_RESET_MODE) {
+ if (check_update_bootloader()) {
writel(CONFIG_UPDATE_RESET_MODE, &pmu->inform4);
- boot_kernel(1);
+ printf("bootloader update complete\n");
+ run_command("reset", 0);
}
- if (mode == CONFIG_UPDATE_RESET_MODE) {
+ rw_img_hdr(1, "read");
+ if (restore_recovery() || mode == CONFIG_UPDATE_RESET_MODE) {
+ mode = CONFIG_FACTORY_RESET_MODE;
+ printf("goto recovery 2nd-phase\n");
writel(0x0, &pmu->inform4);
- /* check if we need to update the bootloader as well */
- check_update_bootloader();
-
- run_command(CONFIG_UPDATE_RESET_COMMAND, 0);
}
+ if (mode == 0 && check_recovery_in_misc())
+ mode = CONFIG_FACTORY_RESET_MODE;
+ rw_img_hdr(mode == CONFIG_FACTORY_RESET_MODE ? 1 : 0, "read");
+ get_bootarg_from_img_hdr(tmp_buf);
+ setenv("bootargs", tmp_buf);
+
+ if (mode == CONFIG_FACTORY_RESET_MODE)
+ boot_kernel(1);
- if(mode == CONFIG_FASTBOOT_MODE) {
+ if (mode == CONFIG_FASTBOOT_MODE) {
writel(0x0, &pmu->inform4);
printf("Download Mode \n");
run_command("fastboot", 0);
diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index 2708f962e..39f628576 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -517,11 +517,6 @@ static int write_to_ptn_sdmmc(struct fastboot_ptentry *ptn, unsigned int addr, u
char dev_num[2];
char *argv[6] = { NULL, NULL, NULL, NULL, NULL, NULL, };
int argc = 0;
- char *nul_buf;
-#if defined(CONFIG_MMC_64BIT_BUS) || defined(CONFIG_CPU_EXYNOS5410_EVT2)
- char *nul_buf_align;
-#endif
- struct mmc *mmc;
if ((ptn->length != 0) && (size > ptn->length))
{
@@ -536,7 +531,7 @@ static int write_to_ptn_sdmmc(struct fastboot_ptentry *ptn, unsigned int addr, u
if (ptn->flags & FASTBOOT_PTENTRY_FLAGS_USE_MMC_CMD)
{
- if (addr && check_compress_ext4((char*)addr,ptn->length) != 0) {
+ if (check_compress_ext4((char*)addr,ptn->length) != 0) {
argv[2] = device;
argv[3] = buffer;
argv[4] = start;
@@ -550,76 +545,8 @@ static int write_to_ptn_sdmmc(struct fastboot_ptentry *ptn, unsigned int addr, u
ret = do_mmcops(NULL, 0, 6, argv);
} else {
- uint bl_st = ptn->start / CFG_FASTBOOT_SDMMC_BLOCKSIZE;
- uint bl_cnt = ptn->length / CFG_FASTBOOT_SDMMC_BLOCKSIZE;
-
printf("Compressed ext4 image\n");
-#if defined(CONFIG_MMC_64BIT_BUS) || defined(CONFIG_CPU_EXYNOS5410_EVT2)
- nul_buf_align = calloc(sizeof(char), 512*1024 + 4);
- if (((unsigned int)nul_buf_align % 8) == 0)
- nul_buf = nul_buf_align;
- else
- nul_buf = nul_buf_align + 4;
-#else
- nul_buf = calloc(sizeof(char), 512*1024);
-#endif
- if (nul_buf == NULL) {
- printf("Error: calloc failed for nul_buf\n");
- ret = 1;
- return ret;
- }
-
- mmc = find_mmc_device(DEV_NUM);
-
- if (bl_st&0x3ff)
- {
- mmc->block_dev.block_write(DEV_NUM, bl_st, 1024 -(bl_st&0x3ff), nul_buf);
-
- printf("*** erase start block 0x%x ***\n", bl_st);
-
- bl_cnt = bl_cnt - (1024-(bl_st&0x3ff));
- bl_st = (bl_st&(~0x3ff))+1024;
- }
-
- if (bl_cnt&0x3ff)
- {
- mmc->block_dev.block_write(DEV_NUM, bl_st+bl_cnt-(bl_cnt&0x3ff), bl_cnt&0x3ff, nul_buf);
-
- printf("*** erase block length 0x%x ***\n", bl_cnt);
-
- bl_cnt = bl_cnt - (bl_cnt&0x3ff);
- }
-
-#if defined(CONFIG_MMC_64BIT_BUS) || defined(CONFIG_CPU_EXYNOS5410_EVT2)
- free(nul_buf_align);
-#else
- free(nul_buf);
-#endif
-
- if (bl_cnt>>10)
- {
- argv[2] = buffer;
- argv[3] = device;
- argv[4] = start;
- argv[5] = length;
-
- sprintf(cmd, "erase");
- sprintf(buffer, "user");
- sprintf(device, "%d", DEV_NUM);
- sprintf(start, "%x", bl_st);
- sprintf(length, "%x", bl_cnt);
- printf("mmc %s %s %s %s %s\n", argv[1], argv[2], argv[3], argv[4], argv[5]);
-
- ret = do_mmcops(NULL, 0, 6, argv);
- }
- else
- {
- printf("*** erase block length too small ***\n");
- }
- if (addr == 0)
- return 0;
-
ret = write_compressed_ext4((char*)addr,
ptn->start / CFG_FASTBOOT_SDMMC_BLOCKSIZE);
}
@@ -739,6 +666,114 @@ static int write_to_ptn_sdmmc(struct fastboot_ptentry *ptn, unsigned int addr, u
return ret;
}
+
+static int erase_ptn_sdmmc(struct fastboot_ptentry *ptn)
+{
+ int ret = 0;
+ char cmd[32], device[32];
+ char start[32], length[32], buffer[32];
+ char *argv[6] = { NULL, NULL, NULL, NULL, NULL, NULL, };
+ char *nul_buf;
+#if defined(CONFIG_MMC_64BIT_BUS) || defined(CONFIG_CPU_EXYNOS5410_EVT2)
+ char *nul_buf_align;
+#endif
+ struct mmc *mmc;
+
+ uint bl_st = ptn->start / CFG_FASTBOOT_SDMMC_BLOCKSIZE;
+ uint bl_cnt = ptn->length / CFG_FASTBOOT_SDMMC_BLOCKSIZE;
+ uint zero_clr_st = 0;
+ uint zero_clr_cnt = 0;
+
+#if defined(CONFIG_MMC_64BIT_BUS) || defined(CONFIG_CPU_EXYNOS5410_EVT2)
+ nul_buf_align = calloc(sizeof(char), CFG_FASTBOOT_SDMMC_BLOCKSIZE * 1024 + 8);
+ if (nul_buf_align == NULL) {
+ printf("Error: calloc failed for nul_buf_align\n");
+ ret = 1;
+ return ret;
+ }
+ if (((unsigned int)nul_buf_align & 0x7) == 0)
+ nul_buf = nul_buf_align;
+ else
+ nul_buf = nul_buf_align + (8 - ((unsigned int)nul_buf_align & 0x7));
+#else
+ nul_buf = calloc(sizeof(char), CFG_FASTBOOT_SDMMC_BLOCKSIZE * 1024);
+ if (nul_buf == NULL) {
+ printf("Error: calloc failed for nul_buf\n");
+ ret = 1;
+ return ret;
+ }
+#endif
+
+ mmc = find_mmc_device(DEV_NUM);
+ if (mmc == NULL) {
+ printf("Error: find_mmc_device return NULL\n");
+ ret = 1;
+#if defined(CONFIG_MMC_64BIT_BUS) || defined(CONFIG_CPU_EXYNOS5410_EVT2)
+ free(nul_buf_align);
+#else
+ free(nul_buf);
+#endif
+ return ret;
+ }
+
+ if (bl_cnt < 1024) {
+ printf("*** erase start: 0x%x, size: 0x%x ***\n", bl_st, bl_cnt);
+ mmc->block_dev.block_write(DEV_NUM, bl_st, bl_cnt, nul_buf);
+ bl_cnt = 0;
+ } else {
+
+ if (bl_st & 0x3ff) {
+ zero_clr_st = bl_st;
+ zero_clr_cnt = 1024 - (bl_st & 0x3ff);
+ printf("*** erase start: 0x%x, size: 0x%x ***\n", zero_clr_st, zero_clr_cnt);
+ mmc->block_dev.block_write(DEV_NUM, zero_clr_st, zero_clr_cnt, nul_buf);
+
+ bl_cnt = bl_cnt - (1024 - (bl_st & 0x3ff));
+ bl_st = (bl_st & (~0x3ff)) + 1024;
+ }
+
+ if (bl_cnt & 0x3ff) {
+ zero_clr_st = bl_st + bl_cnt - (bl_cnt & 0x3ff);
+ zero_clr_cnt = bl_cnt & 0x3ff;
+ printf("*** erase start: 0x%x, size: 0x%x ***\n", zero_clr_st, zero_clr_cnt);
+ mmc->block_dev.block_write(DEV_NUM, zero_clr_st, zero_clr_cnt, nul_buf);
+
+ bl_cnt = bl_cnt - (bl_cnt & 0x3ff);
+ }
+
+ }
+#if defined(CONFIG_MMC_64BIT_BUS) || defined(CONFIG_CPU_EXYNOS5410_EVT2)
+ free(nul_buf_align);
+#else
+ free(nul_buf);
+#endif
+
+ if (bl_cnt >> 10) {
+ argv[1] = cmd;
+ argv[2] = buffer;
+ argv[3] = device;
+ argv[4] = start;
+ argv[5] = length;
+
+ sprintf(cmd, "erase");
+ sprintf(buffer, "user");
+ sprintf(device, "%d", DEV_NUM);
+ sprintf(start, "%x", bl_st);
+ sprintf(length, "%x", bl_cnt);
+ printf("*** erase by mmc erase ***\n");
+ printf("mmc %s %s %s %s %s\n", argv[1], argv[2], argv[3], argv[4], argv[5]);
+
+ ret = do_mmcops(NULL, 0, 6, argv);
+ if (ret)
+ printf("Error: do_mmcops ret:%d\n", ret);
+ } else {
+ printf("*** erase block length too small ***\n");
+ }
+
+ return ret;
+}
+
+
#endif
#if defined(CONFIG_RAMDUMP_MODE)
@@ -1077,17 +1112,17 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
if (is_all || !strcmp(ptn->name, "kernel"))
{
if (is_all)
- sprintf(response, "INFOpartition-size:kernel: %x", PART_SIZE_KERNEL);
+ sprintf(response, "INFOpartition-size:kernel: %x", CONFIG_KERNEL_DUMMY_SIZE);
else
- sprintf(response, "INFO%x", PART_SIZE_KERNEL);
+ sprintf(response, "INFO%x", CONFIG_KERNEL_DUMMY_SIZE);
fastboot_tx_status(response, strlen(response), FASTBOOT_TX_SYNC);
}
if (is_all || !strcmp(ptn->name, "ramdisk"))
{
if (is_all)
- sprintf(response, "INFOpartition-size:ramdisk: %x",PART_SIZE_ROOTFS );
+ sprintf(response, "INFOpartition-size:ramdisk: %x",CONFIG_RAMDISK_DUMMY_SIZE );
else
- sprintf(response, "INFO%x",PART_SIZE_ROOTFS );
+ sprintf(response, "INFO%x",CONFIG_RAMDISK_DUMMY_SIZE );
fastboot_tx_status(response, strlen(response), FASTBOOT_TX_SYNC);
}
#ifdef CONFIG_CHARGER_LOGO
@@ -1110,29 +1145,27 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
fastboot_tx_status(response, strlen(response), FASTBOOT_TX_SYNC);
}
#endif
-#ifdef CONFIG_BOOT
if (is_all || !strcmp(ptn->name, "boot"))
{
+ get_boot_part_info(dev_num, PART_NUM_BOOT, &start, &count, &pid);
if (is_all)
- sprintf(response, "INFOpartition-size:boot: %x",PART_SIZE_BOOT);
+ sprintf(response, "INFOpartition-size:boot: %x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE);
else
- sprintf(response, "INFO%x",PART_SIZE_BOOT);
+ sprintf(response, "INFO%x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE);
fastboot_tx_status(response, strlen(response), FASTBOOT_TX_SYNC);
}
-#endif
-#ifdef CONFIG_KERNEL_RECOVERY_MODE
if (is_all || !strcmp(ptn->name, "recovery"))
{
+ get_boot_part_info(dev_num, PART_NUM_RECOVERY, &start, &count, &pid);
if (is_all)
- sprintf(response, "INFOpartition-size:recovery: %x",PART_SIZE_RECOVERY_MODE);
+ sprintf(response, "INFOpartition-size:recovery: %x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE);
else
- sprintf(response, "INFO%x",PART_SIZE_RECOVERY_MODE);
+ sprintf(response, "INFO%x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE);
fastboot_tx_status(response, strlen(response), FASTBOOT_TX_SYNC);
}
-#endif
if (is_all || !strcmp(ptn->name, "system"))
{
- get_boot_part_info(dev_num, 2, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_SYSTEM, &start, &count, &pid);
if (is_all)
sprintf(response, "INFOpartition-size:system: %x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE );
else
@@ -1141,7 +1174,7 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
}
if (is_all || !strcmp(ptn->name, "userdata"))
{
- get_boot_part_info(dev_num, 3, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_USERDATA, &start, &count, &pid);
if (is_all)
sprintf(response, "INFOpartition-size:userdata: %x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE );
else
@@ -1150,27 +1183,25 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
}
if (is_all || !strcmp(ptn->name, "cache"))
{
- get_boot_part_info(dev_num, 4, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_CACHE, &start, &count, &pid);
if (is_all)
sprintf(response, "INFOpartition-size:cache: %x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE );
else
sprintf(response, "INFO%x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE );
fastboot_tx_status(response, strlen(response), FASTBOOT_TX_SYNC);
}
-#ifdef CONFIG_MISC
if (is_all || !strcmp(ptn->name, "misc"))
{
- get_boot_part_info(dev_num, 5, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_MISC, &start, &count, &pid);
if (is_all)
sprintf(response, "INFOpartition-size:misc: %x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE );
else
sprintf(response, "INFO%x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE );
fastboot_tx_status(response, strlen(response), FASTBOOT_TX_SYNC);
}
-#endif
if (is_all || !strcmp(ptn->name, "bootloader"))
{
- get_boot_part_info(dev_num, 8, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_BLOADER, &start, &count, &pid);
if (is_all)
sprintf(response, "INFOpartition-size:bootloader: %x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE );
else
@@ -1179,7 +1210,7 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
}
if (get_model() && (is_all || !strcmp(ptn->name, "oem")))
{
- get_boot_part_info(dev_num, 9, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_OEM, &start, &count, &pid);
if (is_all)
sprintf(response, "INFOpartition-size:oem: %x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE );
else
@@ -1189,7 +1220,7 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
#ifdef CONFIG_FAT
if (is_all || !strcmp(ptn->name, "fat"))
{
- get_boot_part_info(dev_num, 1, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_FAT, &start, &count, &pid);
if (is_all)
sprintf(response, "INFOpartition-size:fat: %x",count * CFG_FASTBOOT_SDMMC_BLOCKSIZE );
else
@@ -1211,9 +1242,9 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
if(is_all)
max_part = 4;
#elif defined (CONFIG_CMD_GPT)
- char *p[]={"recovery","system","userdata","cache", "misc", "boot", "info", "bootloader", "oem"};
+ char *p[]={"recovery","system","userdata","cache", "misc", "boot", "oem"};
if(is_all)
- max_part = get_model() ? 9 : 6;
+ max_part = get_model() ? 7 : 6;
#endif
for (i = 0; i < max_part; i++) {
@@ -1231,22 +1262,20 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
goto send_tx_status;
#ifdef CONFIG_FAT
} else if (!strcmp(ptn->name, "fat")) {
- get_boot_part_info(dev_num, 1, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_FAT, &start, &count, &pid);
if (pid == 0x0C)
strcpy(response + 4, "FAT");
#endif
-#ifdef CONFIG_KERNEL_RECOVERY_MODE
} else if (!strcmp(ptn->name, "recovery")) {
- get_boot_part_info(dev_num, 1, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_RECOVERY, &start, &count, &pid);
if (pid == 0x83 || pid == 0xee) {
if (is_all)
strcpy(response + 4, "partition-type:recovery: ext4");
else
strcpy(response + 4, "ext4");
}
-#endif
} else if (!strcmp(ptn->name, "system")) {
- get_boot_part_info(dev_num, 2, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_SYSTEM, &start, &count, &pid);
if (pid == 0x83 || pid == 0xee) {
if (is_all)
strcpy(response + 4, "partition-type:system: ext4");
@@ -1254,7 +1283,7 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
strcpy(response + 4, "ext4");
}
} else if (!strcmp(ptn->name, "userdata")) {
- get_boot_part_info(dev_num, 3, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_USERDATA, &start, &count, &pid);
if (pid == 0x83 || pid == 0xee) {
if (is_all)
strcpy(response + 4, "partition-type:userdata: ext4");
@@ -1262,35 +1291,31 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
strcpy(response + 4, "ext4");
}
} else if (!strcmp(ptn->name, "cache")) {
- get_boot_part_info(dev_num, 4, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_CACHE, &start, &count, &pid);
if (pid == 0x83 || pid == 0xee) {
if (is_all)
strcpy(response + 4, "partition-type:cache: ext4");
else
strcpy(response + 4, "ext4");
}
-#ifdef CONFIG_MISC
} else if (!strcmp(ptn->name, "misc")) {
- get_boot_part_info(dev_num, 5, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_MISC, &start, &count, &pid);
if (pid == 0x83 || pid == 0xee) {
if (is_all)
strcpy(response + 4, "partition-type:misc: ext4");
else
strcpy(response + 4, "ext4");
}
-#endif
-#ifdef CONFIG_BOOT
} else if (!strcmp(ptn->name, "boot")) {
- get_boot_part_info(dev_num, 6, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_BOOT, &start, &count, &pid);
if (pid == 0x83 || pid == 0xee) {
if (is_all)
strcpy(response + 4, "partition-type:boot: ext4");
else
strcpy(response + 4, "ext4");
}
-#endif
} else if (!strcmp(ptn->name, "oem")) {
- get_boot_part_info(dev_num, 9, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_OEM, &start, &count, &pid);
if (pid == 0x83 || pid == 0xee) {
if (is_all)
strcpy(response + 4, "partition-type:oem: ext4");
@@ -1366,6 +1391,11 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
ret = 0;
goto send_tx_status;
}
+ if (get_lock_state()) {
+ sprintf(response,"FAILcannot erase,locked");
+ ret = 0;
+ goto send_tx_status;
+ }
char start[32], length[32];
int status;
@@ -1384,96 +1414,17 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
#endif
if (OmPin == BOOT_MMCSD) {
- // Temporary (but, simplest) implementation
- char run_cmd[80];
- status = 1;
- if (!strcmp(ptn->name, "system"))
- {
- sprintf(run_cmd, "ext4format mmc 0:2");
- status = run_command(run_cmd, 0);
- }
- else if (!strcmp(ptn->name, "userdata"))
- {
- sprintf(run_cmd, "ext4format mmc 0:3");
- status = run_command(run_cmd, 0);
- }
- else if (!strcmp(ptn->name, "cache"))
- {
- sprintf(run_cmd, "ext4format mmc 0:4");
- status = run_command(run_cmd, 0);
- }
-#ifdef CONFIG_FAT
- else if (!strcmp(ptn->name, "fat"))
- {
- sprintf(run_cmd, "fatformat mmc 0:1");
- status = run_command(run_cmd, 0);
- }
-#endif
-#ifdef CONFIG_KERNEL_RECOVERY_MODE
- else if (!strcmp(ptn->name, "recovery"))
- {
- sprintf(run_cmd, "ext4format mmc 0:1");
- status = run_command(run_cmd, 0);
- }
-#endif
-#ifdef CONFIG_BOOT
- else if (!strcmp(ptn->name, "boot"))
- {
- sprintf(run_cmd, "ext4format mmc 0:6");
- status = run_command(run_cmd, 0);
- }
-#endif
+
} else if(OmPin == BOOT_EMMC_4_4 || OmPin == BOOT_EMMC) {
- #if 0
- char run_cmd[80];
- status = 1;
- if (!strcmp(ptn->name, "system")) {
- sprintf(run_cmd, "ext4format mmc 0:2");
- status = run_command(run_cmd, 0);
- } else if (!strcmp(ptn->name, "userdata")) {
- sprintf(run_cmd, "ext4format mmc 0:3");
- status = run_command(run_cmd, 0);
- } else if (!strcmp(ptn->name, "cache")) {
- sprintf(run_cmd, "ext4format mmc 0:4");
- status = run_command(run_cmd, 0);
-#ifdef CONFIG_FAT
- } else if (!strcmp(ptn->name, "fat")) {
- sprintf(run_cmd, "fatformat mmc 0:1");
- status = run_command(run_cmd, 0);
-#endif
-#ifdef CONFIG_KERNEL_RECOVERY_MODE
- } else if (!strcmp(ptn->name, "recovery")) {
- sprintf(run_cmd, "ext4format mmc 0:1");
- status = run_command(run_cmd, 0);
-#endif
-#ifdef CONFIG_BOOT
- } else if (!strcmp(ptn->name, "boot")) {
- sprintf(run_cmd, "ext4format mmc 0:6");
- status = run_command(run_cmd, 0);
-#endif
+ if (!strcmp(ptn->name, "system") ||
+ !strcmp(ptn->name, "oem") ||
+ !strcmp(ptn->name, "userdata") ||
+ !strcmp(ptn->name, "misc") ||
+ !strcmp(ptn->name, "cache")) {
+ status = erase_ptn_sdmmc(ptn);
+ } else {
+ status = 0;
}
- #else
- status = get_lock_state();
- #endif
- }
-//#else
- else if(OmPin == BOOT_ONENAND) {
-#if defined(CFG_FASTBOOT_ONENANDBSP)
- int argc_erase = 4;
- /* do_nand and do_onenand do not check argv[0] */
- char *argv_erase[5] = { NULL, "erase", NULL, NULL, NULL, };
-
- argv_erase[2] = start;
- argv_erase[3] = length;
-
- sprintf(start, "0x%x", ptn->start);
- sprintf(length, "0x%x", ptn->length);
-
- if (ptn->length == 0)
- argc_erase = 3;
-
- status = CFG_FASTBOOT_FLASHCMD(NULL, 0, argc_erase, argv_erase);
-#endif
}
if (status)
@@ -1771,9 +1722,8 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
sprintf(response, "INFOErasing userdata and unlocking the device");
fastboot_tx_status(response, strlen(response), FASTBOOT_TX_SYNC);
- // run_command("ext4format mmc 0:3;ext4format mmc 0:4;", 0);
- write_to_ptn_sdmmc(fastboot_flash_find_ptn("userdata"), 0, 0);
- write_to_ptn_sdmmc(fastboot_flash_find_ptn("cache"), 0, 0);
+ erase_ptn_sdmmc(fastboot_flash_find_ptn("userdata"));
+ erase_ptn_sdmmc(fastboot_flash_find_ptn("cache"));
put_lock_state(0);
sprintf(response, "INFORun \"fastboot -w\" to make valid filesystem.");
@@ -2141,20 +2091,6 @@ static int set_partition_table_sdmmc()
ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MOVI_CMD;
pcount++;
- /* Kernel */
- strcpy(ptable[pcount].name, "kernel");
- ptable[pcount].start = 0;
- ptable[pcount].length = 0;
- ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MOVI_CMD;
- pcount++;
-
- /* Ramdisk */
- strcpy(ptable[pcount].name, "ramdisk");
- ptable[pcount].start = 0;
- ptable[pcount].length = PART_SIZE_ROOTFS;
- ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MOVI_CMD;
- pcount++;
-
#ifdef CONFIG_CHARGER_LOGO
strcpy(ptable[pcount].name, "charger");
ptable[pcount].start = 0;
@@ -2169,18 +2105,8 @@ static int set_partition_table_sdmmc()
ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MOVI_CMD;
pcount++;
#endif
- /* recovery */
- get_boot_part_info(dev_num, 1, &start, &count, &pid);
- if (pid != 0x83 && pid != 0xee)
- goto part_type_error;
- strcpy(ptable[pcount].name, "recovery");
- ptable[pcount].start = start * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
- ptable[pcount].length = count * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
- ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MMC_CMD;
- pcount++;
-
/* System */
- get_boot_part_info(dev_num, 2, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_SYSTEM, &start, &count, &pid);
if (pid != 0x83 && pid != 0xee)
goto part_type_error;
strcpy(ptable[pcount].name, "system");
@@ -2190,7 +2116,7 @@ static int set_partition_table_sdmmc()
pcount++;
/* Data */
- get_boot_part_info(dev_num, 3, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_USERDATA, &start, &count, &pid);
if (pid != 0x83 && pid != 0xee)
goto part_type_error;
strcpy(ptable[pcount].name, "userdata");
@@ -2200,7 +2126,7 @@ static int set_partition_table_sdmmc()
pcount++;
/* Cache */
- get_boot_part_info(dev_num, 4, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_CACHE, &start, &count, &pid);
if (pid != 0x83 && pid != 0xee)
goto part_type_error;
strcpy(ptable[pcount].name, "cache");
@@ -2210,7 +2136,7 @@ static int set_partition_table_sdmmc()
pcount++;
/* Misc */
- get_boot_part_info(dev_num, 5, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_MISC, &start, &count, &pid);
if (pid != 0x83 && pid != 0xee)
goto part_type_error;
strcpy(ptable[pcount].name, "misc");
@@ -2220,7 +2146,7 @@ static int set_partition_table_sdmmc()
pcount++;
/* boot */
- get_boot_part_info(dev_num, 6, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_BOOT, &start, &count, &pid);
if (pid != 0x83 && pid != 0xee)
goto part_type_error;
strcpy(ptable[pcount].name, "boot");
@@ -2229,18 +2155,28 @@ static int set_partition_table_sdmmc()
ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MMC_CMD;
pcount++;
- /* info */
- get_boot_part_info(dev_num, 7, &start, &count, &pid);
+ /* recovery */
+ get_boot_part_info(dev_num, PART_NUM_RECOVERY, &start, &count, &pid);
+ if (pid != 0x83 && pid != 0xee)
+ goto part_type_error;
+ strcpy(ptable[pcount].name, "recovery");
+ ptable[pcount].start = start * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
+ ptable[pcount].length = count * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
+ ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MMC_CMD;
+ pcount++;
+
+ /* nvinfo */
+ get_boot_part_info(dev_num, PART_NUM_NVINFO, &start, &count, &pid);
if (pid != 0x83 && pid != 0xee)
goto part_type_error;
- strcpy(ptable[pcount].name, "info");
+ strcpy(ptable[pcount].name, "nvinfo");
ptable[pcount].start = start * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
ptable[pcount].length = count * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MMC_CMD;
pcount++;
/* bootloader */
- get_boot_part_info(dev_num, 8, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_BLOADER, &start, &count, &pid);
if (pid != 0x83 && pid != 0xee)
goto part_type_error;
strcpy(ptable[pcount].name, "bootloader");
@@ -2250,7 +2186,7 @@ static int set_partition_table_sdmmc()
pcount++;
/* oem */
- get_boot_part_info(dev_num, 9, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_OEM, &start, &count, &pid);
if (pid != 0x83 && pid != 0xee)
goto part_type_error;
strcpy(ptable[pcount].name, "oem");
@@ -2261,7 +2197,7 @@ static int set_partition_table_sdmmc()
#ifdef CONFIG_FAT
/* fat */
- get_boot_part_info(dev_num, 1, &start, &count, &pid);
+ get_boot_part_info(dev_num, PART_NUM_FAT, &start, &count, &pid);
if (pid != 0xc && pid != 0xee)
goto part_type_error;
strcpy(ptable[pcount].name, "fat");
@@ -2286,11 +2222,14 @@ part_type_error:
return -1;
}
#endif
+void Lcd_copy_new_logo(void);
+
int write_bootloader_img(unsigned char *buffer)
{
char out[256] __attribute__ ((aligned(8)));
int i, ret=0;
+ int revert_to_old = 0;
struct fastboot_ptentry *ptn;
struct fastboot_bootldr_img_hdr tmp;
struct fastboot_bootldr_img_hdr *bldr_hdr = (struct fastboot_bootldr_img_hdr *) buffer;
@@ -2307,11 +2246,14 @@ int write_bootloader_img(unsigned char *buffer)
return 100;
}
/*
- Name of u-boot partition appended by old mkblimg utility is "bootloader".
- Rename it to "u-boot" for compatibility.
+ Name of u-boot partition appended by old (before KOI017) mkblimg utility
+ is "bootloader". Rename it to "u-boot" for compatibility.
*/
- if (strcmp("bootloader", bldr_hdr->img_info[0].name) == 0)
+ if (strcmp("bootloader", bldr_hdr->img_info[0].name) == 0) {
+ // It seems that bootloader is going to be reverted to the old version
+ revert_to_old = 1;
strcpy(bldr_hdr->img_info[0].name, "u-boot");
+ }
for(i = 0; i< bldr_hdr->image_num; i++)
{
@@ -2338,13 +2280,17 @@ int write_bootloader_img(unsigned char *buffer)
break;
}
}
+ if (revert_to_old) {
+ Lcd_copy_new_logo(); // copy the bootlogo to the old location
+ erase_ptn_sdmmc(fastboot_flash_find_ptn("recovery"));
+ }
return ret;
}
-int do_fastboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
int ret = 1;
int check_timeout = 0;
@@ -2352,8 +2298,10 @@ int do_fastboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
uint64_t timeout_ticks = 0;
long timeout_seconds = -1;
int continue_from_disconnect = 0;
+#if 0
struct fastboot_ptentry *ptn;
unsigned int addr, size;
+#endif
/* checking boot mode before to set partition table */
switch(OmPin) {
#ifndef CFG_FASTBOOT_SDMMCBSP
@@ -2383,7 +2331,7 @@ int do_fastboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (set_partition_table())
return 1;
#endif
-
+#if 0
if ((argc > 1) && (0 == strcmp(argv[1], "flash"))){
ptn = fastboot_flash_find_ptn(argv[2]);
if(ptn == NULL) {
@@ -2397,7 +2345,7 @@ int do_fastboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
write_to_ptn_sdmmc(ptn, addr, size);
return 1;
}
-
+#endif
/* Time out */
if (2 == argc)
{
@@ -2830,6 +2778,7 @@ void AutoFirmwareUpdate(int model)
if (file_size) {
printf("oem size = %ld\n", file_size);
ptn = fastboot_flash_find_ptn("oem");
+ erase_ptn_sdmmc(ptn);
write_to_ptn_sdmmc(ptn, 0x40000000, file_size);
}
}
@@ -2855,6 +2804,7 @@ void AutoFirmwareUpdate(int model)
if (file_size) {
printf("system size = %ld\n", file_size);
ptn = fastboot_flash_find_ptn("system");
+ erase_ptn_sdmmc(ptn);
write_to_ptn_sdmmc(ptn, 0x40000000, file_size);
}
@@ -2863,6 +2813,7 @@ void AutoFirmwareUpdate(int model)
if (file_size) {
printf("userdata size = %ld\n", file_size);
ptn = fastboot_flash_find_ptn("userdata");
+ erase_ptn_sdmmc(ptn);
write_to_ptn_sdmmc(ptn, 0x40000000, file_size);
}
@@ -2871,6 +2822,7 @@ void AutoFirmwareUpdate(int model)
if (file_size) {
printf("cache size = %ld\n", file_size);
ptn = fastboot_flash_find_ptn("cache");
+ erase_ptn_sdmmc(ptn);
write_to_ptn_sdmmc(ptn, 0x40000000, file_size);
}
}
diff --git a/common/cmd_movi.c b/common/cmd_movi.c
index bbf8a7ba6..0f7d7a22c 100644
--- a/common/cmd_movi.c
+++ b/common/cmd_movi.c
@@ -88,16 +88,6 @@ int do_movi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
goto usage;
attribute = 0x3;
break;
- case 'k':
- if (argc != 5)
- goto usage;
- attribute = 0x5;
- break;
- case 'r':
- if (argc != 6)
- goto usage;
- attribute = 0x6;
- break;
#ifdef CONFIG_CHARGER_LOGO
case 'c':
if (argc != (6 - location))
@@ -215,46 +205,6 @@ int do_movi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
return 1;
}
- /* kernel r/w */
- if (attribute == 0x5) {
- for (i=0, image = raw_area_control.image; i<15; i++) {
- if (image[i].attribute == attribute)
- break;
- }
- start_blk = image[i].start_blk;
- blkcnt = image[i].used_blk;
- printf("%s kernel..device %d Start %ld, Count %ld ", rw ? "writing" : "reading",
- dev_num, start_blk, blkcnt);
- sprintf(run_cmd, "mmc %s %d 0x%lx 0x%lx 0x%lx",
- rw ? "write" : "read", dev_num,
- addr, start_blk, blkcnt);
- run_command(run_cmd, dev_num);
- printf("completed\n");
- return 1;
- }
-
- /* root file system r/w */
- if (attribute == 0x6) {
- rfs_size = simple_strtoul(argv[5], NULL, 16);
-
- for (i=0, image = raw_area_control.image; i<15; i++) {
- if (image[i].attribute == attribute)
- break;
- }
- start_blk = image[i].start_blk;
- blkcnt = rfs_size/MOVI_BLKSIZE +
- ((rfs_size&(MOVI_BLKSIZE-1)) ? 1 : 0);
- image[i].used_blk = blkcnt;
- printf("%s RFS..device %d Start %ld, Count %ld ", rw ? "writing":"reading",
- dev_num, start_blk, blkcnt);
- sprintf(run_cmd,"mmc %s %d 0x%lx 0x%lx 0x%lx",
- rw ? "write":"read", dev_num,
- addr, start_blk, blkcnt);
- run_command(run_cmd, dev_num);
- printf("completed\n");
- return 1;
- }
-
#ifdef CONFIG_CHARGER_LOGO
if (attribute == 0x7) {
for (i=0, image = raw_area_control.image; i<15; i++) {
diff --git a/common/main.c b/common/main.c
index a3eb9a51c..4df4b3315 100644
--- a/common/main.c
+++ b/common/main.c
@@ -88,7 +88,7 @@ extern void Lcd_read_bootlogo(void);
extern void Backlight_Turnon(void);
extern void Display_Turnon(void);
extern void Display_Turnoff(void);
-extern void s5p_lcd_draw_bootlogo(void);
+extern int s5p_lcd_draw_bootlogo(void);
#endif
#ifdef CONFIG_PMIC_WAIT_LOW_JITTER
@@ -384,14 +384,6 @@ void main_loop (void)
update_tftp (0UL);
#endif /* CONFIG_UPDATE_TFTP */
-#ifdef CONFIG_USE_LCD // display turnon
- //Display_Turnon();
- Lcd_read_bootlogo();
- s5p_lcd_draw_bootlogo();
- mdelay(200);
- //Backlight_Turnon();
-#endif
-
#ifdef CONFIG_PMIC_WAIT_LOW_JITTER
pmic_enable_low_jitter();
#endif
diff --git a/disk/part_efi.c b/disk/part_efi.c
index cd8685ebe..75278c5e6 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -164,7 +164,7 @@ int find_efi_part_name(block_dev_desc_t * dev_desc, const char *name)
if (!is_pte_valid(&gpt_pte[i]))
break;
- if(!strncmp((print_efiname(&gpt_pte[i])), name, sizeof(name)))
+ if(!strncmp((print_efiname(&gpt_pte[i])), name, 16))
{
printf("Find match partition!%s:%s\n",print_efiname(&gpt_pte[i]),name);
diff --git a/drivers/video/display.c b/drivers/video/display.c
index 143445776..4eaf9fc5e 100644
--- a/drivers/video/display.c
+++ b/drivers/video/display.c
@@ -49,12 +49,12 @@ static void SWTrigger_for_te(void);
#define LOGO_RESERVED_ADDR (0x47000000)
-unsigned char *boot_logo[4]; // 4frame animation logo set. currently not used.
-unsigned char *pboot_logo_data;
-unsigned char *pboot_logo_data2;
+static unsigned char *pboot_logo_data;
+#ifdef CONFIG_CHARGER_LOGO
unsigned char *charger_logo[4];
unsigned char *pcharger_logo_data;
+#endif
static unsigned int gFgColor = 0xFF;
static unsigned int gLeftColor = LCD_BGCOLOR;
@@ -252,6 +252,7 @@ unsigned int s5p_lcd_search_start_blk(const unsigned char *partition_name)
return 0;
}
+#ifdef CONFIG_CHARGER_LOGO
void Lcd_read_charger_logo(void)
{
char run_cmd[100];
@@ -274,6 +275,7 @@ void Lcd_read_charger_logo(void)
charger_logo[2] = (unsigned char *)(pcharger_logo_data + BAT_CHG_BITMAP_LEN*2);
charger_logo[3] = (unsigned char *)(pcharger_logo_data + BAT_CHG_BITMAP_LEN*3);
}
+#endif
#define BMP_FILE_TYPE 0x4d42
typedef struct tag_bmp_file_header
@@ -298,7 +300,7 @@ typedef struct tag_bmp_file_header
bmp_info_header logo_bmp_info_head;
-void s5p_lcd_draw_bootlogo(void)
+int s5p_lcd_draw_bootlogo(void)
{
#if USE_LCD_TEST_PATTERN
int i, j;
@@ -333,9 +335,8 @@ void s5p_lcd_draw_bootlogo(void)
memcpy(&logo_bmp_info_head, (const void*)pboot_logo_data, sizeof(bmp_info_header));
if(BMP_FILE_TYPE!=logo_bmp_info_head.bfType || !logo_bmp_info_head.bfSize) {
- printf("Err: Check logo format not match !\n");
- memcpy(CFG_LCD_FBUFFER, pboot_logo_data, LCD_WIDTH * LCD_HEIGHT * 4);
- return;
+ printf("Invalid logo bmp header\n");
+ return 1;
}
bmp_width = logo_bmp_info_head.biWidth;
@@ -358,6 +359,32 @@ void s5p_lcd_draw_bootlogo(void)
#if defined(CONFIG_MACH_SHIRI) || defined(CONFIG_MACH_KOI)
SWTrigger_for_te();
#endif
+ return 0;
+}
+
+void Lcd_copy_old_logo(void)
+{
+ char run_cmd[80];
+
+ pboot_logo_data = LOGO_RESERVED_ADDR;
+ sprintf(run_cmd, "mmc read 0 %lx %lx %lx", pboot_logo_data,
+ MOVI_BOOT_LOGO_START_OLD_BLK, MOVI_BOOT_LOGO_BLKCNT);
+ run_command(run_cmd, 0);
+ sprintf(run_cmd, "movi w z l 0 %lx", pboot_logo_data);
+ run_command(run_cmd, 0);
+}
+
+void Lcd_copy_new_logo(void)
+{
+ char run_cmd[80];
+
+ pboot_logo_data = LOGO_RESERVED_ADDR;
+ sprintf(run_cmd, "movi r z l 0 %lx", pboot_logo_data);
+ run_command(run_cmd, 0);
+
+ sprintf(run_cmd, "mmc write 0 %lx %lx %lx", pboot_logo_data,
+ MOVI_BOOT_LOGO_START_OLD_BLK, MOVI_BOOT_LOGO_BLKCNT);
+ run_command(run_cmd, 0);
}
void Lcd_read_bootlogo(void)
@@ -374,16 +401,12 @@ void Lcd_read_bootlogo(void)
pboot_logo_data = LOGO_RESERVED_ADDR;
#endif
- start_blk = s5p_lcd_search_start_blk("bootlogo");
- blkcnt = LCD_WIDTH*LCD_HEIGHT*4/512; // for RAW
- printf("%s bootlogo.. %ld, %ld, %08x %08x\n", "reading",start_blk, blkcnt, pboot_logo_data, pboot_logo_data2);
-
// Reading Logo area does not require emmc Open/Close
#if USE_RAW_IMAGE
sprintf(run_cmd,"mmc read 0 %lx %lx %lx ", CFG_LCD_FBUFFER, start_blk, blkcnt);
#else
- sprintf(run_cmd,"movi r z l 0 %lx ", pboot_logo_data);
+ sprintf(run_cmd,"movi r z l 0 %lx", pboot_logo_data);
#endif
run_command(run_cmd,0);
#ifdef CONFIG_SHIRI_LCD
@@ -402,10 +425,10 @@ void Lcd_read_bootlogo(void)
*((unsigned int *)(CFG_LCD_FBUFFER + (i * LCD_WIDTH + j) *4 )) |= tmpR << 16 | tmpB;;
}
}
+#if defined(CONFIG_MACH_SHIRI) || defined(CONFIG_MACH_KOI)
+ SWTrigger_for_te();
#endif
#endif
#endif
-#if defined(CONFIG_MACH_SHIRI) || defined(CONFIG_MACH_KOI)
- SWTrigger_for_te();
#endif
}
diff --git a/include/configs/koi.h b/include/configs/koi.h
index 779fa740a..ef6e8a900 100644
--- a/include/configs/koi.h
+++ b/include/configs/koi.h
@@ -236,37 +236,31 @@
#define CONFIG_PARTITION_UUIDS
-/* TODO Use these macros in CONFIG_GPT_ENV;
- * until then, update the start and size, if required,
- * at both places
- */
-#define CONFIG_GPT_RECOVERY_START_BLK 36096
-#define CONFIG_GPT_RECOVERY_BLKNUM 102400
-#define CONFIG_GPT_SYSTEM_BLKNUM 1048576
-#define CONFIG_GPT_USERDATA_BLKNUM 5529600
-#define CONFIG_GPT_CACHE_BLKNUM 737280
-#define CONFIG_GPT_MISC_BLKNUM 16
-#define CONFIG_GPT_BOOT_BLKNUM 66288
-#define CONFIG_GPT_INFO_BLKNUM 16384
-#define CONFIG_GPT_BOOTLOADER_BLKNUM 16384
-#define CONFIG_GPT_OEM_BLKNUM 32768
-
-#define OLD_GPT_INFO_START_BLK 7515408 /* info offset of before KOI00A */
-
#define CONFIG_GPT_ENV \
"uuid_disk=12345678-1234-1234-1234-123456789012;"\
- "name=recovery,size=50MiB,start=0x11A0000,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4;"\
- "name=system,size=512MiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4;"\
+ "name=system,size=578MiB,start=0x1A0000,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4;"\
"name=userdata,size=2700MiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4;"\
"name=cache,size=360MiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4;" \
"name=misc,size=8KiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4;" \
- "name=boot,size=33144KiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4;" \
- "name=info,size=8MiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4;" \
- "name=bootloader,size=8MiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4"
+ "name=boot,size=12664KiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4;" \
+ "name=recovery,size=20480KiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4;"\
+ "name=nvinfo,size=8MiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4;" \
+ "name=bloader,size=8MiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4"
#define CONFIG_GPT_ENV_OEM \
";name=oem,size=16MiB,uuid=0FC63DAF-8483-4772-8E79-3D69D8477DE4"
+#define PART_NUM_SYSTEM 1
+#define PART_NUM_USERDATA 2
+#define PART_NUM_CACHE 3
+#define PART_NUM_MISC 4
+#define PART_NUM_BOOT 5
+#define PART_NUM_RECOVERY 6
+#define PART_NUM_NVINFO 7
+#define PART_NUM_BLOADER 8
+#define PART_NUM_OEM 9
+
+
#ifdef CONFIG_CPU_EXYNOS3250
/* CFG_FASTBOOT_TRANSFER_BUFFER + CFG_FASTBOOT_TRANSFER_BUFFER_SIZE */
#define CFG_FASTBOOT_MMC_BUFFER (0x78000000)
@@ -418,18 +412,22 @@
#define CONFIG_BOOT_LOGO
/* #define CONFIG_CHARGER_LOGO */
-#define CONFIG_BOOT
-#define CONFIG_MISC
+/*#define CONFIG_BOOT*/
+/*#define CONFIG_MISC*/
/*#define CONFIG_RECOVERY*/
-#define CONFIG_KERNEL_RECOVERY_MODE
+/*#define CONFIG_KERNEL_RECOVERY_MODE*/
-#define CONFIG_RECOVERY_PARTITION_BLK 0x8D00
+#define CONFIG_RECOVERY_PARTITION_OLD_BLK 0x8D00
+#define CONFIG_RECOVERY_PARTITION_BLK 0x722000
#define CONFIG_BOOT_PARTITION_BLK 0x71bd10
#define CONFIG_KERNEL_BOOT_CMD "bootz 40008000 41000000"
#define CONFIG_WORK_RAM_ADDR 0x48000000
#define CONFIG_KERNEL_BASE_RAM_ADDR 0x40008000
#define CONFIG_RAMDISK_BASE_RAM_ADDR 0x41000000
+#define CONFIG_KERNEL_DUMMY_SIZE 8*1024*1024
+#define CONFIG_RAMDISK_DUMMY_SIZE 4*1024*1024
+
#define CONFIG_LOCKING
#include <asm/arch/movi_partition.h>
@@ -492,7 +490,7 @@
#define CONFIG_INTEGRATED_IMG
/* version-bootloader */
-#define VERSION_BOOTLOADER "KOI016"
+#define VERSION_BOOTLOADER "KOI017"
#define CONFIG_AUTO_FW_WRITE
diff --git a/tools/mkblimg.c b/tools/mkblimg.c
index fd6b538cc..5b6795991 100644
--- a/tools/mkblimg.c
+++ b/tools/mkblimg.c
@@ -4,7 +4,7 @@
#include <arpa/inet.h>
#define FASTBOOT_BOOT_MAGIC_SIZE 8
-#define FASTBOOT_BOOTLDR_IMG_NUM 3
+#define FASTBOOT_BOOTLDR_IMG_NUM 2
#define FASTBOOT_BOOTLOADER_MAGIC "BOOTLDR!"
@@ -26,9 +26,8 @@ struct {
const char *fname; // file name
const char *pname; // partition name
} image[FASTBOOT_BOOTLDR_IMG_NUM] = {
- {"u-boot.bin", "bootloader"},
- {"spl/koi-spl.bin", "bl2"},
- {"../../../vendor/casio/koi/prebuilts/bootlogo.bmp", "bootlogo"}
+ {"u-boot.bin", "u-boot"},
+ {"spl/koi-spl.bin", "bl2"}
};