📄 bootconfig.c
字号:
/* bootConfig.c - system configuration module for boot ROMs */
/* Copyright 1984 - 2003 Wind River Systems, Inc. */
/*
modification history
--------------------
12u,12feb03,pmr fixed warning.
12t,24jan03,pmr SPR 83157: remove relative include paths.
SPR 65782: validation of boot line in NVRAM.
12s,22jan03,wap restore bootpLib and ipLib API compatibility
12r,13jan03,vvv merged from branch wrn_velocecp, ver12u (SPR #83245, 83246,
84378)
12q,19jun02,elr Moved close for ftp data sockets (SPR #77169)
12p,06jun02,pai Removed redundant error messages from xxxLoad() routines.
12o,23may02,mas corrected args passed to smNetInit() (SPR 71787)
12n,22may02,jkf SPR#76700, pcmciaInit must be called before muxDevLoad
12m,22may02,sbs changed default sys clock rate to a macro (SPR #1918)
12l,16may02,vvv restored SLIP support
12k,10may02,wap Reduce tBoot's priority to below tNetTask's before doing
netLoad() (SPR #76107)
12j,06may02,sbs updating boot banner
12i,30apr02,wap Correct arguments passed to dhcpcOptionAdd() for
little-endian targets (SPR #73769)
12h,24apr02,mas fixed backplane NETIF params in usrBpInit() (SPR 76236)
12g,31mar02,jkf SPR#74251, using bootLib.h macros for array sizes
12f,28mar02,jkf SPR#74558, bootrom: command line input length increased.
12e,22mar02,zmm Fix mask in 'd' instruction for little endian only (SPR 5602)
12d,14mar02,hdn added X86 specific code for HTT in go () (spr 73738)
12c,13mar02,vvv removed references to SLIP (SPR #72992)
12b,04mar02,pch SPR 73609
12a,29jan02,vvv allow icmpMaskGet to work if host and target are in different
subnets; added debug messages for netmask configuration
11z,17jan02,pcm SPR 72642 - split excInit() into excInit() and excShowInit()
11y,10dec01,kab SPR 71410 - stack overflow
11x,10dec01,sbs Added version command and check for the length of bootline
before saving to NVRAM.
11w,10dec01,rec Made 'd' command endian independent (SPR 5602).
11v,09dec01,jkf SPR#62094, 62122, need devSplit() for booting from dosfs
11u,07dec01,jkf SPR#70548, Booting from Partitioned disks fails with SCSI
11t,30nov01,nrv including sysTffs.c when INCLUDE_TFFS is defined
11s,28nov01,tlc Correct diab syntax error for MIPS architecture.
11r,11nov01,sbs Added intLock() before jumping out of boot image (SPR 3704)
Removed '!' as an option to continue booting (SPR 7256)
11q,13nov01,yvp Added include for private/excLibP.h
11p,27oct01,dat Adding trap for misaligned data section SPR 9006
11o,09oct01,rae merge from truestack ver11n. Base 11j (SPR 25374)
11p,19oct01,vvv fixed IP_MAX_UNITS declaration (SPR #70476)
11o,11oct01,aeg updated initialization sequence of selectLib (SPR #31319).
11n,16sep01,dat Use of WRS_ASM macro
11m,18jun01,mil Cleaned up compiler warnings.
11l,27feb01,hk update printBootLogo() copyright notice to cover 2001.
11l,07feb01,spm added merge record for 30jan01 update from version 10z of
tor2_0_x branch (base 10y) and fixed modification history
11k,30jan01,ijm merged SPR# 28602 fixes: proxy ARP services are obsolete
10q,30apr99,jpd changed copyright year from 1998 to 1999.
10p,13nov98,jpd conditionally add sysHwInit0() call before cacheLibInit(); make
cacheEnable call depend on INCLUDE_CACHE_SUPPORT (SPR #22707).
10z,01sep99,spm allowed proxy client and server to use any device (SPR #8993)
11j,08dec00,rae Fixed minor #ifdef problem
11i,06dec00,rae usrRoot can't return ERROR
11h,17nov00,spm fixed NPT merge to allow build without END device support
11g,14nov00,rae removed unused argument from sockLibAdd()
11f,01nov00,ham update muxDevStopAll call in response to muxLib.c's ver 03k.
11e,17oct00,niq Integrating T3 DHCP
11e,28feb00,gnn merged from NPT
11d,04oct99,pul Modification for NPT: passing the right cookie to muxDevStart
11c,29apr99,pul Upgraded NPT phase3 code to tor2.0.0
11b,29mar99,pul removed mmuxMCastMapAdd()
11a,26mar99,sj added NPT support: muxLibInit; muxMaxBinds
10z,19mar99,dat removed bp driver interface SPR 25877, fixed bug in ver 10x.
11a,19apr00,zl fixed unitNum default to 0 in mEnet(). Updated copyright year.
10y,17mar99,spm added support for identical unit numbers (SPR #20913)
10x,16mar99,dat SPR 25790, fixed startup of END and BSD drivers
10w,16mar99,spm recovered orphaned code from tor1_0_1.sens1_1 (SPR #25770)
10v,01mar99,spm bypassed incorrect cleanup after successful TFTP file
transfer (SPR #24618)
10u,26feb99,dat added FEI support (23818)
10t,19feb99,spm fixed construction of device name for pcmcia (SPR #21676)
10s,02feb99,sgv Added bitflag value to sockLibAdd
10r,28jan99,jmp added TSFS_BOOT facility (SPR# 24466).
10q,20jan99,scb usrBpInit() modified to use "sm=" before SM_ANCHOR_ADRS (23035)
10p,26jan99,jkf removed x86 specific memAddToPool's from ataLoad,
ideLoad, pcmciaLoad, & tffsLoad. Replaced with
BSP specific memAddToPool in sysHwInit2() (SPR#21338).
10o,13nov98,n_s added call to muxDevStopAll in go. spr #23229
10n,11sep98,spm corrected documentation for bootpGet and dhcpGet (SPR #20629)
10m,04sep98,ham set subnetmask through ntohl() in bootpGet(),SPR#21909.
10l,03jun98,hdn disabled system clock just before jumping to the entry point
for PentiumPro's Local APIC Timer.
10k,23apr98,yp merged TrueFFS support
10j,01apr98,hdn moved tffsLoad from usrTffs.c.
10i,04feb98,jpd updated copyright date.
10h,19mar98,spm corrected prototype for mEnet() routine (SPR #20174); changed
parameter name to match coding standards
10g,02feb98,spm replaced invalid logMsg calls with printf statements
10f,06jan98,hdn added support for TFFS.
10e,30nov97,vin added network system pool
10d,20nov97,gnn fixed spr#7265 to deal with devices with no attach routine.
10c,27oct97,vin fixed call to endLoadFunc(..).
10b,03oct97,gnn removed references to endDriver global
10b,23oct97,tam fixed compilation warnings.
10a,26sep97,gnn added muxAddrResFuncAdd call for ipAttach
09z,26sep97,vin used NUM_XXX_MIN macros for system pool configuration.
09y,25sep97,gnn SENS beta feedback fixes
09x,26aug97,vin fixed warnings in muxIoctl
09w,26aug97,spm major overhaul of DHCP client: reorganized code and changed
user interface to support multiple leases at runtime, improved
handling of address information, and allowed selection of UDP
ports; also fixed incorrect treatment of gateway field by
BOOTP/DHCP (SPR #9137)
09v,12aug97,gnn changes necessitated by MUX/END update.
09u,15jul97,spm fixed byte ordering of netmask from DHCP client (SPR #8739)
09t,01jul97,jag removed stale code for RESOLVER (SPR #8868)
09j,15aug97,cdp add casts etc. to stop compiler warnings.
09i,05feb97,cdp remove ARM test hook (_func_armStartup).
09h,21jan97,jpd Added support for Olicom and lnEbsa Ethernet drivers, made
cacheLib calls dependent upon INCLUDE_CACHE_SUPPORT being
defined.
09g,12dec96,cdp added _func_armStartup for ARM platforms.
09s,02jun97,spm changed DHCP option tags to prevent name conflicts (SPR #8667)
09r,20may97,gnn fixed SPR 8627 so that multiple gn devices are supported.
09q,19may97,spm included rngLib.h to fix DHCP client build error (SPR #8606)
09p,30apr97,spm moved usrNetIfConfig for "gn" device to prevent DHCP error
09o,25apr97,gnn changed INCLUDE_GN to INCLUDE_END
09n,18apr97,spm corrected structure element name in BOOTP interface
09m,17apr97,gnn added support for configNet style configuration of ENDs.
09l,07apr97,spm changed BOOTP interface to DHCP style: all options supported
09k,29jan97,spm made global variables for DHCP client unique
09j,29jan97,spm removed parameters from dhcpBootBind()
09i,21jan97,gnn added the new argument to muxDevLoad().
09h,20dec96,vin fixed warnings muxDevLoad(). added AF_ROUTE.
09g,06mar97,mas deleted unused variable 'char gateway[INET_ADDR_LEN];' from
bootLoad() (SPR 8113).
09g,18dec96,spm fixed bug in unit number support and restored lost DHCP code
09f,17dec96,gnn added stuff for new etherHooks.
09e,27nov96,spm added support for DHCP client and network device unit numbers
09d,25nov96,vin added new cluster configuration.
09c,01oct96,spm added bzero() call to checkInetAddrField (SPR 6326)
09b,22sep96,spm Fixed SPR 7120: added support for gateways to BOOTP startup
09a,24jul96,vin fetching netmask after usrNetIfConfig() mods for bsd4.4.
08z,21jun96,jmb long modhist -- deleted entries prior to 1994. SPR #6528
08y,19jun96,hdn defined IDE_MEM_DOSFS to 0x200000.
08x,13jun96,hdn added INCLUDE_ESMC for SMC91c9x Ethernet driver.
08w,05jun96,kkk update copyright year from 1995 to 1996.
08v,05jun96,ism bumped copyright date to 1996.
19v,19apr96,jds changed the include of scsiLib.h to be done after config.h;
also added setting to asynchronous mode all target devices
08u,20mar96,hdn made inclusion of pppLib.h and strmLib.h conditional.
09t,07mar96,gnn added SLIP_MTU to slipInit so that we could configure
the MTU. (SPR #4652)
08s,06mar96,tpr added #include "bootElfLib.h".
08r,06mar96,dat removed __DATE__ from printBootLogo
08q,06mar96,tpr Enabled the Instruction Cache for PowerPC.
08p,06dec95,vin fixed usrStrmInit warning.
08o,29nov95,vin added baudrate processing of boot string.
08n,06sep95,jag deleted call to fattachInit (), changed sadInit to
autopushInit (), and changed iosStrmInit to strmInit ().
08m,01aug95,dzb changed STREAMS options to go through iosStrmInit ().
added usrStrmInit ().
PPP initialization failure message (SPR #4505).
08l,25jul95,dzb tweaked socket library initialization.
08k,25jul95,dzb added socket library init for BSD vs. STREAMS.
08j,18jul95,dzb wait for PPP interface to come up in usrPPPInit().
08i,17jul95,dzb fixed ordering of boot params search.
08h,26jun95,dzb removed PPP_S_USEHOSTNAME option.
08g,21jun95,dzb Added INCLUDE_PPP_CRYPT for unbundled crypt() support.
08f,20jun95,dzb Added PPP support.
09b,28nov95,tpr re-ordered history following PPC merge.
09a,11oct95,dat new BSP revision id, modified signon banner printing
08z,29jun95,caf added nicEvb driver entry.
08y,28jun95,caf for PPC, called cacheTextUpdate() instead of cacheClear().
08x,26jun95,kvk Removed references to _edata and _end for a clean
bootrom_uncmp build.
08w,06jun95,caf fixed edata and end for Green Hills/PowerPC.
08v,26jun95,ms updated for new serial drivers, removed WDB support.
08u,21jun95,ms changed copywrite to 1995
08t,01jun95,caf added support for "ilac" driver.
08s,22may95,yao adjust reference to edata, end to SVR4 ABI standard
for PowerPC.
08r,22may95,p_m added WDB agent support.
+ ms
08q,05apr95,kkk changed edata & end to char arrays (spr# 3917)
08p,28mar95,kkk made baud rate a macro in configAll.h
08o,19mar95,dvs removed TRON references.
08n,08dec94,hdn swapped 1st and 2nd parameters of fdDevCreate().
fixed bootHelp message; fd=... and ide=...
08m,21nov94,hdn fixed a problem by swapping 1st and 2nd parameters of sscanf.
08l,20nov94,kdl added hashLibInit() call if using dosFs.
08k,11nov94,dzb added QU network interface.
08j,09nov94,jds additions for scsi backward compatability ; scsi[12]IfInit()
08i,20oct94,hdn used ideRawio() instead of using raw file system.
swapped 1st and 2nd parameter of ideLoad() and fdLoad().
08h,17aug94,dzb fixed setting the gateway for a slip connection (SPR #2353).
added INCLUDE_NETWORK macros for scalability (SPR #1147).
added CSLIP support.
08g,14jun94,caf updated copyright notices.
08f,29may94,hdn fixed more FTP bootrom bug in netLoad().
updated the copyright year 93 to 94.
disabled cache for i486 and Pentium.
08e,26may94,kdl changed netLoad() to properly close FTP connections (SPR 3231).
08d,10may94,hdn fixed the FTP bootrom bug (John's patch)
08c,09feb94,hdn added support for if_elt 3COM EtherLink III driver.
added support for if_ene Eagle NE2000 driver.
*/
/*
DESCRIPTION
This is the WRS-supplied configuration module for the VxWorks boot ROM.
It is a stripped-down version of usrConfig.c, having no VxWorks shell or
debugging facilities. Its primary function is to load an object module
over the network with either RSH or FTP. Additionally, a simple set of
single letter commands is provided for displaying and modifying memory
contents. Use this module as a starting point for placing applications
in ROM.
*/
#include "vxWorks.h"
#include "bootEcoffLib.h"
#include "bootElfLib.h"
#include "bootLib.h"
#include "bootLoadLib.h"
#include "bsdSockLib.h"
#include "cacheLib.h"
#include "cbioLib.h"
#include "ctype.h"
#include "dosFsLib.h"
#include "dpartCbio.h"
#include "errno.h"
#include "errnoLib.h"
#include "fcntl.h"
#include "fioLib.h"
#include "ftpLib.h"
#include "hostLib.h"
#include "icmpLib.h"
#include "ifLib.h"
#include "if_sl.h"
#include "inetLib.h"
#include "intLib.h"
#include "ioLib.h"
#include "iosLib.h"
#include "loadAoutLib.h"
#include "loadCoffLib.h"
#include "loadLib.h"
#include "logLib.h"
#include "memLib.h"
#include "msgQLib.h"
#include "netLib.h"
#include "pipeDrv.h"
#include "proxyLib.h"
#include "qLib.h"
#include "qPriBMapLib.h"
#include "rebootLib.h"
#include "remLib.h"
#include "rngLib.h"
#include "routeLib.h"
#include "semLib.h"
#include "sockLib.h"
#include "stdio.h"
#include "string.h"
#include "sysLib.h"
#include "sysSymTbl.h"
#include "taskHookLib.h"
#include "taskLib.h"
#include "tftpLib.h"
#include "tickLib.h"
#include "trcLib.h"
#include "unistd.h"
#include "usrFdiskPartLib.h"
#include "version.h"
#include "wdLib.h"
#include "net/if.h"
#include "net/mbuf.h"
#include "netinet/if_ether.h"
#include "drv/netif/smNetLib.h"
#include "ipProto.h"
#include "private/excLibP.h"
#include "private/kernelLibP.h"
#include "private/workQLibP.h"
#include "config.h"
#include "scsiLib.h"
#ifdef INCLUDE_BOOTP
#include "bootpLib.h"
#endif /* INCLUDE_BOOTP */
#ifdef INCLUDE_PPP
#include "pppLib.h"
#endif /* INCLUDE_PPP */
#ifdef INCLUDE_DHCPC
#include "dhcpcLib.h"
#include "dhcpcBootLib.h"
#include "dhcp/dhcpc.h"
#include "dhcp/dhcpcCommonLib.h"
#endif
#if (defined(INCLUDE_SECOND_SMNET) || \
defined(INCLUDE_SM_NET_ADDRGET) || \
defined(INCLUDE_SM_SEQ_ADDR))
# ifndef INCLUDE_SM_NET
# define INCLUDE_SM_NET
# endif /* INCLUDE_SM_NET */
#endif /* INCLUDE_SECOND_SMNET || ... */
#if (defined(INCLUDE_SECOND_SMNET) && !defined(INCLUDE_SM_NET_ADDRGET))
# define INCLUDE_SM_NET_ADDRGET
#endif /* INCLUDE_SECOND_SMNET && !INCLUDE_SM_NET_ADDRGET */
#ifdef INCLUDE_SM_NET
# ifndef INCLUDE_BSD
# define INCLUDE_BSD
# endif /* INCLUDE_BSD */
# ifndef INCLUDE_SM_COMMON
# define INCLUDE_SM_COMMON
# endif /* INCLUDE_SM_COMMON */
#endif /* INCLUDE_SM_NET */
/* defines */
#define STREQ(A, B) (strcmp(A, B) == 0 ? 1 : 0)
#define TIMEOUT 7 /* number of seconds before auto-boot */
/* maximum line length for cmd input to 'm' and 'mEnet' routine */
#define MAX_LINE 160
/* maximum line length for bootCmdLoop() command line input */
#define BOOT_CMD_MAX_LINE BOOT_LINE_SIZE
#define RSHD 514 /* rshd service */
#define DEC FALSE /* getArg parameters */
#define HEX TRUE
#define OPT TRUE
#define MAX_ADR_SIZE 6
#define DOS_ID_OFFSET 3
#define FIRST_PARTITION_SECTOR_OFFSET (0x1be + 8)
#define VXDOS "VXDOS"
#define VXEXT "VXEXT"
#ifndef NUM_PARTITIONS_DISK_BOOT
# define NUM_PARTITIONS_DISK_BOOT 1 /* one partition on the disk */
#endif /* NUM_PARTITIONS_DISK_BOOT */
#ifndef PARTITION_DISK_BOOT
# define PARTITION_DISK_BOOT 1 /* partition mounted during boot */
#endif /* PARTITION_DISK_BOOT */
/* DO NOT ADD ANYTHING BEFORE THE FIRST ROUTINE compressedEntry() */
void usrInit ();
IMPORT void sysInitAlt ();
extern int random ();
#if (CPU_FAMILY==MIPS)
IMPORT void sysGpInit ();
#endif /* (CPU_FAMILY==MIPS) */
#ifdef INCLUDE_NETWORK
#ifdef ETHERNET_ADR_SET
void mEnet (char *);
void sysEnetAddrGet ();
void sysEnetAddrSet ();
#endif /* ETHERNET_ADR_SET */
#endif /* INCLUDE_NETWORK */
#ifdef INCLUDE_END
LOCAL void* findCookie(int unitNo, char* devName);
#endif /* INCLUDE_END */
/*******************************************************************************
*
* compressedEntry - compressed entry point after decompression
*
* This routine is the entry point after the bootroms decompress, if
* compression is utilized. This routine must be the first item of the
* text segment of this file. With ANSI C, strings will appear in text
* segment so one should avoid entering strings, routines, or anything
* else that might displace this routine from base of the text segment.
*
* It is unwise to add functionality to this routine without due cause.
* We are in the prehistoric period of system initialization.
*
* NOMANUAL
*/
void compressedEntry
(
int startType
)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -