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

📄 install.c

📁 mips架构的bootloader,99左右的版本 但源代码现在没人更新了
💻 C
📖 第 1 页 / 共 5 页
字号:
/* File: install.c - performs the PMON/IMON installation * Author: Phil Bunce (pjb@carmel.com) * Revision History: *	931010	Converted from Unix csh script *	960722	Added all-be and all-le *	961223	Added atm2 host and sar *	960810	Added l64008 *	970206	Added l9a0084 DCAM *	970224	Added "was generated automatically.." for devinfo.c *	970307	EPI - changed HCINC to '.' - see email *	970311	Changed DBX_SUPPORT to GDB_SUPPORT *	970313	Fixedup the file fixup list for bsps and imon *	970314	Removed '-' and '+' symbols from 'board' names (DOS). *	970317	Modified the dos file fixup logic to add names that are *		appended to the $(AR) command. *	970317	Removed 'stand' directory from pmon/examples *	970317	Removed SEDPAT. No longer required for 'make depend'. *	970317	Added pkg_rev. *	970318	Added LIB_ONLY to support lib-only target. Removed BUILD_DIRS. *	970324	Added support for Cygnus Elf tools *	970324	Added LR4001_RevA switch *	970331	Switched over to targList[] and toolList[]. *	970418	Created a separate target for 4010 Nitro. *	970422	Changed defaults to hostport=tty0 -srec and dlproto=none *	970515	Removed endianDef(0) from if statement *	970515	Added stuff for etheripaddr *	970525	Removed skipask1: and mdem = "NONE" *	970526	Added 4101 to all-be and all-le *	970526	Corrected CYGUNIX names *	970529	Corrected ALGUNIX and EPIUNIX names  *	970530	Corrected BSOUNIX name *	970624	Added support for CYGELFDOS *	970630	Added win95 switch *	970703	Fixed prob with fixup files (line cont) *	970703	Cygnus EXEC_PREFIX needs all backslashes *	970703	Added _WIN32 switch for Win95 and WinNT *	970704	Added HOSTCCEXTRA and TOOLOBJS - also edited dosit *	970718	Added GCC_EXEC_PREFIX to CYGUNIXELF *	970731	Added Hamilton csh stuff for Win32 *	970731	Changed close to fclose in a couple of places. *	970821	Updated to permit pttys to be added. *	970912	Rewrote frecDef (now recDef) *	970927	Added code to conditionally create TMPDIR *	970927	Added dblqts around %path% in unsetenv.bat for win95 *	971002	Changed TMPDIR (cygelfdos) to use /cygnus *	971003	Fixed TMPDIR for algo and cygelfdos. *	971003	Added examples/xflash to fileLst. *	980113	Added code to selectively build be and le targets in bsps *	980120	Added LR4011 to all-be and all-le lists. *	980202	Enabled nvram on sdp1000. *	980202	Added LR4001 to sdp1000. *	980220	Added COMP_LIBGCC and COMP_LIBLSI to cygelf dos tools. *	980226	Added COMP_LIBGCC and COMP_LIBLSI to cygunixelf. *      980322  Changed winbootdir to windir. NT doesn't have winbootdir. *      980322  Changed win95 to win32. win32 is win95 + winNT. *	980327	NT doesn't like the dbl quotes in path that win95 needs. *		set win32 if windir (NTor95) *		set win95 if winbootdir (95 only) *	980402	Added ALGDOS3. *	980412	Added mdem=no to targ_sdp1000. *	980414	Removed a case from bso file fixup. Better for long paths. *	980414	Don't call getAlgoToolRev for ALGUNIX3. *	980414	Added NOANSI switch in support of old Sun cc command. *	980420	Added 90084 device info *	980615	Added 4102 and 16550. *	980616	Large change. Eliminate devinfo.c. *	980619	Added quotes to sde2-dos-csh-bg COMPILER_PATH *	980624	Added ATMizer-II+ (64364). *	980704	Added 64388 RAP. *	980724	Added "export PATH" to all UNIX Bourne-shell configs. *	980726	Moved chkfile into loop in ALGDOS. *	980817	Changed RMFOBJS to use rm-f. *	980820	Removed LR4001_RevA flag. *	980901	Added ALL_TARG so as to not build imon w sdp1000. *	981006	Added html/makefile to list. *	981019	Removed BSPTARGETS. Added MKDIR for bsps/{lg,bg}. *	981020	Added bsps/target.mk to fixup list. *	981022	Added leading nl to include/defines.h. *	981025	Removed NMOD from GHS. Added COMP_ROOT. *	981030	Added examples/stand. Removed several out-of-date dirs. *	981101	Added EDIR to defines.mk. *	981203	Fixed potential for crash if lsi not found. *	981204	Fixed duplicate BGd in PMON_TARG *	981204	Removed mkdir for examples/xflash/{bg,lg} *//* * This install program is used in both Unix and MSDOS environments. ifdef * MSDOS is used to bracket all MSDOS specific code. At present you MUST * use the Microsoft Visual C++ Pro package to compile this program in * an MSDOS environment.  * For Win32 compile with: cl /DMSDOS install.c /link /stack:8192 */#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#ifdef host_mips#include <ctype.h>char *strstr();#endif#define strNcpy(x,y,z)	strncpy(x,y,z),(x)[z]=0char *strstr(),*rstrstr();char *strichr(),*strchr(),*strrchr();char *readFile();#ifdef MSDOS#define MKDIR(x,y)	_mkdir(x)typedef void VOID;int findit();#ifdef _WIN32#include <io.h>#include <direct.h>#else#include <dos.h>#endif#define strequ(x,y)	((_stricmp(x,y)==0)?1:0)#else /* not MSDOS */#define MKDIR(x,y)	mkdir(x,y)typedef int VOID;#include <dirent.h>#define strequ(x,y)	((strcmp(x,y)==0)?1:0)#endif#define BUFSZ 200#define AVSIZE 40#define CWDSZ 500#define bufnl()		bufptr=prnbuf[lstnadd(prnbuf,"",45)],bufcol=0#define BUFINDSZ 9#define DODOTS		/* insert dots in the display output *//* IMPORTANT: * You must use a unique hardware address for each board that may be  * simultaneously connected to your network. I recommend simply * incrementing this value. For example, your second board would * use aa:bb:cc:00:00:01. */#define ETHERNET_HW_ADDRESS	"aa:bb:cc:00:00:00"#define ETHERNET_IP_ADDRESS	"71.0.0.211"typedef VOID vFunc();typedef int iFunc();typedef char *Lst;char pkg_rev[20];char pmon_rev[20];char imon_rev[20];char bsps_rev[20];char mon_rev[20];char clib_rev[20];char fpem_rev[20];char optfpem_rev[20];#ifdef MSDOSstruct FileLst {	char *src;	char *dst;	};/* list of files that get fixed up */struct FileLst fileLst[] = {	{"makefile.dst","makefile"},	{"include/makefile.dst","include/makefile"},	{"tools/makefile.dst","tools/makefile"},	{"mon/makefile.dst","mon/makefile"},	{"mon/target.dst","mon/target.mk"},	{"pmon/makefile.dst","pmon/makefile"},	{"pmon/target.dst","pmon/target.mk"},	{"imon/makefile.dst","imon/makefile"},	{"imon/target.dst","imon/target.mk"},	{"bsps/makefile.dst","bsps/makefile"},	{"lib/makefile.dst","lib/makefile"},	{"lib/target.dst","lib/target.mk"},	{"libsa/makefile.dst","libsa/makefile"},	{"libsa/target.dst","libsa/target.mk"},	{"html/makefile.dst","html/makefile"},	{"examples/makefile.dst","examples/makefile"},	{"examples/pmon.dst","examples/pmon.mk"},	{"examples/stand.dst","examples/stand.mk"},	{"examples/rom.dst","examples/rom.mk"},	{"examples/xpmon.dst","examples/xpmon.mk"},	{"examples/xstand.dst","examples/xstand.mk"},	{"examples/crules.dst","examples/crules.mk"},	{"examples/recrules.dst","examples/recrules.mk"},	{0}};#endifstruct TargList {	char *name;	vFunc *func;	};struct TargList *targList;extern struct TargList targList_lsi[];extern struct TargList targList_cma[];char *defines[] = {"######################################################################","#     This file contains information about your configuration.       #","######################################################################","","CFLAGS = $(TFLAG) $(OPTLEV)","ASFLAGS = $(TFLAG) $(OPTLEV)","",".c.o:","	pmcc -c $(CFLAGS) $<","",".s.o:","	pmcc -c $(ASFLAGS) $<","",".SUFFIXES: .o .s",0};char *defbaud = "9600";char *bauds[] = {	"75","110","134","150","200","300","600","1200",	"1800","2400","4800","9600","19200","38400",0};/* * This program has far too many global variables, but that's because * it was converted into C from a csh script. That also accounts for * its really horrible structure! */Lst prnbuf[50];char *bufptr;char mach[80],*FPEM_DIR;char manpath[200];Lst cfg[20],pkgsw[20];int Argc,Argcnt;char **Argv;char *devtypes[] = {"2681","8251","PS2","ptty","16c552","90084","16550",0};int bufcol;int win32,win95;char *ALL_TARG;FILE *sfp; /* dot.sh or setenv.bat */FILE *dfp; /* defines.mk */FILE *hfp; /* include/defines.h */FILE *rfp; /* root.sh */FILE *cfp; /* source.csh */char *getenv();char *lststr(),*lstnstr();int do_bso(),do_epi(),do_ghs(),do_algor(),do_algor3(),do_cyg();VOID padnprt();VOID cpuTypeCfg(),devCfg(),ramRomCfg(), autoMemCfg(), autoClkCfg(),    hostDevCfg(), dbgCfg(), frecCfg(), recDef(), timingCfg(),     etherCfg(), dlDevCfg(),protoCfg(), nvRamChk(), fpCfg(), promptSet(),    memTypeCfg(),endianCfg(),endianDef(),SelectTools(),dlmodeCfg(),    mdCfg();#define FFLAG_PMON  1#define FFLAG_IMON  3struct FuncEntry {	vFunc *func;	int flags;	} funcList[] = {		{SelectTools, FFLAG_PMON|FFLAG_IMON},		{cpuTypeCfg, FFLAG_PMON|FFLAG_IMON},		{devCfg, FFLAG_PMON|FFLAG_IMON},		{ramRomCfg,  FFLAG_PMON|FFLAG_IMON},		{autoMemCfg,  FFLAG_PMON|FFLAG_IMON},		{nvRamChk,  FFLAG_PMON|FFLAG_IMON},		{memTypeCfg, FFLAG_PMON|FFLAG_IMON},		{fpCfg,  FFLAG_PMON},		{mdCfg,  FFLAG_PMON|FFLAG_IMON},		{autoClkCfg, FFLAG_PMON|FFLAG_IMON},		{timingCfg,  FFLAG_PMON},		{dbgCfg,  FFLAG_PMON|FFLAG_IMON},		{etherCfg,  FFLAG_PMON|FFLAG_IMON},		{hostDevCfg,  FFLAG_PMON|FFLAG_IMON},		{dlmodeCfg, FFLAG_PMON|FFLAG_IMON},		{dlDevCfg, FFLAG_PMON|FFLAG_IMON},		{protoCfg,  FFLAG_PMON|FFLAG_IMON},		{recDef,  FFLAG_PMON|FFLAG_IMON},		{frecCfg,  FFLAG_PMON|FFLAG_IMON},		{promptSet, FFLAG_PMON|FFLAG_IMON},		{endianCfg, FFLAG_PMON|FFLAG_IMON},		{endianDef, FFLAG_PMON|FFLAG_IMON},	{0}};/* set by SelectTools */char COMP_ROOT[80],*NMOD, *tools;char dlport[10], *dlport_def;char cygbin[400], cygroot[400], libgcc[400], *remote;iFunc *fileFixer;int toolrev, MIPSTOOLS,CROSSTOOLS;char targets[80];char *board;					/* SelectBoard */Lst cpu[20];					/* cpuTypeCfg */char ftext[10],fdata[10],clientpc[10]; 		/* ramRomCfg */long memsize; 					/* autoMemCfg */int clkfreq; 					/* autoClkCfg */char hostport[16]; 				/* hostDevCfg */int no_chksum; 					/* frecCfg */Lst srcdebug[4]; 				/* dbgCfg */char etheraddr[12],etherhwaddr[20],*ethernet,etheripaddr[20];	/* etherCfg */int sonic_dw32;char *dlproto,*dlecho; 				/* protoCfg */char *nvram; 					/* nvRamChk */char *fpem; 					/* fpCfg */char *mdem; 					/* mdCfg */char prompt[20]; 				/* promptSet */char *memtype; 					/* memTypeCfg */char endian[16]; 				/* endianCfg */char *defEndian;				/* endianDef */char *defRecords;				/* recDef */char buf[80],tmp[80],tmp2[80];char *d,*def,*adr;char *msg1[] = {"","","This is the LSIPKG installation program. Use it to specify your tools","and target environment.","","For support Call 801-733-2009, email saltlake@lsil.com,","or point your web browser at 'http://www.carmel.com/pmon/'.","","For each of the questions that follow, the possible choices available","are shown in square brackets and the default is shown in parentheses.","When given as an option, 'q' allows you to cancel the selection.","",0};/**************************************************************  main(argc,argv)*/main(argc,argv)int argc;char *argv[];{int n;char tmp[200];Argc = argc; Argv = argv; Argcnt = 1;#ifdef MSDOSif (getenv("windir")) win32 = 1;if (getenv("winbootdir")) win95 = 1;#endifif (Argc > 1 && strequ(Argv[Argcnt],"cogent")) {	targList = targList_cma;	Argcnt++;	}else targList = targList_lsi;for (n=0;msg1[n];n++) printf("%s\n",msg1[n]);printf("This is PMON %s\n",readFile(pkg_rev,"version"));printf("The following subpackages have been found:\n\n");if (fileExists("pmon")) 	printf("\tPMON    - The Prom Monitor (V%s)\n",		readFile(pmon_rev,"pmon/version"));if (fileExists("imon")) 	printf("\tIMON    - The Serial-ICE Ice Manager (V%s)\n",		readFile(imon_rev,"imon/version"));if (fileExists("mon")) 	printf("\tMON     - The Core Debug Monitor (V%s)\n",		readFile(mon_rev,"mon/version"));if (fileExists("lib")) 	printf("\tCLIB    - The C Run-time Library (V%s)\n",		readFile(clib_rev,"lib/version"));if (fileExists("bsps")) 	printf("\tBSPS    - The Serial-ICE Board Support Packages (V%s)\n",		readFile(bsps_rev,"bsps/version"));if (fileExists("fpem")) 	printf("\tFPEM    - The Standard Floating-point Emulator (V%s)\n",		readFile(fpem_rev,"fpem/version"));if (fileExists("optfpem")) 	printf("\tOPTFPEM - The Optimized Floating-point Emulator (V%s)\n",		readFile(optfpem_rev,"optfpem/version"));printf("\n");printf("Is this correct? [y n] (y) > ");Gets(tmp);printf("\n");if (tmp[0] == 0) strcpy(tmp,"y");if (tmp[0] != 'y') exit(1);lstclr(cfg); lstclr(cpu);lstclr(pkgsw); fpem = "";SelectTools(0);SelectBoard();for (;;) {	n = displayCfg();	if (n == 0) break;	if (n == -1) exit(1);	(* funcList[n-1].func)(0);	}doInstall();exit(0);}/**************************************************************  displayCfg()*/displayCfg(){int i,n,col1,col2,len,maxopt;char *p;printf("Your current selections are:\n");printf("\n");for (i=0;funcList[i].func;i++) {	if (	(funcList[i].flags&FFLAG_PMON && *pmon_rev) ||		(funcList[i].flags&FFLAG_IMON && *imon_rev) ) {		bufnl();		sprintf(tmp," %2d. ",i+1);		bufprt(tmp);		(* funcList[i].func)(1);		}	}maxopt = i;#if 0for (i=0;prnbuf[i];i++) printf("%d: %s\n",i,prnbuf[i]);#endiflen = lstlen(prnbuf);col1 = 0;col2 = (len/2)+(len%2);for (i=col2;col1 < col2;) {	padnprt(prnbuf[col1++]);	if (i < len) padnprt(prnbuf[i++]);	printf("\n");	}printf("\n");lstclr(prnbuf);for (;;) {	printf("Is this correct? [y n 1-%d q] (y) > ",maxopt);	Gets(buf);	printf("\n");	if (*buf == 0) strcpy(buf,"y");	if (striequ(buf,"q")) return(-1);	if (striequ(buf,"y")) return(0);	if (sscanf(buf,"%d",&n) == 1) break;	printf("If this is not correct you can change the configuration\n");	printf("by entering the number of the item you wish to change.\n");	}return(n);}/**************************************************************  padnprt(str)*/VOID padnprt(str)char *str;{char *p;int n;n = 39 - strlen(str);#ifdef DODOTSif (p=strchr(str,':')) {	p++;	if (!strempty(p) && p[strlen(p)-1] != ' ') {		for (;n>0;n--) strichr(p,'.');		printf("%s",str);

⌨️ 快捷键说明

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