Browse Source

Add files via upload

master
kenmartin-unix 4 years ago
committed by GitHub
parent
commit
33358db97c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 533 additions and 0 deletions
  1. +397
    -0
      Plan_9_Ini.rtf
  2. +136
    -0
      Plan_9_Prep.rtf

+ 397
- 0
Plan_9_Ini.rtf View File

@@ -0,0 +1,397 @@
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}{\f1\fnil Calibri;}}
{\*\generator Riched20 10.0.18362}\viewkind4\uc1
\pard\sa200\sl276\slmult1\f0\fs22\lang9\par
\par
NAME\par
\tab plan9.ini \f1\endash configuration file primarily for PCs\par
\par
SYNOPSIS\par
\tab none\par
\par
DESCRIPTION\par
\tab When booting Plan 9 on a PC, the bootstrap programs described in 9boot(8) first read, via TFTP or a FAT filesystem on the boot disk, a file containing configuration information. This file, /cfg/pxe/hex\endash digits (TFTP; see 9boot(8)) or plan9.ini (FAT), looks like a shell script containing lines of the form\par
\tab name=value\par
\par
each of which defines a kernel or device parameter.\par
\par
Blank lines and Carriage Returns (\\r) are ignored. # comments are ignored, but are only recognised if # appears at the start of a line.\par
\par
For devices, the generic format of value is\par
\tab type=TYPE [port=N] [irq=N] [mem=N] [size=N] [dma=N] [ea=N]\par
\par
specifying the controller type, the base I/O port of the interface, its interrupt level, the physical starting address of any mapped memory, the length in bytes of that memory, the DMA channel, and for Ethernets an override of the physical network address. Not all elements are relevant to all devices; the relevant values and their defaults are defined below in the description of each device.\par
\par
The file is used by the bootstrap programs and the kernel to configure the hardware available, although nowadays the kernel can usually detect the attached hardware by itself. The information it contains is also passed to the boot process, and subsequently other programs, as environment variables (see boot(8)). However, values whose names begin with an asterisk * are used by the kernel and are stored in #ec rather than #e.\par
\par
The following sections describe how variables are used.\par
\par
ETHERNET\par
\par
etherX=value\par
This defines an Ethernet interface. X, a unique monotonically increasing number beginning at 0, identifies an Ethernet card to be probed at system boot. Probing stops when a card is found or there is no line for etherX+1. After probing as directed by the etherX lines, any remaining Ethernet cards that can be automatically detected are added. Almost all cards can be automatically detected. For debugging purposes, automatic probing can be disabled by specifying the line *noetherprobe=.\par
\par
Many cards are software configurable and do not require all options. Unspecified options default to the factory defaults.\par
\par
Known TYPEs are\par
igbe The Intel 8254X Gigabit Ethernet controllers, as found on the Intel PRO/1000 adapters for copper (not fiber). Completely configurable.\par
igbepcie\par
\tab\par
\tab The Intel 8256[36], 8257[12], and 82573[ev] Gigabit Ethernet PCI\endash Express controllers. Completely configurable.\par
rtl8169The Realtek 8169 Gigabit Ethernet controller. Completely configurable.\par
ga620 Netgear GA620 and GA620T Gigabit Ethernet cards, and other cards using the Alteon Acenic chip such as the Alteon Acenic fiber and copper cards, the DEC DEGPA\endash SA and the SGI Acenic. Completely configurable.\par
dp83820National Semiconductor DP83820\endash based Gigabit Ethernet adapters, notably the D\endash Link DGE\endash 500T. Completely configurable.\par
vgbe The VIA Velocity Gigabit Ethernet controller. Known to drive the VIA8237 (ABIT AV8), but at 100Mb/s full\endash duplex only.\par
m10g The Myricom 10\endash Gigabit Ethernet 10G\endash PCIE\endash 8A controller. Completely configurable.\par
i82598 The Intel 8259[89] 10\endash Gigabit Ethernet PCI\endash Express controllers. Completely configurable.\par
i82557 Cards using the Intel 8255[789] Fast Ethernet PCI Bus LAN Controller such as the Intel EtherExpress PRO/100B. Completely configurable, no options need be given. If you need to force the media, specify one of the options (no value) 10BASE\endash T, 10BASE\endash 2, 10BASE\endash 5, 100BASE\endash TX, 10BASE\endash TFD,\par
\tab\par
\tab 100BASE\endash TXFD, 100BASE\endash T4, 100BASE\endash FX, or 100BASE\endash FXFD. Completely configurable.\par
2114x Cards using the Digital Equipment (now Intel) 2114x PCI Fast Ethernet Adapter Controller, for example the Netgear FA310. Completely configurable, no options need be given. Media can be specified the same was as for the i82557. Some cards using the PNIC and PNIC2 near\endash clone chips may also work. 83815 National Semiconductor DP83815\endash based adapters, notably the Netgear FA311, Netgear FA312, and various SiS built\endash in controllers such as the SiS900. On the SiS controllers, the Ethernet address is not detected properly; specify it with an ea= attribute. Completely configurable. rtl8139The Realtek 8139 Fast Ethernet controller. Completely configurable.\par
vt6102 The VIA VT6102 Fast Ethernet Controller (Rhine II).\par
vt6105mThe VIA VT6105M Fast Ethernet Controller (Rhine III).\par
smc91cxx\par
\tab\par
\tab SMC 91cXX chip\endash based PCMCIA adapters, notably the SMC EtherEZ card.\par
elnk3 The 3COM Etherlink III series of cards including the 5x9, 59x, and 905 and 905B. Completely configurable, no options need be given. The media may be specified by setting media= to the value 10BaseT, 10Base2, 100BaseTX, 100BaseFX, aui, and mii. If you need to force full duplex, because\par
\tab\par
\tab for example the Ethernet switch does not negotiate correctly, just name the word (no value) fullduplex or 100BASE\endash TXFD. Similarly, to force 100Mbit operation, specify force100. Port 0x110 is used for the little ISA configuration dance.\par
3c589 The 3COM 3C589 series PCMCIA cards, including the 3C562 and the 589E. There is no support for the modem on the 3C562. Completely configurable, no options need be given. Defaults are\par
\tab\par
\tab port=0x240 irq=10\par
The media may be specified as media=10BaseT or media=10Base2.\par
ec2t The Linksys Combo PCMCIA EthernetCard (EC2T), EtherFast 10/100 PCMCIA cards (PCMPC100) and integrated controllers (PCM100), the Netgear FA410TX 10/100 PCMCIA card and the Accton EtherPair\endash PCMCIA (EN2216). Completely configurable, no options need be given. Defaults are\par
\tab\par
\tab port=0x300 irq=9\par
These cards are NE2000 clones. Other NE2000 compatible PCMCIA cards may be tried with the option\par
id=string\par
where string is a unique identifier string contained in the attribute memory of the card (see pcmcia(8)); unlike most options in plan9.ini, this string is case\endash sensitive. The option dummyrr=[01] can be used to turn off (0) or on (1) a dummy remote read in the driver in such cases, depending on how NE2000 compatible they are.\par
ne2000 Not software configurable iff ISA; PCI clones or supersets are software configurable; includes the Realtek 8029 clone used by Parallels. 16\endash bit card. Defaults are\par
\tab\par
\tab port=0x300 irq=2 mem=0x04000 size=0x4000\par
The option (no value) nodummyrr is needed on some (near) clones to turn off a dummy remote read in the driver.\par
amd79c970\par
\tab\par
\tab The AMD PCnet PCI Ethernet Adapter (AM79C970). (This is the Ethernet adapter used by VMware.) Completely configurable, no options need be given.\par
wd8003 Includes WD8013 and SMC Elite and Elite Ultra cards. There are varying degrees of software configurability. Cards may be in either 8\endash bit or 16\endash bit slots. Defaults are\par
\tab\par
\tab port=0x280 irq=3 mem=0xD0000 size=0x2000\par
BUG: On many machines only the 16 bit card works.\par
sink A /dev/null for Ethernet packets -- the interface discards sent packets and never receives any. This is used to provide a test bed for some experimental Ethernet bridging software.\par
wavelanLucent Wavelan (Orinoco) IEEE 802.11b and compatible PCMCIA cards. Compatible cards include the Dell TrueMobile 1150 and the Linksys Instant Wireless Network PC Card. Port and IRQ defaults are 0x180 and 3 respectively.\par
\tab\par
\tab These cards take a number of unique options to aid in identifying the card correctly on the 802.11b network. The network may be ad hoc or managed (i.e. use an access point):\par
mode=[adhoc, managed]\par
and defaults to managed. The 802.11b network to attach to (managed mode) or identify as (ad hoc mode), is specified by\par
essid=string\par
and defaults to a null string. The card station name is given by\par
station=string\par
and defaults to Plan 9 STA. The channel to use is given by\par
channel=number\par
where number lies in the range 1 to 16 inclusive; the channel is normally negotiated automatically.\par
If the card is capable of encryption, the following options may be used:\par
crypt=[off, on]\par
and defaults to on.\par
keyN=string\par
sets the encryption key N (where N is in the range 1 to 4 inclusive) to string; this will also set the transmit key to N (see below). There are two formats for string which depend on the length of the string. If it is exactly 5 or 13 characters long it is assumed to be an alphanumeric key; if it is exactly 10 or 26 characters long the key is assumed to be in hex format (without a leading 0x). The lengths are checked, as is the format of a hex key.\par
txkey=number\par
sets the transmit key to use to be number in the range 1 to 4 inclusive. If it is desired to exclude or include unencrypted packets\par
clear=[off, on]\par
configures reception and defaults to inclusion.\par
The defaults are intended to match the common case of a managed network with encryption and a typical entry would only require, for example\par
essid=left\endash armpit key1=afish key2=calledraawaru\par
if the port and IRQ defaults are used. These options may be set after boot by writing to the device's ctl file using a space as the separator between option and value, e.g.\par
echo 'key2 1d8f65c9a52d83c8e4b43f94af' >/net/ether0/0/ctl\par
Card\endash specific power management may be enabled/disabled by\par
pm=[on, off]\par
wavelanpci\par
\tab\par
\tab PCI Ethernet adapters that use the same Wavelan programming interface. Currently the only tested cards are those based on the Intersil Prism 2.5 chipset.\par
\par
DISKS, TAPES\par
(S)ATA controllers are autodetected.\par
\par
usbX=type=uhci\par
\par
usbX=type=ohci\par
\par
usbX=type=ehci\par
This specifies the settings for a USB UHCI, OHCI or EHCI controller. Like the Ethernet controllers, USB controllers are autodetected after scanning for the ones listed in plan9.ini. Thus, most systems will not need a usbX line. Also like the Ethernet controllers, USB autoprobing can be disabled by specifying the line *nousbprobe=.\par
\par
scsiX=value\par
This defines a SCSI interface which cannot be automatically detected by the kernel.\par
\par
Known TYPEs are\par
aha1542\par
\tab Adaptec 154x series of controllers (and clones). Almost completely configurable, only the\par
\tab port=0x300\par
option need be given.\par
\par
NCR/Symbios/LSI\endash Logic 53c8xx\endash based adapters and Mylex MultiMaster (Buslogic BT\endash *) adapters are automatically detected and need no entries.\par
\par
By default, the NCR 53c8xx driver searches for up to 32 controllers. This can be changed by setting the variable *maxsd53c8xx.\par
\par
By default the Mylex driver resets SCSI cards by using both the hard reset and SCSI bus reset flags in the driver interface. If a variable *noscsireset is defined, the SCSI bus reset flag is omitted.\par
\par
aoeif=list\par
This specifies a space\endash separated list of Ethernet interfaces to be bound at boot to the ATA\endash over\endash Ethernet driver, aoe(3). For example, aoeif=ether0 ether1. Only interfaces on this list will initially be accessible via AoE.\par
\par
aoedev=e!#\f0\'e6/aoe/shelf.slot\par
This specifies an ATA\f1\endash over\endash Ethernet device accessible via the interfaces named in aoeif on AoE shelf and slot to use as a root device for bootstrapping.\par
\par
AUDIO\par
\par
audioX=value\par
This defines a pre\endash USB sound interface.\par
\par
Known types are\par
sb16 Sound Blaster 16.\par
ess1688 A Sound Blaster clone.\par
\par
The DMA channel may be any of 5, 6, or 7. The defaults are\par
\tab port=0x220 irq=7 dma=5\par
\par
Uarts\par
Plan 9 automatically configures COM1 and COM2, if found, as eia0 (port 0x3F8, IRQ4) and eia1 (port 0x2F8, IRQ3) respectively. These devices can be disabled by adding a line:\par
\tab eiaX=disabled\par
\par
This is typically done in order to reuse the IRQ for another device.\par
\par
Plan 9 used to support various serial concentrators, including the TTC 8 serial line card and various models in the Star Gate Avanstar series of intelligent serial boards. These are no longer supported; the much simpler Perle PCI\endash Fast4, PCI\endash Fast8, and PCI\endash Fast16 controllers have taken their places. These latter cards are automatically detected and need no configuration lines.\par
\par
The line serial=type=com can be used to specify settings for a PCMCIA modem.\par
\par
mouseport=value\par
This specifies where the mouse is attached. Value can be\par
ps2 the PS2 mouse/keyboard port. The BIOS setup procedure should be used to configure the machine appropriately.\par
ps2intellimouse\par
\tab an Intellimouse on the PS2 port.\par
0 for COM1\par
1 for COM2\par
\par
modemport=value\par
Picks the UART line to call out on. This is used when connecting to a file server over an async line. Value is the number of the port.\par
\par
console=value params\par
This is used to specify the console device. The default value is cga; a number 0 or 1 specifies COM1 or COM2 respectively. A serial console is initially configured with the uart(3) configuration string b9600 l8 pn s1, specifying 9600 baud, 8 bit bytes, no parity, and one stop bit. If params is given, it will be used to further configure the uart. Notice that there is no = sign in the params syntax. For example,\par
\tab console=0 b19200 po\par
\par
would use COM1 at 19,200 baud with odd parity.\par
\par
PC CARD\par
\par
pccard0=disabled\par
Disable probing for and automatic configuration of PC card controllers.\par
\par
pcmciaX=type=XXX irq=irq\par
If the default IRQ for the PCMCIA is correct, this entry can be omitted. The value of type is ignored.\par
\par
pcmcia0=disabled\par
Disable probing for and automatic configuration of PCMCIA controllers.\par
\par
NVRAM\par
\par
nvram=file\par
\par
nvrlen=\par
\par
length\par
\par
nvroff=\par
\par
offset\par
This is used to specify an nvram device and optionally the length of the ram and read/write offset to use. These values are consulted by readnvram (see authsrv(2)). The most common use of the nvram is to hold a secstore(1) password for use by factotum(4).\par
\par
nvr=value\par
This is used by the WORM file server kernel to locate a file holding information to configure the file system. The file cannot live on a SCSI disk. The default is fd!0!plan9.nvr (sic), unless bootfile is set, in which case it is plan9.nvr on the same disk as bootfile. The syntax is either fd!unit!name or hd!unit!name where unit is the numeric unit id. This variant syntax is a vestige of the file server kernel's origins.\par
\par
BOOTING\par
\par
bootfile=value\par
This is used to direct the actions of the bootstrap programs by naming the device and file from which to load the kernel.\par
\par
rootdir=dir\par
\par
rootspec=spec\par
These are used by the bootstrap programs to identify the directory dir to make the root directory for the kernel, and the file system specifier spec (see mount in bind(2)) on which it can be found. These are usually used to test variant file systems for distributions, etc.\par
\par
bootargs=args\par
The value of this variable is passed to boot(8) by the kernel as the name of the root file system. It is typically used to specify additional arguments to pass to kfs(4) or ipconfig(8). For example, if the system is to run from a local kfs(4) partition, the definition might read bootargs=local!#S/sdC0/fs. See boot(8) for more.\par
\par
nobootprompt=root\par
Suppress the root from prompt and use root as the answer instead.\par
\par
user=user\par
Suppress the user prompt and use user as the answer instead.\par
\par
debugfactotum=\par
Causes boot(8) to start factotum with the \endash p option, so that it can be debugged.\par
\par
factotumopts=options\par
Causes boot(8) to start factotum with the given options, which must be a single word (i.e., contain no whitespace).\par
\par
venti=value\par
When booting from a local fossil server backed by a local or remote venti server, this variable specifies how to establish the connection to the venti server. See boot(8) for more.\par
\par
cfs=partition\par
This names the file holding the disk partition for the cache file system, cfs(4). Extending the bootargs example, one would write cfs=#S/sdC0/cache.\par
\par
bootdisk=value\par
This deprecated variable was used to specify the disk used by the cache file system and other disk\endash resident services. It is superseded by bootargs and cfs.\par
\par
partition=value\par
This defines the partition table 9load(8) will examine to find disk partitioning information. By default, a partition table in a Plan 9 partition is consulted; if no such table is found, an old\endash Plan 9 partition table on the next\endash to\endash last or last sector of the disk is consulted. A value of new consults only the first table, old only the second.\par
\par
readparts=\par
Causes boot(8) to look for MBR and Plan 9 partition tables on all sd(3) disks, even before factotum is started, so NVRAM, for example, may be found. On PCs, 9load (but not 9boot) normally does this and passes the partitions found in #ec/sdCnpart.\par
\par
fs=a.b.c.d\par
\par
auth=a.b.c.d\par
These specify the IP address of the file and authentication server to use when mounting a network\endash provided root file system. They are used only if the addresses cannot be determined via DHCP.\par
\par
PROCESSOR\par
\par
*norealmode=\par
The PC kernel switches the processor to 16\endash bit real mode to run BIOS interrupts, for example to find the memory map or to enable VESA. This variable disables such switches.\par
\par
*noe820scan=\par
When available, the PC kernel uses the BIOS E820 memory map to size memory. This variable disables the scan.\par
\par
*maxmem=address\par
This defines the maximum physical address that the system will scan when sizing memory. By default the PC operating system will scan up to 3.75 gigabytes (0xF0000000, the base of kernel virtual address space), but setting *maxmem will limit the scan. *maxmem must be less than 3.75 gigabytes. This variable is not consulted if using the E820 memory map.\par
\par
*kernelpercent=percent\par
This defines the percentage of available memory reserved for the kernel allocation pool. The remainder is left for user processes. The default percent is 30 on CPU servers, 60 on terminals with less than 16MB of memory, and 40 on terminals with memories of 16MB or more. Terminals use more kernel memory because draw(3) maintains its graphic images in kernel memory. This deprecated option is rarely necessary in newer kernels.\par
\par
*nomce=value\par
If machine check exceptions are supported by the processor, then they are enabled by default. Setting this variable to 1 causes them to be disabled even when available.\par
\par
*nomp=\par
A multiprocessor machine will enable all processors by default. Setting *nomp restricts the kernel to starting only one processor and using the traditional interrupt controller.\par
\par
*ncpu=cpus\par
Setting *ncpu restricts the kernel to starting at most cpus processors.\par
\par
*pcimaxbno=bno\par
Limits the maximum bus number probed on a PCI bus (default 7). For example, a bno of 1 should suffice on a 'standard' motherboard with an AGP slot. This, and *pcimaxdno below are rarely used and only on troublesome or suspect hardware.\par
\par
*pcimaxdno=dno\par
Limits the maximum device number probed on a PCI bus (default 31).\par
\par
*nopcirouting=\par
Disable pci routing during boot. May solve interrupt routing problems on certain machines.\par
\par
*nodumpstack=\par
Disable printing a stack dump on panic. Useful if there is only a limited cga screen available, otherwise the textual information about the panic may scroll off.\par
\par
ioexclude=range\par
Specifies a list of ranges of I/O ports to exclude from use by drivers. Ranges are inclusive on both ends and separated by commas. For example:\par
\tab ioexclude=0x330\endash 0x337,0x430\endash 0x43F\par
\par
umbexclude=\par
\par
range\par
Specifies a list of ranges of UMB to exclude from use by drivers. Ranges are inclusive on both ends and separated by commas. For example:\par
\tab umbexclude=0xD1800\endash 0xD3FFF\par
\par
apm0=\par
This enables the ``advanced power management'' interface as described in apm(3) and apm(8). The main feature of the interface is the ability to watch battery life (see stats(8)). It is not on by default because it causes problems on some laptops.\par
\par
VIDEO\par
\par
monitor=monitor\par
\par
vgasize=xxyxd\par
These are used not by the kernel but by termrc (see cpurc(8)) when starting vga(8).\par
\par
*dpms=value\par
This is used to specify the screen blanking behavior of the MGA4xx video driver. Values are standby, suspend, and off. The first two specify differing levels of power saving; the third turns the monitor off completely.\par
\par
Multiple Configurations\par
\par
A plan9.ini file may contain multiple configurations, each within a block beginning with a line\par
\tab [tag]\par
A special block with the tag menu gives a list of blocks from which the user may interactively select the contents of plan9.ini. There may also be multiple blocks with the tag common which will be included in all selections; if any lines appear in plan9.ini before the first block, they are treated as a common block.\par
\par
Within the menu block the following configuration lines are allowed:\par
\par
menuitem=tag[, description]\par
The block identified by tag will appear in the presented menu. The menu entry will consist of the tag unless the optional description is given.\par
\par
menudefault=tag[, timeout]\par
Identifies a default block to be given in the menu selection prompt. If the optional timeout is given (in seconds), the default block will be selected if there is no user input within the timeout period.\par
\par
menuconsole=value[, baud]\par
Selects a serial console upon which to present the menu as no console or baud configuration information will have been processed yet (the plan9.ini contents are still to be decided...).\par
\par
In response to the menu being printed, the user is prompted to select a menu item from the list. If the numeric response is followed by a p, the selected configuration is printed and the menu presented again.\par
\par
The line\par
\tab menuitem=tag\par
is prefixed to the selected configuration as an aid to user\endash level initialization scripts.\par
\par
EXAMPLES\par
\par
\tab A representative plan9.ini:\par
\tab % cat /n/c:/plan9.ini\par
ether0=type=3C509\par
mouseport=ps2\par
modemport=1\par
serial0=type=generic port=0x3E8 irq=5\par
monitor=445x\par
vgasize=1600x1200x8\par
%\par
\par
Minimum CONFIG.SYS and AUTOEXEC.BAT files to use COM2 as a console:\par
\tab % cat /n/c:/config.sys\par
SHELL=COMMAND.COM COM2 /P\par
% cat /n/c:/autoexec.bat\par
@ECHO OFF\par
PROMPT $p$g\par
PATH C:\\DOS;C:\\BIN\par
mode com2:96,n,8,1,p\par
SET TEMP=C:\\TMP\par
%\par
\par
Simple plan9.ini with multiple configurations:\par
\tab [menu]\par
menuitem=vga, Plan 9 with VGA\par
menuitem=novga, Plan 9 no automatic VGA\par
menudefault=vga\par
[vga]\par
monitor=multisync135\par
vgasize=1024x768x8\par
[novga]\par
[common]\par
ether0=type=i82557\par
audio0=type=sb16 port=0x220 irq=5 dma=1\par
\par
With this, the following menu will be presented on boot:\par
\tab Plan 9 Startup Menu:\par
====================\par
\tab 1. Plan 9 with VGA\par
2. Plan 9 no automatic VGA\par
Selection[default==1]:\par
\par
Selecting item 1 generates the following plan9.ini to be used by the remainder of the bootstrap process:\par
\tab menuitem=vga\par
monitor=multisync135\par
vgasize=1024x768x8\par
ether0=type=i82557\par
audio0=type=sb16 port=0x220 irq=5 dma=1\par
\par
and selecting item 2:\par
\tab menuitem=novga\par
ether0=type=i82557\par
audio0=type=sb16 port=0x220 irq=5 dma=1\par
\par
SEE ALSO\par
\tab 9boot(8), booting(8), boot(8)\par
\par
BUGS\par
\tab Being able to set the console device to other than a display is marginally useful on file servers; MS\endash DOS and the programs which run under it are so tightly bound to the display that it is necessary to have a display if any setup or reconfiguration programs need to be run. Also, the delay before any messages appear at boot time is disconcerting, as any error messages from the BIOS are lost.\par
\par
This idea is at best an interesting experiment that needs another iteration.\par
Copyright \f0\'a9 2016 Alcatel-Lucent. All rights reserved. \par
}

+ 136
- 0
Plan_9_Prep.rtf View File

@@ -0,0 +1,136 @@
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}{\f1\fnil Calibri;}}
{\*\generator Riched20 10.0.18362}\viewkind4\uc1
\pard\sa200\sl276\slmult1\f0\fs22\lang9\par
NAME\par
\tab prep, fdisk, format, mbr \f1\endash prepare disks, floppies and flashes\par
\par
SYNOPSIS\par
\tab disk/prep [ \endash bcfnprw ] [ \endash a name ]... [ \endash s sectorsize ] plan9partition\par
\par
disk/fdisk [ \endash abfprw ] [ \endash s sectorsize ] disk\par
\par
disk/format [ \endash dfvx ] [ \endash b bootblock ] [ \endash c csize ] [ \endash l label ] [ \endash r nresrv ] [ \endash t type ] disk [ file... ]\par
\par
disk/mbr [ \endash 9 ] [ \endash m mbrfile ] disk\par
\par
DESCRIPTION\par
\tab A partition table is stored on a non\endash floppy disk to specify the division of the physical disk into a set of logical units. On PCs, the partition table is stored at the end of the master boot record of the disk. Partitions of type 0x39 are Plan 9 partitions. The names of PC partitions are chosen by convention from the type: dos, plan9, etc. Second and subsequent partitions of the same type on a given disk are given unique names by appending a number (or a period and a number if the name already ends in a number).\par
\par
Plan 9 partitions (and Plan 9 disks on non\endash PCs) are themselves divided, using a textual partition table, called the Plan 9 partition table, in the second sector of the partition (the first is left for architecture\endash specific boot data, such as PC boot blocks). The table is a sequence of lines of the format part name start end, where start and end name the starting and ending sector. Sector 0 is the first sector of the Plan 9 partition or disk, regardless of its position in a larger disk. Partition extents do not contain the ending sector, so a partition from 0 to 5 and a partition from 5 to 10 do not overlap.\par
\par
The Plan 9 partition often contains a number of conventionally named subpartitions. They include:\par
9fat A small FAT file system used to hold configuration information (such as plan9.ini and plan9.nvr) and kernels. This typically begins in the first sector of the partition, and contains the partition table as a ``reserved'' sector. See the discussion of the \endash r option to format. arenas A venti(8) arenas partition.\par
bloom A venti(8) bloom\endash filter partition.\par
cache A cfs(4) file system cache.\par
fossil A fossil(4) file system.\par
fs A kfs(4) file system.\par
fscfg A few\endash sector partition used to store an fs(3) configuration.\par
isect A venti(8) index section.\par
nvram A one\endash sector partition used to simulate non\endash volatile RAM on PCs.\par
other A non\endash archived fossil(4) file system.\par
swap A swap(8) swap partition.\par
\par
fdisk and prep\par
Fdisk edits the PC partition table and is usually invoked with a disk like /dev/sdC0/data as its argument, while prep edits the Plan 9 partition table and is usually invoked with a disk partition like /dev/sdC0/plan9 as its argument. Fdisk works in units of disk ``cylinders'': the cylinder size in bytes is printed when fdisk starts. Prep works in units of disk sectors, which are almost always 512 bytes. Fdisk and prep share most of their options:\par
\endash a Automatically partition the disk. Fdisk will create a Plan 9 partition in the largest unused area on the disk, doing nothing if a Plan 9 partition already exists. If no other partition on the disk is marked active (i.e. marked as the boot partition), fdisk will mark the new partition active. Prep's \endash a flag takes the name of\par
\tab a partition to create. (See the list above for partition names.) It can be repeated to specify a list of partitions to create. If the disk is currently unpartitioned, prep will create the named partitions on the disk, attempting to use the entire disk in a sensible manner. The partition names must be from the list given above.\par
\endash\par
b Start with a blank disk, ignoring any extant partition table.\par
\endash p Print a sequence of commands that when sent to the disk device's ctl file will bring the partition table information kept by the sd(3) driver up to date. Then exit. Prep will check to see if it is being called with a disk partition (rather than an entire disk) as its argument; if so, it will translate the printed sectors by\par
\tab the partition's offset within the disk. Since fdisk operates on a table of unnamed partitions, it assigns names based on the partition type (e.g., plan9, dos, ntfs, linux, linuxswap) and resolves collisions by appending a numbered suffix. (e.g., dos, dos.1, dos.2).\par
\endash\par
r In the absence of the \endash p and \endash w flags, prep and fdisk enter an interactive partition editor; the \endash r flag runs the editor in read\endash only mode.\par
\endash s sectorsize\par
\tab Specify the disk's sector size. In the absence of this flag, prep and fdisk look for a disk ctl file and read it to find the disk's sector size. If the ctl file cannot be found, a message is printed and a sector size of 512 bytes is assumed.\par
\endash\par
w Write the partition table to the disk and exit. This is useful when used in conjunction with \endash a or \endash b.\par
\par
If neither the \endash p flag nor the \endash w flag is given, prep and fdisk enter an interactive partition editor that operates on named partitions. The PC partition table distinguishes between primary partitions, which can be listed in the boot sector at the beginning of the disk, and secondary (or extended) partitions, arbitrarily many of which may be chained together in place of a primary partition. Primary partitions are named pn, secondary partitions sn. The number of primary partitions plus number of contiguous chains of secondary partitions cannot exceed four.\par
\par
The commands are as follows. In the descriptions, read ``sector'' as ``cylinder'' when using fdisk.\par
a name [ start [ end ] ]\par
\tab\par
\tab Create a partition named name starting at sector offset start and ending at offset end. The new partition will not be created if it overlaps an extant partition. If start or end are omitted, prep and fdisk will prompt for them. In fdisk, the newly created partition has type ``PLAN9;'' to set a different type, use the t command (q.v.). Start and end may be expressions using the operators +, \endash , *, and /, numeric constants, and the pseudovariables . and $. At the start of the program, . is set to zero; each time a partition is created, it is set to the end sector of the new partition. It can also be explicitly set using the . command. When evaluating start, $ is set to one past the last disk sector. When evaluating end, $ is set to the maximum value that end can take on without running off the disk or into another partition. Numeric constants followed by k, m, g, or t (or upper\endash case equivalents) are scaled to the respective size in kilo\endash , mega\endash , giga\endash , or tera\endash bytes. Finally, the expression n% evaluates to (nxdisksize)/100. As examples, a . .+20% creates a new partition starting at . that takes up a fifth of the disk, a . .+21G creates a new partition starting at . that takes up 21 gigabytes (21x230 bytes), and a 1000 $ creates a new partition starting at sector 1000 and extending as far as possible.\par
. newdotSet the value of the variable . to newdot, which is an arithmetic expression as described in the discussion of the a command.\par
d name Delete the named partition.\par
h Print a help message listing command synopses.\par
p Print the disk partition table. Unpartitioned regions are also listed. The table consists of a number of lines containing partition name, beginning and ending sectors, and total size. A ' is prefixed to the names of partitions whose entries have been modified but not written to disk. Fdisk adds to the end of\par
\tab\par
\tab each line a textual partition type, and places a * next to the name of the active partition (see the A command below).\par
P Print the partition table in the format accepted by the disk's ctl file, which is also the format of the output of the \endash p option.\par
w Write the partition table to disk. Prep will also inform the kernel of the changed partition table. The write will fail if any programs have any of the disk's partitions open. If the write fails (for this or any other reason), prep and fdisk will attempt to restore the partition table to its former state. q Quit the program. If the partition table has been modified but not written, a warning is printed. Typing q again will quit the program.\par
\par
Fdisk also has the following commands.\par
A name Set the named partition active. The active partition is the one whose boot block is used when booting a PC from disk.\par
e Print the names of empty slots in the partition table, i.e., the valid names to use when creating a new partition.\par
t [ type ]Set the partition type. If it is not given, fdisk will display a list of choices and then prompt for it.\par
\par
format and pbs\par
Format prepares for use the disk partition or the floppy diskette in the file named disk, for example /dev/sdC0/9fat or /dev/fd0disk. The options are:\par
\endash f Do not physically format the disc. Used to install a FAT file system on a previously formatted disc. If disk is not a floppy device, this flag is a no\endash op.\par
\endash t specify a density and type of disk to be prepared. The possible types are:\par
\tab 3\f0\'bdDD3\'bd" double density, 737280 bytes\par
3\'bdHD3\'bd" high density, 1474560 bytes\par
5\'bcDD5\'bc" double density, 368640 bytes\par
5\'bcHD5\'bc" high density, 1146880 bytes\par
hardfixed disk\par
\par
The default when disk is a floppy drive is the highest possible on the device. When disk is a regular file, the default is 3\'bdHD. When disk is an sd(3) device, the default is hard.\par
\f1\endash\par
d initialize a FAT file system on the disk.\par
\endash b use the contents of bootblock as a bootstrap block to be installed in sector 0.\par
\par
The remaining options have effect only when \endash d is specified:\par
\endash c use a FAT cluster size of csize sectors when creating the FAT.\par
\endash l add a label when creating the FAT file system.\par
\endash r mark the first nresrv sectors of the partition as ``reserved''. Since the first sector always contains the FAT parameter block, this really marks the nresrv\endash 1 sectors starting at sector 1 as ``reserved''. When formatting the 9fat partition, \endash r 2 should be used to jump over the partition table sector.\par
\par
Again under \endash d, any files listed are added, in order, to the root directory of the FAT file system. The files are contiguously allocated. If a file is named 9load, it will be created with the SYSTEM attribute set so that dossrv(4) keeps it contiguous when modifying it.\par
\par
Format checks for a number of common mistakes; in particular, it will refuse to format a 9fat partition unless \endash r is specified with nresrv larger than two. It also refuses to format a raw sd(3) partition that begins at offset zero in the disk. (The beginning of the disk should contain an fdisk partition table with master boot record, not a FAT file system or boot block.) Both checks are disabled by the \endash x option. The \endash v option prints debugging information.\par
\par
The file /386/pbs is an example of a suitable bootblock to make the disk a boot disk. It gets loaded by the BIOS at 0x7C00, reads the first sector of the root directory into address 0x7E00, and looks for a directory entry named 9LOAD. If it finds such an entry, it uses single sector reads to load the file into address 0x10000 and then jumps to the loaded file image. The file /386/pbslba is similar, but because it uses LBA addressing (not supported by older BIOSes), it can access more than the first 8.5GB of the disk. /386/pbsraw is suitable for CDs.\par
\par
mbr\par
Mbr installs a new boot block in sector 0 (the master boot record) of a disk such as /dev/sdC0/data. If mbrfile contains more than one sector of `boot block', the rest will be copied into the first track of the disk, if it fits. This boot block should not be confused with the boot block used by format, which goes in sector 0 of a partition. Typically, the boot block in the master boot record scans the PC partition table to find an active partition and then executes the boot block for that partition. The partition boot block then loads a bootstrap program such as 9load (see 9boot(8)), which then loads the operating system. If MS\endash DOS or Windows is already installed on your disk, the master boot record already has a suitable boot block. Otherwise, /386/mbr is an appropriate mbrfile. It detects and uses LBA addressing when available from the BIOS (the same could not be done in the case of pbs due to space considerations). If the mbrfile is not specified, a boot block is installed that prints a message explaining that the disk is not bootable. The \endash 9 option initialises the partition table to consist of one plan9 partition which spans the entire disc starting at the end of the first track.\par
\par
EXAMPLES\par
\tab Initialize the kernel disk driver with the partition information from the FAT boot sectors. If Plan 9 partitions exist, pass that partition information as well.\par
\tab for(disk in /dev/sd??) \{\par
\tab if(test \endash f $disk/data && test \endash f $disk/ctl)\par
disk/fdisk \endash p $disk/data >$disk/ctl\par
for(part in $disk/plan9*)\par
if(test \endash f $part)\par
disk/prep \endash p $part >$disk/ctl\par
\}\par
\par
Create a Plan 9 boot floppy on a previously formatted diskette.\par
\tab disk/format \endash b /386/pbs \endash df /dev/fd0disk \\\par
\tab /386/9load /tmp/plan9.ini /386/9pcf.gz\par
\tab\par
\par
Initialize the blank disk /dev/sdC0/data.\par
\tab disk/mbr \endash m /386/mbr /dev/sdC0/data\par
disk/fdisk \endash baw /dev/sdC0/data\par
disk/prep \endash bw \endash a^(9fat nvram fossil cache swap) /dev/sdC0/plan9\par
disk/format \endash b /386/pbslba \endash d \endash r 2 /dev/sdC0/9fat \\\par
\tab /386/9load /386/9pcf /tmp/plan9.ini\par
\par
FILES\par
\tab /386/mbr\par
/386/mbr.bootmgr self\endash configuring `smart boot manager'\par
\par
SOURCE\par
\tab /sys/src/cmd/disk/prep\par
/sys/src/boot/pc\par
/n/sources/extra/bootmgr.tgz nasm assembler source for /386/mbr.bootmgr\par
\par
SEE ALSO\par
\tab floppy(3), sd(3), usb(4), 9boot(8), mk9660(8), mkusbboot(8), partfs(8)\par
\par
BUGS\par
\tab Format can create FAT12 and FAT16 file systems, but not FAT32 file systems. The boot block can only read from FAT12 and FAT16 file systems.\par
\par
If prep \endash p doesn't find a Plan 9 partition table, it will emit commands to delete all extant partitions. Similarly, fdisk \endash p will delete all partitions, including data, if there are no partitions defined in the MBR.\f0\par
}

Loading…
Cancel
Save