I have finally got my hands on some SPARC gear, and I am making use of it by documenting the crap out of it. So after I got the ILOM situation sorted out I noticed that the OS itself wasn’t starting up, and I was just ending up at a prompt that looks like this.
{0} ok
This is the OK Prompt, some systems will display ok> and this is how I will refer to it in subsequent examples. So lets dig in.
What is OpenBoot PROM?
The OpenBoot PROM (OK Prompt) is a boot monitor which allows us to interact with the boot environment, we can use it to pass different boot parameters. We can use it to select a boot device, boot into various modes (verbose, single user, reconfigure). There is much more to it then this, look up Open Firmware for more information.
Why am I Stuck at the OK Prompt?
Now in my situation, the system was not even attempting booting up. That is because on this particular system auto_boot was disabled. This can be seen by printing the environment…
ok> printenv Variable Name Value Default Value ... auto-boot? false true ...
Now in my case that is fine. I don’t want this to boot automatically, but I still need to boot it, but before we do lets check our boot order.
Configuring Boot Devices
ok> printenv boot-device boot-device = disk net
We can change this easily enough if it is incorrect. For example if we wanted to add a cdrom, but after the disk.
ok> setenv boot-device disk cdrom net
ok> printenv boot-device boot-device = disk cdrom net
But I don’t want to have a cdrom as part of the boot order, so instead I would rather boot up the device as an override.
Manually Select a Boot Device
ok> boot cdrom
This can also be done against any other device which is bootable, for example another disk. But first lets find out what exactly we have for disks.
View Disks
ok> show-disks a) /pci@400/pci@2/pci@0/pci@f/pci@0/usb@0,2/hub@2/hub@3/storage@2/disk b) /pci@400/pci@2/pci@0/pci@4/scsi@0/disk c) /pci@400/pci@1/pci@0/pci@4/scsi@0/disk d) /iscsi-hba/disk q) NO SELECTION Enter Selection, q to quit: q
So we can see here we have 2 disks:
/pci@400/pci@1/pci@0/pci@4/scsi@0/disk
/pci@400/pci@2/pci@0/pci@4/scsi@0/disk
Now with this information, we still haven’t made the connection between our boot-device which is “disk cdrom net” in order to define these names we need to look at devalias.
Just Call me Disk. A Lesson in aliases.
Devalias allows us to define names for our devices, which can be more easily referred to. Below is trimmed for brevity.
ok> devalias ... net0 /pci@400/pci@2/pci@0/pci@6/network@0 net /pci@400/pci@2/pci@0/pci@6/network@0 ... disk4 /pci@400/pci@2/pci@0/pci@4/scsi@0/disk@p0 cdrom /pci@400/pci@2/pci@0/pci@4/scsi@0/disk@p6 ... disk0 /pci@400/pci@1/pci@0/pci@4/scsi@0/disk@p0 disk /pci@400/pci@1/pci@0/pci@4/scsi@0/disk@p0 ...
Now when we look at this output we notice a few things.
1) @p0 on disks – I believe this refers to partitions on the disk. p0 being the whole disk.
2) Multiple aliases to the same underlying device, case in point disk and disk0 as well as net and net0.
So we can create aliases to denote a primary and a mirror disk on our two disks.
ok> devalias primary /pci@400/pci@1/pci@0/pci@4/scsi@0/disk@p0 ok> devalias mirror /pci@400/pci@2/pci@0/pci@4/scsi@0/disk@p0 ok> devalias mirror /pci@400/pci@2/pci@0/pci@4/scsi@0/disk@p0 primary /pci@400/pci@1/pci@0/pci@4/scsi@0/disk@p0 ...
Important to note that when you create an alias using devalias it doesn’t get committed, and will disappear after a reboot… If you need a persistent alias, use nvalias.
ok> nvalias primary /pci@400/pci@1/pci@0/pci@4/scsi@0/disk@p0 ok> nvalias mirror /pci@400/pci@1/pci@0/pci@4/scsi@0/disk@p0
Then of course we can change our boot-device to reflect this.
ok> setenv boot-device primary mirror
Now at some point you might need to remove an alias.
ok> nvunalias mirror nvunalias primary
To finalize the removal, we need to reset the machine.
ok> reset-all
There is much more to the OK prompt, but this ought to get you started. Enjoy.