diff --git a/app/droidboot_gui b/app/droidboot_gui index 71fa505..2988fcb 160000 --- a/app/droidboot_gui +++ b/app/droidboot_gui @@ -1 +1 @@ -Subproject commit 71fa505a23826ec1ba5a8b5908b88826babd70d3 +Subproject commit 2988fcb85abdd6d4904cf0f38f3fb9bedac67250 diff --git a/app/mt_boot/mt_boot.c b/app/mt_boot/mt_boot.c index a500759..a8c8ca3 100755 --- a/app/mt_boot/mt_boot.c +++ b/app/mt_boot/mt_boot.c @@ -774,7 +774,7 @@ extern void *g_fdt; int boot_linux_fdt(void *kernel, unsigned *tags, unsigned machtype, - void *ramdisk, unsigned ramdisk_sz) + void *ramdisk, unsigned ramdisk_sz, unsigned char *kernel_raw, off_t kernel_raw_size) { void *fdt = tags; int ret; @@ -841,10 +841,19 @@ int boot_linux_fdt(void *kernel, unsigned *tags, * LK start: 0x41E00000, Kernel Start: 0x40080000 * Max is 0x41E00000 - 0x40080000 = 0x1D80000. * using 0x1C00000=28MB for decompressed kernel image size */ - if (decompress_kernel((unsigned char *)(kernel_load_addr), - (void *)kernel_target_addr, (int)zimage_size, - (int)kernel_sz_mb)) { - panic("decompress kernel image fail!!!\n"); + if(kernel_raw==NULL){ + if (decompress_kernel((unsigned char *)(kernel_load_addr), + (void *)kernel_target_addr, (int)zimage_size, + (int)kernel_sz_mb)) { + panic("decompress kernel image fail!!!\n"); + } + } else { + video_printf("Custom kernel found, decomressing it\n"); + if (decompress_kernel((unsigned char *)(kernel_raw), + (void *)kernel_target_addr, (int)kernel_raw_size, + (int)kernel_sz_mb)) { + panic("decompress kernel image fail!!!\n"); + } } } else { pal_log_info("32 bits kernel\n"); @@ -1678,12 +1687,12 @@ int boot_linux_fdt(void *kernel, unsigned *tags, void boot_linux(void *kernel, unsigned *tags, unsigned machtype, - void *ramdisk, unsigned ramdisk_sz) + void *ramdisk, unsigned ramdisk_sz, unsigned char *kernel_raw, off_t kernel_raw_size) { #ifdef DEVICE_TREE_SUPPORT boot_linux_fdt((void *)kernel, (unsigned *)tags, machtype, - (void *)ramdisk, ramdisk_sz); + (void *)ramdisk, ramdisk_sz, kernel_raw, kernel_raw_size); panic("%s Fail to enter EL1\n", __func__); #endif } @@ -1712,6 +1721,30 @@ void get_AB_OTA_name(char *part_name, int size) #endif /* MTK_AB_OTA_UPDATER */ int boot_linux_from_storage(void) +{ + uint32_t kernel_target_addr = 0; + uint32_t ramdisk_target_addr = 0; + uint32_t tags_target_addr = 0; + uint32_t ramdisk_real_sz = 0; + kernel_target_addr = get_kernel_target_addr(); + ramdisk_target_addr = get_ramdisk_target_addr(); + ramdisk_real_sz = get_ramdisk_real_sz(); + tags_target_addr = get_tags_addr(); + + /* pass related root of trust info via SMC call */ + send_root_of_trust_info(); + set_boot_phase(BOOT_PHASE_KERNEL); + + boot_linux((void *)kernel_target_addr, + (unsigned *)tags_target_addr, + board_machtype(), + (void *)ramdisk_target_addr, + ramdisk_real_sz, NULL, 0); + + return 0; +} + +static void mtk_pre_boot() { int ret = 0; uint32_t kernel_target_addr = 0; @@ -1860,7 +1893,13 @@ int boot_linux_from_storage(void) } else { cmdline_append("androidboot.meta_log_disable=0"); } +} +int mtk_boot_linux_from_ram(unsigned char *kernel_raw, off_t kernel_raw_size, unsigned char *ramdisk_raw, off_t ramdisk_size){ +uint32_t kernel_target_addr = 0; + uint32_t tags_target_addr = 0; +kernel_target_addr = get_kernel_target_addr(); + tags_target_addr = get_tags_addr(); /* pass related root of trust info via SMC call */ send_root_of_trust_info(); set_boot_phase(BOOT_PHASE_KERNEL); @@ -1868,8 +1907,8 @@ int boot_linux_from_storage(void) boot_linux((void *)kernel_target_addr, (unsigned *)tags_target_addr, board_machtype(), - (void *)ramdisk_target_addr, - ramdisk_real_sz); + (void *)ramdisk_raw, + ramdisk_size, kernel_raw, kernel_raw_size); return 0; } @@ -2093,6 +2132,9 @@ void mt_boot_init(const struct app_descriptor *app) #endif /* Will not return */ + mtk_pre_boot(); + droidboot_show_dualboot_menu(); + video_printf("Going to boot linux from storage"); boot_linux_from_storage(); fastboot: diff --git a/platform/common/boot/boot_info.c b/platform/common/boot/boot_info.c index 7f06146..0362906 100644 --- a/platform/common/boot/boot_info.c +++ b/platform/common/boot/boot_info.c @@ -73,6 +73,10 @@ static uint32_t get_bootimg_ramdisk_load_addr(void) return (uint32_t)ramdisk_addr; } +uint32_t get_ramdisk_real_sz() { + return g_boot_info.bootimg_ramdisk_sz; +} + int relocate_ramdisk(uint32_t *ramdisk_addr, uint32_t *ramdisk_real_sz) { uint32_t ramdisk_load_addr; diff --git a/platform/common/boot_menu/boot_menu.c b/platform/common/boot_menu/boot_menu.c index cfc67fa..4ea8a3c 100644 --- a/platform/common/boot_menu/boot_menu.c +++ b/platform/common/boot_menu/boot_menu.c @@ -47,92 +47,9 @@ #include #include #include - -extern void cmdline_append(const char *append_string); -typedef void (*entry_cb)(void); - -struct boot_menu { - u8 boot_mode; - const char *item_text; - entry_cb callback; -}; - -//register the callback function -void ftrace_cb() -{ - cmdline_append("androidboot.boot_trace=1"); -} - -void kmemleak_cb() -{ - cmdline_append("kmemleak=on"); -} - -void initcall_cb() -{ - cmdline_append("initcall_debug=1 log_buf_len=4M"); -} - -struct boot_menu ui_entry[] = { - {RECOVERY_BOOT, "[Recovery Mode]", NULL}, - {FASTBOOT, "[Fastboot Mode]", NULL}, - {NORMAL_BOOT, "[Normal Boot]", NULL}, -#if !defined(USER_LOAD) || defined(MTK_BUILD_ENHANCE_MENU) - {NORMAL_BOOT, "[Normal Boot +ftrace]", ftrace_cb}, - {NORMAL_BOOT, "[Normal kmemleak on]", kmemleak_cb}, - {NORMAL_BOOT, "[Normal Boot +initcall]", initcall_cb}, -#endif -}; - -static void update_menu(unsigned int index) { - #define LEN 100 - const char* title_msg = "Select Boot Mode:\n[VOLUME_UP to select. VOLUME_DOWN is OK.]\n\n"; - char str_buf[LEN]; - unsigned int i, length; - - video_set_cursor(video_get_rows()/2, 0); - video_printf(title_msg); - - for (i = 0; i < countof(ui_entry); i++) { - memset(str_buf, 0, LEN); - length = strlen(ui_entry[i].item_text); - snprintf(str_buf, length+1, "%s", ui_entry[i].item_text); - if (i == index) { - dprintf(0, "Switch to %s mode.\n", str_buf); - sprintf(str_buf+length, " <<==\n"); - } else - sprintf(str_buf+length, " \n"); - video_printf(str_buf); - } -} +#include void boot_menu_select() { - //0=recovery mode 1=fastboot 2=normal boot - //3=normal boot + ftrace 4=kmemleak on 5=Boot + initcall - unsigned int select = 0; - - video_clean_screen(); - update_menu(0); - - while (1) { - if (mtk_detect_key(MT65XX_MENU_SELECT_KEY)) { //VOL_UP - select = (select + 1) % countof(ui_entry); - update_menu(select); - mdelay(300); - } else if (mtk_detect_key(MT65XX_MENU_OK_KEY)) { //VOL_DOWN - //use for OK; - break; - } - } - - dprintf(0, "Boot mode:%s is selected!\n", ui_entry[select].item_text); - g_boot_mode = ui_entry[select].boot_mode; - - if (ui_entry[select].callback) - ui_entry[select].callback(); - - video_set_cursor(video_get_rows() / 2 + 8, 0); - video_clean_screen(); - - return; + video_printf("Enter droidboot_mtk_show_boot_mode_menu"); + g_boot_mode=droidboot_mtk_show_boot_mode_menu(); } diff --git a/platform/mt6768/include/platform/mt_disp_drv.h b/platform/mt6768/include/platform/mt_disp_drv.h index 8422bf6..fabbba5 100644 --- a/platform/mt6768/include/platform/mt_disp_drv.h +++ b/platform/mt6768/include/platform/mt_disp_drv.h @@ -61,7 +61,7 @@ typedef enum { // --------------------------------------------------------------------------- // UBoot Display Export Functions // --------------------------------------------------------------------------- - +void mtkfb_draw_block(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int color); UINT32 mt_disp_get_vram_size(void); void mt_disp_init(void *lcdbase); void mt_disp_power(BOOL on); diff --git a/platform/mt6768/mt_disp_drv.c b/platform/mt6768/mt_disp_drv.c index 93bb96d..e61bb7e 100644 --- a/platform/mt6768/mt_disp_drv.c +++ b/platform/mt6768/mt_disp_drv.c @@ -157,11 +157,11 @@ int mt_disp_get_dfo_setting(const char *string, unsigned int *value) } #endif -static void _mtkfb_draw_block(unsigned int addr, unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int color) +void mtkfb_draw_block(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int color) { unsigned int i = 0; unsigned int j = 0; - void* start_addr = (void*)(addr+ALIGN_TO(CFG_DISPLAY_WIDTH, MTK_FB_ALIGNMENT)*4*y+x*4); + void* start_addr = (void*)(fb_addr+ALIGN_TO(CFG_DISPLAY_WIDTH, MTK_FB_ALIGNMENT)*4*y+x*4); unsigned int pitch = ALIGN_TO(CFG_DISPLAY_WIDTH, MTK_FB_ALIGNMENT)*4; unsigned int* line_addr = start_addr; @@ -184,7 +184,7 @@ static int _mtkfb_internal_test(unsigned int va, unsigned int w, unsigned int h) for (i = 0; i < w * h / _internal_test_block_size / _internal_test_block_size; i++) { color = (i & 0x1) * 0xff; color += 0xff000000U; - _mtkfb_draw_block(va, + mtkfb_draw_block( i % (w / _internal_test_block_size) * _internal_test_block_size, i / (w / _internal_test_block_size) * _internal_test_block_size, _internal_test_block_size, _internal_test_block_size, color); diff --git a/platform/mt6768/platform.c b/platform/mt6768/platform.c index 56b9996..1b15e15 100755 --- a/platform/mt6768/platform.c +++ b/platform/mt6768/platform.c @@ -120,6 +120,10 @@ extern u8 g_oemkey[OEM_PUBK_SZ]; #undef LK_DL_CHECK_BLOCK_LEVEL #endif +//ABM include file with init functions +#include +#include + extern void platform_early_init_timer(); extern void jump_da(u32 addr, u32 arg1, u32 arg2); extern int i2c_hw_init(void); @@ -716,6 +720,12 @@ void platform_init(void) #ifndef MACH_FPGA PROFILING_START("boot mode select"); + //ABM: init lvgl stuff + video_printf("Enter droidboot init\n"); + mtk_wdt_disable(); + droidboot_init(); + mt65xx_backlight_on(); + video_printf("Droidboot init done\n"); #if !defined(NO_BOOT_MODE_SEL) boot_mode_select(); #endif @@ -761,7 +771,8 @@ void platform_init(void) #ifndef MACH_FPGA_NO_DISPLAY PROFILING_START("show logo"); - mt_disp_show_boot_logo(); + droidboot_show_boot_logo(); + video_printf("Droidboot show boot logo done\n"); PROFILING_END(); #endif video_printf(" => Downloading...\n"); @@ -801,7 +812,8 @@ void platform_init(void) mtk_bat_allow_backlight_enable()) { #ifndef MACH_FPGA_NO_DISPLAY PROFILING_START("show logo"); - mt_disp_show_boot_logo(); + droidboot_show_boot_logo(); + video_printf("Droidboot show boot logo done\n"); PROFILING_END(); #endif // MACH_FPGA_NO_DISPLAY #ifndef MACH_FPGA