415 lines · 8.4 KB · Text
RawDownload
.TH BOOT 8.SH NAMEboot \- connect to the root file server.SH SYNOPSIS.B /boot/boot[.B -fkm][.BI -u username][.IB method ! fs-addr][.I args].SH DESCRIPTION.I Bootis the first program run after a kernel has been loaded.It connects to the file server that will serve theroot, performs any authentication needed toconnect to that server, and.IR exec (2)'sthe.IR init (8)program.It is started by the kernel, never run directly by the user.  See.IR booting (8)for information about the process of loading the kernel (and.IR boot )into memory..PPOnce loaded, the kernel initializes its data structures and devices.It sets the two environment variables.B /env/cputypeand.B /env/terminalto describe the processor.It then binds a place-holder file server,.IR root (3),onto.B /and crafts an initial process whose sole function is to.IR exec (2).BR /boot/boot ,a binary which is compiled into.IR root (3)..PPThe command line passed dependson the information passed from boot ROMto kernel.Machines that boot directly from ROM (that is, most machines other than PCs)pass the boot line given to the ROM directly to.IR boot ..PPOn the PC, each line in the DOS file.B plan9.iniof the form.IB name = valueis passed to the boot program as an environmentvariable with the same name and value.The command line is.IP.B /386/9dos.IB method ! server.PP(The first argument is ignored by.IR boot .).I Bootmust determine the file.I serverto useand a.I methodwith which to connect to it.Typically this will name a file server on the network,or state that the root file system is on local disk and name the partition.The complete list of methods is given below..PP.I Bootmust also set a user name to be usedas the owner of devices and all consoleprocesses and an encryption key to be usedwhen challenged..I Bootwill prompt for these..PPMethod and address are prompted for first.The prompt lists all valid methods, with the default in brackets, for example:.IP.EXroot is from (tcp, local!#S/sdC0/fs)[tcp]:.EE.PPA newline picks the default.Other possible responses are.I methodor.IB method ! address\f1.To aid in automatic reboot, the default is automaticallytaken on CPU servers if nothing is typed within 15 seconds..PPThe other interactions depend on whether the systemis aterminal or a CPU server..SS TerminalThe terminal must have a.I usernameto set.If none is specified with the.B -uoption,.I bootwill prompt for one on the console:.IP.EXuser:.EE.PPThe user will also be prompted for a password tobe used as an encryption key on each.IR attach (5):.IP.EXpassword:.EE.PPWith most.I methods.I bootcan now connect to the file server.However, with the serial line.I methods.B 9600and.BR 19200 ,the actual mechanics of setting up the complete connectionare too varied to put into the boot program.Instead.I bootlets the user set up the connection.It prints a prompt on the console and then simulatesa dumb terminal between the user and the serial line:.IP.EXConnect to file system now, type ctrl-d when done.(Use the view or down arrow key to send a break).EE.PPThe user can now type at the modem todial the number.  What is typed depends onthe modem and is beyond this discussion..PPWhen the user types a control-D,.I bootstops simulating a terminal and starts the filesystem protocol over the serial line..PPOnce connected,.I bootmountsthe root file system before.B /and makes the connection available as.B #s/bootfor subsequent processes to.B mount(see.IR bind (2))..I Bootcompletes by.IR exec (2)'ing.B /$objtype/init.BR -t .If the.B -moption is given it is also passed as an option to.IR init .If the environment variable.B initis set (via.IR plan9.ini (8)),it is used as a command line to exec instead..PPIf the kernel has been built with the cache file system,.IR cfs (4),the local disk partition.BI /dev/sd XX /cache(where.B XXis a unit specifier)exists, and the root file system is from a remote server,then the kernel will insert a user level cacheprocess between the remote server and the local namespacethat caches all remote accesses on the local partition.The.B -fflag commands.B cfsto reformat the cache partition..SS CPU ServersThe user owning devices and console processes on CPU serversand that user's domain and encryption key areread from NVRAM on all machines except PC's.PC's keep the information in the disk partition.BI /dev/sd XX /nvram\f1.If a.B -koption is given or if no stored information is found.I bootwill prompt for all three items and store them..IP.EXpassword:authid: bootesauthdom: research.bell-labs.com.EE.PPThe key is used for mutual authentication of the server and its clients.The domain and id identify the owner of the key..PPOnce connected,.I bootbehaves as on the terminal except for.IR exec (2)'ing.B /$objtype/init.BR -c ..SS Booting MethodsThe methods available to any system depend on what wascompiled into the kernel.The complete list of booting methods are listed below..TP 8.BR tcpconnect via Ethernet using the TCP protocol.The.I argsare passed to.IR ipconfig (8)when configuring the IP stack.The.IR plan9.ini (8)variables.B fsand.B authoverride the file server and authentication server IP addressesobtained (if any) from DHCP during.IR ipconfig (8)..TP 8.B localconnect to the local file system.The first argument is a disk holding a file system..I Bootinspects the disk.If the disk is a.IR fossil (4)file system, it invokes.B /boot/fossilto serve it.If the.B ventienvironment variable (really,.IR plan9.ini (8)variable) is set,.I bootfirst arranges for fossil to be able tocontact the named.IR venti (8)server.The variable's value can take the following forms:.RS.TP.B /dev/sdC0/arenasthe file should be a venti partition with a configurationstored on it using.I venti/conf(see.IR venti-fmt (8))..I Bootwill start a loopback IP interface on 127.0.0.1and start.I ventiannouncing on.B tcp!127.1!17034for venti serviceand.B tcp!127.1!8000for web service,using the configuration stored in that partition..TP.B /dev/sdC0/arenas tcp!*!17034same as the last but specify an alternate venti service address.In this example, using.B *will announce on all available IP interfaces (even ones configured later)rather than just the loopback device.The loopback interface is still configured..TP.B /dev/sdC0/arenas tcp!*!17034 tcp!*!80same as the last but specify alternate venti service and web addresses.The loopback interface is still configured..TP.B tcp!135.104.9.2!17034 \fR[ \fIargs\fR ]the network address of a venti server running on a separate machine..I Bootwill configure the IP stack by passing.IR args ,if any, to.IR ipconfig (8)..RE.IP.I Fossilis invoked as.RS.IP.EX/boot/fossil -f \fIpartition\fP -c 'srv -A fboot' -c 'srv -p fscons'.EE.RE.IPand.I bootthen renames.L /srv/fbootto.LR /srv/boot ,so.B fossil.confshould not use the.B srvcommand to create.LR fboot ,.LR boot ,nor.LR fscons ..IPIf the disk is not a.IR fossil (4)partition,.I bootinvokes.BR /boot/kfs .A variety of programs, like.I 9660srvand.IR dossrv (4)masquerade as.I kfsto allow booting from alternate media formats,so as long as the disk is not a.I fossildisk, no check is made that the disk is in facta.I kfsdisk.The args are passed to.IR kfs (4)..IPFor the.B tcpmethod,the address must be a numeric IP address.If no address is specified,a file server address will be found from anothersystem on the network using the BOOTP protocol andthe Plan 9 vendor-specific fields..SH EXAMPLESOn PCs, the default arguments to boot are constructed usingthe.B bootargsvariable in.IR plan9.ini (8)..PPStart.IR kfs (4)with extra disk buffers:.IP.EXbootargs=local!#S/sdC0/fs -B 4096.EE.LPUse an IP stack on an alternate ethernet interfacewith a static address and fixed file server and authenticationserver addresses..IP.EXfs=192.168.0.2auth=192.168.0.3bootargs=tcp -g 192.168.0.1 ether /net/ether1 \e    192.168.0.50 255.255.255.0.EE.LP(The.B bootargsline is split only for presentation; it is one line in the file.).SH FILES.B #s/boot.br.B #//boot/boot.SH SOURCE.B /sys/src/9/boot.SH "SEE ALSO".IR root (3),.IR factotum (4),.IR dhcpd (8),.IR init (8).SH BUGSThe use of.B bootargsin general is odd.The configuration specificationfor fossil and venti serversis particularly odd, but it doescover the common cases well.