1 /* 2 * Copyright 2016 Google Inc. All Rights Reserved. 3 * Author: gkalsi@google.com (Gurjant Kalsi) 4 * 5 * Use of this source code is governed by a MIT-style 6 * license that can be found in the LICENSE file or at 7 * https://opensource.org/licenses/MIT 8 */ 9 10 #include <app/moot/fsboot.h> 11 #include <app/moot/moot.h> 12 #include <app/moot/stubs.h> 13 #include <app/moot/usbboot.h> 14 15 #include <app.h> 16 #include <arch.h> 17 #include <assert.h> 18 #include <lk/debug.h> 19 #include <lk/err.h> 20 #include <kernel/event.h> 21 #include <lk/init.h> 22 #include <stdlib.h> 23 #include <lk/trace.h> 24 do_boot(void)25static void do_boot(void) { 26 arch_disable_ints(); 27 arch_quiesce(); 28 arch_chain_load((void *)(moot_system_info.sys_base_addr), 0, 0, 0, 0); 29 } 30 moot_init(const struct app_descriptor * app)31static void moot_init(const struct app_descriptor *app) { 32 // Initialize our boot subsystems. 33 init_usb_boot(); 34 35 } 36 moot_entry(const struct app_descriptor * app,void * args)37static void moot_entry(const struct app_descriptor *app, void *args) { 38 // Wait a few seconds for the host to try to talk to us over USB. 39 printf("attempting usb boot...\n"); 40 attempt_usb_boot(); 41 42 // Check the SPIFlash for an upgrade image. 43 printf("attempting fs boot...\n"); 44 attempt_fs_boot(); 45 46 // Boot the main system image. 47 printf("proceeding to boot...\n"); 48 do_boot(); 49 } 50 51 APP_START(moot) 52 .init = moot_init, 53 .entry = moot_entry, 54 APP_END 55