blob: 3eac0258a8e3520d049d595f86687b1ddd0e4050 [file] [log] [blame]
Brian Swetland9c4c0752009-01-25 16:23:50 -08001/*
2 * Copyright (c) 2009, Google Inc.
3 * All rights reserved.
4 *
Shashank Mittal4f99a882010-02-01 13:58:50 -08005 * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
Brian Swetland9c4c0752009-01-25 16:23:50 -08006 *
Chandan Uddaraju5fa471a2009-12-02 17:31:34 -08007 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of Code Aurora nor
15 * the names of its contributors may be used to endorse or promote
16 * products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
Brian Swetland9c4c0752009-01-25 16:23:50 -080031 */
32
33#include <app.h>
34#include <debug.h>
35#include <arch/arm.h>
36#include <dev/udc.h>
37#include <string.h>
38#include <kernel/thread.h>
39#include <arch/ops.h>
40
Dima Zavin214cc642009-01-26 11:16:21 -080041#include <dev/flash.h>
42#include <lib/ptable.h>
Dima Zavinb4283602009-01-26 16:36:57 -080043#include <dev/keys.h>
Shashank Mittal4f99a882010-02-01 13:58:50 -080044#include <dev/fbcon.h>
Dima Zavin214cc642009-01-26 11:16:21 -080045
Shashank Mittal024c0332010-02-03 11:44:00 -080046#include "recovery.h"
Brian Swetland9c4c0752009-01-25 16:23:50 -080047#include "bootimg.h"
48#include "fastboot.h"
49
Chandan Uddarajuda919832009-11-17 01:06:11 -080050#define DEFAULT_CMDLINE "mem=100M console=null";
Brian Swetland2defe162009-08-18 14:35:59 -070051
Ajay Dudanicd01f9b2010-02-23 21:13:04 -080052#ifdef MEMBASE
53#define EMMC_BOOT_IMG_HEADER_ADDR (0xFF000+(MEMBASE))
54#else
David Ng183a7422009-12-07 14:55:21 -080055#define EMMC_BOOT_IMG_HEADER_ADDR 0xFF000
Ajay Dudanicd01f9b2010-02-23 21:13:04 -080056#endif
57
Chandan Uddarajude85d3f2010-01-05 16:32:33 -080058#define RECOVERY_MODE 0x77665502
59#define FASTBOOT_MODE 0x77665500
60
David Ng183a7422009-12-07 14:55:21 -080061static const char *emmc_cmdline = " androidboot.emmc=true";
62
Brian Swetland9c4c0752009-01-25 16:23:50 -080063static struct udc_device surf_udc_device = {
64 .vendor_id = 0x18d1,
Chandan Uddarajuc53a1a12009-11-18 14:53:40 -080065 .product_id = 0xD00D,
Brian Swetland9c4c0752009-01-25 16:23:50 -080066 .version_id = 0x0100,
67 .manufacturer = "Google",
68 .product = "Android",
69};
70
Dima Zavin42168f22009-01-30 11:52:22 -080071struct atag_ptbl_entry
72{
73 char name[16];
74 unsigned offset;
75 unsigned size;
76 unsigned flags;
77};
78
Brian Swetland9c4c0752009-01-25 16:23:50 -080079void platform_uninit_timer(void);
Chandan Uddarajuc6860e12009-11-19 11:22:15 -080080unsigned* target_atag_mem(unsigned* ptr);
Chandan Uddaraju885e4db2009-12-03 22:45:26 -080081unsigned board_machtype(void);
Chandan Uddarajude85d3f2010-01-05 16:32:33 -080082unsigned check_reboot_mode(void);
David Ng3679bc52010-02-09 15:43:43 -080083void *target_get_scratch_address(void);
David Ng183a7422009-12-07 14:55:21 -080084int target_is_emmc_boot(void);
Chandan Uddaraju94183c02010-01-15 15:13:59 -080085void reboot_device(unsigned);
Chandan Uddaraju7f5b9012010-02-06 16:37:48 -080086void target_battery_charging_enable(unsigned enable, unsigned disconnect);
Brian Swetland9c4c0752009-01-25 16:23:50 -080087
Chandan Uddarajude85d3f2010-01-05 16:32:33 -080088
Dima Zavin42168f22009-01-30 11:52:22 -080089static void ptentry_to_tag(unsigned **ptr, struct ptentry *ptn)
90{
91 struct atag_ptbl_entry atag_ptn;
92
Shashank Mittal8e49dec2010-03-01 15:19:04 -080093 if (ptn->type == TYPE_MODEM_PARTITION)
94 return;
Dima Zavin42168f22009-01-30 11:52:22 -080095 memcpy(atag_ptn.name, ptn->name, 16);
96 atag_ptn.name[15] = '\0';
97 atag_ptn.offset = ptn->start;
98 atag_ptn.size = ptn->length;
99 atag_ptn.flags = ptn->flags;
100 memcpy(*ptr, &atag_ptn, sizeof(struct atag_ptbl_entry));
101 *ptr += sizeof(struct atag_ptbl_entry) / sizeof(unsigned);
102}
Brian Swetland9c4c0752009-01-25 16:23:50 -0800103
104void boot_linux(void *kernel, unsigned *tags,
105 const char *cmdline, unsigned machtype,
106 void *ramdisk, unsigned ramdisk_size)
107{
108 unsigned *ptr = tags;
Shashank Mittal8e49dec2010-03-01 15:19:04 -0800109 unsigned pcount = 0;
Brian Swetland9c4c0752009-01-25 16:23:50 -0800110 void (*entry)(unsigned,unsigned,unsigned*) = kernel;
Dima Zavin42168f22009-01-30 11:52:22 -0800111 struct ptable *ptable;
David Ng183a7422009-12-07 14:55:21 -0800112 int cmdline_len = 0;
113 int have_cmdline = 0;
Brian Swetland9c4c0752009-01-25 16:23:50 -0800114
115 /* CORE */
116 *ptr++ = 2;
117 *ptr++ = 0x54410001;
118
119 if (ramdisk_size) {
120 *ptr++ = 4;
121 *ptr++ = 0x54420005;
Dima Zavin214cc642009-01-26 11:16:21 -0800122 *ptr++ = (unsigned)ramdisk;
Brian Swetland9c4c0752009-01-25 16:23:50 -0800123 *ptr++ = ramdisk_size;
124 }
125
Chandan Uddarajuc6860e12009-11-19 11:22:15 -0800126 ptr = target_atag_mem(ptr);
127
David Ng183a7422009-12-07 14:55:21 -0800128 if (!target_is_emmc_boot()) {
129 /* Skip NAND partition ATAGS for eMMC boot */
130 if ((ptable = flash_get_ptable()) && (ptable->count != 0)) {
131 int i;
Shashank Mittal8e49dec2010-03-01 15:19:04 -0800132 for(i=0; i < ptable->count; i++) {
133 struct ptentry *ptn;
134 ptn = ptable_get(ptable, i);
135 if (ptn->type == TYPE_APPS_PARTITION)
136 pcount++;
137 }
138 *ptr++ = 2 + (pcount * (sizeof(struct atag_ptbl_entry) /
David Ng183a7422009-12-07 14:55:21 -0800139 sizeof(unsigned)));
140 *ptr++ = 0x4d534d70;
141 for (i = 0; i < ptable->count; ++i)
142 ptentry_to_tag(&ptr, ptable_get(ptable, i));
143 }
Dima Zavin42168f22009-01-30 11:52:22 -0800144 }
145
Brian Swetland9c4c0752009-01-25 16:23:50 -0800146 if (cmdline && cmdline[0]) {
David Ng183a7422009-12-07 14:55:21 -0800147 cmdline_len = strlen(cmdline);
148 have_cmdline = 1;
149 }
150 if (target_is_emmc_boot()) {
151 cmdline_len += strlen(emmc_cmdline);
152 }
153 if (cmdline_len > 0) {
154 const char *src;
155 char *dst;
Brian Swetland9c4c0752009-01-25 16:23:50 -0800156 unsigned n;
157 /* include terminating 0 and round up to a word multiple */
David Ng183a7422009-12-07 14:55:21 -0800158 n = (cmdline_len + 4) & (~3);
Brian Swetland9c4c0752009-01-25 16:23:50 -0800159 *ptr++ = (n / 4) + 2;
160 *ptr++ = 0x54410009;
David Ng183a7422009-12-07 14:55:21 -0800161 dst = (char *)ptr;
162 if (have_cmdline) {
163 src = cmdline;
164 while ((*dst++ = *src++));
165 }
166 if (target_is_emmc_boot()) {
167 src = emmc_cmdline;
168 if (have_cmdline) --dst;
169 while ((*dst++ = *src++));
170 }
Brian Swetland9c4c0752009-01-25 16:23:50 -0800171 ptr += (n / 4);
172 }
173
174 /* END */
175 *ptr++ = 0;
176 *ptr++ = 0;
177
178 dprintf(INFO, "booting linux @ %p, ramdisk @ %p (%d)\n",
179 kernel, ramdisk, ramdisk_size);
180 if (cmdline)
181 dprintf(INFO, "cmdline: %s\n", cmdline);
182
183 enter_critical_section();
184 platform_uninit_timer();
185 arch_disable_cache(UCACHE);
Brian Swetland9c4c0752009-01-25 16:23:50 -0800186 arch_disable_mmu();
187
188 entry(0, machtype, tags);
189
190}
191
Shashank Mittaldcc2e352009-11-19 19:11:16 -0800192unsigned page_size = 0;
193unsigned page_mask = 0;
Brian Swetland9c4c0752009-01-25 16:23:50 -0800194
Shashank Mittaldcc2e352009-11-19 19:11:16 -0800195#define ROUND_TO_PAGE(x,y) (((x) + (y)) & (~(y)))
Brian Swetland9c4c0752009-01-25 16:23:50 -0800196
Shashank Mittaldcc2e352009-11-19 19:11:16 -0800197static unsigned char buf[4096]; //Equal to max-supported pagesize
Dima Zavin214cc642009-01-26 11:16:21 -0800198
199int boot_linux_from_flash(void)
200{
201 struct boot_img_hdr *hdr = (void*) buf;
202 unsigned n;
203 struct ptentry *ptn;
204 struct ptable *ptable;
205 unsigned offset = 0;
206 const char *cmdline;
Shashank Mittal4f99a882010-02-01 13:58:50 -0800207 struct fbcon_config *fb_display = NULL;
Chandan Uddarajude85d3f2010-01-05 16:32:33 -0800208
David Ng183a7422009-12-07 14:55:21 -0800209 if (target_is_emmc_boot()) {
210 hdr = (struct boot_img_hdr *)EMMC_BOOT_IMG_HEADER_ADDR;
211 if (memcmp(hdr->magic, BOOT_MAGIC, BOOT_MAGIC_SIZE)) {
212 dprintf(CRITICAL, "ERROR: Invalid boot image header\n");
213 return -1;
214 }
215 goto continue_boot;
216 }
217
Dima Zavin214cc642009-01-26 11:16:21 -0800218 ptable = flash_get_ptable();
219 if (ptable == NULL) {
220 dprintf(CRITICAL, "ERROR: Partition table not found\n");
221 return -1;
222 }
223
Shashank Mittal4f99a882010-02-01 13:58:50 -0800224#if DISPLAY_SPLASH_SCREEN
225 ptn = ptable_find(ptable, "splash");
226 if (ptn == NULL) {
227 dprintf(CRITICAL, "ERROR: No splash partition found\n");
228 } else {
229 fb_display = fbcon_display();
230 if (fb_display) {
231 if (flash_read(ptn, 0, fb_display->base,
232 (fb_display->width * fb_display->height * fb_display->bpp/8))) {
233 fbcon_clear();
234 dprintf(CRITICAL, "ERROR: Cannot read splash image\n");
235 }
236 }
237 }
238#endif
239
Chandan Uddarajude85d3f2010-01-05 16:32:33 -0800240 if(!boot_into_recovery)
241 {
242 ptn = ptable_find(ptable, "boot");
243 if (ptn == NULL) {
244 dprintf(CRITICAL, "ERROR: No boot partition found\n");
245 return -1;
246 }
247 }
248 else
249 {
250 ptn = ptable_find(ptable, "recovery");
251 if (ptn == NULL) {
252 dprintf(CRITICAL, "ERROR: No recovery partition found\n");
253 return -1;
254 }
Dima Zavin214cc642009-01-26 11:16:21 -0800255 }
256
Shashank Mittaldcc2e352009-11-19 19:11:16 -0800257 if (flash_read(ptn, offset, buf, page_size)) {
Dima Zavin214cc642009-01-26 11:16:21 -0800258 dprintf(CRITICAL, "ERROR: Cannot read boot image header\n");
259 return -1;
260 }
Shashank Mittaldcc2e352009-11-19 19:11:16 -0800261 offset += page_size;
Dima Zavin214cc642009-01-26 11:16:21 -0800262
263 if (memcmp(hdr->magic, BOOT_MAGIC, BOOT_MAGIC_SIZE)) {
264 dprintf(CRITICAL, "ERROR: Invaled boot image heador\n");
265 return -1;
266 }
267
Shashank Mittaldcc2e352009-11-19 19:11:16 -0800268 if (hdr->page_size != page_size) {
269 dprintf(CRITICAL, "ERROR: Invaled boot image pagesize. Device pagesize: %d, Image pagesize: %d\n",page_size,hdr->page_size);
270 return -1;
271 }
272
273 n = ROUND_TO_PAGE(hdr->kernel_size, page_mask);
Dima Zavin214cc642009-01-26 11:16:21 -0800274 if (flash_read(ptn, offset, (void *)hdr->kernel_addr, n)) {
275 dprintf(CRITICAL, "ERROR: Cannot read kernel image\n");
276 return -1;
277 }
278 offset += n;
279
Shashank Mittaldcc2e352009-11-19 19:11:16 -0800280 n = ROUND_TO_PAGE(hdr->ramdisk_size, page_mask);
Dima Zavin214cc642009-01-26 11:16:21 -0800281 if (flash_read(ptn, offset, (void *)hdr->ramdisk_addr, n)) {
282 dprintf(CRITICAL, "ERROR: Cannot read ramdisk image\n");
283 return -1;
284 }
285 offset += n;
286
David Ng183a7422009-12-07 14:55:21 -0800287continue_boot:
Dima Zavin214cc642009-01-26 11:16:21 -0800288 dprintf(INFO, "\nkernel @ %x (%d bytes)\n", hdr->kernel_addr,
289 hdr->kernel_size);
290 dprintf(INFO, "ramdisk @ %x (%d bytes)\n", hdr->ramdisk_addr,
291 hdr->ramdisk_size);
292
293 if(hdr->cmdline[0]) {
294 cmdline = (char*) hdr->cmdline;
295 } else {
296 cmdline = DEFAULT_CMDLINE;
297 }
298 dprintf(INFO, "cmdline = '%s'\n", cmdline);
299
300 /* TODO: create/pass atags to kernel */
301
302 dprintf(INFO, "\nBooting Linux\n");
303 boot_linux((void *)hdr->kernel_addr, (void *)TAGS_ADDR,
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800304 (const char *)cmdline, board_machtype(),
Dima Zavin214cc642009-01-26 11:16:21 -0800305 (void *)hdr->ramdisk_addr, hdr->ramdisk_size);
306
307 return 0;
308}
Brian Swetland9c4c0752009-01-25 16:23:50 -0800309
310void cmd_boot(const char *arg, void *data, unsigned sz)
311{
312 unsigned kernel_actual;
313 unsigned ramdisk_actual;
314 static struct boot_img_hdr hdr;
315 char *ptr = ((char*) data);
316
317 if (sz < sizeof(hdr)) {
318 fastboot_fail("invalid bootimage header");
319 return;
320 }
321
322 memcpy(&hdr, data, sizeof(hdr));
323
324 /* ensure commandline is terminated */
325 hdr.cmdline[BOOT_ARGS_SIZE-1] = 0;
326
Shashank Mittaldcc2e352009-11-19 19:11:16 -0800327 kernel_actual = ROUND_TO_PAGE(hdr.kernel_size, page_mask);
328 ramdisk_actual = ROUND_TO_PAGE(hdr.ramdisk_size, page_mask);
Brian Swetland9c4c0752009-01-25 16:23:50 -0800329
330 if (2048 + kernel_actual + ramdisk_actual < sz) {
331 fastboot_fail("incomplete bootimage");
332 return;
333 }
334
335 memmove((void*) KERNEL_ADDR, ptr + 2048, hdr.kernel_size);
336 memmove((void*) RAMDISK_ADDR, ptr + 2048 + kernel_actual, hdr.ramdisk_size);
337
338 fastboot_okay("");
Chandan Uddaraju7f5b9012010-02-06 16:37:48 -0800339 target_battery_charging_enable(0, 1);
Brian Swetland9c4c0752009-01-25 16:23:50 -0800340 udc_stop();
341
Brian Swetland9c4c0752009-01-25 16:23:50 -0800342 boot_linux((void*) KERNEL_ADDR, (void*) TAGS_ADDR,
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800343 (const char*) hdr.cmdline, board_machtype(),
Brian Swetland9c4c0752009-01-25 16:23:50 -0800344 (void*) RAMDISK_ADDR, hdr.ramdisk_size);
345}
346
Dima Zavin214cc642009-01-26 11:16:21 -0800347void cmd_erase(const char *arg, void *data, unsigned sz)
348{
349 struct ptentry *ptn;
350 struct ptable *ptable;
351
352 ptable = flash_get_ptable();
353 if (ptable == NULL) {
354 fastboot_fail("partition table doesn't exist");
355 return;
356 }
357
358 ptn = ptable_find(ptable, arg);
359 if (ptn == NULL) {
360 fastboot_fail("unknown partition name");
361 return;
362 }
363
364 if (flash_erase(ptn)) {
365 fastboot_fail("failed to erase partition");
366 return;
367 }
368 fastboot_okay("");
369}
370
371void cmd_flash(const char *arg, void *data, unsigned sz)
372{
373 struct ptentry *ptn;
374 struct ptable *ptable;
375 unsigned extra = 0;
376
377 ptable = flash_get_ptable();
378 if (ptable == NULL) {
379 fastboot_fail("partition table doesn't exist");
380 return;
381 }
382
383 ptn = ptable_find(ptable, arg);
384 if (ptn == NULL) {
385 fastboot_fail("unknown partition name");
386 return;
387 }
388
389 if (!strcmp(ptn->name, "boot") || !strcmp(ptn->name, "recovery")) {
390 if (memcmp((void *)data, BOOT_MAGIC, BOOT_MAGIC_SIZE)) {
391 fastboot_fail("image is not a boot image");
392 return;
393 }
394 }
395
Chandan Uddarajud6d45042010-02-24 21:12:45 -0800396 if (!strcmp(ptn->name, "system") || !strcmp(ptn->name, "userdata")
397 || !strcmp(ptn->name, "persist"))
Shashank Mittaldcc2e352009-11-19 19:11:16 -0800398 extra = ((page_size >> 9) * 16);
Dima Zavin214cc642009-01-26 11:16:21 -0800399 else
Shashank Mittaldcc2e352009-11-19 19:11:16 -0800400 sz = ROUND_TO_PAGE(sz, page_mask);
Dima Zavin214cc642009-01-26 11:16:21 -0800401
402 dprintf(INFO, "writing %d bytes to '%s'\n", sz, ptn->name);
403 if (flash_write(ptn, extra, data, sz)) {
404 fastboot_fail("flash write failure");
405 return;
406 }
407 dprintf(INFO, "partition '%s' updated\n", ptn->name);
408 fastboot_okay("");
409}
410
411void cmd_continue(const char *arg, void *data, unsigned sz)
412{
413 fastboot_okay("");
Chandan Uddaraju7f5b9012010-02-06 16:37:48 -0800414 target_battery_charging_enable(0, 1);
Dima Zavin214cc642009-01-26 11:16:21 -0800415 udc_stop();
416
417 boot_linux_from_flash();
418}
419
Chandan Uddaraju94183c02010-01-15 15:13:59 -0800420void cmd_reboot(const char *arg, void *data, unsigned sz)
421{
422 dprintf(INFO, "rebooting the device\n");
423 fastboot_okay("");
424 reboot_device(0);
425}
426
427void cmd_reboot_bootloader(const char *arg, void *data, unsigned sz)
428{
429 dprintf(INFO, "rebooting the device\n");
430 fastboot_okay("");
431 reboot_device(FASTBOOT_MODE);
432}
433
Brian Swetland9c4c0752009-01-25 16:23:50 -0800434void aboot_init(const struct app_descriptor *app)
435{
Shashank Mittal4f99a882010-02-01 13:58:50 -0800436 unsigned reboot_mode = 0;
437 unsigned disp_init = 0;
438 #if DISPLAY_SPLASH_SCREEN
439 display_init();
440 dprintf(INFO, "Diplay initialized\n");
441 disp_init = 1;
442 #endif
Shashank Mittaldcc2e352009-11-19 19:11:16 -0800443 page_size = flash_page_size();
444 page_mask = page_size - 1;
Chandan Uddarajude85d3f2010-01-05 16:32:33 -0800445 if (keys_get_state(KEY_HOME) != 0)
446 boot_into_recovery = 1;
Dima Zavinb4283602009-01-26 16:36:57 -0800447 if (keys_get_state(KEY_BACK) != 0)
448 goto fastboot;
Chandan Uddaraju26a56902010-01-13 18:26:56 -0800449 if (keys_get_state(KEY_CLEAR) != 0)
450 goto fastboot;
Dima Zavinb4283602009-01-26 16:36:57 -0800451
Chandan Uddarajude85d3f2010-01-05 16:32:33 -0800452 reboot_mode = check_reboot_mode();
453 if (reboot_mode == RECOVERY_MODE){
454 boot_into_recovery = 1;
455 }else if(reboot_mode == FASTBOOT_MODE){
456 goto fastboot;
457 }
Shashank Mittal024c0332010-02-03 11:44:00 -0800458 recovery_init();
Dima Zavinb4283602009-01-26 16:36:57 -0800459 boot_linux_from_flash();
460 dprintf(CRITICAL, "ERROR: Could not do normal boot. Reverting "
461 "to fastboot mode.\n");
462
463fastboot:
Shashank Mittal4f99a882010-02-01 13:58:50 -0800464 if(!disp_init) {
465 display_init();
466 } else {
467 fbcon_clear();
468 }
Chandan Uddaraju24120502009-12-12 19:17:04 -0800469 dprintf(INFO, "Diplay initialized\n");
Brian Swetland9c4c0752009-01-25 16:23:50 -0800470 udc_init(&surf_udc_device);
471
472 fastboot_register("boot", cmd_boot);
Dima Zavin214cc642009-01-26 11:16:21 -0800473 fastboot_register("erase:", cmd_erase);
474 fastboot_register("flash:", cmd_flash);
475 fastboot_register("continue", cmd_continue);
Chandan Uddaraju94183c02010-01-15 15:13:59 -0800476 fastboot_register("reboot", cmd_reboot);
477 fastboot_register("reboot-bootloader", cmd_reboot_bootloader);
Brian Swetland9c4c0752009-01-25 16:23:50 -0800478 fastboot_publish("product", "swordfish");
479 fastboot_publish("kernel", "lk");
480
Ajay Dudanid43419e2010-02-10 13:17:39 -0800481 fastboot_init(target_get_scratch_address(), 120 * 1024 * 1024);
Brian Swetland9c4c0752009-01-25 16:23:50 -0800482 udc_start();
Chandan Uddaraju7f5b9012010-02-06 16:37:48 -0800483 target_battery_charging_enable(1, 0);
Brian Swetland9c4c0752009-01-25 16:23:50 -0800484}
485
486APP_START(aboot)
487 .init = aboot_init,
488APP_END
489