Adding Solaris Drivers to a Nexenta Installation

From Docupedia

Contents

Motivation

I have a few systems with an Adaptec AIC-7899 SCSI controller as their main disk controller on which I wanted to install Nexenta. The driver that supports these controllers (cadp160) is not yet open-sourced and is not available as a part of Nexenta. Luckily, Solaris Express still includes these closed-source parts of the operating system and we can "steal" the driver from the same Solaris Express build on which a Nexenta release is based.

I believe this instructions to be applicable to OpenSolaris builds as well, though there may be path changes.

Please email me (Tim Stewart) with comments or suggestions.

Procedure

In shell command examples you should type the text in bold.

Requirements

The procedure has only been tested with the cadp160 driver. It should work for other drivers of this type as well, though I have no way of testing since I don't have other hardware. You also must identify the PCI IDs of the hardware to associate with the driver. You can do this by looking at /etc/driver_aliases on a Solaris system that supports the driver, or using a tool like lspci on a Linux system. For our cadp160 example, the PCI IDs we care about are 8086,00cf and 9005,00cf. Note that leading zeros must be removed when using the add_drv command below.

We will assume that all work is being performed in a single directory. The procedure will use an environment variable called WORKDIR to represent this path. We also assume a bourne-compatible shell, and all work is done as the root user.

Materials Needed

You will need the following:

  • An x86 Solaris, Solaris Express, or Nexenta system to host your work, as you need several tools that come with these distros.
  • An ISO image of the Nexenta release to which you want to add drivers. Place this ISO file in WORKDIR. For the purposes of this procedure, we'll assume you're using Nexenta Core Platform, Beta 1, Test 3, which is based on Solaris Express build 68 (ncp_beta1-test3-b68_i386.iso).
  • An ISO image of the Solaris Express that matches the Nexenta release you're using. Place this file in WORKDIR. For this procedure, we'll use Solaris Express build 68 (sol-nv-b68-x86-v1.iso).

Create the new CD

  • Set workdir:
# WORKDIR=/export/home        # substitute your work directory here
# export WORKDIR
  • Make sure your ISO files are placed in WORKDIR.
  • Run the following commands to mount the ISO images and extract the miniroot images used to boot the system:
# cd $WORKDIR; mkdir nexentamnt; mkdir expressmnt; mkdir nexentaroot; mkdir expressroot
# mount -F hsfs `lofiadm -a $WORKDIR/ncp_beta1-test3-b68_i386.iso` $WORKDIR/nexentamnt
# mount -F hsfs `lofiadm -a $WORKDIR/sol-nv-b68-x86-v1.iso` $WORKDIR/expressmnt
# mkdir newiso && cd nexentamnt
# /usr/sfw/bin/gtar cf - .|(cd $WORKDIR/newiso; /usr/sfw/bin/gtar xvf -); cd $WORKDIR
# /boot/solaris/bin/root_archive unpack nexentamnt/platform/i86pc/miniroot nexentaroot
# /boot/solaris/bin/root_archive unpack expressmnt/boot/x86.miniroot expressroot
  • Copy the driver itself from the Solaris miniroot to the Nexenta miniroot, and register it with Nexenta:
# cp expressroot/platform/i86pc/kernel/drv/cadp160* nexentaroot/platform/i86pc/kernel/drv
# add_drv -b /export/home/nexentaroot -n -v -m '* 0600 root sys' \
  -i "\"pci8086,cf\" \"pci9005,cf\"" cadp160             # make *sure* PCI ID has no leading zeros
  • Add the cadp160 driver to the /etc/driver_classes file:
# cat >>nexentaroot/etc/driver_classes <<EOF
  cadp160 scsi
  EOF
  • Create a new miniroot file and burn a new CD. Note the -V optoin to mkisofs. Currently the Nexenta install CDs have a volume label of Elatte_InstallCD, and so we set it on the new ISO file. If this changes in the future, make sure the -V option reflects the new label:
# /boot/solaris/bin/root_archive pack miniroot.new nexentaroot
# cp miniroot.new newiso/platform/i86pc/miniroot
# mkisofs -o ncp_beta1-test3-b68_i386-stoo.iso -b boot/grub/stage2_eltorito \
  -c .catalog -no-emul-boot -boot-load-size 4 -boot-info-table \
  -relaxed-filenames -N -L -l -r -J -d -D -V Elatte_InstallCD newiso
  • Burn this ISO image to a CD and proceed to the next section.

Run the Installation

Start the installation using the new CD. Note: I think that something about the above mkisofs command breaks the screen session used to start the installation, and I haven't bothered to fix it yet. All you have to do is log in as root and run /usr/gnusolaris/nexenta-install.sh to get it to come up. Sorry, no Tetris this time!

The installation should see your drive controller now. Our work is not done, though; once the installation finishes, you must go to a shell and put the driver on your newly-installed system since it is not included in the normal installation.

Perform the following steps in a shell just after the installation, right before the first reboot (the installer should drop you to a shell once finished since we broke screen above--another reason I haven't fixed that issue):

  • Remount the new root filesystem on /a:
# mount -F zfs syspool/rootfs /a
  • Copy the driver from the Nexenta installer system to the newly installed system:
# cp /platform/i86pc/kernel/drv/cadp160* /a/platform/i86pc/kernel/drv
# add_drv -b /a -n -v -m '* 0600 root sys' \
  -i "\"pci8086,cf\" \"pci9005,cf\"" cadp160             # make *sure* PCI ID has no leading zeros
  • Add the cadp160 driver to the /a/etc/driver_classes file:
# cat >>/a/etc/driver_classes <<EOF
  cadp160 scsi
  EOF
  • Rebuild the boot archive:
# bootadm update-archive -R /a
  • Unmount /a and restart the system:
# cd / && umount /a
# reboot

Everything should come up as expected when you reboot the system! Enjoy.

References