diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-03-14 20:22:30 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-03-14 20:22:30 +0000 |
commit | 7ef47f2b0ae3597fba0857235374e2df2a1f75c4 (patch) | |
tree | 955523e896d2e9d5a241280f348df7fbe43b6bb8 | |
parent | 05b94fcf880acc2bf2c914dcdc59e6ad6f50542d (diff) | |
parent | 5cf62279a7965e6ffce68bda9bcf1a346239ff54 (diff) | |
download | koi-uboot-oreo-wear-dr.tar.gz |
Snap for 4654740 from 5cf62279a7965e6ffce68bda9bcf1a346239ff54 to oc-wear-dr-kingyo-releaseoreo-wear-dr
Change-Id: Ic135f4ca59d9d2ac37cc885628f92925f426445a
-rw-r--r-- | board/samsung/koi/koi.c | 29 | ||||
-rw-r--r-- | include/configs/koi.h | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/board/samsung/koi/koi.c b/board/samsung/koi/koi.c index 977d1675c..4ba7c151e 100644 --- a/board/samsung/koi/koi.c +++ b/board/samsung/koi/koi.c @@ -714,6 +714,32 @@ static void gpt_partitioning(void) do_gpt(NULL, 0, 5, argv); } +/* + * Check if "boot-recovery" is present at the first 32byte + * of misc partition. + */ +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); + if (pid != 0x83 && pid != 0xee) + return 0; + + strcpy(arg, "mmc read 0 0x48000000 "); + sprintf(startstr, "0x%x ", start); + strcat(arg, startstr); + strcat(arg, "0x1"); + run_command(arg, 0); + if (strncmp("boot-recovery", (char *)0x48000000, 13) == 0) + return 1; + return 0; +} + int board_late_init(void) { struct exynos4_power *pmu = (struct exynos4_power *)EXYNOS4_POWER_BASE; @@ -881,6 +907,9 @@ int board_late_init(void) /* 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); diff --git a/include/configs/koi.h b/include/configs/koi.h index 1f294f812..779fa740a 100644 --- a/include/configs/koi.h +++ b/include/configs/koi.h @@ -492,7 +492,7 @@ #define CONFIG_INTEGRATED_IMG /* version-bootloader */ -#define VERSION_BOOTLOADER "KOI015" +#define VERSION_BOOTLOADER "KOI016" #define CONFIG_AUTO_FW_WRITE |