Commit a9289e4c1bfa8af172a77f24410fa0fc4276cf61

Authored by zhang sanshan
1 parent 79d4702dd9

MA-7633-1 [Android-SD-EMMC] enable BCB partition in android

1 Add some APIs to operate BCB/command.
2 Add action to check the command of BCB.
  It can cover the case that power down when do factory-reset\ota in recovery mode.

Signed-off-by: zhang sanshan <b51434@freescale.com>

Showing 16 changed files with 384 additions and 220 deletions Side-by-side Diff

board/freescale/common/recovery.c
1 1 /*
2   - * Copyright (C) 2010-2014 Freescale Semiconductor, Inc. All Rights Reserved.
  2 + * Copyright (C) 2010-2016 Freescale Semiconductor, Inc. All Rights Reserved.
3 3 *
4 4 * SPDX-License-Identifier: GPL-2.0+
5 5 */
... ... @@ -72,6 +72,11 @@
72 72 } else if (check_recovery_cmd_file()) {
73 73 puts("Fastboot: Recovery command file found!\n");
74 74 setup_recovery_env();
  75 +#ifdef CONFIG_BCB_SUPPORT
  76 + } else if (recovery_check_and_clean_command()) {
  77 + puts("Fastboot: BCB command found\n");
  78 + setup_recovery_env();
  79 +#endif
75 80 } else {
76 81 puts("Fastboot: Normal\n");
77 82 }
drivers/usb/gadget/Makefile
... ... @@ -21,6 +21,7 @@
21 21 obj-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o
22 22 obj-$(CONFIG_CMD_FASTBOOT) += f_fastboot.o
23 23 obj-$(CONFIG_BRILLO_SUPPORT) += bootctrl.o
  24 +obj-$(CONFIG_BCB_SUPPORT) += command.o bcb.o
24 25 endif
25 26 ifdef CONFIG_USB_ETHER
26 27 obj-y += ether.o
drivers/usb/gadget/bcb.c
  1 +/*
  2 + * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
  3 + *
  4 + * SPDX-License-Identifier: GPL-2.0+
  5 + */
  6 +
  7 +#include "bcb.h"
  8 +#include "bootctrl.h"
  9 +#include <linux/stat.h>
  10 +#include <linux/types.h>
  11 +#include <common.h>
  12 +#include <g_dnl.h>
  13 +static unsigned int g_mmc_id;
  14 +void set_mmc_id(unsigned int id)
  15 +{
  16 + g_mmc_id = id;
  17 +}
  18 +#define ALIGN_BYTES 64 /*armv7 cache line need 64 bytes aligned */
  19 +static ulong get_block_size(char *ifname, int dev, int part)
  20 +{
  21 + block_dev_desc_t *dev_desc = NULL;
  22 + disk_partition_t part_info;
  23 +
  24 + dev_desc = get_dev(ifname, dev);
  25 + if (dev_desc == NULL) {
  26 + printf("Block device %s %d not supported\n", ifname, dev);
  27 + return 0;
  28 + }
  29 +
  30 + if (get_partition_info(dev_desc, part, &part_info)) {
  31 + printf("Cannot find partition %d\n", part);
  32 + return 0;
  33 + }
  34 +
  35 + return part_info.blksz;
  36 +}
  37 +
  38 +static int do_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  39 +{
  40 + char *ep;
  41 + block_dev_desc_t *dev_desc = NULL;
  42 + int dev;
  43 + int part = 0;
  44 + disk_partition_t part_info;
  45 + ulong offset = 0u;
  46 + ulong limit = 0u;
  47 + void *addr;
  48 + uint blk;
  49 + uint cnt;
  50 +
  51 + if (argc != 6) {
  52 + cmd_usage(cmdtp);
  53 + return 1;
  54 + }
  55 +
  56 + dev = (int)simple_strtoul(argv[2], &ep, 16);
  57 + if (*ep) {
  58 + if (*ep != ':') {
  59 + printf("Invalid block device %s\n", argv[2]);
  60 + return 1;
  61 + }
  62 + part = (int)simple_strtoul(++ep, NULL, 16);
  63 + }
  64 +
  65 + dev_desc = get_dev(argv[1], dev);
  66 + if (dev_desc == NULL) {
  67 + printf("Block device %s %d not supported\n", argv[1], dev);
  68 + return 1;
  69 + }
  70 +
  71 + addr = (void *)simple_strtoul(argv[3], NULL, 16);
  72 + blk = simple_strtoul(argv[4], NULL, 16);
  73 + cnt = simple_strtoul(argv[5], NULL, 16);
  74 +
  75 + if (part != 0) {
  76 + if (get_partition_info(dev_desc, part, &part_info)) {
  77 + printf("Cannot find partition %d\n", part);
  78 + return 1;
  79 + }
  80 + offset = part_info.start;
  81 + limit = part_info.size;
  82 + } else {
  83 + /* Largest address not available in block_dev_desc_t. */
  84 + limit = ~0;
  85 + }
  86 +
  87 + if (cnt + blk > limit) {
  88 + printf("Write out of range\n");
  89 + return 1;
  90 + }
  91 +
  92 + if (dev_desc->block_write(dev, offset + blk, cnt, addr) < 0) {
  93 + printf("Error writing blocks\n");
  94 + return 1;
  95 + }
  96 +
  97 + return 0;
  98 +}
  99 +
  100 +U_BOOT_CMD(
  101 + write, 6, 0, do_write,
  102 + "write binary data to a partition",
  103 + "<interface> <dev[:part]> addr blk# cnt"
  104 +);
  105 +
  106 +int rw_block(bool bread, char **ppblock,
  107 + uint *pblksize, char *pblock_write, uint offset, uint size)
  108 +{
  109 + int ret;
  110 + char *argv[6];
  111 + char addr_str[20];
  112 + char cnt_str[8];
  113 + char devpart_str[8];
  114 + char block_begin_str[8];
  115 + ulong blk_size = 0;
  116 + uint blk_begin = 0;
  117 + uint blk_end = 0;
  118 + uint block_cnt = 0;
  119 + char *p_block = NULL;
  120 +
  121 + if (bread && ((ppblock == NULL) || (pblksize == NULL)))
  122 + return -1;
  123 +
  124 + if (!bread && (pblock_write == NULL))
  125 + return -1;
  126 +
  127 + blk_size = get_block_size("mmc", g_mmc_id,
  128 + CONFIG_ANDROID_MISC_PARTITION_MMC);
  129 + if (blk_size == 0) {
  130 + printf("rw_block, get_block_size return 0\n");
  131 + return -1;
  132 + }
  133 +
  134 + blk_begin = offset/blk_size;
  135 + blk_end = (offset + size)/blk_size;
  136 + block_cnt = 1 + (blk_end - blk_begin);
  137 +
  138 +
  139 + sprintf(devpart_str, "0x%x:0x%x", g_mmc_id,
  140 + CONFIG_ANDROID_MISC_PARTITION_MMC);
  141 + sprintf(block_begin_str, "0x%x", blk_begin);
  142 + sprintf(cnt_str, "0x%x", block_cnt);
  143 +
  144 + argv[0] = "rw"; /* not care */
  145 + argv[1] = "mmc";
  146 + argv[2] = devpart_str;
  147 + argv[3] = addr_str;
  148 + argv[4] = block_begin_str;
  149 + argv[5] = cnt_str;
  150 +
  151 + if (bread) {
  152 + p_block = (char *)memalign(ALIGN_BYTES, blk_size * block_cnt);
  153 + if (NULL == p_block) {
  154 + printf("rw_block, memalign %d bytes failed\n",
  155 + (int)(blk_size * block_cnt));
  156 + return -1;
  157 + }
  158 + sprintf(addr_str, "0x%x", (unsigned int)p_block);
  159 + ret = do_raw_read(NULL, 0, 6, argv);
  160 + if (ret) {
  161 + free(p_block);
  162 + printf("do_raw_read failed, ret %d\n", ret);
  163 + return -1;
  164 + }
  165 +
  166 + *ppblock = p_block;
  167 + *pblksize = (uint)blk_size;
  168 + } else {
  169 + sprintf(addr_str, "0x%x", (unsigned int)pblock_write);
  170 + ret = do_write(NULL, 0, 6, argv);
  171 + if (ret) {
  172 + printf("do_write failed, ret %d\n", ret);
  173 + return -1;
  174 + }
  175 + }
  176 + return 0;
  177 +}
drivers/usb/gadget/bcb.h
  1 +/*
  2 + * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
  3 + *
  4 + * SPDX-License-Identifier: GPL-2.0+
  5 + */
  6 +
  7 +#ifndef BCB_H
  8 +#define BCB_H
  9 +#include <linux/types.h>
  10 +#include <linux/stat.h>
  11 +/* keep same as bootable/recovery/bootloader.h */
  12 +struct bootloader_message {
  13 + char command[32];
  14 + char status[32];
  15 + char recovery[768];
  16 +
  17 + /* The 'recovery' field used to be 1024 bytes. It has only ever
  18 + been used to store the recovery command line, so 768 bytes
  19 + should be plenty. We carve off the last 256 bytes to store the
  20 + stage string (for multistage packages) and possible future
  21 + expansion. */
  22 + char stage[32];
  23 + char slot_suffix[32];
  24 + char reserved[192];
  25 +};
  26 +
  27 +/* start from bootloader_message.slot_suffix[BOOTCTRL_IDX] */
  28 +#define BOOTCTRL_IDX 0
  29 +#define MISC_COMMAND_IDX 0
  30 +#define BOOTCTRL_OFFSET \
  31 + (u32)(&(((struct bootloader_message *)0)->slot_suffix[BOOTCTRL_IDX]))
  32 +#define MISC_COMMAND \
  33 + (u32)(&(((struct bootloader_message *)0)->command[MISC_COMMAND_IDX]))
  34 +int rw_block(bool bread, char **ppblock,
  35 + uint *pblksize, char *pblock_write, uint offset, uint size);
  36 +
  37 +void set_mmc_id(unsigned int id);
  38 +#endif
drivers/usb/gadget/bootctrl.c
... ... @@ -10,46 +10,6 @@
10 10 #include "bootctrl.h"
11 11 #include <linux/types.h>
12 12 #include <linux/stat.h>
13   -
14   -#define SLOT_NUM (unsigned int)2
15   -
16   -/* keep same as bootable/recovery/bootloader.h */
17   -struct bootloader_message {
18   - char command[32];
19   - char status[32];
20   - char recovery[768];
21   -
22   - /* The 'recovery' field used to be 1024 bytes. It has only ever
23   - been used to store the recovery command line, so 768 bytes
24   - should be plenty. We carve off the last 256 bytes to store the
25   - stage string (for multistage packages) and possible future
26   - expansion. */
27   - char stage[32];
28   - char slot_suffix[32];
29   - char reserved[192];
30   -};
31   -
32   -/* start from bootloader_message.slot_suffix[BOOTCTRL_IDX] */
33   -#define BOOTCTRL_IDX 0
34   -#define BOOTCTRL_OFFSET \
35   - (u32)(&(((struct bootloader_message *)0)->slot_suffix[BOOTCTRL_IDX]))
36   -#define CRC_DATA_OFFSET \
37   - (uint32_t)(&(((struct boot_ctl *)0)->a_slot_meta[0]))
38   -
39   -struct slot_meta {
40   - u8 bootsuc:1;
41   - u8 tryremain:3;
42   - u8 priority:4;
43   -};
44   -
45   -struct boot_ctl {
46   - char magic[4]; /* "\0FSL" */
47   - u32 crc;
48   - struct slot_meta a_slot_meta[SLOT_NUM];
49   - u8 recovery_tryremain;
50   -};
51   -
52   -static unsigned int g_mmc_id;
53 13 static unsigned int g_slot_selected;
54 14 static const char *g_slot_suffix[SLOT_NUM] = {"_a", "_b"};
55 15  
... ... @@ -62,10 +22,6 @@
62 22 return strncmp(s1, s2, strlen(s1));
63 23 }
64 24  
65   -void set_mmc_id(unsigned int id)
66   -{
67   - g_mmc_id = id;
68   -}
69 25  
70 26 static void dump_slotmeta(struct boot_ctl *ptbootctl)
71 27 {
72 28  
73 29  
... ... @@ -112,99 +68,8 @@
112 68 return slot;
113 69 }
114 70  
115   -static ulong get_block_size(char *ifname, int dev, int part)
116   -{
117   - block_dev_desc_t *dev_desc = NULL;
118   - disk_partition_t part_info;
119 71  
120   - dev_desc = get_dev(ifname, dev);
121   - if (dev_desc == NULL) {
122   - printf("Block device %s %d not supported\n", ifname, dev);
123   - return 0;
124   - }
125 72  
126   - if (get_partition_info(dev_desc, part, &part_info)) {
127   - printf("Cannot find partition %d\n", part);
128   - return 0;
129   - }
130   -
131   - return part_info.blksz;
132   -}
133   -
134   -#define ALIGN_BYTES 64 /*armv7 cache line need 64 bytes aligned */
135   -static int rw_block(bool bread, char **ppblock,
136   - uint *pblksize, char *pblock_write)
137   -{
138   - int ret;
139   - char *argv[6];
140   - char addr_str[20];
141   - char cnt_str[8];
142   - char devpart_str[8];
143   - char block_begin_str[8];
144   - ulong blk_size = 0;
145   - uint blk_begin = 0;
146   - uint blk_end = 0;
147   - uint block_cnt = 0;
148   - char *p_block = NULL;
149   -
150   - if (bread && ((ppblock == NULL) || (pblksize == NULL)))
151   - return -1;
152   -
153   - if (!bread && (pblock_write == NULL))
154   - return -1;
155   -
156   - blk_size = get_block_size("mmc", g_mmc_id,
157   - CONFIG_ANDROID_MISC_PARTITION_MMC);
158   - if (blk_size == 0) {
159   - printf("rw_block, get_block_size return 0\n");
160   - return -1;
161   - }
162   -
163   - blk_begin = BOOTCTRL_OFFSET/blk_size;
164   - blk_end = (BOOTCTRL_OFFSET + sizeof(struct boot_ctl) - 1)/blk_size;
165   - block_cnt = 1 + (blk_end - blk_begin);
166   -
167   - sprintf(devpart_str, "0x%x:0x%x", g_mmc_id,
168   - CONFIG_ANDROID_MISC_PARTITION_MMC);
169   - sprintf(block_begin_str, "0x%x", blk_begin);
170   - sprintf(cnt_str, "0x%x", block_cnt);
171   -
172   - argv[0] = "rw"; /* not care */
173   - argv[1] = "mmc";
174   - argv[2] = devpart_str;
175   - argv[3] = addr_str;
176   - argv[4] = block_begin_str;
177   - argv[5] = cnt_str;
178   -
179   - if (bread) {
180   - p_block = (char *)memalign(ALIGN_BYTES, blk_size * block_cnt);
181   - if (NULL == p_block) {
182   - printf("rw_block, memalign %d bytes failed\n",
183   - (int)(blk_size * block_cnt));
184   - return -1;
185   - }
186   - sprintf(addr_str, "0x%x", (unsigned int)p_block);
187   - ret = do_raw_read(NULL, 0, 6, argv);
188   - if (ret) {
189   - free(p_block);
190   - printf("do_raw_read failed, ret %d\n", ret);
191   - return -1;
192   - }
193   -
194   - *ppblock = p_block;
195   - *pblksize = (uint)blk_size;
196   - } else {
197   - sprintf(addr_str, "0x%x", (unsigned int)pblock_write);
198   - ret = do_write(NULL, 0, 6, argv);
199   - if (ret) {
200   - printf("do_write failed, ret %d\n", ret);
201   - return -1;
202   - }
203   - }
204   -
205   - return 0;
206   -}
207   -
208 73 static int read_bootctl(struct boot_ctl *ptbootctl)
209 74 {
210 75 int ret = 0;
... ... @@ -216,8 +81,8 @@
216 81  
217 82 if (ptbootctl == NULL)
218 83 return -1;
219   -
220   - ret = rw_block(true, &p_block, &blk_size, NULL);
  84 + ret = rw_block(true, &p_block, &blk_size, NULL,
  85 + BOOTCTRL_OFFSET, sizeof(struct boot_ctl));
221 86 if (ret) {
222 87 printf("read_bootctl, rw_block read failed\n");
223 88 return -1;
224 89  
225 90  
226 91  
... ... @@ -264,22 +129,22 @@
264 129 ptbootctl->crc = crc32(0, (unsigned char *)ptbootctl + CRC_DATA_OFFSET,
265 130 sizeof(struct boot_ctl) - CRC_DATA_OFFSET);
266 131  
267   - ret = rw_block(true, &p_block, &blk_size, NULL);
  132 + ret = rw_block(true, &p_block, &blk_size, NULL,
  133 + BOOTCTRL_OFFSET, sizeof(struct boot_ctl));
268 134 if (ret) {
269 135 printf("write_bootctl, rw_block read failed\n");
270 136 return -1;
271 137 }
272   -
273 138 offset_in_block = BOOTCTRL_OFFSET%blk_size;
274 139 memcpy(p_block + offset_in_block, ptbootctl, sizeof(struct boot_ctl));
275 140  
276   - ret = rw_block(false, NULL, NULL, p_block);
  141 + ret = rw_block(false, NULL, NULL, p_block,
  142 + BOOTCTRL_OFFSET, sizeof(struct boot_ctl));
277 143 if (ret) {
278 144 free(p_block);
279 145 printf("write_bootctl, rw_block write failed\n");
280 146 return -1;
281 147 }
282   -
283 148 free(p_block);
284 149 return 0;
285 150 }
... ... @@ -478,72 +343,4 @@
478 343  
479 344 return;
480 345 }
481   -
482   -static int do_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
483   -{
484   - char *ep;
485   - block_dev_desc_t *dev_desc = NULL;
486   - int dev;
487   - int part = 0;
488   - disk_partition_t part_info;
489   - ulong offset = 0u;
490   - ulong limit = 0u;
491   - void *addr;
492   - uint blk;
493   - uint cnt;
494   -
495   - if (argc != 6) {
496   - cmd_usage(cmdtp);
497   - return 1;
498   - }
499   -
500   - dev = (int)simple_strtoul(argv[2], &ep, 16);
501   - if (*ep) {
502   - if (*ep != ':') {
503   - printf("Invalid block device %s\n", argv[2]);
504   - return 1;
505   - }
506   - part = (int)simple_strtoul(++ep, NULL, 16);
507   - }
508   -
509   - dev_desc = get_dev(argv[1], dev);
510   - if (dev_desc == NULL) {
511   - printf("Block device %s %d not supported\n", argv[1], dev);
512   - return 1;
513   - }
514   -
515   - addr = (void *)simple_strtoul(argv[3], NULL, 16);
516   - blk = simple_strtoul(argv[4], NULL, 16);
517   - cnt = simple_strtoul(argv[5], NULL, 16);
518   -
519   - if (part != 0) {
520   - if (get_partition_info(dev_desc, part, &part_info)) {
521   - printf("Cannot find partition %d\n", part);
522   - return 1;
523   - }
524   - offset = part_info.start;
525   - limit = part_info.size;
526   - } else {
527   - /* Largest address not available in block_dev_desc_t. */
528   - limit = ~0;
529   - }
530   -
531   - if (cnt + blk > limit) {
532   - printf("Write out of range\n");
533   - return 1;
534   - }
535   -
536   - if (dev_desc->block_write(dev, offset + blk, cnt, addr) < 0) {
537   - printf("Error writing blocks\n");
538   - return 1;
539   - }
540   -
541   - return 0;
542   -}
543   -
544   -U_BOOT_CMD(
545   - write, 6, 0, do_write,
546   - "write binary data to a partition",
547   - "<interface> <dev[:part]> addr blk# cnt"
548   -);
drivers/usb/gadget/bootctrl.h
... ... @@ -7,12 +7,32 @@
7 7 #ifndef BOOTCTRL_H
8 8 #define BOOTCTRL_H
9 9  
10   -void set_mmc_id(unsigned int id);
  10 +#include <common.h>
  11 +#include <g_dnl.h>
  12 +#include <linux/types.h>
  13 +#include <linux/stat.h>
  14 +#include "bcb.h"
  15 +
  16 +#define SLOT_NUM (unsigned int)2
  17 +#define CRC_DATA_OFFSET \
  18 + (uint32_t)(&(((struct boot_ctl *)0)->a_slot_meta[0]))
  19 +
  20 +struct slot_meta {
  21 + u8 bootsuc:1;
  22 + u8 tryremain:3;
  23 + u8 priority:4;
  24 +};
  25 +
  26 +struct boot_ctl {
  27 + char magic[4]; /* "\0FSL" */
  28 + u32 crc;
  29 + struct slot_meta a_slot_meta[SLOT_NUM];
  30 + u8 recovery_tryremain;
  31 +};
11 32 char *select_slot(void);
12 33 bool is_sotvar(char *cmd);
13 34 void get_slotvar(char *cmd, char *response, size_t chars_left);
14 35 void cb_set_active(struct usb_ep *ep, struct usb_request *req);
15 36 const char *get_slot_suffix(void);
16   -
17 37 #endif
drivers/usb/gadget/command.c
  1 +/*
  2 + * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
  3 + *
  4 + * SPDX-License-Identifier: GPL-2.0+
  5 + */
  6 +
  7 +#include <common.h>
  8 +#include <g_dnl.h>
  9 +#include "bcb.h"
  10 +
  11 +#ifndef CONFIG_FASTBOOT_STORAGE_NAND
  12 +static char command[32];
  13 +static int read_command(char *command)
  14 +{
  15 + int ret = 0;
  16 + char *p_block = NULL;
  17 + uint offset_in_block = 0;
  18 + uint blk_size = 0;
  19 +
  20 + if (command == NULL)
  21 + return -1;
  22 +
  23 + ret = rw_block(true, &p_block, &blk_size, NULL, MISC_COMMAND, 32);
  24 + if (ret) {
  25 + printf("read_bootctl, rw_block read failed\n");
  26 + return -1;
  27 + }
  28 +
  29 + offset_in_block = MISC_COMMAND%blk_size;
  30 + memcpy(command, p_block + offset_in_block, 32);
  31 +
  32 + return 0;
  33 +}
  34 +static int write_command(char *bcb_command)
  35 +{
  36 + int ret = 0;
  37 + char *p_block = NULL;
  38 + uint offset_in_block = 0;
  39 + uint blk_size = 0;
  40 +
  41 + if (bcb_command == NULL)
  42 + return -1;
  43 +
  44 +
  45 + ret = rw_block(true, &p_block, &blk_size, NULL, MISC_COMMAND, 32);
  46 + if (ret) {
  47 + printf("write_bootctl, rw_block read failed\n");
  48 + return -1;
  49 + }
  50 +
  51 + offset_in_block = MISC_COMMAND%blk_size;
  52 + memcpy(p_block + offset_in_block, bcb_command, 32);
  53 +
  54 + ret = rw_block(false, NULL, NULL, p_block, MISC_COMMAND, 32);
  55 + if (ret) {
  56 + free(p_block);
  57 + printf("write_bootctl, rw_block write failed\n");
  58 + return -1;
  59 + }
  60 +
  61 + free(p_block);
  62 + return 0;
  63 +}
  64 +
  65 +int recovery_check_and_clean_command(void)
  66 +{
  67 + int ret;
  68 + ret = read_command(command);
  69 + if (ret < 0) {
  70 + printf("read command failed\n");
  71 + return 0;
  72 + }
  73 + if (!strcmp(command, "boot-recovery")) {
  74 + memset(command, 0, 32);
  75 + write_command(command);
  76 + return 1;
  77 + }
  78 + return 0;
  79 +}
  80 +int fastboot_check_and_clean_command(void)
  81 +{
  82 + int ret;
  83 + ret = read_command(command);
  84 + if (ret < 0) {
  85 + printf("read command failed\n");
  86 + return 0;
  87 + }
  88 + if (!strcmp(command, "boot-bootloader")) {
  89 + memset(command, 0, 32);
  90 + write_command(command);
  91 + return 1;
  92 + }
  93 +
  94 + return 0;
  95 +}
  96 +#else
  97 +int recovery_check_and_clean_command(void)
  98 +{
  99 + return 0;
  100 +}
  101 +int fastboot_check_and_clean_command(void)
  102 +{
  103 + return 0;
  104 +}
  105 +#endif
drivers/usb/gadget/f_fastboot.c
... ... @@ -41,7 +41,9 @@
41 41 #ifdef CONFIG_BRILLO_SUPPORT
42 42 #include "bootctrl.h"
43 43 #endif
44   -
  44 +#ifdef CONFIG_BCB_SUPPORT
  45 +#include "bcb.h"
  46 +#endif
45 47 #define FASTBOOT_VERSION "0.4"
46 48  
47 49 #define FASTBOOT_INTERFACE_CLASS 0xff
... ... @@ -1099,7 +1101,7 @@
1099 1101 } else if (!strncmp(fastboot_env, "mmc", 3)) {
1100 1102 fastboot_devinfo.type = DEV_MMC;
1101 1103 fastboot_devinfo.dev_id = _fastboot_get_mmc_no(fastboot_env);
1102   -#ifdef CONFIG_BRILLO_SUPPORT
  1104 +#ifdef CONFIG_BCB_SUPPORT
1103 1105 set_mmc_id(fastboot_devinfo.dev_id);
1104 1106 #endif
1105 1107 }
include/configs/mx6sabreandroid_common.h
1 1 /*
2   - * Copyright (C) 2013-2015 Freescale Semiconductor, Inc. All Rights Reserved.
  2 + * Copyright (C) 2013-2016 Freescale Semiconductor, Inc. All Rights Reserved.
3 3 *
4 4 * SPDX-License-Identifier: GPL-2.0+
5 5 */
... ... @@ -22,6 +22,8 @@
22 22 #define CONFIG_G_DNL_MANUFACTURER "FSL"
23 23  
24 24 #define CONFIG_CMD_FASTBOOT
  25 +#define CONFIG_CMD_READ
  26 +#define CONFIG_BCB_SUPPORT
25 27 #define CONFIG_ANDROID_BOOT_IMAGE
26 28 #define CONFIG_FASTBOOT_FLASH
27 29  
... ... @@ -42,6 +44,7 @@
42 44 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2
43 45 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6
44 46 #define CONFIG_ANDROID_DATA_PARTITION_MMC 4
  47 +#define CONFIG_ANDROID_MISC_PARTITION_MMC 8
45 48  
46 49 #if defined(CONFIG_FASTBOOT_STORAGE_NAND)
47 50 #define ANDROID_FASTBOOT_NAND_PARTS "16m@64m(boot) 16m@80m(recovery) 810m@96m(android_root)ubifs"
include/configs/mx6slevkandroid.h
1 1  
2 2 /*
3   - * Copyright (C) 2013-2015 Freescale Semiconductor, Inc. All Rights Reserved.
  3 + * Copyright (C) 2013-2016 Freescale Semiconductor, Inc. All Rights Reserved.
4 4 *
5 5 * SPDX-License-Identifier: GPL-2.0+
6 6 */
... ... @@ -25,6 +25,8 @@
25 25 #define CONFIG_G_DNL_MANUFACTURER "FSL"
26 26  
27 27 #define CONFIG_CMD_FASTBOOT
  28 +#define CONFIG_CMD_READ
  29 +#define CONFIG_BCB_SUPPORT
28 30 #define CONFIG_ANDROID_BOOT_IMAGE
29 31 #define CONFIG_FASTBOOT_FLASH
30 32  
... ... @@ -39,6 +41,7 @@
39 41 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2
40 42 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6
41 43 #define CONFIG_ANDROID_DATA_PARTITION_MMC 4
  44 +#define CONFIG_ANDROID_MISC_PARTITION_MMC 8
42 45  
43 46 #define CONFIG_CMD_BOOTA
44 47 #define CONFIG_SUPPORT_RAW_INITRD
include/configs/mx6sxsabreautoandroid.h
1 1  
2 2 /*
3   - * Copyright (C) 2014-2015 Freescale Semiconductor, Inc.
  3 + * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
4 4 *
5 5 * SPDX-License-Identifier: GPL-2.0+
6 6 */
... ... @@ -23,6 +23,8 @@
23 23 #define CONFIG_G_DNL_MANUFACTURER "FSL"
24 24  
25 25 #define CONFIG_CMD_FASTBOOT
  26 +#define CONFIG_CMD_READ
  27 +#define CONFIG_BCB_SUPPORT
26 28 #define CONFIG_ANDROID_BOOT_IMAGE
27 29 #define CONFIG_FASTBOOT_FLASH
28 30  
... ... @@ -45,6 +47,7 @@
45 47 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2
46 48 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6
47 49 #define CONFIG_ANDROID_DATA_PARTITION_MMC 4
  50 +#define CONFIG_ANDROID_MISC_PARTITION_MMC 8
48 51  
49 52 #define CONFIG_CMD_BOOTA
50 53 #define CONFIG_SUPPORT_RAW_INITRD
include/configs/mx6sxsabresdandroid.h
1 1  
2 2 /*
3   - * Copyright (C) 2014-2015 Freescale Semiconductor, Inc.
  3 + * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
4 4 *
5 5 * SPDX-License-Identifier: GPL-2.0+
6 6 */
... ... @@ -23,6 +23,8 @@
23 23 #define CONFIG_G_DNL_MANUFACTURER "FSL"
24 24  
25 25 #define CONFIG_CMD_FASTBOOT
  26 +#define CONFIG_CMD_READ
  27 +#define CONFIG_BCB_SUPPORT
26 28 #define CONFIG_ANDROID_BOOT_IMAGE
27 29 #define CONFIG_FASTBOOT_FLASH
28 30  
... ... @@ -37,6 +39,7 @@
37 39 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2
38 40 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6
39 41 #define CONFIG_ANDROID_DATA_PARTITION_MMC 4
  42 +#define CONFIG_ANDROID_MISC_PARTITION_MMC 8
40 43  
41 44 #define CONFIG_CMD_BOOTA
42 45 #define CONFIG_SUPPORT_RAW_INITRD
include/configs/mx6ul_14x14_evk_android.h
1 1  
2 2 /*
3   - * Copyright (C) 2015 Freescale Semiconductor, Inc.
  3 + * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
4 4 *
5 5 * SPDX-License-Identifier: GPL-2.0+
6 6 */
... ... @@ -23,6 +23,7 @@
23 23 #define CONFIG_G_DNL_MANUFACTURER "FSL"
24 24  
25 25 #define CONFIG_CMD_FASTBOOT
  26 +#define CONFIG_BCB_SUPPORT
26 27 #define CONFIG_ANDROID_BOOT_IMAGE
27 28 #define CONFIG_FASTBOOT_FLASH
28 29  
include/configs/mx7dsabresdandroid.h
1 1  
2 2 /*
3   - * Copyright (C) 2015 Freescale Semiconductor, Inc.
  3 + * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
4 4 *
5 5 * SPDX-License-Identifier: GPL-2.0+
6 6 */
... ... @@ -23,6 +23,8 @@
23 23 #define CONFIG_G_DNL_MANUFACTURER "FSL"
24 24  
25 25 #define CONFIG_CMD_FASTBOOT
  26 +#define CONFIG_CMD_READ
  27 +#define CONFIG_BCB_SUPPORT
26 28 #define CONFIG_ANDROID_BOOT_IMAGE
27 29 #define CONFIG_FASTBOOT_FLASH
28 30  
... ... @@ -36,6 +38,7 @@
36 38 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2
37 39 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6
38 40 #define CONFIG_ANDROID_DATA_PARTITION_MMC 4
  41 +#define CONFIG_ANDROID_MISC_PARTITION_MMC 8
39 42  
40 43 #define CONFIG_CMD_BOOTA
41 44 #define CONFIG_SUPPORT_RAW_INITRD
include/fsl_fastboot.h
... ... @@ -158,6 +158,7 @@
158 158  
159 159 /* Check the board special boot mode reboot to fastboot mode. */
160 160 int fastboot_check_and_clean_flag(void);
  161 +int fastboot_check_and_clean_command(void);
161 162  
162 163 /* Set the flag which reboot to fastboot mode*/
163 164 void fastboot_enable_flag(void);
1 1 /*
2   - * Copyright (C) 2010-2014 Freescale Semiconductor, Inc. All Rights Reserved.
  2 + * Copyright (C) 2010-2016 Freescale Semiconductor, Inc. All Rights Reserved.
3 3 *
4 4 * SPDX-License-Identifier: GPL-2.0+
5 5 */
... ... @@ -14,6 +14,7 @@
14 14  
15 15 void check_recovery_mode(void);
16 16 int recovery_check_and_clean_flag(void);
  17 +int recovery_check_and_clean_command(void);
17 18 int check_recovery_cmd_file(void);
18 19 void board_recovery_setup(void);
19 20