1.\" $NetBSD: boot.8,v 1.5 2007/12/14 21:16:01 pavel 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 March 28, 2004 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. 53Depending on the Open Firmware variable 54.Sq Ev auto-boot? 55it will either stop at the Open Firmware 56prompt or attempt to boot an operating system. 57Depending on the contents 58of the 59.Sq Ev use-nvramrc? , 60.Sq Ev boot-command , 61.Sq Ev boot-device , 62and 63.Sq Ev boot-file 64Open Firmware variables, it will attempt to boot 65.Tn MacOS , 66.Tn "MacOS X" , 67or 68.Nx . 69.Pp 70To boot 71.Nx , 72Open Firmware loads the bootloader 73.Xr ofwboot 8 74from the specified 75.Sq Ev boot-device . 76The bootloader then loads the kernel from the 77.Sq Ev boot-file , 78.Pq if it exists . 79Otherwise, it tries to load (in the following order): 80.Pa netbsd , netbsd.gz , 81or 82.Pa netbsd.macppc 83on the 84.Dq a 85partition of the same device that had the bootloader. 86.Ss "Open Firmware Commands" 87An essential but incomplete list of Open Firmware commands follows. 88A more thorough list is contained in the FAQ. 89.Lk http://www.NetBSD.org/ports/macppc/faq.html#ofw-use 90.Pp 91.Ic boot 92.Op Ar boot-device Op Ar boot-file 93.Op Ar options 94.Pp 95Boot an operating system. 96The default arguments for this command are taken from the Open Firmware 97environment variables: 98.Bl -tag -width boot-device -compact 99.It Ar boot-device 100primary bootloader location 101.It Ar boot-file 102kernel location 103.It Ar options 104flags passed to the kernel 105.El 106.Pp 107.Ic reset-all 108.Pp 109Reset the system, and proceed as specified by the 110.Sq Ev use-nvramrc? 111and 112.Sq Ev auto-boot? 113variables. 114If 115.Sq Ev use-nvramrc? 116is set to 117.Sq Ev true , 118then the system will attempt to execute the commands stored in the 119.Sq Ev nvramrc 120variable. 121If 122.Sq Ev auto-boot? 123is set to 124.Sq Ev true , 125the system will attempt to use the values stored in 126.Sq Ev boot-command , 127.Sq Ev boot-device , 128and 129.Sq Ev boot-file 130to boot the system. 131If 132.Sq Ev auto-boot? 133is set to 134.Sq Ev false , 135the system will halt at the Open Firmware prompt. 136.Pp 137.Ic shut-down 138.Pp 139Power off the system. 140.Pp 141.Ic setenv Ar variable Ar value 142.Pp 143Set an Open Firmware variable, e.g., 144.Bd -literal -offset indent 145setenv auto-boot? false 146setenv boot-device hd:,\eofwboot.xcf 147setenv boot-file netbsd-GENERIC.gz 148.Ed 149.Pp 150.Ic set-default Ar variable 151.Pp 152Set an Open Firmware variable to its default value. 153.Pp 154.Ic printenv Op Ar variable 155.Pp 156Show Open Firmware variables and values. 157.Pp 158.Ic eject fd 159.Pp 160Eject floppy disk on systems with on-board floppy drives. 161.Pp 162.Ic mac-boot 163.Pp 164Attempt to boot 165.Tn MacOS 166on an Open Firmware 3 system. 167.Pp 168.Ic bye 169.Pp 170Attempt to boot 171.Tn MacOS 172on an Open Firmware 1.0.5, 2.0.x, or 2.4 system. 173.Ss "Open Firmware Variables" 174An essential but incomplete list of Open Firmware variables follows. 175A more thorough list is contained in the FAQ. 176.Lk http://www.NetBSD.org/ports/macppc/faq.html#ofw-variables 177.Bl -tag -width "ew*0_protocols" 178.It Ev auto-boot? 179What Open Firmware will do at system startup or reset: 180.Bl -tag -width false 181.It Ar true 182automatically bootstrap an operating system using values from the 183.Sq Ev boot-command , 184.Sq Ev boot-device , 185and 186.Sq Ev boot-file 187variables. 188.It Ar false 189stop at the Open Firmware prompt. 190.El 191.Pp 192.It Ev use-nvramrc? 193If 194.Sq Ev true 195runs commands in variable 196.Sq Ev nvramrc . 197.Pp 198.It Ev real-base 199Kernel memory location. 200.Em "Do not modify this value on Open Firmware 3 systems \(em you may" 201.Em "damage your computer" . 202All other Open Firmware versions should use 203.Li F00000 . 204.Pp 205.It Ev load-base 206Bootloader memory location. 207.Em "Do not modify this value on Open Firmware 3 systems \(em you may" 208.Em "damage your computer" . 209All other Open Firmware versions should use 210.Li 600000 . 211.Pp 212.It Ev boot-command 213The command to use for booting. 214Typically, the default of 215.Sq Ev boot 216is used. 217.Pp 218.It Ev boot-device 219Device from which to load primary bootloader. 220Value depends on a variety of factors. 221See 222.Xr ofwboot 8 . 223.It Ev boot-file 224Kernel location. 225Value depends on a variety of factors. 226See 227.Xr ofwboot 8 . 228.Pp 229.It Ev input-device 230What type of console input device 231.Po 232.Tn ADB 233keyboard, 234.Tn USB 235keyboard, or serial port 236.Pc . 237.Bl -tag -width ttya 238.It Ar kbd 239.Tn ADB 240keyboard on models with 241.Tn ADB , 242.Tn USB 243keyboard on models with 244.Tn USB , 245and built-in keyboard on laptops. 246This is the default on some Open Firmware 2472.0.x machines and all Open Firmware 2.4 and 3 machines. 248.It Ar ttya 249.Sq Modem 250serial port on machines with serial ports. 251Properties are 38400 bps, 8 bits, no parity, 1 stop bit, no handshaking. 252This is the default on all 253Open Firmware 1.0.5 systems and some Open Firmware 2.0.x systems. 254.It Ar ttyb 255.Sq Printer 256serial port on machines with serial ports. 257Properties are the same as the 258.Sq Modem 259port. 260.It Ar scca 261Serial port on Xserve models. 262Properties are 57600 bps, 8 bits, no 263parity, 1 stop bit, no handshaking. 264.El 265.Pp 266.It output-device 267What type of console output device (On-board video, AGP video, PCI video, 268built-in LCD, or serial console). 269Value depends on a variety of factors. 270See 271.Xr ofwboot 8 272and 273.Lk http://www.NetBSD.org/ports/macppc/faq.html#ofw-input-output-devices 274.Pp 275.It nvramrc 276If 277.Sq Ev use-nvramrc? 278is set to true, these 279.Tn FORTH 280commands will be run when the computer is reset 281.Pp 282.El 283.Ss "Normal Operation" 284When Open Firmware loads the primary bootloader, it will print something 285like the following: 286.Bd -unfilled -offset indent 287 loading XCOFF 288 tsize=CC50 dsize=14AC bsize=2668 entry=640000 289 SECTIONS: 290 .text 00640000 00640000 0000CC50 000000E0 291 .data 0064D000 0064D000 000014AC 0000CD30 292 .bss 0064E4B0 0064E4B0 00002668 00000000 293 loading .text, done.. 294 loading .data, done.. 295 clearing .bss, done.. 296.Ed 297.Pp 298When 299.Xr ofwboot 8 300is started, it prints something like the following: 301.Bd -unfilled -offset indent 302 \*[Gt]\*[Gt] NetBSD/macppc OpenFirmware Boot, Revision 1.7 303 \*[Gt]\*[Gt] (autobuild@tgm.daemon.org, Thu Feb 6 17:50:27 UTC 2003) 304.Ed 305.Pp 306When 307.Xr ofwboot 8 308is loading the kernel, it prints something like the following: 309.Bd -unfilled -offset indent 310 4395364+254568 [220144+193803]=0x4d477c 311 start=0x100000 312.Ed 313.Pp 314When the 315.Nx 316kernel has started it prints a banner similar to the following: 317.Bd -literal -offset indent 318 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 319 The NetBSD Foundation, Inc. All rights reserved. 320 Copyright (c) 1982, 1986, 1989, 1991, 1993 321 The Regents of the University of California. All rights reserved. 322 323 NetBSD 1.6ZC (GENERIC) #0: Tue Sep 30 13:09:10 UTC 2003 324 autobuild@tgm.NetBSD.org:/autobuild/HEAD/macppc/OBJ/autobuild/HEAD/src/sys/arch/macppc/compile/GENERIC 325.Ed 326.Ss "After bootstrap" 327Once the 328.Nx Ns Tn /macppc 329kernel is booted normally 330it initializes itself and proceeds to start the system. 331An automatic consistency check of the file systems takes place, 332and unless this fails, the system comes up to multi-user operation. 333.Pp 334The proper way to shut the system down is with the 335.Xr shutdown 8 336command. 337.Pp 338If the system crashes, it will enter the kernel debugger, 339.Xr ddb 4 , 340if it is configured in the kernel. 341If the crash occurred during initialization and the debugger is 342not present or is exited, the kernel will halt the system. 343.Pp 344If the crash occurred during normal operation and the debugger 345is not present or is exited, the system will attempt a dump to the 346configured dump device (which will be automatically recovered with 347.Xr savecore 8 348during the next bootstrap cycle), and after the dump is complete (successful 349or not) the kernel will attempt a reboot. 350.Sh FILES 351.Bl -tag -width /usr/mdec/bootxx_cd9660 -compact 352.It Pa /boot 353.Nx 354secondary bootstrap program (Open Firmware 1.x and 2.x) 355.It Pa /netbsd 356default 357.Nx 358system kernel 359.It Pa /usr/mdec/bootxx 360.Nx 361primary bootstrap program (Open Firmware 1.x and 2.x) a.k.a. 362.Dq "partition zero" 363bootloader 364.It Pa /usr/mdec/ofwboot 365.Nx 366secondary bootstrap program (Open Firmware 1.x and 2.x) 367.It Pa /usr/mdec/ofwboot.xcf 368primary bootstrap for netboot and 369.Dq cd9660 370.Pq Tn ISO 9660 , 371.Dq MS-DOS , 372.Dq HFS , 373and 374.Dq HFS+ 375file systems. 376.El 377.Sh SEE ALSO 378.Xr ddb 4 , 379.Xr intro 4 , 380.Xr diskless 8 , 381.Xr halt 8 , 382.Xr init 8 , 383.Xr installboot 8 , 384.Xr ofwboot 8 , 385.Xr rc 8 , 386.Xr reboot 8 , 387.Xr savecore 8 , 388.Xr shutdown 8 389.Pp 390.Lk http://www.NetBSD.org/ports/macppc/faq.html 391.br 392.Lk http://www.NetBSD.org/docs/network/netboot/ 393.Sh STANDARDS 394.St -ieee1275-94 395.Lk http://playground.sun.com/1275/home.html 396.Sh BUGS 397The device names used by 398.Nx Ns Tn /macppc 399and Open Firmware often have no relation to each other. 400.Pp 401Apple Computer's Open Firmware implementation is easily confused. 402It is best to reboot your computer 403after a failed boot attempt, 404.Ic halt , 405or 406.Ic "shutdown -h" . 407Use the Open Firmware 408.Ic reset-all 409command. 410.Pp 411Apple Computer's Open Firmware implementation is notoriously bad. 412Thorough instructions for installing and booting 413.Nx 414are in the install notes 415.Pq Pa INSTALL.html 416included with every release of 417.Nx . 418