BBS水木清华站∶精华区

发信人: reden (鱼 ~ 看流星和她的故事), 信区: Linux 
标  题: Linux Remote-Boot mini-HOWTO(6/7) 
发信站: BBS 水木清华站 (Sun Oct 18 20:54:17 1998) WWW-POST 
 
5. Remote-Boot Tools Reference Manual 
 
This section provides detailled informations on the use of the tools we  
developped at the CUI, University of Geneva for this 
remote-boot configuration. 
 
5.1 BpBatch, MrBatch and MrZip 
 
These three names stand for three variants of the same program, with the  
following characteristics:  
 
     BpBatch is a special program that can be started from the BootProm  
before the operating system is loaded. It is made of 
     two parts: bpbatch.P, the dynamic loader, and bpbatch.ovl, the program  
itself. BpBatch has full disk I/O 
     capabilities through our own implementation of FAT16, FAT32 and Ext2fs,  
as well as remote network I/O capabilities 
     through the BootProm TFTP API. BpBatch was compiled under DOS using  
Borland C 5.0 and Turbo Assembler 3.2.  
     MrBatch is the DOS/Linux version of BpBatch. All commands recognized by  
BpBatch are recognized by MrBatch 
     and vice versa. This is very usefull if you want to test your batch  
scripts from a DOS/Linux session. Under DOS, 
     MrBatch emulates remote I/O by OS-based file access if the bootprom is  
not available. Under Linux, the bootprom 
     cannot be seen anymore but MrBatch can emulate it using Linux IP  
support, or use OS-based file access. MrBatch was 
     compiled under Linux using GCC 2.7.2.1 and under DOS using Borland C 5.0  
and Turbo Assembler 3.2.  
     MrZip is an interpreter that recognizes a superset of MrBatch language,  
and that serves to build disk images. In MrZip, 
     the limited remote file I/O is replaced by a full-featured OS-based file  
access. MrZip does not include VESA support. 
     MrZip was compiled under Linux using GCC 2.7.2.1 and under DOS using  
Borland C 5.0 and Turbo Assembler 3.2.  
 
Command Line Arguments 
 
All programs accept the same syntax of arguments. MrBatch and MrZip take them  
from the command line, while BpBatch 
look for them in the BOOTP option 155 (decimal). Here is the syntax of the  
arguments:  
 
        [-x] [-l] [-b] [-v] [-w] [-i] [script-basename] 
 
where:  
 
     -x disable the use of extended memory  
     -l disable the use of ISO-latin-8859-1 as default character set  
     -b cancel the bootprom detection (which cause a floppy seek under DOS)  
     -v cancel the VESA detection (which cause a switch to full screen under  
Windows 95)  
     -w enable direct disk write access (disabled by default under DOS and  
Linux)  
     -i enable interactive mode even if a script name is provided  
 
The script-basename is optional. If provided, MrBatch and BpBatch load the  
file with the .bpb extension, and MrZip 
loads the file with the .mrz extension. If not provided, MrBatch and MrZip  
run in interactive mode while BpBatch loads the 
file with the same basename as the BOOTP Boot file and a .bpb extension. 
 
Syntax rules 
 
The following rules apply when BpBatch parses an input line.  
 
     Commands are parsed line by line. Lines are separated by CR and/or LF.  
     The maximal line length is currently 255 characters.  
     Keywords and variable names are case-insensitive.  
     " is interpreted as the special string delimiter  
     When ${variable} or $variable is encountred, it is substituted by the  
value of the variable, or by an empty string if the 
     variable is undefined. The substitution also occurs within a string.  
Moreover, the resulting substituted value must be 
     explicitely enclosed between double quotes if used as a string value  
(ie. one should merely speak of macro expansion than 
     of a variables).  
 
         \a is substituted by the audible-bell character (ASCII 7)  
         \b is substituted by the backspace character (ASCII 8)  
         \n is substituted by the newline character (ASCII 10)  
         \r is substituted by the return character (ASCII 13)  
         \t is substituted by the tabulation character (ASCII 9)  
         \v is substituted by the vertical-tab character (ASCII ...)  
         \nnn where n is a 3-digit octal number between 000 and 377 is  
substituted by the character with ascii code 
         specified  
         \X where X is any other character not listed above is substituted by  
X itself. In particular,  
              \" is substituted by a regular double-quote (not a  
string-delimiter)  
              \$ is substituted by a regular dollar sign (not variable  
substitution)  
              \\ is substituted by a regular backslash (not a special  
character)  
     The character "end of string" (ASCII code 0) CANNOT be used anywhere as  
it is used internally as end-of-string delimiter 
     The character "floating diaeresis" (ASCII code dec 249, hex F9, octal  
371) CANNOT be used in any string as it is used 
     internally as string delimiter in the input parsing routine.  
     The character "block space" (ASCII code dec 255, hex FF, octal 377)  
CANNOT be used in any variable value as it is used 
     internally as variable delimiter.  
 
Empty lines are ignored. Lines starting with a sharp (#) are treated as  
comments and are not interpreted. Lines starting with a 
column (:) are treated as labels and are not interpreted. 
 
String expressions 
 
     Strings are delimited by opening and closing double-quotes:  
 
             "Hello world" 
 
     To include double-quotes within a string, quote them using a backslash:  
 
 
             "I said: \"Hello world\"" 
 
     Strings can be postfixed with a few operators.  
         The character substitution operator:  
 
                 "Hello world"/o=u/      ==      "Hellu wurld" 
                 "198.76.54.32"/.= /     ==      "198 76 54 32" 
 
         The word selection operator (zero-based):  
 
                 "Hello world"{0}        ==      "Hello" 
                 "198 76 54 32"{1-3}     ==      "76 54 32" 
 
         The substring selection operator (zero-based):  
 
                 "Hello world"[4]        ==      "o" 
                 "Hello world"[4-7]      ==      "o wo" 
 
     Operators can be chained by postfixing one after the other. For  
informations about the string length and word count 
     operators, see under "Numerical expressions". 
 
Numerical expressions 
 
     Numerical expressions work on 32-bits integer numbers (from  
-2,147,483,646 to 2,147,483,647). Hexadecimal octal and 
     binary numbers are not understood. Whenever a numerical expression is  
expected, the following are recognized:  
         A positive or negative integer number  
         An expression in the form (expr1 op expr2) where op can be either +,  
-, * (multiply), / (divide) or % (modulo) and 
         expr is a numerical expression. Note that EACH operation MUST be  
enclosed between parenthesis :  
 
                 ((3 * 5)+2)             == 17 
 
         The string-length operator (@), followed by a string :  
 
                 @"Hello world"          == 11 
 
         The word-count operator (#) followed by a string :  
 
                 #"Hello world"          == 2 
 
Durations 
 
     A few commands expect durations as arguments. Durations are measured in  
seconds, with a precision of up to a tenth of 
     second:  
 
             Delay 3                 waits for 3 seconds 
             Delay 0.3               waits for 3/10 seconds 
 
Colors 
 
     Whenever a color is expected, you can either use the numeric value of  
the color or its symbolic name (case-insensitive). 
     The following colors are recognized  
 
             Black           0 
             Blue            1 
             Green           2 
             Cyan            3 
             Red             4 
             Magenta         5 
             Brown           6 
             LightGray       7 
             DarkGray        8 
             LightBlue       9 
             LightGreen     10 
             LightCyan      11 
             LightRed       12 
             LightMagenta   13 
             Yellow         14 
             White          15 
 
File References 
 
     File names are strings. They must therefore always be enclosed between  
double-quotes. File names are case-sensitive on 
     case-sensitive filesystems, case-insensitive on case-insensitive  
filesystems. Slash and backslash can be freely used one in 
     place of the other. Do not forget to double backslash since a single  
backslash is an escape character. 
 
     There are two kinds of file references:  
         Direct disk files  
         Foreign files  
 
     Direct disk files are referenced using the following notation:  
 
             "{disk:partition}/absolute/filename" 
 
     The disk number can be omitted and defaults to zero. For instance,  
"{:1}/usr/bin" points to /usr/bin assuming 
     there is such a directory on the first partition. Direct file I/O is  
solely based on our own file access routines (we do not use 
     the operating system). 
 
     There are two special partitions. Partition zero corresponds to the hard  
disk master boot record (MBR) and has a pseudo 
     file-system which let you access the boot code. Partition minus-one (-1)  
corresponds to the cache filesystem (see below). 
 
     Under BpBatch/MrBatch, foreign files correspond to remote files on the  
TFTP server when the BootProm is available:  
 
             "help.bpb"           is the file help.bpb in the /tftpboot  
directory 
             "gifs/MyImage.gif"   is a file in /tftpboot/gifs 
 
     Other TFTP servers can be referenced :  
 
             "198.76.54.32:help.bpb"  
 
     If the other server is behind a gateway :  
 
             "198.70.0.1/198.76.54.31:help.bpb" 
 
     One can also specify a specific port for the TFTP connection :  
 
             "198.76.54.32@89:getpasswd/smith" 
 
     There can be only one open remote file at a time. If the BootProm is not  
available, remote files are emulated using the 
     operating system file I/O, but the same restriction apply. 
 
     Under MrZip, foreign files correspond to files as seen by the operating  
system. There is no limitation, and foreign files can 
     be used wherever direct disk files can be. Foreign files are usually  
faster than direct disk files, because the operating 
     system has more buffers. Foreign files can refer to network files if  
supported by the operating system.  
 
             "C:\\autoexec.bat" 
             "C:/config.sys" 
             "/mnt/net/usr" 
 
The Cache Filesystem 
 
In order to reduce network load and to fasten the boot process, disk  
archives, linux kernels and possibly other files are cached on 
the hard disk. This disk cache is located at the end of the hard disk,  
between the last cylinder allocated in the partition table and 
the last physical cylinder of the disk (out of any allocated partition).  
There MUST be room between the last partition and the end 
of the disk if you want the cache filesystem to work. The cache filesystem  
MUST work if you want to restore a disk image. 
 
The disk cache is organised in a volatile, CRC-validated filesystem : Each  
directory entry and each 32 KB data block is validated 
by a 32-bits CRC. Whenever a directory entry or a data block unexpectedly  
changes, the file is automatically removed from the 
cache and downloaded again upon the next request. 
 
You can freely access the cache filesystem from within BpBatch, MrBatch and  
MrZip using direct disk access on the special 
partition "{:-1}". To see the content of the cache, just type :  
 
        logdir "{:-1}" 
 
If the cache ever gets corrupted and is not automatically cleaned (which  
should never occurs), you can either type :  
 
        clean -1 
 
(in interactive mode) or hold both shifts down when BpBatch access the cache  
for the first time. 
 
Special variables 
 
Some variable are initially set and/or have special meanings. Some of them  
exist within all programs, other are only available under 
MrZip and other are only available when a BOOTP/DHCP reply has been  
received. 
 
General variables 
 
         $Program is set to "BpBatch" within BpBatch, "MrBatch" within  
MrBatch and "MrZip" within MrZip  
         $Basename is set to the basename of the script on which the batch  
interpreter was started  
         $HelpFile is the name of the file loaded when Help is invoked.  
Default: "${Basename}.hlp"  
         $BOOTP-... are variables set from the BOOTP/DHCP reply (see the  
paragraph on BOOTP/DHCP variables for 
         more details)  
         $DHCP-... are variables set from the DHCP reply (see the paragraph  
on BOOTP/DHCP variables for more 
         details)  
         $Disks is set to the space-separated list of sizes for each disk.  
That means, #"$Disks" represent the number of 
         disks and "$Disks"{0} is the size of the first disk  
         $Keypressed is set to the next ready-to-read key available in the  
keyboard buffer (if available)  
         $LBA controls the use of LBA to access disks > 2Gb. Default: "ON"  
         $FDA controls the use of fast disk access (write accross cylinders).  
Default: "ON"  
         $VESA controls the use of VESA graphics. Default: "ON" if available  
 
         $VESA-Modes gives the list of all available VESA modes. The first  
entry of the list is the default mode, which is 
         used when no parameter is given to InitGraph. Note: if VESA="OFF",  
this variable is blank  
         $APM is set to "ON" if your computer supports Avanced Power  
Management. If $APM is "ON", you can use the 
         command PowerOff to turn your computer off. Default: depends on your  
hardware  
         $Trace controls the display of each command before execution. It  
also controls the display of file names when 
         creating new archives. Default: "OFF"  
         $AutoShowLog controls the automatic switch to the text log whenever  
the ESC key is pressed. Default: "ON"  
         $PauseLog controls the pause between each page of log when the log  
is visible. Default: "ON"  
         $CacheDisk is set to the disk used for caching remote files.  
Default: empty == 0, the first hard disk  
         $CacheAlways controls the automatic caching of remote files copied,  
patched or drawn as GIF. Default: "OFF"  
         $CacheNever prevents any file from being cached. Turn this variable  
on for diskless Linux boot. Default: "OFF"  
         $CacheReserve controls the preventive allocation of 25 percent more  
space than necessary in the cache 
         partition, to let the files grow. Turn this variable off if you are  
short of disk space. Default: "ON"  
         $ExtMemory controls the use of Extended Memory (or XMS). Once  
deactivated, extended memory cannot be 
         reactivated. Default: "ON" if available  
         $IsoLatin controls the interpretation of upper ASCII codes in  
included and patched files. The IsoLatin settings 
         are processed at the time the file is loaded, not at the time the  
file is processed. Default: "ON"  
         $ProgressX and $ProgressY controls the position of the progress  
window displayed in VESA graphics during 
         archive download and decompression. Default: 200 200  
         $EXT2-Backup controls the update of superblock backups in Linux ext2  
filesystem. Superblock backups take a 
         few seconds to do and are never used by current kernels (only by  
e2fsck).  
         $Security-Gateway controls the gateway-server used for user  
authentication. Our special authentication 
         gateway must be running on the target computer. Default:  
"${BOOTP-Server-IP}@89" (ie. the TFTP server, 
         on port 89)  
         $Security-Check contains the answer of the security server for the  
last check performed, either PASSED or 
         FAILED. Default: "FAILED"  
         $Security-Passwd, $HelpTopic, $OnExit, $OnKey-... are used  
internally.  
 
     See also BOOTP variables and MrZip-specific variables. 
 
MrZip-specific variables 
 
     The following variables are only used within MrZip.  
         $TempPath controls the directory where temporary files will be  
stored. Default: <empty> == current directory  
         $DumpFormat controls the way archives are dumped to the log when  
requested. It is a string containing  
              "h"/"H" to display the archive header  
              "b"/"B" to summarize/dump boot sectors  
              "s"/"S" to display a short/long allocation summary  
              "d"/"D" to display a short/long directory listing  
              "f"/"F" to summarize/dump files  
         Default: "hbD"  
         $FragmentSize controls the size of archive pieces. If you do not use  
InCom's extended TFTP server, you 
         should set this to "30 MB". Default: "87 MB"  
         $SourceArchive, $DestArchive, $Filter... are used internally.  
 
BOOTP variables 
 
     The following BOOTP-... and DHCP-... variables are recognized, as long  
as a BOOTP/DHCP reply has been received 
     (TCP/IP Bootprom must be reported as detected):  
 
             $BOOTP-Client-ID 
             $BOOTP-Your-IP 
             $BOOTP-Server-IP 
             $BOOTP-Gateway-IP 
             $BOOTP-Bootfile 
             $BOOTP-Server-Name 
             $BOOTP-Subnet-Mask 
             $BOOTP-Time-Offset 
             $BOOTP-Routers 
             $BOOTP-Time-Servers 
             $BOOTP-Name-Servers 
             $BOOTP-Domain-name-Servers 
             $BOOTP-BOOTP-Log-Servers 
             $BOOTP-Cookie-Servers 
             $BOOTP-Lpr-Servers 
             $BOOTP-Impress-Servers 
             $BOOTP-Resource-Location-Servers 
             $BOOTP-Host-Name 
             $BOOTP-Boot-Size 
             $BOOTP-Merit-Dump 
             $BOOTP-Domain-Name 
             $BOOTP-Swap-Servers 
             $BOOTP-Root-Path 
             $BOOTP-Extensions-Path 
             $BOOTP-IP-Forwarding 
             $BOOTP-Interface-MTU 
             $BOOTP-All-Subnets-Are-Local 
             $BOOTP-Broadcast-Address 
             $BOOTP-NIS-Domain 
             $BOOTP-NIS-Servers 
             $BOOTP-NTP-Servers 
             $BOOTP-Font-Servers 
             $BOOTP-X-Display-Manager 
             $DHCP-IP-Address-Lease-Time 
             $DHCP-Message-Type 
             $DHCP-Server-Identifier 
             $DHCP-Message 
             $DHCP-Renewal-Time 
             $DHCP-Rebinding-Time 
             $BOOTP-NIS+-Domain 
             $BOOTP-NIS+-Servers 
             $BOOTP-Server-Name 
             $BOOTP-Bootfile 
             $BOOTP-Mobile-IP-Agent 
             $BOOTP-SMTP-Servers 
             $BOOTP-POP3-Servers 
             $BOOTP-NNTP-Servers 
             $BOOTP-WWW-Servers 
             $BOOTP-Finger-Servers 
             $BOOTP-IRC-Servers 
             $BOOTP-StreetTalk-Servers 
             $BOOTP-STDA-Servers 
 
     Other BOOTP/DHCP parameters can be used under the name  
 
             $BOOTP-Option-n 
 
     where n is the decimal representation of the BOOTP option number. 
 
     Do not mix-up BOOTP-Gateway-IP, which is the gateway to use for TFTP and  
should be 0.0.0.0 if the TFTP server is 
     in the same subnet, and BOOTP-Routers, which contains the default IP  
gateway(s). The TCP/IP Bootprom sometimes 
     seems to set the value of BOOTP-Gateway-IP from the value in  
BOOTP-Routers, causing each TFTP ack packet to 
     be sent to the router first. To avoid such behaviour, if your TFTP  
server is in the same subnet as the client, force 
     BOOTP-Gateway-IP to 0.0.0.0 (thanks to Maciek Uhlig for having pointed  
out this problem). 
 
Monitoring commands 
 
This section lists commands for monitoring the system state. Optional  
arguments are listed between parenthesis (I would have 
prefered square brackets, but LaTeX do not like them at this place...)  
 
Interact 
 
     Show the log and turn to interactive mode until QUIT or EXIT is entered.  
Type HideLog before quitting if you want to 
     avoid disturbing log messages during batch execution. 
 
Help (topic) 
 
     Load the on-line help file (bpbatch.hlp) and display the description of  
the given topic. If no topic is provided, or if the 
     topic is unknown, display the help index. 
-- 
    白马带著她一步步的回到中原。白马已经老了,只能慢慢的走, 
但终是能回到中原的。江南有杨柳、桃花,有燕子、金鱼…… 
汉人中有的是英俊勇武的少年,倜傥潇洒的少年……但这个美 
丽的姑娘就像古高昌国人那样固执: 
 
    「那都是很好很好的,可是我偏不喜欢。」  
 
※ 来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: 202.99.18.67]  

BBS水木清华站∶精华区