BOOT(8) (cobalt)

BOOT(8) | System Manager's Manual (cobalt) | BOOT(8)

# NAME

`boot` — system bootstrapping procedures

# DESCRIPTION

Cobalt Networks' MIPS-based Microservers (now known as Sun Server Appliances) that can run NetBSD/cobalt can use any of the following boot procedures:

- bootstrap NetBSD from disk using the standard Cobalt Firmware boot sequence
- bootstrap NetBSD from disk using the NetBSD boot loader
- network bootstrap NetBSD using the standard Cobalt Firmware means from a TCP/IP LAN with DHCP and NFS.
- network bootstrap NetBSD using the NetBSD boot loader which can be loaded by the standard Cobalt Firmware with DHCP and NFS.

## Power fail and crash recovery

Normally, the system will reboot itself at power-up or after crashes. An automatic consistency check of the file systems will be performed, and unless this fails, the system will resume multi-user operations.

## Cobalt Boot Sequence

The first program to take a control after reboot or at power-on is the Cobalt Firmware. The Firmware can load a compressed kernel from disk, subject to a few limitations. The Firmware expects the disk to contain DOS-style partition information with the first partition being a boot one which is special in that it should reside close to the beginning of the disk and must contain an ext2 file system with a boot directory which is treated specially by the Firmware. The default sequence is pretty straightforward, the Firmware finds the boot partition, mounts the Ext2 file system from it and tries to load a compressed kernel image from the boot directory. The name of the kernel image differs from machine to machine and this is the reason for having multiple copies of NetBSD kernel installed under different names. The following kernel image names are known to be in use by certain Cobalt flavors:

    /boot/vmlinuz.gz
    /boot/vmlinux.gz
    /boot/vmlinux-nfsroot.gz
    /boot/vmlinux_RAQ.gz
    /boot/vmlinux_raq-2800.gz

where /boot is the directory on the boot partition.

The Firmware console provides the means to alter the default boot sequence and/or to specify boot parameters. Pressing ‘⟨space⟩’ right after the Firmware printed its greeting brings the Firmware console prompt and pressing ‘?’ at the prompt prints a help screen with all commands supported by the Firmware. For example, the ‘bfd’ command can be used to boot a kernel image:

    Cobalt: bfd /boot/<kernel image> [options]

where “options” are the kernel options.

## Bootstrap from disk using the standard Firmware sequence

The Firmware enters the standard boot sequence after reboot or at power-on when no front-panel buttons are pressed and the Firmware console is not used to change the boot procedure. At boot time, the Firmware checks the hardware, prints the banner and performs the standard Cobalt boot sequence. There are a few culprits tightly connected to this boot method. First of all, the kernel must be compressed. Second, the Firmware enforces a hard restriction on the kernel size (it cannot exceed approximately 900,000/2,500,000 bytes compressed/uncompressed) resulting in a lock-up should this requirement not be fulfilled. For NetBSD, another pitfall is that the uncompressed kernel should be copied to the root directory to make certain system binaries (such as e.g. netstat) work, and the kernel images in the boot directory should always be in sync with the ones installed in the root directory.

## Bootstrap from disk using the NetBSD boot loader

The NetBSD boot loader is an attempt to break through the limitations enforced by the Firmware loader. The main idea is to make the Firmware load the NetBSD boot loader and let the latter take care of loading the kernel. To achieve this goal, multiple copies of the boot loader are installed in the boot directory on the boot partition, one copy per each kernel image name the Cobalt Firmware might look for. The NetBSD kernel is located in the root directory (usually /dev/wd0a) like it is on other platforms. Once running, the boot loader prints a banner to the serial console similar to the following:

    >> NetBSD/cobalt 5.0 Bootloader, Revision 0.9 [@0x80f00000]
    >> (user@buildhost, builddate)
    >> Model:               Cobalt Qube 2
    >> Memory:              32768 k
    >> PROM boot string:    root=/dev/hda1 ro
    Boot [wd0a:netbsd]:
    Loading: wd0a:netbsd
    3763776+312244 [216944+209676]=0x44b97c
    Starting at 0x80001000

The boot loader also prints a banner to the LCD panels as the following:

NetBSD/cobalt Bootloader Loading: wd0a:netbsd

## Boot loader Options

It is possible to specify some options and boot devices on the boot loader prompt:

boot [wd0a:netbsd]: [device:][filename] [`-acdmqsvxz`]

The default device will be set to the disk that the boot loader was loaded from. To boot from an alternate disk or partition, the full name of the device should be given at the prompt. device is of the form xdNx where xd is the device from which to boot, N is the unit number, and x is the partition letter of the NetBSD disklabel(5) in the NetBSD partition of the MBR partitions. The NetBSD boot loader recognizes FFS (both UFS1 and UFS2) and Linux Ext2fs.

The following list of supported devices may vary from installation to installation:

wd
  IDE hard disks recognized by the Firmware.

The default filename is netbsd; if the boot loader fails to successfully open that image, it then tries netbsd.gz (expected to be a kernel image compressed by gzip(1)), followed by netbsd, netbsd.gz, onetbsd, onetbsd.gz, netbsd.bak, netbsd.bak.gz, netbsd.old, netbsd.old.gz, netbsd.cobalt, netbsd.cobalt.gz, netbsd.elf, and finally netbsd.elf.gz. Alternate system images can be loaded by just specifying the name of the image, so it is always a good idea to have a copy of working kernel in the NetBSD root partition before trying a new kernel.

Options are:

`-a`
  Prompt for the root file system device, the system crash dump device, and the path to init(8).
`-c`
  Bring the system up into the device configuration manager. From here the device locators can be tuned to the hardware; see userconf(4).
`-d`
  Bring the system up in debug mode. Here it waits for a kernel debugger connect; see ddb(4).
`-q`
  Boot the system in quiet mode.
`-s`
  Bring the system up in single-user mode.
`-v`
  Boot the system in verbose mode.

As the older version of the boot loader, it is also possible to specify options to the boot loader by breaking into the Firmware and using the “bfd” command:

    Cobalt: bfd /boot/boot.gz [options]

The boot loader allows the following options:

`nbsd=` [device:][filename] [`-acdqsv`]

  The device, filename and options on the bfd prompt are same with the boot loader.

It is also a good idea to have a small rescue kernel in the boot directory in the Ext2 partition for the Firmware boot. In an emergency case, this will allow you to use the Firmware ‘bfd’ command to boot the rescue image:

    Cobalt: bfd /boot/netbsd.gz

## Network bootstrap using the standard Firmware sequence

The Cobalt Firmware allows to boot a kernel over the network, with all the limitations of the Firmware loader described above. The simplest method is to break into the Firmware prompt and use “bfd” command to specify where to boot from:

    Cobalt: bfd /netbsd.gz nfsroot=/home/raq/root

The Firmware is picky about syntax and in general, so if things fail mysteriously, try to conform to the conventions described above. For netbooting, you need to NFS-export the directory given to “nfsroot=”, and the named kernel (netbsd.gz) needs to be executable and in that directory. You will also need to setup dhcpd(8). Once the kernel is loaded with the command line values, the data given via DHCP is used to mount the root file system. Here is a known working DHCP entry:

    host raq {
            hardware ethernet 0:10:e0:0:52:62;      # raq MAC
            fixed-address 10.0.0.15;                # raq address
            filename "/netbsd.gz";                  # kernel name in root-path
            option root-path "/home/raq/root";      # absolute dir on NFS server
            server-name="10.0.0.3";                 # IP of NFS server
    }

Another option is to hold down the left and right cursor buttons during power-on which executes the command

    bfd /boot/vmlinux.gz root=/dev/nfs nfsroot=/nfsroot,

resulting in a netboot. On RaQ 1's, the default kernel name is vmlinux_RAQ.gz and on RaQ 2's, it is vmlinux_raq-2800.gz.

## Network bootstrap using the NetBSD boot loader

The idea here is the same with the bootstrap from disk using the NetBSD boot loader. Make the firmware load the NetBSD boot loader via network and let the latter take care of loading the kernel even via network. A simple method to load the NetBSD boot loader is to use the “bfd” command as well as booting the NetBSD kernel via network as described above:

    Cobalt: bfd /boot/boot.gz nfsroot=/home/raq/root

Note the boot loader binary needs to be gzip(1)-compressed. Once the boot loader is successfully loaded it prints a banner as well as booting from disk:

    >> NetBSD/cobalt 5.0 Bootloader, Revision 0.9 [@0x80f00000]
    >> (user@buildhost, builddate)
    >> Model:               Cobalt Qube 2
    >> Memory:              32768 k
    >> PROM boot string:    root=/dev/nfs nfsroot=/nfsroot nfsaddrs=bootp
    Boot [nfs:netbsd]:
    Loading: nfs:netbsd
    3763776+312244 [216944+209676]=0x44b97c
    Starting at 0x80001000

The boot loader load the NetBSD kernel via NFS which should be specified by the DHCP configuration on the server. Note the nfsroot option specified on the “bfd” prompt will be ignored by the NetBSD boot loader so it's recommended to use the same directory on the “bfd” prompt and in the DHCP configuration.

# FILES

/boot/boot.gz
  boot program code loaded by the Firmware loader
/boot/netbsd.gz
  gzip(1)-compressed rescue system code
/netbsd
  system code
/netbsd.gz
  gzip(1)-compressed system code
/usr/mdec/boot
  master copy of the boot program (to be compressed and copied to /boot/boot.gz)

# SEE ALSO

ddb(4), userconf(4), dhcpd.conf(5), dhcpd(8), fdisk(8), halt(8), reboot(8), shutdown(8), printf(9)

https://www.NetBSD.org/docs/network/netboot/

August 16, 2014 | NetBSD 11.0