Hi,

There are two cases where you need to know the location of the Solaris slice (root or otherwise)

1. To locate the GRUB menu:

The slice and fdisk parttion are encoded into stage2 of GRUB so it know which slice contains the GRUB menu.
This is true for both UFS and ZFS


2. To locate the "unix" module and the boot_archive. Note that the root slice is *always* the slice that contains unix and boot_archive

This is in the GRUB menu entry. Specified by findroot() alone in the UFS case and by findroot and bootfs in the ZFS case. ZFS needs to extra step because findroot only specifies the pool and you need either an explicit bootfs or the bootfs property
set in the pool.

pygrub appears to be a OSOL only utility. If you try SXCE (use prtvtoc/fmthard to remove the root tag) it will boot just fine.

Vikram



John Levon wrote:
On Wed, Sep 16, 2009 at 04:09:19PM -0700, Vikram Hegde wrote:

Actually when newboot i.e. GRUB boot was introduced we did away with the requirement that root slice needs to have the "root" tag and I booted Solaris all the time without the root tag. AFAIK this is still true with SXCE. I dont know if beadm (or Opensolaris) has reintroduced this requirement.

pygrub requires it (see below). If I don't have the tag, how do I know
which slice contains the root?

regards
john


def get_solaris_slice(file, offset):
    """Find the root slice in a Solaris VTOC."""
    buf = fsimage.get_disk_data(file, (offset + (DK_LABEL_LOC * SECTOR_SIZE)), 
512)

    if struct.unpack("<H", buf[508:510])[0] != DKL_MAGIC:
        raise RuntimeError, "Invalid disklabel magic"

    nslices = struct.unpack("<H", buf[30:32])[0]

    for i in range(nslices):
        sliceoff = 72 + 12 * i
        slicetag = struct.unpack("<H", buf[sliceoff:sliceoff+2])[0]
        slicesect = struct.unpack("<L", buf[sliceoff+4:sliceoff+8])[0]
        if slicetag == V_ROOT:
            return slicesect * SECTOR_SIZE

    raise RuntimeError, "No root slice found"

_______________________________________________
xen-discuss mailing list
xen-discuss@opensolaris.org

Reply via email to