⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bootconfig.c

📁 MPC850的bootrom。使用后可以直接启动boot程序
💻 C
📖 第 1 页 / 共 5 页
字号:
        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    pcmciaInit ();			/* init PCMCIA Lib */    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, pEntry) == OK)	    return (OK);	/* fall through if the PC card is not a block device.	 * let's try to boot it from an ethernet device.	 */	}#endif	/* INCLUDE_PCMCIA */#ifdef  INCLUDE_TFFS    if (strncmp (params.bootDev, "tffs", 4) == 0)	{	int drive = 0;	int removable = 0;	if (strlen (params.bootDev) == 4)	    return (ERROR);	else	    sscanf (params.bootDev, "%*4s%*c%d%*c%d", &drive, &removable);	/* tffsLoad () should be after pcmciaInit () */	if (tffsLoad (drive, removable, params.bootFile, pEntry) != OK)	    {	    printErr ("\nError loading file: errno = 0x%x.\n", errno);	    return (ERROR);	    }	return (OK);	}#endif  /* INCLUDE_TFFS */#ifdef  INCLUDE_TSFS_BOOT    if (strncmp (params.bootDev, "tsfs", 4) == 0)	{	if (tsfsLoad (params.bootFile, pEntry) != OK)	    {	    printErr ("\nError loading file: errno = 0x%x.\n", errno);	    return (ERROR);	    }	return (OK);	}#endif  /* INCLUDE_TSFS_BOOT */#ifndef  INCLUDE_NETWORK    printf ("\nError loading file: networking code not present.\n");    return (ERROR);    }#else  /* INCLUDE_NETWORK */    /* start the network */    /* initialize the generic socket library */    if (sockLibInit (NUM_FILES) == ERROR)        return (ERROR);#if defined(INCLUDE_STREAMS) || defined(INCLUDE_STREAMS_ALL)    if (usrStrmInit() == ERROR)         /* init Streams subsystem */        return (ERROR);#endif   #if defined(INCLUDE_BSD) || defined(INCLUDE_BSD_SOCKET)    /* add the BSD socket library interface */    if (sockLibAdd ((FUNCPTR) bsdSockLibInit, AF_INET_BSD, AF_INET) == ERROR)        return (ERROR);    if (sockLibAdd ((FUNCPTR) bsdSockLibInit, AF_ROUTE, AF_ROUTE) == ERROR)        return (ERROR);#endif  /* INCLUDE_BSD || INCLUDE_BSD_SOCKET */    /* install default socket library interface */#ifndef DEFAULT_STREAMS_SOCKET    if (sockLibAdd ((FUNCPTR) bsdSockLibInit, AF_INET, AF_INET) == ERROR)        return (ERROR);#endif  /* DEFAULT_STREAMS_SOCKET */     hostTblInit ();		/* initialize host table */    usrNetProtoInit ();         /* initialize various protocols */    netLibInit ();#ifdef	INCLUDE_PPP#ifdef	INCLUDE_PPP_CRYPT     cryptRtnInit (&pppCryptRtn);	/* install crypt() routine */ #endif	/* INCLUDE_PPP_CRYPT */#endif	/* INCLUDE_PPP */    /* attach and configure boot interface */    if (strncmp (params.bootDev, "ppp", 3) == 0)        {        /* booting via ppp */        if (usrPPPInit (params.bootDev, params.unitNum, params.ead,                         ((params.gad[0] == EOS)? params.had : params.gad))                         == ERROR)            return (ERROR);        }    else if (strncmp (params.bootDev, "sl", 2) == 0)	{  	if (usrSlipInit (params.bootDev, params.unitNum, params.ead,                          ((params.gad[0] == EOS)? params.had : params.gad))                          == ERROR)	    return (ERROR);        }    else	{        strncpy (bootDev, params.bootDev, sizeof (bootDev));	if ((strncmp (params.bootDev, "bp", 2) != 0) &&            (strncmp (params.bootDev, "sm", 2) != 0))	    {	    pBootAddr = params.ead;	    backplaneBoot = FALSE;	    }        else	    {	    if (sysProcNumGet () == 0)		{                printf (                  "Error: processor number must be non-zero to boot from bp\n");	        return (ERROR);                }	    if (usrBpInit (bootDev, params.unitNum, 0) == ERROR)		return (ERROR);	    pBootAddr = params.bad;	    backplaneBoot = TRUE;	    }        /* Save requested lease length, if any. Ignore lease origin value. */        result = bootLeaseExtract (pBootAddr, &leaseLen, NULL);        if (result < 0)            {            printf ("Error reading target address information.\n");            return (ERROR);            }        /* Handle any lease information attached to the address entry. */        if (result == 2)            {            /*              * The current address contains both a duration value and a start             * time, indicating that it was assigned by a DHCP server.             */            if (leaseLen != (ULONG)~0)                {                /* Handle a finite address assignment. */                if (sysFlags & SYSFLG_AUTOCONFIG)                    *pBootAddr = EOS;    /* Remove for later replacement. */                else                    {                    /*                      * Technically, this address is invalid since it contains                     * a finite interval that requires DHCP for verification                     * and the automatic configuration flag is not set.                     * However, this situation can only occur if caused                      * deliberately by the user. So, just ignore the timing                     * information and assign the address permanently.                     */                    result = 0;    /* Prevents restoration of time values. */                    }                }            }#ifdef INCLUDE_DHCPC        /* Set the DHCP lease information, if needed. */        if (sysFlags & SYSFLG_AUTOCONFIG)            {            /* Save the requested lease length if entered by the user. */            if (result == 1)                dhcpLease.lease_duration = leaseLen;            else                {                /*                  * The lease length is either not present or left over from                 * an earlier lease. Use the default value.                 */                dhcpLease.lease_duration = DHCPC_DEFAULT_LEASE;                }            dhcpLease.lease_origin = 0;            }#endif  /* INCLUDE_DHCPC */        netmask = 0;        bootNetmaskExtract (pBootAddr, &netmask);	/* start of network attachment code block */#ifdef INCLUDE_END	/* Try an END device first */	pEnd = endFindByName (bootDev, params.unitNum);	if (!attached && (pEnd != NULL))	    {            if (muxDevStart (pEnd) != OK)                {                printf("Failed to start device %s\n", bootDev);                return (ERROR);                }	    if (muxIoctl (pEnd, EIOCGMIB2, (char *)&endM2Tbl)		    == ERROR)		return (ERROR);	    /* Add our default address resolution functions. */	    muxAddrResFuncAdd (M2_ifType_ethernet_csmacd, 0x800, arpresolve);	    if (ipAttach (params.unitNum, bootDev) != OK)		{		printf ("Failed to attach TCP/IP to device %s", muxDevName);		return (ERROR);		}	    printf ("Attached TCP/IP interface to %s%d.\n", bootDev,		     params.unitNum);	    attached = TRUE;	    }#endif /*INCLUDE_END*/#ifdef INCLUDE_BSD	/* Try a BSD 4.4 device attach sequence */        if (!attached)	    {	    if (usrNetIfAttach (bootDev, params.unitNum, pBootAddr) == OK)		{		attached = TRUE;		}	    else		return ERROR;	    }            #endif /* INCLUDE_BSD */	if (!attached)	    return ERROR;	/* attachment failed */        /*         * Now that any extra parameters following an "=" sign have         * been removed (e.g. the pcmcia socket number), build the         * network device string by appending the unit number to the         * device name.         */        sprintf (netDev, "%s%d", bootDev, params.unitNum);        if ( (sysFlags & SYSFLG_AUTOCONFIG) || (sysFlags & SYSFLG_PROXY) ||            (netmask == 0))            {            struct ifnet *	pIf;                            /* Initialize the boot device */                            if ( (pIf = ifunit (netDev)) == NULL)                 {                printf ("invalid device \"%s\"\n", netDev);                return (ERROR);			/* device not attached */                }                            if (pIf->if_init != NULL)                {                if ( (*pIf->if_init) (pIf->if_unit) != 0)                    {                    printf ("initialization failed for device \"%s\"\n",netDev);                    return (ERROR);                    }                }            }#ifdef INCLUDE_SM_NET 	if (backplaneBoot)	    {	    if ((params.bad [0] == EOS) &&	    	(strncmp (bootDev, "sm", 2) == 0) &&		(smNetInetGet (netDev, params.bad, NONE) == OK))	    	printf ("Backplane inet address: %s\n", params.bad);	    if (params.bad [0] == EOS) 	    	{	    	printf ("no backplane address specified\n");		return (ERROR);		}	    if ((sysFlags & SYSFLG_AUTOCONFIG) &

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -