最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

MTK平台修改Bootloader源代码,让Android设备一通电就自动开机

IT圈 admin 44浏览 0评论

2024年1月22日发(作者:次云岚)

if (kedump_mini())

{ mrdump_check(); return; } } if (meta_detection()) { return; } mrdump_check();#if defined (HAVE_LK_TEXT_MENU)/*Check RTC to know if system want to reboot to Fastboot*/ if(Check_RTC_PDN1_bit13()) { printf("[FASTBOOT] reboot to boot loadern"); g_boot_mode = FASTBOOT; Set_Clr_RTC_PDN1_bit13(false); return; } /*If forbidden mode is factory, cacel the factory key detection*/

if(g_boot_arg->sec__num == 0x4C4C4C4C) { if(g_boot_arg->sec__mode == F_FACTORY_MODE) { //Forbid to enter factory mode printf("%s Forbiddenn",MODULE_NAME); factory_forbidden=1; } } // forbid_mode = g_boot_arg->boot_mode &= 0x000000FF; /*If boot reason is power key + volumn down, then disable factory mode dectection*/ if(mtk_detect_pmic_just_rst()) { factory_forbidden=1; } /*Check RTC to know if system want to reboot to Recovery*/ if(Check_RTC_Recovery_Mode()) { g_boot_mode = RECOVERY_BOOT; return; } /*If MISC Write has not completed in recovery mode

before system reboot, go to recovery mode to finish remain tasks*/

if(unshield_recovery_detection()) { return; } ulong begin = get_timer(0);/*we put key dectection here to detect key which is pressed*/ printf("eng buildn"); printf("MT65XX_FACTORY_KEY 0x%xn",MT65XX_FACTORY_KEY); printf("MT65XX_BOOT_MENU_KEY 0x%xn",MT65XX_BOOT_MENU_KEY); printf("MT65XX_RECOVERY_KEY 0x%xn",MT65XX_RECOVERY_KEY); while(get_timer(begin)<50) { if(!factory_forbidden){ if(mtk_detect_key(MT65XX_FACTORY_KEY)) {

{ printf("%s Detect keyn",MODULE_NAME); printf("%s Enable factory moden",MODULE_NAME); g_boot_mode = FACTORY_BOOT; //video_printf("%s : detect factory mode !n",MODULE_NAME); return; } } if(mtk_detect_key(MT65XX_BOOT_MENU_KEY)) { printf("n%s Check boot menun",MODULE_NAME); printf("%s Wait 50ms for special keysn",MODULE_NAME); mtk_wdt_disable(); boot_mode_menu_select(); mtk_wdt_init(); return;

}#ifdef MT65XX_RECOVERY_KEY if(mtk_detect_key(MT65XX_RECOVERY_KEY)) { printf("%s Detect cal keyn",MODULE_NAME); printf("%s Enable recovery moden",MODULE_NAME); g_boot_mode = RECOVERY_BOOT; //video_printf("%s : detect recovery mode !n",MODULE_NAME); return; }#endif

}#else/*We put conditions here to filer some cases that can not do key detection*//*Check RTC to know if system want to reboot to Fastboot*/#ifdef MTK_FASTBOOT_SUPPORT if(Check_RTC_PDN1_bit13()) { dprintf(INFO,"[FASTBOOT] reboot to boot loadern"); g_boot_mode = FASTBOOT; Set_Clr_RTC_PDN1_bit13(false); return ; }#endif /*If forbidden mode is factory, cacel the factory key detection*/ if(g_boot_arg->sec__num == 0x4C4C4C4C) { if(g_boot_arg->sec__mode == F_FACTORY_MODE) { //Forbid to enter factory mode printf("%s Forbiddenn",MODULE_NAME); factory_forbidden=1; } }// forbid_mode = g_boot_arg->boot_mode &= 0x000000FF; /*If boot reason is power key + volumn down, then

disable factory mode dectection*/ if(mtk_detect_pmic_just_rst()) { factory_forbidden=1; } /*Check RTC to know if system want to reboot to Recovery*/ if(Check_RTC_Recovery_Mode()) { g_boot_mode = RECOVERY_BOOT; return ;

2024年1月22日发(作者:次云岚)

if (kedump_mini())

{ mrdump_check(); return; } } if (meta_detection()) { return; } mrdump_check();#if defined (HAVE_LK_TEXT_MENU)/*Check RTC to know if system want to reboot to Fastboot*/ if(Check_RTC_PDN1_bit13()) { printf("[FASTBOOT] reboot to boot loadern"); g_boot_mode = FASTBOOT; Set_Clr_RTC_PDN1_bit13(false); return; } /*If forbidden mode is factory, cacel the factory key detection*/

if(g_boot_arg->sec__num == 0x4C4C4C4C) { if(g_boot_arg->sec__mode == F_FACTORY_MODE) { //Forbid to enter factory mode printf("%s Forbiddenn",MODULE_NAME); factory_forbidden=1; } } // forbid_mode = g_boot_arg->boot_mode &= 0x000000FF; /*If boot reason is power key + volumn down, then disable factory mode dectection*/ if(mtk_detect_pmic_just_rst()) { factory_forbidden=1; } /*Check RTC to know if system want to reboot to Recovery*/ if(Check_RTC_Recovery_Mode()) { g_boot_mode = RECOVERY_BOOT; return; } /*If MISC Write has not completed in recovery mode

before system reboot, go to recovery mode to finish remain tasks*/

if(unshield_recovery_detection()) { return; } ulong begin = get_timer(0);/*we put key dectection here to detect key which is pressed*/ printf("eng buildn"); printf("MT65XX_FACTORY_KEY 0x%xn",MT65XX_FACTORY_KEY); printf("MT65XX_BOOT_MENU_KEY 0x%xn",MT65XX_BOOT_MENU_KEY); printf("MT65XX_RECOVERY_KEY 0x%xn",MT65XX_RECOVERY_KEY); while(get_timer(begin)<50) { if(!factory_forbidden){ if(mtk_detect_key(MT65XX_FACTORY_KEY)) {

{ printf("%s Detect keyn",MODULE_NAME); printf("%s Enable factory moden",MODULE_NAME); g_boot_mode = FACTORY_BOOT; //video_printf("%s : detect factory mode !n",MODULE_NAME); return; } } if(mtk_detect_key(MT65XX_BOOT_MENU_KEY)) { printf("n%s Check boot menun",MODULE_NAME); printf("%s Wait 50ms for special keysn",MODULE_NAME); mtk_wdt_disable(); boot_mode_menu_select(); mtk_wdt_init(); return;

}#ifdef MT65XX_RECOVERY_KEY if(mtk_detect_key(MT65XX_RECOVERY_KEY)) { printf("%s Detect cal keyn",MODULE_NAME); printf("%s Enable recovery moden",MODULE_NAME); g_boot_mode = RECOVERY_BOOT; //video_printf("%s : detect recovery mode !n",MODULE_NAME); return; }#endif

}#else/*We put conditions here to filer some cases that can not do key detection*//*Check RTC to know if system want to reboot to Fastboot*/#ifdef MTK_FASTBOOT_SUPPORT if(Check_RTC_PDN1_bit13()) { dprintf(INFO,"[FASTBOOT] reboot to boot loadern"); g_boot_mode = FASTBOOT; Set_Clr_RTC_PDN1_bit13(false); return ; }#endif /*If forbidden mode is factory, cacel the factory key detection*/ if(g_boot_arg->sec__num == 0x4C4C4C4C) { if(g_boot_arg->sec__mode == F_FACTORY_MODE) { //Forbid to enter factory mode printf("%s Forbiddenn",MODULE_NAME); factory_forbidden=1; } }// forbid_mode = g_boot_arg->boot_mode &= 0x000000FF; /*If boot reason is power key + volumn down, then

disable factory mode dectection*/ if(mtk_detect_pmic_just_rst()) { factory_forbidden=1; } /*Check RTC to know if system want to reboot to Recovery*/ if(Check_RTC_Recovery_Mode()) { g_boot_mode = RECOVERY_BOOT; return ;

发布评论

评论列表 (0)

  1. 暂无评论