1.\" $NetBSD: boot.8,v 1.3 2003/11/14 17:18:18 keihan Exp $ 2.\" 3.\" Copyright (c) 2003 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Michael Wolfson and Erik E. Fair. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed for the 20.\" NetBSD Project. See http://www.NetBSD.org/ for 21.\" information about NetBSD. 22.\" 4. The name of the author may not be used to endorse or promote products 23.\" derived from this software without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 26.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 29.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35.\" 36.\" 37.Dd June 21, 2003 38.Dt BOOT 8 macppc 39.Os 40.Sh NAME 41.Nm boot 42.Nd Macppc system bootstrapping procedures 43.Sh DESCRIPTION 44.Ss Power fail and crash recovery 45Normally, the system will reboot itself at power-up or after crashes. 46An automatic consistency check of the file systems will be performed 47as described in 48.Xr fsck 8 , 49and unless this fails, the system will resume multi-user operations. 50.Ss Cold starts 51The boot ROM performs a Power On Self Test (POST) then loads Open 52Firmware. Depending on the Open Firmware variable 53.Sq Ev auto-boot? 54it will either stop at the Open Firmware 55prompt or attempt to boot an operating system. Depending on the contents 56of the 57.Sq Ev use-nvramrc? , 58.Sq Ev boot-command , 59.Sq Ev boot-device , 60and 61.Sq Ev boot-file 62Open Firmware variables, it will attempt to boot 63.Tn MacOS , 64.Tn "MacOS X" , 65or 66.Nx . 67.Pp 68To boot 69.Nx , 70Open Firmware loads the bootloader 71.Xr ofwboot 8 72from the specified 73.Sq Ev boot-device . 74The bootloader then loads the kernel from the 75.Sq Ev boot-file , 76(if it exists). Otherwise, it tries to load (in the following order): 77.Pa netbsd , netbsd.gz , 78or 79.Pa netbsd.macppc 80on the 81.Dq a 82partition of the same device that had the bootloader. 83.Ss "Open Firmware Commands" 84An essential but incomplete list of Open Firmware commands follows. 85A more thorough list is contained in the FAQ. 86.Lk http://www.NetBSD.org/Ports/macppc/faq.html#ofw-use 87.Pp 88.Ic boot 89.Op Ar boot-device Op Ar boot-file 90.Op Ar options 91.Pp 92Boot an operating system. 93The default arguments for this command are taken from the Open Firmware 94environment variables: 95.Bl -tag -width boot-device -compact 96.It Ar boot-device 97primary bootloader location 98.It Ar boot-file 99kernel location 100.It Ar options 101flags passed to the kernel 102.El 103.Pp 104.Ic reset-all 105.Pp 106Reset the system, and proceed as specified by the 107.Sq Ev use-nvramrc? 108and 109.Sq Ev auto-boot? 110variables. If 111.Sq Ev use-nvramrc? 112is set to 113.Sq Ev true , 114then the system will attempt to execute the commands stored in the 115.Sq Ev nvramrc 116variable. If 117.Sq Ev auto-boot? 118is set to 119.Sq Ev true , 120the system will attempt to use the values stored in 121.Sq Ev boot-command , 122.Sq Ev boot-device , 123and 124.Sq Ev boot-file 125to boot the system. If 126.Sq Ev auto-boot? 127is set to 128.Sq Ev false , 129the system will halt at the Open Firmware prompt. 130.Pp 131.Ic shut-down 132.Pp 133Power off the system. 134.Pp 135.Ic setenv Ar variable Ar value 136.Pp 137Set an Open Firmware variable, e.g., 138.Bd -literal -offset indent 139setenv auto-boot? false 140setenv boot-device hd:,\eofwboot.xcf 141setenv boot-file netbsd-GENERIC.gz 142.Ed 143.Pp 144.Ic set-default Ar variable 145.Pp 146Set an Open Firmware variable to its default value. 147.Pp 148.Ic printenv Op Ar variable 149.Pp 150Show Open Firmware variables and values. 151.Pp 152.Ic eject fd 153.Pp 154Eject floppy disk on systems with on-board floppy drives. 155.Pp 156.Ic mac-boot 157.Pp 158Attempt to boot 159.Tn MacOS 160on an Open Firmware 3 system. 161.Pp 162.Ic bye 163.Pp 164Attempt to boot 165.Tn MacOS 166on an Open Firmware 1.0.5, 2.0.x, or 2.4 system. 167.Ss "Open Firmware Variables" 168An essential but incomplete list of Open Firmware variables follows. 169A more thorough list is contained in the FAQ. 170.Lk http://www.NetBSD.org/Ports/macppc/faq.html#ofw-variables 171.Bl -tag -width "ew*0_protocols" 172.It Ev auto-boot? 173What Open Firmware will do at system startup or reset: 174.Bl -tag -width false 175.It Ar true 176automatically bootstrap an operating system using values from the 177.Sq Ev boot-command , 178.Sq Ev boot-device , 179and 180.Sq Ev boot-file 181variables. 182.It Ar false 183stop at the Open Firmware prompt. 184.El 185.Pp 186.It Ev use-nvramrc? 187If 188.Sq Ev true 189runs commands in variable 190.Sq Ev nvramrc . 191.Pp 192.It Ev real-base 193Kernel memory location. 194.Em "Do not modify this value on Open Firmware 3 systems \(em you may" 195.Em "damage your computer" . 196All other Open Firmware versions should use 197.Li F00000 . 198.Pp 199.It Ev load-base 200Bootloader memory location. 201.Em "Do not modify this value on Open Firmware 3 systems \(em you may" 202.Em "damage your computer" . 203All other Open Firmware versions should use 204.Li 600000 . 205.Pp 206.It Ev boot-command 207The command to use for booting. Typically, the default of 208.Sq Ev boot 209is used. 210.Pp 211.It Ev boot-device 212Device from which to load primary bootloader. Value depends on a variety 213of factors. See 214.Xr ofwboot 8 . 215.It Ev boot-file 216Kernel location. Value depends on a variety of factors. See 217.Xr ofwboot 8 . 218.Pp 219.It Ev input-device 220What type of console input device (ADB keyboard, USB keyboard, or serial 221port). 222.Bl -tag -width ttya 223.It Ar kbd 224ADB keyboard on models with ADB, USB keyboard on models with USB, and 225built-in keyboard on laptops. This is the default on some Open Firmware 2262.0.x machines and all Open Firmware 2.4 and 3 machines. 227.It Ar ttya 228.Sq Modem 229serial port on machines with serial ports. Properties are 38400 bps, 8 230bits, no parity, 1 stop bit, no handshaking. This is the default on all 231Open Firmware 1.0.5 systems and some Open Firmware 2.0.x systems. 232.It Ar ttyb 233.Sq Printer 234serial port on machines with serial ports. Properties are the same as the 235.Sq Modem 236port. 237.It Ar scca 238Serial port on Xserve models. Properties are 57600 bps, 8 bits, no 239parity, 1 stop bit, no handshaking. 240.El 241.Pp 242.It output-device 243What type of console output device (On-board video, AGP video, PCI video, 244built-in LCD, or serial console). 245Value depends on a variety of factors. See 246.Xr ofwboot 8 247and 248.Lk http://www.NetBSD.org/Ports/macppc/faq.html#ofw-input-output-devices 249.Pp 250.It nvramrc 251If 252.Sq Ev use-nvramrc? 253is set to true, these 254.Tn FORTH 255commands will be run when the computer is reset 256.Pp 257.El 258.Ss "Normal Operation" 259When Open Firmware loads the primary bootloader, it will print something 260like the following: 261.Bd -unfilled -offset indent 262 loading XCOFF 263 tsize=CC50 dsize=14AC bsize=2668 entry=640000 264 SECTIONS: 265 .text 00640000 00640000 0000CC50 000000E0 266 .data 0064D000 0064D000 000014AC 0000CD30 267 .bss 0064E4B0 0064E4B0 00002668 00000000 268 loading .text, done.. 269 loading .data, done.. 270 clearing .bss, done.. 271.Ed 272.Pp 273When 274.Xr ofwboot 8 275is started, it prints something like the following: 276.Bd -unfilled -offset indent 277 \*[Gt]\*[Gt] NetBSD/macppc OpenFirmware Boot, Revision 1.7 278 \*[Gt]\*[Gt] (autobuild@tgm.daemon.org, Thu Feb 6 17:50:27 UTC 2003) 279.Ed 280.Pp 281When 282.Xr ofwboot 8 283is loading the kernel, it prints something like the following: 284.Bd -unfilled -offset indent 285 4395364+254568 [220144+193803]=0x4d477c 286 start=0x100000 287.Ed 288.Pp 289When the 290.Nx 291kernel has started it prints a banner similar to the following: 292.Bd -literal -offset indent 293 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 294 The NetBSD Foundation, Inc. All rights reserved. 295 Copyright (c) 1982, 1986, 1989, 1991, 1993 296 The Regents of the University of California. All rights reserved. 297 298 NetBSD 1.6ZC (GENERIC) #0: Tue Sep 30 13:09:10 UTC 2003 299 autobuild@tgm.NetBSD.org:/autobuild/HEAD/macppc/OBJ/autobuild/HEAD/src/sys/arch/macppc/compile/GENERIC 300.Ed 301.Ss "After bootstrap" 302Once the 303.Nx Ns Tn /macppc 304kernel is booted normally 305it initializes itself and proceeds to start the system. 306An automatic consistency check of the file systems takes place, 307and unless this fails, the system comes up to multi-user operation. 308.Pp 309The proper way to shut the system down is with the 310.Xr shutdown 8 311command. 312.Pp 313If the system crashes, it will enter the kernel debugger, 314.Xr ddb 4 , 315if it is configured in the kernel. 316If the crash occurred during initialization and the debugger is 317not present or is exited, the kernel will halt the system. 318.Pp 319If the crash occurred during normal operation and the debugger 320is not present or is exited, the system will attempt a dump to the 321configured dump device (which will be automatically recovered with 322.Xr savecore 8 323during the next bootstrap cycle), and after the dump is complete (successful 324or not) the kernel will attempt a reboot. 325.Sh FILES 326.Bl -tag -width /usr/mdec/bootxx_cd9660 -compact 327.It Pa /boot 328.Nx 329secondary bootstrap program (Open Firmware 1.x and 2.x) 330.It Pa /netbsd 331default 332.Nx 333system kernel 334.It Pa /usr/mdec/bootxx 335.Nx 336primary bootstrap program (Open Firmware 1.x and 2.x) a.k.a. 337.Dq "partition zero" 338bootloader 339.It Pa /usr/mdec/ofwboot 340.Nx 341secondary bootstrap program (Open Firmware 1.x and 2.x) 342.It Pa /usr/mdec/ofwboot.xcf 343primary bootstrap for netboot and 344.Dq cd9660 345.Pq Tn ISO 9660 , 346.Dq MS-DOS , 347.Dq HFS , 348and 349.Dq HFS+ 350file systems. 351.El 352.Sh SEE ALSO 353.Xr ddb 4 , 354.Xr diskless 8 , 355.Xr halt 8 , 356.Xr init 8 , 357.Xr installboot 8 , 358.Xr ofwboot 8 , 359.Xr rc 8 , 360.Xr reboot 8 , 361.Xr savecore 8 , 362.Xr shutdown 8 363.Pp 364.Lk http://www.NetBSD.org/Ports/macppc/faq.html 365.br 366.Lk http://www.NetBSD.org/Documentation/network/netboot/ 367.Sh STANDARDS 368.St -ieee1275-94 369.Lk http://playground.sun.com/1275/home.html 370.Sh BUGS 371The device names used by 372.Nx Ns Tn /macppc 373and Open Firmware often have no relation to each other. 374.Pp 375Open Firmware is easily confused. It is best to reboot your computer 376after a failed boot attempt, 377.Ic halt , 378or 379.Ic "shutdown -h" . 380Use the Open Firmware 381.Ic reset-all 382command. 383.Pp 384Open Firmware is notoriously bad. Thorough instructions for installing 385and booting 386.Nx 387are in the install notes 388.Pq Pa INSTALL.html 389included with every release of 390.Nx . 391