Boot a 32-bit or 64-bit Solaris Kernel at the ok Prompt

Use ok boot with kernel/unix or kernel/sparcv9/unix to start the 32-bit or 64-bit Solaris 7, 8 or 9 kernel when a 32-bit driver or firewall module must load.

Boot a 32-bit or 64-bit Solaris Kernel at the ok Prompt

Purpose

Take a Solaris 8 server on an UltraSPARC II that needs a third-party 32-bit firewall module. A system running a 64-bit kernel needs 64-bit versions of the drivers and other modules that load into the kernel , so the 32-bit module cannot load. The fix is to boot the 32-bit kernel.

On Solaris 7, 8 and 9, systems based on the UltraSPARC I and UltraSPARC II processors can boot either a 32-bit or a 64-bit kernel , and the 64-bit kernel is the default. Some models cannot make that choice. The Sun Blade 100 and 1000, for example, boot only the 64-bit kernel, so check the hardware list in Key Points before you try this. The kernel file you name after ok boot at the OpenBoot PROM prompt picks the kernel for that one boot. Use kernel/unix for 32-bit and kernel/sparcv9/unix for 64-bit.

The usual reason is the one in the Solaris 9 release notes: a third-party module that exists only for the 32-bit kernel. It is one of the commands collected on the Solaris commands and scripts page .

Code

1# To boot a 32-bit kernel, at the ok prompt type:
2ok boot [disk or net] kernel/unix
3
4# To boot a 64-bit kernel (default), at the ok prompt type:
5ok boot [disk or net] kernel/sparcv9/unix
6
7ok boot [disk or net]

Code Breakdown

ok boot

ok is the OpenBoot PROM prompt. On a running system, init 0 takes Solaris down to run level 0 and shows the ok prompt . boot starts the system kernel or another standalone program. OpenBoot does not read the argument strings itself. It passes all of them to the secondary booter .

On illumos, the SPARC form of the command is:

1boot [ OBP names ] [ file ] [ -aLV ] [ -F object ] [ -D default-file ] [ -Z dataset ] [ boot-flags ] [ -- ] [ client-program-args ]

The device comes first, then the kernel file, then the flags. To boot the 32-bit kernel in single-user mode, put the file before the flag: ok boot disk kernel/unix -s.

[disk or net]

The square brackets mean the device is optional. Type a device alias such as disk, net or cdrom, or a full device path, without the brackets. If the line names no device, OpenBoot typically uses the boot-device or diag-device NVRAM variable. NVRAM variables are the OpenBoot settings kept in the PROM. printenv shows them and setenv changes them.

kernel/unix and kernel/sparcv9/unix

On UltraSPARC systems running Solaris 7, 8 or 9, kernel/unix is the 32-bit kernel and kernel/sparcv9/unix is the 64-bit one. sparcv9 is the label for 64-bit SPARC code. An UltraSPARC running the 64-bit kernel lists 64-bit sparcv9 applications in its isainfo -v output .

Both paths are relative because they do not start with a slash. For a relative path, the second-level booter searches a platform-dependent path. That path always contains /platform/<platform-name>. Many SPARC platforms then search /platform/<hardware-class-name>. uname -i prints the platform name and uname -m prints the hardware class. On 64-bit SPARC, /platform/<platform-name>/kernel/sparcv9/unix is the default program to boot.

The booter uses an absolute path exactly as written. The path must not contain any whitespace.

Plain ok boot [disk or net]

When no file is named on the line or in the boot-file NVRAM variable, boot picks a suitable default. On Solaris 7, 8 and 9 that default is the 64-bit kernel, which runs both 32-bit and 64-bit applications.

UltraSPARC systems with processors at 200MHz or lower are the exception. On Solaris 9 these boot the 32-bit kernel by default , because a specially written 64-bit program can stall the processor. To make the 64-bit kernel the default on such a box, add this line, uncommented, to /platform/<platform-name>/boot.conf:

1ALLOW_64BIT_KERNEL_ON_UltraSPARC_1_CPU=true

When boot-file holds a value, a plain boot uses it. Any argument on the command line replaces boot-file completely, because OpenBoot does not merge the two. For example, ok boot -s ignores boot-file and treats -s as the arguments. On a box with boot-file set to kernel/unix, a plain ok boot -s therefore comes up on the default kernel, not the 32-bit one.

Making the choice stick: boot-file and eeprom

To make another kernel the default, set the boot-file parameter to it . From the ok prompt:

1# init 0
2ok setenv boot-file kernel/unix
3ok printenv boot-file
4ok reset-all

printenv confirms the value, and reset-all writes the new value to the PROM. After reset-all, the self-test runs, and the system reboots if auto-boot? is true.

From the running system, use eeprom as superuser or an equivalent role:

1# eeprom boot-file=kernel/unix

The same syntax boots any kernel directory, not only the two shipped ones. For example, ok boot kernel.myname/sparcv9/unix boots a copied kernel tree. Before you change boot-file, write down the value printenv boot-file shows so you can set it back.

Key Points

  • The hardware sets the limits. SPARCstation 4, 5, 10, 10SX and 20 boot only the 32-bit kernel. Ultra 1, 2, 5, 10, 30, 60 and 80 boot either kernel. Sun Blade 100 and 1000, and Sun Fire 280R and 880, boot only the 64-bit kernel. UltraSPARC III and later systems support only the 64-bit kernel.
  • Solaris 7, 8 and 9 offer both kernels on UltraSPARC I and II systems, apart from the 64-bit-only models listed above. The 64-bit kernel is the default, except on Solaris 9 systems at 200MHz or lower. As of Solaris 9 9/02, the 32-bit kernel for UltraSPARC I and II might not be available in a future release. UltraSPARC I systems at 200MHz or lower might also lose support.
  • Later Oracle Solaris releases ship only a 64-bit kernel on SPARC . A Solaris 10 boot on an Ultra 5/10 prints File and args: kernel/sparcv9/unix and then SunOS Release 5.10 Version s10_60 64-bit.
  • illumos lists /platform/<platform-name>/kernel/sparcv9/unix as the default SPARC kernel. Its boot(8) man page also says "the current release of the Solaris operating system does not support machines running an UltraSPARC-I CPU." Its 64-bit x86 kernel is /platform/i86pc/kernel/amd64/unix.
  • x86 Solaris with GRUB has no ok prompt. eeprom boot-file=kernel/unix boots the 32-bit kernel on a 64-bit capable system, and eeprom boot-file="" restores automatic detection. To make the 32-bit kernel the default, remove every $ISADIR keyword from the menu.lst file, so the line reads kernel$ /platform/i86pc/kernel/unix. On releases where GRUB loads the unix kernel directly, an old kernel /platform/i86pc/multiboot entry stops the boot with multiboot is no longer used to boot the Solaris Operating System.
  • Root and non-root: typing at ok takes the system console, not a Solaris login. Running eeprom to change boot-file takes superuser or an equivalent role.

Insights and Best Practices

Safe usage

For tests and one-off boots, name the kernel on the ok boot line and leave boot-file alone. In most cases it is best to let boot pick its default from the system type, the hardware and firmware, and what is installed on the root file system. A changed boot-file can give unexpected results. Some forms of boot ignore it, so most production systems should not depend on it. This applies to most OpenBoot 2.x and 3.x systems, and some platforms differ.

boot cdrom normally takes no arguments, so it uses boot-file. If boot-file points to the 64-bit kernel and the install media holds only a 32-bit kernel, the boot fails. On older PROMs, boot net also took no arguments and used boot-file instead.

Some boxes must run the 32-bit kernel on every boot, for example when the only firewall module for that box is 32-bit. For those, setting boot-file is the way to make the choice stick. Record the change in the host's notes, and remember that every plain boot and every boot cdrom now uses it.

Alternatives

ok boot -a starts an interactive boot . -a means "ask me": boot asks for the name of the standalone and then passes -a on to it. The first prompt asks for the kernel file name. Type another kernel name, or press Return to accept the default shown in square brackets. The later prompts ask for the module directory, the system file, the root file system type and the root device. Press Return at each one to accept the default.

eeprom changes boot-file from a running shell, so you do not have to go to ok first.

Scripting and checking

After the boot, confirm which kernel is running:

1$ isainfo -kv
2$ isainfo -v
3$ isainfo -b
4% psrinfo -v | grep MHz
5# prtconf -vp | grep whoami

isainfo -kv shows the kernel type. On an UltraSPARC running the 32-bit kernel, isainfo -v prints only 32-bit sparc applications, so the box runs 32-bit applications only. On the 64-bit kernel it prints 64-bit sparcv9 applications and then 32-bit sparc applications. isainfo -b prints the number of bits that native applications support on the running system.

psrinfo -v | grep MHz shows the processor clock rate, which tells you whether the 200MHz rule applies. prtconf -vp | grep whoami shows the kernel that was booted.

What to log

  • The ok banner output, such as Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 333MHz). The reset banner also shows the PROM version, such as OpenBoot 3.15.
  • printenv boot-file, before and after any change.
  • The File and args: line from the console during the boot.
  • The isainfo -v output once the system is up.

When to Run This

  • A vendor ships a firewall, driver or replacement filesystem module only in a 32-bit version, and the host is an UltraSPARC I or II on Solaris 7, 8 or 9.
  • To test a new 64-bit build of a driver for one boot on a box that normally runs 32-bit.
  • Before an upgrade past Solaris 9, find out whether an UltraSPARC II still depends on 32-bit kernel modules. Those modules must be replaced with 64-bit versions.
  • After a test, go back to the default kernel with a plain ok boot.
  • When a box with a 200MHz-or-lower UltraSPARC comes up 32-bit and you need to know why.

Troubleshooting Common Issues

ok boot disk kernel/unix fails on a Sun Blade 100 or Sun Fire 280R. These models boot only the 64-bit kernel. Run ok banner to see the model and CPU, then check them against the hardware list in Key Points.

boot cdrom fails after someone changed boot-file. Run ok printenv boot-file. With boot-file set to the 64-bit kernel, a boot from media that holds only a 32-bit kernel fails. Any argument on the line bypasses boot-file, so ok boot cdrom -s does not use it.

A 32-bit module will not load. Run isainfo -kv. A 64-bit kernel needs 64-bit modules. Boot kernel/unix, or get a 64-bit version of the module.

The system will not come up after a boot-file change. Name the kernel on the line, for example ok boot disk kernel/sparcv9/unix. A file on the line overrides boot-file. If the disk still will not boot, use ok boot cdrom -s or ok boot net -s to reach single-user mode from media or the network.

The box boots 32-bit even though no file was named. Run psrinfo -v. At 200MHz or lower, Solaris 9 boots the 32-bit kernel by default until boot.conf allows the 64-bit kernel.

It is not clear which kernel booted. Read the File and args: line on the console, or run prtconf -vp | grep whoami.

References