📄 vxw_pt2.html
字号:
<br>(From: Eric Lucazeau (elucazeau@my-deja.com))<p><hr WIDTH="50%"><a NAME="2.3-E"></a><p>Q: When I try to start an VxWorks image from T1 it runs, but when I tryto start the image compiled under T2 the system freezes.<p>A: The problem was a file called "sysalib.s" in our vxWorks configurationBSP. It contains the first entrypoint for vxWorks.<br>When we have compiled the image an warning was shown in the last line likethis<br>"could not find _sysinit, set it to default 0x10000"<br>After we added the file to the vxWorks build, it works fine.<br>(From: "Achim Zimmer" (hzimmer@dica.de))<p><hr WIDTH="50%"><a NAME="2.3-F"></a><p>Q: Is it possible to boot from a compressed VxWorks image on a file system?<p>A: Yes, that is possible. It can be done if you have enough RAM available.<p>Take a look at the attached routine bootLoadModuleInflate() in <a href="bootLoadModInfl.c">bootLoadModInfl.c</a>,intended to go in all/bootConfig.c. It presents the sameinterface as bootLoadModule(), except the file descriptor thatit takes is that of a deflated file.<p>Code such as the following code can be used to automaticallycall bootLoadModuleInflate() instead of bootLoadModule() whenthe boot file name ends with a certain extension. Then you canboot either way.<pre>#define DEFLATED_EXT ".D"#define DEFLATED_EXT_LEN (sizeof (DEFLATED_EXT) - 1)#define DEFLATED_FILE(fileName) \ (strlen(fileName) >= DEFLATED_EXT_LEN && \ strcmp((fileName) + strlen(fileName) - DEFLATED_EXT_LEN, \ DEFLATED_EXT) == 0) /* * Support loading deflated or regular files. */ if (DEFLATED_FILE(fileName)) { if (bootLoadModuleInflate(fd, pEntry) != OK) goto readErr; } else { if (bootLoadModule (fd, pEntry) != OK) goto readErr; }</pre>Also, a Makefile rule like the following will help createthe required deflated file more easily.<pre>DEFLATE = ${WIND_BASE}/host/${WIND_HOST_TYPE}/bin/deflateVX_BINARY = vxWorks.st${VX_BINARY}.D: ${VX_BINARY} @echo "Deflating ${VX_BINARY} ==> ${VX_BINARY}.D ...." ${DEFLATE} < ${VX_BINARY} > ${VX_BINARY}.D</pre>(From: Curt McDowell (csm@broadcom.com))<p><hr WIDTH="50%"><a NAME="2.3-G"></a><p>Q: When I boot my target over an FTP connection the kernel is loaded ina couple of seconds, but then the symbol table takes a much more time. Whydoes the second phase take so much more time than the first part.<p>A: The FTP client binds a port and lets vxWorks assign the port number.VxWorks always assigns port numbers incrementing from 1024. So firstthe boot ROM uses port 1024 to load the image. Then vxWorks resetsitself, causing it to use port 1024 again for the first file transferafter boot. Unfortunately, some servers don't let you re-use thesame port number for up to several minutes. The port is keptunusable in the TIMED_WAIT state.<br>The problem may also occur if you reboot a system twice in a rowbecause the boot ROM tries to use port 1024 repeatedly.<br>One fix is to call bind() a bunch of times in a loop during earlyinit. This wastes port numbers. The loop count may be chosenpseudo-randomly, but then you may occasionally still have theproblem. It is better to store the loop count in NVRAM andincrement it by 16 or something every boot, modulo some number.<br>Since doing this I have had no problems using any server. Here'smy version of the routine sysBindFix(). It should be calledafter usrNetInit() in usrConfig.c for the kernel, and also from aconvenient place in the boot ROM, such as before netLoad().My implementation is appended below.<pre>#include "netinet/in.h" /* for sysBindFix() */#include "sockLib.h" /* for sysBindFix() *//******************************************************************************* Each time VxWorks is rebooted, it starts assigning system-assigned* port numbers beginning at 1024. Thus, if vxWorks is rebooted two or* more times in succession, the same port number will be re-used.** This behavior causes problems when vxWorks is being booted from a* remote FTP server (particularly one running Solaris), because port* 1024 goes into a TIME_WAIT state on the server and cannot be reused* until it times out, typically in 2-4 minutes.** This hack reduces the likelyhood of this happening by "wasting"* a different number of system-assigned port numbers for each boot.*/void sysBindFix(void){ UINT8 N; sysNvRamGet((char *) &N, 1, NV_OFF_BINDFIX); N -= 16; sysNvRamSet((char *) &N, 1, NV_OFF_BINDFIX); /* This is quite fast even when N=255 */ while (N--) { int s; struct sockaddr_in saddr; saddr.sin_addr.s_addr = htonl(INADDR_ANY); saddr.sin_port = 0; saddr.sin_family = AF_INET; s = socket(AF_INET, SOCK_STREAM, 0); bind(s, (struct sockaddr *) &saddr, sizeof(saddr)); close(s); }}</pre><br>(From: Curt McDowell, csm@broadcom.com)<p><a NAME="2.3-G1"></a>If the host is Solaris that you are booting from you can set TIMED_WAIT toits minimum value, as root using 'ndd':<ul><li>When using Solaris 2.6:<pre>ndd -set /dev/tcp tcp_close_wait_interval 1000</pre></li><li>When using Solaris 2.7:<pre>ndd -set /dev/tcp tcp_time_wait_interval 1000</pre></li></ul>This will make the boot load and symbol table operate normal.<p>I put a script in /etc/rc2.d to automate this on each reboot:<pre>#!/sbin/sh# for Solaris 2.7# refer to ndd man pagecase "$1" in'start') if [ -f /usr/sbin/ndd ]; then echo 'shortening tcp_close_wait_interval to 1000' /usr/sbin/ndd -set /dev/tcp/ tcp_close_wait_interval 1000 fi ;;'stop') ;;*) echo "Usage: $0 { start | stop }" exit 1 ;;esacexit 0</pre>(From: Jeff Szczepanski, jszczep1@rochester.rr.com and Bob Irwinbobi@systemsinterface.com)<p>There is also a possible solution on the Vxworks side - make sure thatwhen the machine reboots, it does not reuse the same port numbers again.This happens on fast reboots as well as switches between boot and memory(vxWorks) images. A simple way to go about is to add code into useNetwork.c,that creates a couple of additional sockets and binds them to dunamic ports.<br>(From: Leonid Rosenboim, leonid@bitband.com)<p><hr WIDTH="50%"><a NAME="2.3-H"></a><p>Q: When I startup my target and want to download my VxWorks image using anFTP session, and my ftp daemon is not yet available I have to manually restartmy target or use the bootprompt to start my system. How can I avoid this?<p>A: You could try to increase the boot timeout, but that would also be thecase when your FTP deamon machine is available.<br>Another option is to modify the boot process. Now, when the boot fails thebootprompt apears. Modify it in such a way that the countdown startsagain. This means that after 10 seconds a new FTP action is started, and ifthis fails 10 seconds later another is started.<br>Be sure to have the bootloader react to a key however. The bootpromptshould apear when you press a key, so you can still modify the bootparameters.<p><hr WIDTH="50%"><a NAME="2.3-I"></a><p>Q: Is it possible to make a "multi-boot"?<p>A: Yes, VxWorks is quite capable of multi-booting. However, not withoutsome work on your part and then reburning the boot ROMs (or rebuilding theboot image if you're using BOOTP).<br>What you have to do is to modify the bootConfig.cfile in the area of the routine called the bootCmdLoop.<br>You will need to define an alternate bootline and storeit somewhere. You'll find an example in <Your BSP>/config.h.It should look something like this:<pre>#define DEFAULT_BOOT_LINE \"ei(0,0)host:/usr/vw/config/mv162/vxWorks h=90.0.0.3 e=90.0.0.50 u=target"#define ALTERNATE_BOOT_LINE1 \"scsi=0,0(0,0)intructor:/u/team7/vxWorks h=192.168.32.50 e=192.168.32.17u=team7 tn=vx7 s=/sd0/startup.cmd o=ei"#define ALTERNATE_BOOT_LINE2 \"ei(0,0)intructor:/u/team7/vxWorks h=192.168.32.50 e=192.168.32.17 u=team7tn=vx7 s=/u/team7/startup.cmd"</pre>Then, in bootConfig.c add the following global:<pre>char secondChance = 2;</pre>Then, in bootConfig.c (bootCmdLoop) you would add something like this:<pre> /* start autoboot, unless no-autoboot specified */ bootStringToStruct (BOOT_LINE_ADRS, &params); sysFlags = params.flags; 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); /* doesn't return if successful */ } else { int timeout = TIMEOUT; /* we only get here if the autoboot above fails */ switch (secondChance) { case 2 : strcpy (BOOT_LINE_ADRS, ALTERNATE_BOOT_LINE2); secondChance--; key = autoboot (timeout); /* doesn't return if successful */ break; case 1 : timeout = TIMEOUT; strcpy (BOOT_LINE_ADRS, ALTERNATE_BOOT_LINE1); secondChance--; key = autoboot (timeout); /* doesn't return if successful */ break; } } /* If we're here, either we aren't auto-booting, or we got an error * auto-booting, or the auto-booting was stopped. */</pre>Make sure that the boot lines are configured properly and thatall of the devices that you are trying to boot from are knownto both the bootConfig.c (bootROM) and the usrNetwork.c andusrLoadSym.c code if you're using the two step boot process(load the O/S then the symbol table). You will have to rebuildthe bootROM image for this to work.<br>This code snippet actually supports booting from 3 differentdevices as "failsoft" devices. It trys the default NVRAMbootline, then ALTERNATE_BOOT_LINE2 then ALTERNATE_BOOT_LINE1.I've even had this default to dialing up via SLIP/PPP and bootingvia modem -- the ultimate phone home ;-) -- if all else fails.<br>(From: Mike Anderson, mike@chipware.com)<p><hr WIDTH="50%"><a NAME="2.3-J"></a><p>Q: When I use a compressed VxWorks image a timeout resets my target beforemy VxWorks becomes active. Is it possible te reset the watchdog during theinflate?<p>A: You can modify and rebuild the inflate function to include a function toreset the watchdog. The sources can be found at:<a href="http://www.info-zip.org/pub/infozip/zlib/">http://www.info-zip.org/pub/infozip/zlib/</a><br>(Bill Pringlemeir, bpringlemeir@yahoo.com)<p><hr WIDTH="50%"><a NAME="2.3-K"></a><p>Q: How do I create a boot-disk?<p>A: Creating Bootable Floppy from Boot-ROM:<blockquote><ul><li>Open DOS window.</li><li>From DOS window execute<code>tornado\host\x86-win32\bin\torvars</code>(it will fix environment vars).</li><li>From the location of your boot-rom file (tornado\target\config\BSP-dir\bootrom_uncmp) type<code>mkboot a: bootrom_uncmp</code>. The mkboot utility will create abootable floppydisk</li></ul></blockquote>Creating Bootable Hard Disk from Boot-ROM:<blockquote><ul><li>1st stage will be to prepare a Hard Disk that will be suitable for VxWorksenvironment.</li><li>Prepare a Floppy Disk with DOS6.2, FDISK & FORMAT files on it.</li><li>Turn off your PC, remove your HD and place VxWorks HD instead.</li><li>Boot your PC from DOS 6.2 Floppy Disk.</li><li>Run FDISK Create FAT16 2Gbyte partition and set it to be the activepartition.</li><li>Exit from FDISK, reboot from the Floppy Disk and format the HD by using theFORMAT command from the Floppy Disk.</li><li>Turn Off your PC, reconnect your original HD, and add VxWorks HD as asecondary HD (for example as disk D).</li><li>Turn ON your PC (Windows NT should be activated).</li><li>Open DOS window.</li><li>From DOS window execute <code>tornado\host\x86-win32\bin\torvars</code>(it will fix environment vars).</li><li>From the location of your boot-rom file (tornado\target\config\BSP-dir\bootrom_uncmp) copy bootrom_uncmp to file name bootrom.dat.</li><li>Type <code>vxsys d:</code> (assuming VxWorks HD is mapped as disk D).The vxsys.com installs a bootstrap loader that will be used to loadbootrom.sys file.</li>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -