1dnl $OpenBSD: install,v 1.44 2010/03/16 17:23:09 miod Exp $ 2OpenBSDInstallPrelude 3 4There are several ways to install OpenBSD onto a disk. The easiest way 5in terms of preliminary setup is to use the OpenBSD installation 6CD-ROM, or an installation floppy (if your machine can boot from floppy). 7 8If your machine is hooked up to a network, try and find a server to 9arrange for a diskless setup. This is a convenient way to install on a 10machine whose disk does not currently hold a usable operating system. 11This is difficult to get set up correctly the first time, but easy to 12use afterwards. (See ``Installing using a diskless setup'' below.) 13 14It is also possible to install OpenBSD "manually" from a running Solaris 15system, using the system tools, as well as gunzip; see ``Installing from 16Solaris'' below. 17 18Booting from the Installation Media: 19 20Prior to attempting an installation, you should make sure that everything 21of value on the target system has been backed up. While installing OpenBSD 22does not necessarily wipe out all the partitions on the hard disk, errors 23during the install process can have unforeseen consequences and you will 24probably render the system unbootable if you start, but do not complete 25the installation. Having the installation media for the prior installation, 26be it a Solaris or OpenBSD CD-ROM or OpenBSD install diskettes, is good 27insurance if you want to be able to "go back" for some reason. 28 29After taking care of all that, bring your system down gracefully using 30the shutdown(8) and/or halt(8) commands. This will get you to the monitor 31prompt. 32 33 34Booting from Floppy Disk installation media: 35 36 ok boot floppy bsd 37 38This will cause the kernel contained in the floppy to be booted. 39Not all systems are able to boot from floppy; also, Ultra 1, 1E, and 2 40systems might need a firmware update to be able to boot from floppy; 41refer to the ``Updating your firmware'' section earlier in 42this document for details. 43 44 45Booting From CD-ROM installation media: 46 47dnl No args! not a typo 48 ok boot cdrom 49 50If the boot is successful, you will get a loader version message, 51executable sizes, and then the kernel copyright and device probe 52messages. Boot failure modes are typically a lot of CD-ROM drive 53activity, but no messages or complaints about magic numbers, 54checksums or formats. 55 56 57Booting from disk: 58 59Boot the miniroot by typing the appropriate command at the PROM: 60 61 ok boot disk:b bsd 62 63If you've loaded the miniroot onto some other disk than the default 64drive 0, modify the boot specifier accordingly, keeping in mind the 65partition naming a=0, b=1... 66 67 ok boot disk1:b bsd # example - scsi target 1 or 68 # second ide drive 69 70 71Installing using a diskless setup: 72 73First, you must set up a diskless client configuration on a server. If 74you are using an OpenBSD system as the boot-server, have a look at the 75diskless(8) manual page for guidelines on how to proceed with this. 76If the server runs another operating system, you'll have to consult 77documentation that came with it (on SunOS systems, add_client(8) and 78the Sun System/Networks administrators guide constitute a good start; 79on Solaris systems, share(1M) is a good starting point as well). 80 81 82Boot your workstation from the server by entering the appropriate `boot' 83command at the monitor prompt: 84 85 ok boot net bsd.rd 86 87 88Installing using the Floppy, CD-ROM, miniroot or netboot procedure: 89 90OpenBSDInstallPart2 91 92 Boot your machine from the installation media as described above. 93 94 It will take a while to load the kernel especially from a floppy 95 or slow network connection, most likely more than a minute. If 96 some action doesn't eventually happen, or the spinning cursor has 97 stopped and nothing further has happened, either your boot media 98 is bad, your diskless setup isn't correct, or you may have 99 a hardware or configuration problem. 100 101OpenBSDInstallPart3 102 103OpenBSDInstallPart4 104 105OpenBSDInstallPart5 106 107OpenBSDInstallPart6({:-CD-ROM, tape, -:}) 108 109OpenBSDURLInstall 110 111OpenBSDCDROMInstall 112 113OpenBSDDISKInstall({:-"wdN" or -:},{:-only -:}) 114 115OpenBSDCommonInstall 116 117OpenBSDTAPEInstall 118 119OpenBSDInstallWrapup 120 121After completing an installation: 122 123Now try a reboot. (If needed, swap your SCSI IDs first). 124 125The UltraSPARC OpenFirmware will normally load the kernel from the device 126and filename as instructed by the ``boot-device'' and ``boot-file'' 127variables. If the ``boot-file'' variable is empty, the OpenBSD bootloader 128will look for a kernel named ``bsd'', unless a different filename has been 129specified in the boot command. To reset this variable to its default, 130empty, value, type the following: 131 132 ok set-default boot-file 133 134On multiprocessor systems, to boot the multiprocessor kernel automatically, 135type the following: 136 137 ok setenv boot-file bsd.mp 138 139 140OpenBSDCongratulations 141 142 143Installing from Solaris: 144 145You need a machine running under Solaris to install OpenBSD. You will 146also need at least the following pieces: 147 148 - the *.tgz files you want to install (as a minimum, base{:--:}OSrev.tgz and 149 etc{:--:}OSrev.tgz) 150 - gunzip (GNU gzip) Solaris binary 151 - the OpenBSD boot blocks (bootblk and ofwboot) 152 - an OpenBSD kernel 153 154All these pieces, except gunzip, are supplied in the OpenBSD/MACHINE 155distribution. 156 157You need to format and partition the disk using Solaris (since 158OpenBSD/MACHINE uses Sun compatible disk labels). Give yourself adequate 159partition sizes. Here is an example layout: 160 161 solaris# prtvtoc -s /dev/rdsk/c0t1d0s2 162 * First Sector Last 163 * Partition Tag Flags Sector Count Sector Mount Directory 164 0 2 00 0 80000 79999 / 165 1 3 01 80000 256000 335999 166 2 5 00 0 4165271 4165270 167 3 7 00 336000 100000 435999 /tmp 168 4 7 00 436000 100000 535999 /var 169 5 7 00 536000 400000 935999 /var/tmp 170 6 4 00 936000 3229271 4165270 /usr 171 172Use Solaris to newfs the partitions which will have filesystems on them. 173(OpenBSD's filesystem format is almost identical to Solaris.) 174 175 solaris# newfs /dev/rdsk/c0t1d0s0 176 [... lots of output] 177 178Repeat for any other partition (in this example, /dev/rdsk/c0t1d0s3, 179/dev/rdsk/c0t1d0s4, /dev/rdsk/c0t1d0s5 and /dev/rdsk/c0t1d0s6). 180 181dnl XXX I had no time to check the -O restriction is still necessary. 182NOTE: If you are able to, there is a performance benefit from 183newfs'ing using OpenBSD. If you newfs using the OpenBSD newfs command, 184be sure to use the -O flag for your / partition, so that newfs will 185use the 4.3BSD filesystem format, rather than the new 4.4BSD filesystem 186format. If you forget, you will not be able to boot -- the Solaris boot 187blocks do not understand the extended 4.4BSD filesystem format. 188 189Mount those partitions in a tree formation, under /mnt; ie: 190 191 solaris# df -k 192 Filesystem kbytes used avail capacity Mounted on 193 [...] 194 /dev/dsk/c0t1d0s0 38427 0 38427 0% /mnt 195 /dev/dsk/c0t1d0s3 48249 0 48249 0% /mnt/tmp 196 /dev/dsk/c0t1d0s4 48249 0 48249 0% /mnt/var 197 /dev/dsk/c0t1d0s5 193536 0 193536 0% /mnt/var/tmp 198 /dev/dsk/c0t1d0s6 1564024 0 1564024 0% /mnt/usr 199 200Place the boot blocks in /mnt (your new root partition), and use the Solaris 201command "installboot" to make it work. 202The installboot man page says to do something like this: 203 204 solaris# cp bootblk ofwboot /mnt 205 solaris# sync; sync 206 solaris# /usr/sbin/installboot /mnt/bootblk /dev/rdsk/c0t1d0s0 207 208You can now extract the provided "*.tgz" files onto your disk. 209 210 solaris# ls -FC 211 base{:--:}OSrev.tgz etc{:--:}OSrev.tgz misc{:--:}OSrev.tgz xserv{:--:}OSrev.tgz 212 bsd game{:--:}OSrev.tgz xbase{:--:}OSrev.tgz xshare{:--:}OSrev.tgz 213 comp{:--:}OSrev.tgz man{:--:}OSrev.tgz xfont{:--:}OSrev.tgz 214 solaris{:-#-:} gunzip < base{:--:}OSrev.tgz | (cd /mnt; tar xvpf -) 215 [...] for each set 216 217And finally copy the OpenBSD kernel onto your disk. 218 219 solaris# cp bsd /mnt/bsd 220 221The GNU gunzip program is not distributed as part of Solaris, but may be 222present in your /usr/local/bin. If not, you will need to obtain it from a 223GNU archive and install before proceeding. 224 225After the files have been extracted, set up /mnt/etc/fstab to match 226your actual disk layout. (Minus the "/mnt" component of each path, of 227course :-) 228 229Now proceed to reboot the machine and the customize your installation. 230 231 232Net Boot or Diskless Setup Information: 233 234The set up is similar to the diskless setup, but not identical, because 235the Sun setup assumes that the bootblocks load a kernel image, which then 236uses NFS to access the exported root partition, while the OpenBSD bootblocks 237use internal NFS routines to load the kernel image directly from the 238exported root partition. 239 240Please understand that no one gets this right the first try, since 241there is a lot of setup and all the host daemons must be running and 242configured correctly. If you have problems, extract the diskless(8) 243manpage, find someone who's been through it before and use the host 244syslog and tcpdump(8) to get visibility of what's happening (or not). 245 246Your UltraSPARC expects to be able to download a second stage bootstrap 247program via TFTP after having acquired its IP address through RevARP when 248instructed to boot "over the net". It will look for a filename composed of 249the machine's IP address. For example, a machine which has been assigned IP 250address 130.115.144.11 will make a TFTP request for `8273900B'. 251Normally, this file is a symbolic link to an appropriate second-stage 252boot program, which should be located in a place where the TFTP daemon 253can find it (remember, many TFTP daemons run in a chroot'ed environment). 254 255You can find the boot program in `/usr/mdec/boot' in the OpenBSD/MACHINE 256distribution. 257 258After the boot program has been loaded into memory and given control by 259the PROM, it starts locating the machine's remote root directory through 260the BOOTPARAM protocol. First a BOOTPARAM WHOAMI request is broadcast 261on the local net. The answer to this request (if it comes in) contains 262the client's name. This name is used in the next step, a BOOTPARAM GETFILE 263request -- sent to the server that responded to the WHOAMI request -- 264requesting the name and address of the machine that will serve the client's 265root directory, as well as the path of the client's root on that server. 266 267Finally, this information (if it comes in) is used to issue a REMOTE MOUNT 268request to the client's root filesystem server, asking for an NFS file 269handle corresponding to the root filesystem. If successful, the boot 270program starts reading from the remote root filesystem in search of the 271kernel which is then read into memory. 272 273You will want export the miniroot{:--:}OSrev.fs filesystem to the client. You 274can dd this filesystem image to some spare partition, mount and export 275that partition, or use tar to copy the contents to a more convenient spot. 276 277Alternatively you can build a bootable partition from the distribution sets 278as follows: 279 280Unpack `base{:--:}OSrev.tgz' and `etc{:--:}OSrev.tgz' on the server in the root directory 281for your target machine. If you elect to use a separately NFS-mounted 282filesystem for `/usr' with your diskless setup, make sure the "./usr" base 283files in base{:--:}OSrev.tgz end up in the correct location. One way to do this is 284to temporarily use a loopback mount on the server, re-routing <root>/usr to 285your server's exported OpenBSD "/usr" directory. Also put the kernel and 286the install/upgrade scripts into the root directory. 287 288A few configuration files need to be edited: 289 290 <root>/etc/hosts 291 Add the IP addresses of both server and client. 292 293 <root>/etc/myname 294 This files contains the client's hostname; use the same 295 name as in <root>/etc/hosts. 296 297 <root>/etc/fstab 298 Enter the entries for the remotely mounted filesystems. 299 For example: 300 server:/export/root/client / nfs rw 0 0 301 server:/export/exec/MACHINE.OpenBSD /usr nfs rw 0 0 302 303OpenBSDInstNFS 304