12 December 2010

BIOS Boot Device - Solaris

In 'Host Info - Boot Parameters', we saw how the boot device on Solaris
could be identified using 'prtconf'.  The output was similar to:
        boot-device:    '/pci@1e,600000/ide@d/disk@0,0:a
While similar output to the above should exist on any SPARC platform,
on x86 'prtconf' may leave you wanting, returning a result like:
        snorkle [0] /usr/sbin/prtconf -vp | /usr/bin/egrep 'boot(args|-command|-device)'
            bios-boot-device:  '80'
By itself, this isn't very useful.  So how do we relate this to something
that Solaris can identify?  One could run 'prtconf -v', pipe it to a
pager like 'less' or 'more', and sift through searching for 'boot'.
This would produce output such as:
        snorkle [0] /usr/sbin/prtconf -v | /usr/bin/less
                name='bootpath' type=string items=1
            Hardware properties:
                name='bios-boot-device' type=string items=1
We could then assume BIOS device '0x80' translates to
'/pci@0,0/pci1000,8000@14/sd@0,0:a'.  On Solaris 10 x86, installed in
pkg SUNWcsr, 'biosdev' verifies our assumption:
        snorkle [0] /sbin/biosdev
        0x80 /pci@0,0/pci1000,8000@14/sd@0,0
        0x81 /pci@0,0/pci1000,8000@14/sd@1,0
From there, it's just a matter of figuring out the 'ctd' that resolves
to the identified device path.  You could use 'ioDev' to figure this out:
        snorkle [0] /usr/local/bin/ioDev -x
                                      -- ioDev v1.7 --                              
                                    snorkle: i386, i86pc                            
        Disk Device               IO Ident   Phys Device          Bus Speed         
        c0t0d0                    sd1        DVD/CDROM                                       
        c1t0d0                    sd0        Disk 1                                       
        c1t1d0                    sd4        Disk 2                                       
You can also manually identify it:
        snorkle [0] /usr/bin/ls -l /dev/rdsk/c*p0 | /usr/bin/awk '{print $9, $11}'    
        /dev/rdsk/c0t0d0p0 ../../devices/pci@0,0/pci-ide@1,1/ide@0/sd@0,0:q,raw
        /dev/rdsk/c1t0d0p0 ../../devices/pci@0,0/pci1000,8000@14/sd@0,0:q,raw
        /dev/rdsk/c1t1d0p0 ../../devices/pci@0,0/pci1000,8000@14/sd@1,0:q,raw
Stripping off '/dev/rdsk/' and 'p0' from the first column, we have
0x80 referencing:
Based on code released from opensolaris.org, BIOS identified drives
start numbering with 0x80, incrementing by 1 for each subsequent device.
By this logic, 0x80 is the first identified disk, 0x81 is the second,
and so on.  This gets presented to 'grub' by stripping off '0x8'
(or simply 8), thus:
            bios-boot-device:  '80'
is the first identified disk, which 'grub' sees as disk 0.  So to tie
all of the above together, we get:
        bios dev        grub disk       ctd     devic path
        0x80            0               c1t0d0  /pci@0,0/pci1000,8000@14/sd@0,0
        0x81            1               c1t1d0  /pci@0,0/pci1000,8000@14/sd@1,0
Also released from opensolaris.org is 'create_diskmap.ksh', which
effectively takes the same steps above and simply automates it into a
script, with the output directed to '/var/run/solaris_grubdisk.map'.
The following is a sample of this output:
        snorkle [0] /usr/bin/cat /var/run/solaris_grubdisk.map
        0 c1t0d0 /pci@0,0/pci1000,8000@14/sd@0,0
        1 c1t1d0 /pci@0,0/pci1000,8000@14/sd@1,0
A local copy of 'create_diskmap.ksh' is available here.

No comments: