COMPUTER AND NETWORK
SYSTEM ADINISTRATION
CIS 5406-01
Summer 1998 - Lesson 4

Booting the System

 
 
Steps in the typical operating system boot process
 
  A. monitor or BIOS mode
 
     "man eeprom", "man monitor" on Suns
 
     "man lilo" on Linux

      Check /usr/doc/HOWTO/Bootdisk-HOWTO.gz on Linux or
      any of the Linux Documentation Project pages.
 
      Select Windows NT Help (press F1 while mouse
      is on the desktop, or use Start/Help menu) and
      use the "Find" option to find the word "boot")

      Read pages 1339 through 1348 in MWNTS4 for a good 
      description of the boot process.
 
  B. boot file
 
     1. depending on EEPROM settings or command line
        boot arguments (example from old Suns:)
       
         b sd(0,0,1)
 
         b le()
 
     2. disk boot
 
     3. network boot (diskless clients and X terminals)
 
  C. kernel initialization
 
     1. running monologue from various kernel routines
 
     2. logged in /var/adm/messages (or /var/log/messages) and
        typically the system console
 
     3. Tend to be very system-specific
 
Here's an example from mu:
 
Jan 15 14:12
SunOS Release 4.1.2 (mu) #2: Mon Aug 8 14:13:05 EDT 1994
Copyright (c) 1983-1991, Sun Microsystems, Inc.
mem = 32768K (0x2000000)
avail mem = 30597120
Ethernet address = 8:0:20:e:b0:40
cpu = Sun 4/40
zs0 at obio 0xf1000000 pri 12
zs1 at obio 0xf0000000 pri 12
fd0 at obio 0xf7200000 pri 11
audio0 at obio 0xf7201000 pri 13
sbus0 at SBus slot 0 0x0
dma0 at SBus slot 0 0x400000
esp0 at SBus slot 0 0x800000 pri 3
esp0:	Target 3 now Synchronous at 4.167 mb/s max transmit rate
sd0 at esp0 target 3 lun 0
sd0: SUN0207 cyl 1254 alt 2 hd 9 sec 36
st0 at esp0 target 4 lun 0
st0: Exabyte 4200 Helical Scan
le0 at SBus slot 0 0xc00000 pri 5
bwtwo0 at SBus slot 3 0x0 pri 7
root on sd0a fstype 4.2
swap on sd0b fstype spec size 32724K
dump on sd0b fstype spec size 32712K
 
Example from dmesg on xi
 
cpu0: SUNW,UltraSPARC (upaid 0 impl 0x10 ver 0x22 clock 143 MHz)
SunOS Release 5.5.1 Version Generic_103640-03 [UNIX(R) System V Release 4.0]
Copyright (c) 1983-1996, Sun Microsystems, Inc.
mem = 98304K (0x6000000)
avail mem = 94601216
Ethernet address = 8:0:20:7d:4f:49
root nexus = Sun Ultra 1 SBus (UltraSPARC 143MHz)
sbus0 at root: UPA 0x1f 0x0 ...
espdma0 at sbus0: SBus0 slot 0xe offset 0x8400000
esp0 at espdma0: SBus0 slot 0xe offset 0x8800000 Onboard device sparc9 ipl 4
sd0 at esp0: target 0 lun 0
sd0 is /sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@0,0
<SUN2.1G cyl 2733 alt 2 hd 19 sec 80>
sd1 at esp0: target 1 lun 0
sd1 is /sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@1,0
<SEAGATE-ST410800N-0025 cyl 4924 alt 2 hd 27 sec 133>
sd4 at esp0: target 4 lun 0
sd4 is /sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@4,0
<SEAGATE-ST32430N-0250 cyl 3984 alt 2 hd 9 sec 117>
sd6 at esp0: target 6 lun 0
sd6 is /sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@6,0
<>
root on /sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@0,0:a fstype ufs
zs0 at sbus0: SBus0 slot 0xf offset 0x1100000 Onboard device sparc9 ipl 12
zs0 is /sbus@1f,0/zs@f,1100000
zs1 at sbus0: SBus0 slot 0xf offset 0x1000000 Onboard device sparc9 ipl 12
zs1 is /sbus@1f,0/zs@f,1000000
keyboard is </sbus@1f,0/zs@f,1000000> major <29> minor <2>
mouse is </sbus@1f,0/zs@f,1000000:b> major <29> minor <3>
stdin is </sbus@1f,0/zs@f,1000000> major <29> minor <2>
cgsix0 at sbus0: SBus0 slot 0x2 offset 0x0 SBus level 5 sparc9 ipl 9
cgsix0 is /sbus@1f,0/cgsix@2,0
cgsix0: screen 1152x900, single buffered, 1M mappable, rev 11
stdout is </sbus@1f,0/cgsix@2,0> major <39> minor <0>
boot cpu (0) initialization complete - online
SUNW,hme0: FEPS (Rev Id = 22) Found
SUNW,hme0 at sbus0: SBus0 slot 0x1 offset 0x8c00000 and slot 0x1 offset 0x8c02000 and slot 0x1 offset 0x8c04000 and slot 0x1 offset 0x8c06000 and slot 0x1 offset 0x8c07000 SBus level 4 sparc9 ipl 7
SUNW,hme0 is /sbus@1f,0/SUNW,hme@1,8c00000
dump on /dev/dsk/c0t0d0s1 size 164136K
SUNW,hme0: Using Internal Transceiver
SUNW,hme0: 100 Mbps Link Up
pcmcia: no PCMCIA adapters found
 
 
Example from dmesg on Linux:
 
pcibios_init : BIOS32 Service Directory structure at 0x000faf50
pcibios_init : BIOS32 Service Directory entry at 0xfb3f0
pcibios_init : PCI BIOS revision 2.10 entry at 0xfb420
Probing PCI hardware.
Calibrating delay loop.. ok - 53.04 BogoMIPS
Memory: 63148k/65536k available (776k kernel code, 384k reserved, 1228k data)
Swansea University Computer Society NET3.035 for Linux 2.0
NET3: Unix domain sockets 0.13 for Linux NET3.035.
Swansea University Computer Society TCP/IP for NET3.034
IP Protocols: IGMP, ICMP, UDP, TCP
VFS: Diskquotas version dquot_5.6.0 initialized
Checking 386/387 coupling... Ok, fpu using exception 16 error reporting.
Checking 'hlt' instruction... Ok.
Linux version 2.0.30 (root@sim.cs.fsu.edu) (gcc version 2.7.2.1) #2 Thu May 1 10:22:19 EDT 1997
Booting processor 1 stack 00002000: Calibrating delay loop.. ok - 53.04 BogoMIPS
Total of 2 processors activated (106.09 BogoMIPS).
Serial driver version 4.13 with no serial options enabled
tty00 at 0x03f8 (irq = 4) is a 16550A
tty01 at 0x02f8 (irq = 3) is a 16550A
ide: i82371 PIIX (Triton) on PCI bus 0 function 57
    ide0: BM-DMA at 0x9000-0x9007
    ide1: BM-DMA at 0x9008-0x900f
Floppy drive(s): fd0 is 1.44M
Started kswapd v 1.4.2.2 
FDC 0 is a post-1991 82077
scsi: ***** BusLogic SCSI Driver Version 2.0.9 of 29 March 1997 *****
scsi: Copyright 1995 by Leonard N. Zubkoff <lnz@dandelion.com>
scsi0: Configuring BusLogic Model BT-958 PCI Wide Ultra SCSI Host Adapter
scsi0:   Firmware Version: 5.06I, I/O Address: 0x6100, IRQ Channel: 10/Level
scsi0:   PCI Bus: 0, Device: 18, Address: 0xE0411000, Host Adapter SCSI ID: 7
scsi0:   Parity Checking: Enabled, Extended Translation: Enabled
scsi0:   Synchronous Negotiation: Fast, Wide Negotiation: Enabled
scsi0:   Disconnect/Reconnect: Enabled, Tagged Queuing: Enabled
scsi0:   Scatter/Gather Limit: 128 of 8192 segments, Mailboxes: 255
scsi0:   Driver Queue Depth: 255, Host Adapter Queue Depth: 192
scsi0:   Tagged Queue Depth: Automatic, Untagged Queue Depth: 3
scsi0:   Error Recovery Strategy: Default, SCSI Bus Reset: Enabled
scsi0:   SCSI Bus Termination: Both Enabled, SCAM: Disabled
scsi0: *** BusLogic BT-958 Initialized Successfully ***
scsi0:   Target 0: Synchronous at 10.0 mega-transfers/second, offset 15
scsi0:   Target 2: Synchronous at 10.0 mega-transfers/second, offset 15
scsi0 : BusLogic BT-958
scsi : 1 host.
  Vendor: SEAGATE   Model: ST51080N          Rev: 0943
  Type:   Direct-Access                      ANSI SCSI revision: 02
Detected scsi disk sda at scsi0, channel 0, id 0, lun 0
  Vendor: QUANTUM   Model: FIREBALL_TM2110S  Rev: 300X
  Type:   Direct-Access                      ANSI SCSI revision: 02
Detected scsi disk sdb at scsi0, channel 0, id 2, lun 0
scsi : detected 2 SCSI disks total.
SCSI device sda: hdwr sector= 512 bytes. Sectors= 2109840 [1030 MB] [1.0 GB]
SCSI device sdb: hdwr sector= 512 bytes. Sectors= 4124736 [2014 MB] [2.0 GB]
Partition check:
 sda: sda1 sda2 sda3 sda4
 sdb: sdb1
VFS: Mounted root (ext2 filesystem) readonly.
scsi0: Tagged Queuing now active for Target 0
Adding Swap: 130748k swap-space (priority -1)
scsi0: Tagged Queuing now active for Target 2
loading device 'eth0'...
eth0: DC21140 at 0x6000 (PCI bus 0, device 17), h/w address 00:c0:f0:16:37:1c,
      and requires IRQ9 (provided by PCI BIOS).
eth0: mode is 100Mb/s.
 
 
  D. bootup scripts
 
     (BSD) scripts /etc/rc*
 
     (BSD) order of execution 
  
         single-user startup
 
             -init
                -rc.boot 
                  -rc.single 
                -single user shell
                -exit (or CTL-D) 
 
         multi-user startup
             -init
                -rc.boot 
                -rc.single
                -rc  
                  -rc.local
                -getty and login prompt 
 
     SysV bootup scripts

        1. /etc/inittab is the master config file for init
        2. this file controls which boot-up scripts will be executed
        3. the scripts are divied into 'run-levels'
        4. example from Redhat Linux:
 
# Default runlevel. The runlevels used by RHS are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
# 
id:3:initdefault:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

# Things to run in every runlevel.
ud::once:/sbin/update

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# When our UPS tells us power has failed, assume we have a few minutes
# of power left.  Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly.  
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"


# Run gettys in standard runlevels
1:12345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6


      Notice the location of the actual startup shell scripts
      can vary (/etc, /etc/rc.d, etc.), esp. between different
      versions of Linux.
 
 
  D. Halting and rebooting
 
     1. don't turn off power if possible until halted
     2. shutdown, halt, or reboot
     3. the telinit command
 
  E. Problems with booting
 
     1. can't find bootblock
     2. kernel won't load
     3. can't find swap
     4. damaged root file system
     5. error in startup scripts
 
Windows NT booting
 
Comment: Windows NT and Linux can run on the same exact hardware, so at
the earliest levels of booting both follow the same path through the
hardware and firmware initialization (CMOS settings for boot device,
loading up the boot loader from the boot disk, etc.).
 
Being a proprietary operating system, much of the internal machinations
of Windows NT are not apparent or difficult to learn.
 
     Steps in boot process (page 1339 in MWNTS4)
 
       1.  NTDETECT.COM (Intel NT) or OSLOADER.EXE (RISC NT)
           finds the next stage (NTOSKRNL.EXE)
 
       2.  NTOSKRNL.EXE extracts system information from the
           system's Registry database and then it:
 
                   a. Loads the kernel
                   b. Initializes the kernel
                   c. Loads services
                   d. Loads subsystems
 
            The system information includes HAL (Hardware Abstraction
            Layer) and the system hive from the Registry.
 
       This all happens on the blue screen with the marching periods.
 
 
     Steps in boot process (from Microsoft Windows NT Server -
       Concepts and Planning, page 257)
 
         1. System boot sector contains NTLDR, which is executed first
 
         2. NTLDR reads BOOT.INI and builds a menu of OS choices.
 
         3. NTLDR runs NTDETECT.COM (Intel) and builds a list of the
            system's hardware components.
 
         4. User selects OS or a default is automatically chosen.
 
         5. If NT is chosen, low-level NT components are started, then
            the drivers and services as specified in the Registry are
            started.
 
         6. The high-level components of NT load (windowing system)? and
            the login screen is presented.
 
By default, NT booting happens "behind the scenes".  You can modify that
by editing C:\BOOT.INI :
 
[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
 
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Server Version 4.00"
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Server Version 4.00 [VGA mode]" /basevideo /sos
 
Notice the "boot loader" stanza used to specify the loader behavior and
give the default operating system while the "operating systems" stanza
gives the choices for operating system.  To boot NT or DOS, for example,
you could use:
 
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Server Version 4.00"
C:\="MS-DOS"
 
Notice the "/sos" option on the VGA only mode menu choice; that will 
display device driver initialization messages at boot time.  You can
customize this file (be careful!).
 
Notice the path name for the WINNT binary isn't your standard DOS path;
it's called an ARC (Advanced RISC Computing) name - a generic method of
identifying devices.
 
Assignment: Figure out how to add the "/sos" option to your BOOT.INI file
for the first menu option and once done, reboot to see the verbose messages.
Also, research what the other options are with WINNT.EXE.
 
Linux provides a flexible multi-operating system boot loader named
lilo (Linux Loader) that can be used to boot different operating systems.  It also sits
on the Master Boot Record (MBR) of the boot device and transfers control
to specific operating system kernels depending on either a user type-in
or a default.  Lilo's behavior is controlled by /etc/lilo.conf.  Here's
a sample /etc/lilo.conf that I use to select between Win95 and Linux:
 
boot=/dev/hda
install=/boot/boot.b
map=/boot/map
vga=normal
prompt
timeout=50
#
# Windows 95
#
other = /dev/hda1
  table = /dev/hda
  label = win95
#
# Linux
#
image=/vmlinuz
  label = linux
  root=/dev/hda3
  read-only
 
Assignment: Grab the latest production Linux kernel (2.0.33),
configure and compile it for your machine, modify or create a 
/etc/lilo.conf so that you can boot from your original kernel
or from the new 2.0.33 kernel you build.  This is always a wise
idea, so if your new kernel doesn't work you don't have to
resort back to a floppy boot.