int __init tivo_init(void) { char buffer[60]; char *value; boardID=0; // is brev on command line? value=cmdline_lookup(arcs_cmdline,"brev="); if (!value) /* board rev arg not passed in, so make an assumption here */ { strcpy(buffer,"0x90002"); /* X3 is alloted the default board revision of 0x9002 */ boardID=simple_strtoul(buffer,NULL,0)<<8; } else { boardID=simple_strtoul(value, NULL, 0)<<8; } // in any case, force board ID into range for this platform if (boardID < kTivoConfigBoardIDPaceBase || boardID > kTivoConfigBoardIDPaceMax) { printk("Missing or invalid BoardID, taking a wild guess...\n"); boardID = kTivoConfigBoardIDX3; } printk(KERN_NOTICE "BoardID is 0x%X\n", boardID); // tell kernel InitTivoConfig( (TivoConfigValue) boardID ); // and user space if (!cmdline_lookup(arcs_cmdline,"boardID=")) cmdline_append(arcs_cmdline, COMMAND_LINE_SIZE, "boardID=0x%X", boardID); // set default HpkImpl if (!cmdline_lookup(arcs_cmdline,"HpkImpl=")) cmdline_append(arcs_cmdline, COMMAND_LINE_SIZE, "HpkImpl=Pac02"); // set default boot device if (!cmdline_lookup(arcs_cmdline,"boot_device=")) { // use sda if firmware reports BOOT_DEVICE=1, else normally use mmca if ((cfe_getenv("BOOT_DEVICE", buffer, sizeof(buffer))==CFE_OK) && (simple_strtoul(buffer,NULL,0) != 0)) cmdline_append(arcs_cmdline, COMMAND_LINE_SIZE,"boot_device=sda"); else cmdline_append(arcs_cmdline, COMMAND_LINE_SIZE,"boot_device=mmca"); } // also set default bmem if not on command line if (!cmdline_lookup(arcs_cmdline,"bmem=")) { unsigned long size, addr; if(!GetTivoConfig(kTivoConfigBmem0Size, &size) && !GetTivoConfig(kTivoConfigBmem0Address,&addr)) { sprintf(buffer,"%lu@%lu",size,addr); bmem_setup(buffer); if(!GetTivoConfig(kTivoConfigBmem1Size, &size) && !GetTivoConfig(kTivoConfigBmem1Address, &addr)) { sprintf(buffer,"%lu@%lu",size,addr); bmem_setup(buffer); } } } // set default sata spread spectrum if (!cmdline_lookup(arcs_cmdline, "sata3_ssc")) cmdline_append(arcs_cmdline, COMMAND_LINE_SIZE, "sata3_ssc"); #ifdef CONFIG_TIVO_DEVEL if (cmdline_lookup(arcs_cmdline, "nfs1")) { cmdline_delete(arcs_cmdline, "nfs1", NULL); cmdline_append(arcs_cmdline, COMMAND_LINE_SIZE, "xnfsinit=192.168.1.250:/Pac02/nfsroot sysgen=true rw"); } if ((value = cmdline_lookup(arcs_cmdline, "nfsinit=")) != NULL || (value = cmdline_lookup(arcs_cmdline, "xnfsinit=")) !=NULL) { // note, leave the [x]nfsinit command intact so it lands in the environment cmdline_delete(arcs_cmdline, "init=", "nfsroot=", NULL); cmdline_append(arcs_cmdline, COMMAND_LINE_SIZE, "init=/devbin/nfsinit nfsroot=%s", value); } #else // disable dsscon by default on release if (!cmdline_lookup(arcs_cmdline, "dsscon=")) cmdline_append(arcs_cmdline, COMMAND_LINE_SIZE, "dsscon=false"); #endif return 0; }
void boot_mode_menu_select() { int select = 0; // 0=recovery mode, 1=fastboot. 2=normal boot 3=normal boot + ftrace.4=slub debug off const char* title_msg = "Select Boot Mode:\n[VOLUME_UP to select. VOLUME_DOWN is OK.]\n\n"; mt65xx_backlight_on(); video_clean_screen(); video_set_cursor(video_get_rows()/2, 0); video_printf(title_msg); video_printf("[Recovery Mode] <<==\n"); #ifdef MTK_FASTBOOT_SUPPORT video_printf("[Fastboot Mode] \n"); #endif video_printf("[Normal Boot] \n"); #if !defined(USER_BUILD) || defined(MTK_BUILD_ROOT) video_printf("[Normal Boot +ftrace] \n"); video_printf("[Normal slub debug off] \n"); #endif while (1) { if (mtk_detect_key(MT65XX_MENU_SELECT_KEY)) { //VOL_UP g_boot_menu = true; switch (select) { case 0: #ifdef MTK_FASTBOOT_SUPPORT select = 1; video_set_cursor(video_get_rows()/2, 0); video_printf(title_msg); video_printf("[Recovery Mode] \n"); video_printf("[Fastboot Mode] <<==\n"); video_printf("[Normal Boot] \n"); #if !defined(USER_BUILD) || defined(MTK_BUILD_ROOT) video_printf("[Normal Boot +ftrace] \n"); video_printf("[Normal slub debug off] \n"); #endif break; #endif case 1: select = 2; video_set_cursor(video_get_rows()/2, 0); video_printf(title_msg); video_printf("[Recovery Mode] \n"); #ifdef MTK_FASTBOOT_SUPPORT video_printf("[Fastboot Mode] \n"); #endif video_printf("[Normal Boot] <<==\n"); #if !defined(USER_BUILD) || defined(MTK_BUILD_ROOT) video_printf("[Normal Boot +ftrace] \n"); video_printf("[Normal slub debug off] \n"); #endif break; case 2: #if defined(USER_BUILD) && !defined(MTK_BUILD_ROOT) select = 0; #else select = 3; #endif video_set_cursor(video_get_rows()/2, 0); video_printf(title_msg); #if defined(USER_BUILD) && !defined(MTK_BUILD_ROOT) video_printf("[Recovery Mode] <<==\n"); #ifdef MTK_FASTBOOT_SUPPORT video_printf("[Fastboot Mode] \n"); #endif video_printf("[Normal Boot] \n"); #else video_printf("[Recovery Mode] \n"); #ifdef MTK_FASTBOOT_SUPPORT video_printf("[Fastboot Mode] \n"); #endif video_printf("[Normal Boot] \n"); video_printf("[Normal Boot +ftrace] <<==\n"); video_printf("[Normal slub debug off] \n"); #endif break; #if !defined(USER_BUILD) || defined(MTK_BUILD_ROOT) case 3: select = 4; video_set_cursor(video_get_rows()/2, 0); video_printf(title_msg); video_printf("[Recovery Mode] \n"); #ifdef MTK_FASTBOOT_SUPPORT video_printf("[Fastboot Mode] \n"); #endif video_printf("[Normal Boot] \n"); video_printf("[Normal Boot +ftrace] \n"); video_printf("[Normal slub debug off] <<==\n"); break; #endif #if !defined(USER_BUILD) || defined(MTK_BUILD_ROOT) case 4: select = 0; video_set_cursor(video_get_rows()/2, 0); video_printf(title_msg); video_printf("[Recovery Mode] <<==\n"); #ifdef MTK_FASTBOOT_SUPPORT video_printf("[Fastboot Mode] \n"); #endif video_printf("[Normal Boot] \n"); video_printf("[Normal Boot +ftrace] \n"); video_printf("[Normal slub debug off] \n"); break; #endif default: break; } dprintf(0, "[VOL_UP]Key Detect, current select:%d\n", select); mdelay(300); } else if (mtk_detect_key(MT65XX_MENU_OK_KEY)) { //VOL_DOWN, //use for OK break; } else { //pass } } if (select == 0) { g_boot_mode = RECOVERY_BOOT; } else if (select == 1) { g_boot_mode = FASTBOOT; } else if (select == 2) { g_boot_mode = NORMAL_BOOT; } else if (select == 3) { cmdline_append("boot_trace"); g_boot_mode = NORMAL_BOOT; } else if (select == 4) { cmdline_append("slub_debug=-"); g_boot_mode = NORMAL_BOOT; } else { //pass } video_set_cursor(video_get_rows()/2 +8, 0); return; }