?? bootconfig.c
字號:
}#endif printExcMsg (sysExcMsg); *sysExcMsg = EOS; bootStringToStruct (BOOT_LINE_ADRS, ¶ms); sysFlags = params.flags;#if defined(INCLUDE_TSFS_BOOT) && defined(INCLUDE_TSFS_BOOT_VIO_CONSOLE) while (!wdbTargetIsConnected()) taskDelay (sysClkRateGet()); sysStartType |= BOOT_NO_AUTOBOOT;#endif if (!(sysStartType & BOOT_NO_AUTOBOOT) && !(sysFlags & SYSFLG_NO_AUTOBOOT)) { int timeout = TIMEOUT; if ((sysStartType & BOOT_QUICK_AUTOBOOT) || (sysFlags & SYSFLG_QUICK_AUTOBOOT)) { timeout = 1; } key = autoboot (timeout); } (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL); printf ("\n"); FOREVER { if (key == '@') { line [0] = key; line [1] = EOS; key = 0; } else { printf ("[VxWorks Boot]: "); fioRdString (STD_IN, line, sizeof (line)); } adr = adr2 = 0; nwords = 0; /* take blanks off end of line */ pLine = line + strlen (line) - 1; /* point at last char */ while ((pLine >= line) && (*pLine == ' ')) { *pLine = EOS; pLine--; } pLine = line; skipSpace (&pLine); switch (*(pLine++)) { case EOS: break; case 'z': if( tffsDevFormat(0,0) != OK ) printErr ("tffsDevFormat tffs 0 fail!\n"); break; case 'd': if ((getArg (&pLine, &adr, HEX, OPT) == OK) && (getArg (&pLine, &nwords, DEC, OPT) == OK)) d ((char *) adr, nwords); break; case 'e': printExcMsg (sysExcMsg + 1); break; case 'f': /* fill */ if ((getArg (&pLine, &adr, HEX, !OPT) == OK) && (getArg (&pLine, &nbytes, DEC, !OPT) == OK) && (getArg (&pLine, &value, DEC, !OPT) == OK)) { bfillBytes ((char *) adr, nbytes, value); } break; case 't': /* transpose(?) (running out of letters!) */ if ((getArg (&pLine, &adr, HEX, !OPT) == OK) && (getArg (&pLine, &adr2, HEX, !OPT) == OK) && (getArg (&pLine, &nbytes, HEX, !OPT) == OK)) { bcopy ((char *) adr, (char *) adr2, nbytes); } break; case 'm': /* modify */ if (getArg (&pLine, &adr, HEX, !OPT) == OK) m ((char *) adr); break;#ifdef TARGET_HK_V2F case 's': /* system controller */ { extern ULONG sysBCLSet (); if (getArg (&pLine, &value, DEC, !OPT) == OK) { if (value != 0) { (void) sysBCLSet ((ULONG)HK_BCL_SYS_CONTROLLER, (ULONG)HK_BCL_SYS_CONTROLLER); printf ("System controller on.\n"); } else { (void) sysBCLSet ((ULONG)HK_BCL_SYS_CONTROLLER, (ULONG)0); printf ("System controller off.\n"); } } break; }#endif /* TARGET_HK_V2F */#if defined(TARGET_FRC_30) || defined(TARGET_FRC_31) || defined(TARGET_FRC_33) case 's': /* system controller */ if (getArg (&pLine, &value, DEC, !OPT) == OK) { if (value != 0) { *FGA_CTL1 |= FGA_CTL1_SCON; printf ("System controller on.\n"); } else { *FGA_CTL1 &= ~FGA_CTL1_SCON; printf ("System controller off.\n"); } } break;#endif /* TARGET_FRC_30 || TARGET_FRC_31 || TARGET_FRC_33 */ case 'p': bootParamsShow (BOOT_LINE_ADRS); break; case 'c': bootParamsPrompt (BOOT_LINE_ADRS); if (strlen(BOOT_LINE_ADRS) <= BOOT_LINE_SIZE) { if((SST39VF160_ChipProg(0x3F800,(LOCAL_MEM_LOCAL_ADRS+BOOT_LINE_OFFSET),ROM_PARA_LEN))== 0) printf("\nNOTE: Bootline not saved to NVRAM\n"); } else { } bootStringToStruct (BOOT_LINE_ADRS, ¶ms); for (i = 0; i < 50; ++i) (IP_PARAMS).ipadrinfo[i]=params.ead[i]; sprintf(IP_PARAMS.gatewayinfo, "%s", params.gad); if(params.flags == 0x40) IP_PARAMS.dhcpflag = 1; if(params.flags == 0x0) IP_PARAMS.dhcpflag = 2;SST39VF160_ChipProg(0x3F000,&(IP_PARAMS),sizeof(IP_PARAMS)); break; case 'g': if (getArg (&pLine, (int *) &entry, HEX, !OPT) == OK) go (entry); break;#ifdef INCLUDE_NETWORK case 'n': netifAdrsPrint (pLine); break;#ifdef ETHERNET_ADR_SET case 'N': mEnet (pLine); break;#endif /* ETHERNET_ADR_SET */#endif /* INCLUDE_NETWORK */ case '?': /* help */ case 'h': /* help */ bootHelp (); break; case '@': case '$': if (tffsLoad (0, 0, "/tffs0/vxworks", &entry) == OK) { go (entry); } else { taskDelay (sysClkRateGet ()); reboot (BOOT_NO_AUTOBOOT); } break; case 'v': printBootLogo (); break; default: printf ("Unrecognized command. Type '?' for help.\n"); break; } /* switch */ } /* FOREVER */ }/******************************************************************************** autoboot - do automatic boot sequence** RETURNS: Doesn't return if successful (starts execution of booted system).*/LOCAL char autoboot ( int timeout /* timeout time in seconds */ ) { ULONG autoBootTime; int timeLeft; UINT timeMarker; int bytesRead = 0; FUNCPTR entry; char key; if (timeout > 0) { printf ("\nPress any key to stop auto-boot...\n"); /* Loop looking for a char, or timeout after specified seconds */ autoBootTime = tickGet () + sysClkRateGet () * timeout; timeMarker = tickGet () + sysClkRateGet (); timeLeft = timeout; printf ("%2d\r", timeLeft); while ((tickGet () < autoBootTime) && (bytesRead == 0)) { (void) ioctl (consoleFd, FIONREAD, (int) &bytesRead); if (tickGet () == timeMarker) { timeMarker = tickGet () + sysClkRateGet (); printf ("%2d\r", --timeLeft); } } } if (bytesRead == 0) { (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL); if (tffsLoad (0, 0, "/tffs0/vxworks", &entry) == OK) go (entry); else { printf ("Can't load boot file from TFFS!!\n"); printErr ("\nError loading file: errno = 0x%x.\n", errno); taskDelay (sysClkRateGet ()); /* pause a second */ } } else { read (consoleFd, &key, 1); return (key & 0x7f); } return (ERROR); } /******************************************************************************** printBootLogo - print initial boot banner page*/LOCAL void printBootLogo (void) { printf ("\n\n\n\n\n\n\n\n\n\n\n"); printf ("%20s%s", "","Strong S3C2410X Gold Board Boot"); /* : modified */ printf ("\n\n\nCopyright 2004-2005 ChenXi@bupt-bcnl.com"); /* : added */ printf ("\nCopyright 1984-2002 Wind River Systems, Inc.\n\n\n"); /* : modified */ printf ("CPU: %s\n", sysModel ()); printf ("Version: %s\n", vxWorksVersion); printf ("BSP version: " BSP_VERSION BSP_REV "\n"); printf ("Creation date: %s\n\n", creationDate); }/********************************************************************************* bootHelp - print brief help list*/LOCAL void bootHelp (void) { static char *helpMsg[] = { "#", "- network boot (load and go)", "z", "- format tffs 0", "?", "- print this list", "@", "- tffs boot (load and go)", "r", "- tffs backup image boot (when the newest image is broken)", "p", "- print boot params", "c", "- change boot params", "&", "- get vxworks image by tftp" "l", "- load boot file", "g adrs", "- go to adrs", "d adrs[,n]", "- display memory", "m adrs", "- modify memory", "f adrs, nbytes, value", "- fill memory", "t adrs, adrs, nbytes", "- copy memory", "e", "- print fatal exception", "v", "- print boot logo with version",#ifdef INCLUDE_NETWORK "n netif", "- print network interface device address",#if defined(ETHERNET_ADR_SET) "N", "- set ethernet address",#endif /* ETHERNET_ADR_SET */#endif /* INCLUDE_NETWORK */#if defined(TARGET_HK_V2F) || defined(TARGET_FRC_30) || \ defined(TARGET_FRC_31) || defined(TARGET_FRC_33) "s [0/1]", "- system controller 0 = off, 1 = on",#endif /* TARGET_HK_V2F/FRC_30/FRC_31/FRC_33 */ "$dev(0,procnum)host:/file h=# e=# b=# g=# u=usr [pw=passwd] f=#", "", " tn=targetname s=script o=other", "",#ifdef INCLUDE_SCSI_BOOT "boot device: scsi=id,lun file name: /sd0/vxWorks","",#endif /*INCLUDE_SCSI_BOOT*/#ifdef INCLUDE_FD "boot device: fd=drive,fdType file name: /fd0/vxWorks","",#endif /* INCLUDE_FD */#ifdef INCLUDE_IDE "boot device: ide=drive,configType file name: /ide0/vxWorks","",#endif /* INCLUDE_IDE */#ifdef INCLUDE_ATA "boot device: ata=ctrl,drive file name: /ata0/vxWorks","",#endif /* INCLUDE_ATA */#ifdef INCLUDE_PCMCIA "boot device: pcmcia=sock file name: /pcmcia0/vxWorks","",#endif /* INCLUDE_PCMCIA */#ifdef INCLUDE_TFFS "boot device: tffs=drive,removable file name: /tffs0/vxWorks","",#endif /* INCLUDE_TFFS */#ifdef INCLUDE_TSFS_BOOT "boot device: tsfs file name: /tgtsvr/vxWorks","",#endif /*INCLUDE_TSFS_BOOT */ "Boot flags:", "",#if defined(TARGET_HK_V2F) || defined(TARGET_FRC_30) || \ defined(TARGET_FRC_31) || defined(TARGET_FRC_33) " 0x01 - don't be system controller", "",#endif /* TARGET_HK_V2F/FRC_30/FRC_31/FRC_33 */ " 0x02 - load local system symbols", "", " 0x04 - don't autoboot", "", " 0x08 - quick autoboot (no countdown)", "",#ifdef INCLUDE_NETWORK " 0x20 - disable login security", "",#ifdef INCLUDE_DHCPC " 0x40 - use dhcp to get boot parameters", "",#else#ifdef INCLUDE_BOOTP " 0x40 - use bootp to get boot parameters", "",#else " 0x40 - autoconfigure: NOT AVAILABLE (no method installed)", "",#endif /* INCLUDE_BOOTP */#endif /* INCLUDE_DHCPC */ " 0x80 - use tftp to get boot image", "", " 0x100 - use proxy arp", "",#endif /* INCLUDE_NETWORK */ NULL }; FAST char **pMsg;#ifdef INCLUDE_NETWORK FAST NETIF *pNif;#endif /* INCLUDE_NETWORK */#ifdef INCLUDE_END int count; char muxDevName[8]; END_TBL_ENTRY* pDevTbl;#endif /* INCLUDE_END */ printf ("\n"); for (pMsg = helpMsg; *pMsg != NULL; pMsg += 2) printf (" %-21s %s\n", *pMsg, *(pMsg + 1));#ifdef INCLUDE_NETWORK printf ("\navailable boot devices:");#ifdef INCLUDE_END printf ("Enhanced Network Devices\n"); for (count = 0, pDevTbl = endDevTbl; pDevTbl->endLoadFunc != END_TBL_END; pDevTbl++, count++) { if (!pDevTbl->processed) { muxDevName [0] = EOS; pDevTbl->endLoadFunc (muxDevName, NULL); printf (" %s%d", muxDevName, pDevTbl->unit); } }#endif /* INCLUDE_END */ for (pNif = netIf; pNif->ifName != 0; pNif++) { if (strncmp (pNif->ifName, "lo", 2) != 0) printf (" %s", pNif->ifName); }#endif /* INCLUDE_NETWORK */#ifdef INCLUDE_SCSI_BOOT printf (" scsi");#endif /*INCLUDE_SCSI_BOOT*/#ifdef INCLUDE_FD printf (" fd");#endif /* INCLUDE_FD */#ifdef INCLUDE_IDE printf (" ide");#endif /* INCLUDE_IDE */#ifdef INCLUDE_ATA printf (" ata");#endif /* INCLUDE_ATA */#ifdef INCLUDE_TFFS printf (" tffs");#endif /* INCLUDE_TFFS */#ifdef INCLUDE_TSFS_BOOT printf (" tsfs");#endif /* INCLUDE_TSFS_BOOT */ printf ("\n"); }/********************************************************************************* bootLoad - load a module into memory** RETURNS: OK or ERROR*/LOCAL STATUS bootLoad ( char * bootString, FUNCPTR *pEntry ) { BOOT_PARAMS params;#ifdef INCLUDE_SCSI_BOOT#ifdef INCLUDE_SCSI2 SCSI_OPTIONS options; UINT which; int devBusId;#endif /* INCLUDE_SCSI2 */#endif /* INCLUDE_SCSI_BOOT */#ifdef INCLUDE_NETWORK IMPORT int netTaskPriority; int oldTaskPriority;#endif /* INCLUDE_NETWORK */#ifndef INCLUDE_NETWORK printf ("\nError loading file: networking code not present.\n"); return (ERROR); }#else /* INCLUDE_NETWORK */ return (OK); }#ifdef INCLUDE_END/********************************************************************************* findCookie - traverses the cookieTbl to return the right cookie** Given the unit number and the device name this function traverses the cookieTbl* to return the right cookie. This is a local file.** RETURNS: cookie or NULL**/LOCAL void* findCookie ( int unitNo, char* devName ) { int count; for(count=0;count<32;count++) { if((cookieTbl[count].unitNo==unitNo) && (STREQ(cookieTbl[count].devName,devName))) return(cookieTbl[count].pCookie);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -