1dnl $OpenBSD: install,v 1.48 2014/03/19 01:59:49 tedu 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, -:}) 108 109OpenBSDURLInstall 110 111OpenBSDCDROMInstall 112 113OpenBSDDISKInstall({:-"wdN" or -:},{:-only -:}) 114 115OpenBSDCommonInstall 116 117OpenBSDInstallWrapup 118 119After completing an installation: 120 121Now try a reboot. (If needed, swap your SCSI IDs first). 122 123The UltraSPARC OpenFirmware will normally load the kernel from the device 124and filename as instructed by the ``boot-device'' and ``boot-file'' 125variables. If the ``boot-file'' variable is empty, the OpenBSD bootloader 126will look for a kernel named ``bsd'', unless a different filename has been 127specified in the boot command. To reset this variable to its default, 128empty, value, type the following: 129 130 ok set-default boot-file 131 132 133OpenBSDCongratulations 134 135 136Installing from Solaris: 137 138You need a machine running under Solaris to install OpenBSD. You will 139also need at least the following pieces: 140 141 - the *.tgz files you want to install (as a minimum, base{:--:}OSrev.tgz and 142 etc{:--:}OSrev.tgz) 143 - gunzip (GNU gzip) Solaris binary 144 - the OpenBSD boot blocks (bootblk and ofwboot) 145 - an OpenBSD kernel 146 147All these pieces, except gunzip, are supplied in the OpenBSD/MACHINE 148distribution. 149 150You need to format and partition the disk using Solaris (since 151OpenBSD/MACHINE uses Sun compatible disk labels). Give yourself adequate 152partition sizes. Here is an example layout: 153 154 solaris# prtvtoc -s /dev/rdsk/c0t1d0s2 155 * First Sector Last 156 * Partition Tag Flags Sector Count Sector Mount Directory 157 0 2 00 0 80000 79999 / 158 1 3 01 80000 256000 335999 159 2 5 00 0 4165271 4165270 160 3 7 00 336000 100000 435999 /tmp 161 4 7 00 436000 100000 535999 /var 162 5 7 00 536000 400000 935999 /var/tmp 163 6 4 00 936000 3229271 4165270 /usr 164 165Use Solaris to newfs the partitions which will have filesystems on them. 166(OpenBSD's filesystem format is almost identical to Solaris.) 167 168 solaris# newfs /dev/rdsk/c0t1d0s0 169 [... lots of output] 170 171Repeat for any other partition (in this example, /dev/rdsk/c0t1d0s3, 172/dev/rdsk/c0t1d0s4, /dev/rdsk/c0t1d0s5 and /dev/rdsk/c0t1d0s6). 173 174dnl XXX I had no time to check the -O restriction is still necessary. 175NOTE: If you are able to, there is a performance benefit from 176newfs'ing using OpenBSD. If you newfs using the OpenBSD newfs command, 177be sure to use the -O flag for your / partition, so that newfs will 178use the 4.3BSD filesystem format, rather than the new 4.4BSD filesystem 179format. If you forget, you will not be able to boot -- the Solaris boot 180blocks do not understand the extended 4.4BSD filesystem format. 181 182Mount those partitions in a tree formation, under /mnt; ie: 183 184 solaris# df -k 185 Filesystem kbytes used avail capacity Mounted on 186 [...] 187 /dev/dsk/c0t1d0s0 38427 0 38427 0% /mnt 188 /dev/dsk/c0t1d0s3 48249 0 48249 0% /mnt/tmp 189 /dev/dsk/c0t1d0s4 48249 0 48249 0% /mnt/var 190 /dev/dsk/c0t1d0s5 193536 0 193536 0% /mnt/var/tmp 191 /dev/dsk/c0t1d0s6 1564024 0 1564024 0% /mnt/usr 192 193Place the boot blocks in /mnt (your new root partition), and use the Solaris 194command "installboot" to make it work. 195The installboot man page says to do something like this: 196 197 solaris# cp bootblk ofwboot /mnt 198 solaris# sync; sync 199 solaris# /usr/sbin/installboot /mnt/bootblk /dev/rdsk/c0t1d0s0 200 201You can now extract the provided "*.tgz" files onto your disk. 202 203 solaris# ls -FC 204 base{:--:}OSrev.tgz etc{:--:}OSrev.tgz xbase{:--:}OSrev.tgz xshare{:--:}OSrev.tgz 205 bsd game{:--:}OSrev.tgz xfont{:--:}OSrev.tgz 206 comp{:--:}OSrev.tgz man{:--:}OSrev.tgz xserv{:--:}OSrev.tgz 207 solaris{:-#-:} gunzip < base{:--:}OSrev.tgz | (cd /mnt; tar xvpf -) 208 [...] for each set 209 210And finally copy the OpenBSD kernel onto your disk. 211 212 solaris# cp bsd /mnt/bsd 213 214The GNU gunzip program is not distributed as part of Solaris, but may be 215present in your /usr/local/bin. If not, you will need to obtain it from a 216GNU archive and install before proceeding. 217 218After the files have been extracted, set up /mnt/etc/fstab to match 219your actual disk layout. (Minus the "/mnt" component of each path, of 220course :-) 221 222Now proceed to reboot the machine and the customize your installation. 223 224 225Net Boot or Diskless Setup Information: 226 227The set up is similar to the diskless setup, but not identical, because 228the Sun setup assumes that the bootblocks load a kernel image, which then 229uses NFS to access the exported root partition, while the OpenBSD bootblocks 230use internal NFS routines to load the kernel image directly from the 231exported root partition. 232 233Please understand that no one gets this right the first try, since 234there is a lot of setup and all the host daemons must be running and 235configured correctly. If you have problems, extract the diskless(8) 236manpage, find someone who's been through it before and use the host 237syslog and tcpdump(8) to get visibility of what's happening (or not). 238 239Your UltraSPARC expects to be able to download a second stage bootstrap 240program via TFTP after having acquired its IP address through RevARP when 241instructed to boot "over the net". It will look for a filename composed of 242the machine's IP address. For example, a machine which has been assigned IP 243address 130.115.144.11 will make a TFTP request for `8273900B'. 244Normally, this file is a symbolic link to an appropriate second-stage 245boot program, which should be located in a place where the TFTP daemon 246can find it (remember, many TFTP daemons run in a chroot'ed environment). 247 248You can find the boot program in `/usr/mdec/boot' in the OpenBSD/MACHINE 249distribution. 250 251After the boot program has been loaded into memory and given control by 252the PROM, it starts locating the machine's remote root directory through 253the BOOTPARAM protocol. First a BOOTPARAM WHOAMI request is broadcast 254on the local net. The answer to this request (if it comes in) contains 255the client's name. This name is used in the next step, a BOOTPARAM GETFILE 256request -- sent to the server that responded to the WHOAMI request -- 257requesting the name and address of the machine that will serve the client's 258root directory, as well as the path of the client's root on that server. 259 260Finally, this information (if it comes in) is used to issue a REMOTE MOUNT 261request to the client's root filesystem server, asking for an NFS file 262handle corresponding to the root filesystem. If successful, the boot 263program starts reading from the remote root filesystem in search of the 264kernel which is then read into memory. 265 266You will want export the miniroot{:--:}OSrev.fs filesystem to the client. You 267can dd this filesystem image to some spare partition, mount and export 268that partition, or use tar to copy the contents to a more convenient spot. 269 270Alternatively you can build a bootable partition from the distribution sets 271as follows: 272 273Unpack `base{:--:}OSrev.tgz' and `etc{:--:}OSrev.tgz' on the server in the root directory 274for your target machine. If you elect to use a separately NFS-mounted 275filesystem for `/usr' with your diskless setup, make sure the "./usr" base 276files in base{:--:}OSrev.tgz end up in the correct location. One way to do this is 277to temporarily use a loopback mount on the server, re-routing <root>/usr to 278your server's exported OpenBSD "/usr" directory. Also put the kernel and 279the install/upgrade scripts into the root directory. 280 281A few configuration files need to be edited: 282 283 <root>/etc/hosts 284 Add the IP addresses of both server and client. 285 286 <root>/etc/myname 287 This files contains the client's hostname; use the same 288 name as in <root>/etc/hosts. 289 290 <root>/etc/fstab 291 Enter the entries for the remotely mounted filesystems. 292 For example: 293 server:/export/root/client / nfs rw 0 0 294 server:/export/exec/MACHINE.OpenBSD /usr nfs rw 0 0 295 296OpenBSDInstNFS 297 298 299 300OpenBSDUnattendedInstallation 301