📄 bootconfig.c
字号:
{ /* put the console back in line mode so it echoes (so's you can bang * on it to see if it's still alive) */ (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL); printf ("\nauto-booting...\n\n"); if (bootLoad (BOOT_LINE_ADRS, &entry) == OK) go (entry); /* ... and never return */ else { printf ("Can't load boot file!!\n"); taskDelay (sysClkRateGet ()); /* pause a second */ reboot (BOOT_NO_AUTOBOOT); /* something is awry */ } } else { /* read the key that stopped autoboot */ read (consoleFd, &key, 1); return (key & 0x7f); /* mask off parity in raw mode */ } return (ERROR); /* for lint - can't really get here */ }/******************************************************************************** printBootLogo - print initial boot banner page*/LOCAL void printBootLogo (void) { printf ("\n\n\n\n\n\n\n\n\n\n\n"); printf ("%28s%s", "","VxWorks System Boot"); printf ("\n\n\nCopyright 1984-2002 Wind River Systems, Inc.\n\n\n\n\n\n"); 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[] = { "?", "- print this list", "@", "- boot (load and go)", "p", "- print boot params", "c", "- change boot params", "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 " 0x40 - use bootp to get boot parameters", "",#endif " 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 char nad [20]; /* host's network internet addr */ int netmask = 0; /* temporary storage */ int result; /* classification of address string */ unsigned long leaseLen; /* lease length field (optional) */#ifdef INCLUDE_DHCPC DHCP_LEASE_DATA dhcpLease;#endif /* INCLUDE_DHCPC */ char buf [30]; /* string of netmask and timestamps */ char netDev [BOOT_DEV_LEN + 1]; char bootDev [BOOT_DEV_LEN]; BOOL backplaneBoot; char * pBootAddr; BOOL attached = FALSE; /* driver is attached */ char icmpPeer [BOOT_ADDR_LEN]; IMPORT int netTaskPriority; int oldTaskPriority;#ifdef INCLUDE_END char muxDevName[8];#endif /* INCLUDE_END */#endif /* INCLUDE_NETWORK */ /* copy bootString to low mem address, if specified */ if ((bootString != NULL) && (*bootString != EOS)) strcpy (BOOT_LINE_ADRS, bootString); /* interpret boot command */ if (usrBootLineCrack (BOOT_LINE_ADRS, ¶ms) != OK) return (ERROR); /* Display boot parameters */ bootParamsShow (BOOT_LINE_ADRS); /* set our processor number: may establish vme access, etc. */ sysFlags = params.flags; sysProcNumSet (params.procNum);#ifdef INCLUDE_SCSI_BOOT /* * initialize either the SCSI1 or SCSI2 interface; initialize SCSI2 when * the SCSI2 interface is available. */#ifndef INCLUDE_SCSI2 scsi1IfInit ();#else scsi2IfInit ();#endif if (strncmp (params.bootDev, "scsi", 4) == 0) { int bootDevId = NONE; int bootDevLUN = NONE;#ifdef INCLUDE_SCSI2 /* Set all devices to asynchronous data transfer */ which = SCSI_SET_OPT_XFER_PARAMS; options.maxOffset = 0; options.minPeriod = SCSI_SYNC_XFER_MIN_PERIOD; for (devBusId = 0; devBusId < 8; devBusId++) { scsiTargetOptionsSet (pSysScsiCtrl, devBusId, &options, which); }#endif /* INCLUDE_SCSI2 */ /* check for absence of bus ID and LUN, in which case * auto-configure and display results */ if (strlen (params.bootDev) == 4) { if (!scsiInitialized) { if (sysScsiInit () == ERROR) { printErr ("Could not initialize SCSI.\n"); return (ERROR); } scsiInitialized = TRUE; } scsiAutoConfig (pSysScsiCtrl); scsiShow (pSysScsiCtrl); /* return ERROR to indicate that no file was loaded */ return (ERROR); } sscanf (params.bootDev, "%*4s%*c%d%*c%d", &bootDevId, &bootDevLUN); if (scsiLoad (bootDevId, bootDevLUN, params.bootFile, pEntry) != OK) { printErr ("\nError loading file: errno = 0x%x.\n", errno); return (ERROR); } return (OK); }#endif /* INCLUDE_SCSI_BOOT */#ifdef INCLUDE_FD if (strncmp (params.bootDev, "fd", 2) == 0) { int type = 0; int drive = 0; if (strlen (params.bootDev) == 2) return (ERROR); else sscanf (params.bootDev, "%*2s%*c%d%*c%d", &drive, &type); if (fdLoad (drive, type, params.bootFile, pEntry) != OK) { printErr ("\nError loading file: errno = 0x%x.\n", errno); return (ERROR); } return (OK); }#endif /* INCLUDE_FD */#ifdef INCLUDE_IDE if (strncmp (params.bootDev, "ide", 3) == 0) { int type = 0; int drive = 0; if (strlen (params.bootDev) == 3) return (ERROR); else sscanf (params.bootDev, "%*3s%*c%d%*c%d", &drive, &type); if (ideLoad (drive, type, params.bootFile, pEntry) != OK) { printErr ("\nError loading file: errno = 0x%x.\n", errno); return (ERROR); } return (OK); }#endif /* INCLUDE_IDE */#ifdef INCLUDE_ATA if (strncmp (params.bootDev, "ata", 3) == 0) { int ctrl = 0; int drive = 0; if (strlen (params.bootDev) == 3) return (ERROR); else sscanf (params.bootDev, "%*3s%*c%d%*c%d", &ctrl, &drive); if (ataLoad (ctrl, drive, params.bootFile, pEntry) != OK) { printErr ("\nError loading file: errno = 0x%x.\n", errno); return (ERROR); } return (OK); }#endif /* INCLUDE_ATA */#ifdef INCLUDE_PCMCIA if (strncmp (params.bootDev, "pcmcia", 6) == 0) { int sock = NONE; if (strlen (params.bootDev) == 6) return (ERROR); else sscanf (params.bootDev, "%*6s%*c%d", &sock); if (pcmciaLoad (sock, params.bootFile, pE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -