Solaris: passing parameters from GRUB to the O/S

The problem with ramdisks is that each system ends up identical to each other. Hence you need a way to distinctly identify and pre-customize each system rather early in the boot process.

A clever way to do this is the MAC-address of the 1st network interface. This works nicely with Linux where the 1st network interface is always eth0. It doesn’t work as well in Solaris though for a couple of reasons:

  1. the network interface name depends on the NIC, i.e. e1000g0 for Intel NICs, bnx0 for Broadcom 1GbE, bnxe0 for Broadcom 10GbE ones etc.
  2. with Solaris the network interface and hence its MAC address is not visible with ifconfig until it is “plumbed”. And you can’t really expect the interface to be plumbed early in the boot process

Hence I considered a different approach. “With GRUB it is very easy to specify kernel and boot options in the boot menu“, so let’s go ahead, define a custom option in our menu.lst (which is centrally controlled by the DHCP/TFTPboot server) … :


# cat /tftpboot/menu.lst.01000C29A6B8E8
default=0
timeout=30
min_mem64 1024
title Solaris_10 Ramdisk
kernel$ /I86PC.Solaris_10-7/multiboot kernel/$ISADIR/unix -B hostname='random-hostname'
module$ /I86PC.Solaris_10-7/$ISADIR/ramdisk.img

… and read this option once the O/S boots. Easy enough. Only an hour or so later I couldn’t find any documentation on how to read my custom boot parameter.

[… clickety click …]

Turns out that the custom parameter is available using the prtconf command.


# prtconf -v /devices | sed -n '/hostname/{;n;p;}' |cut -f 2 -d \'
random-hostname

Easy to implement, hard to find out and remember.

Advertisements

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: