====== Booting OpenSolaris Live image over PXE ======
===== Based on OpenSolaris 2008.05 LiveCD =====
The following is based on the work documented at
* http://blog.buttermountain.co.uk/2008/05/24/pxe-net-booting-open-solaris-200805-release/
That URI is at time of writing not available, I picked it up using google cache at:
* http://www.google.com/search?q=cache:PD-vHliCBo8J:blog.buttermountain.co.uk/2008/05/24/pxe-net-booting-open-solaris-200805-release/
My edit/change from that document, is a hardcoded NFSv3 mount in the miniroot,
as opposed to the suggestion in the original document; disabling NFSv4 on the
server. This is simply because disabling NFSv4 on my Debian Etch server
was never an option.
Assuming the following:
* tftpd is installed and serving, examples use /tftpboot as the root of tftp.
* pxelinux is installed on the tftp server, and is used to chain-load pxegrub.
* nfs is using /srv/exports as a valid mountpoint.
* You are able to install opensolaris, or have a running solaris install, this will be used to make modifications to the Solaris live-miniroot... (Solaris calls this microroot, and gives it a prefix related to arch)
* Your opensolaris Live-CD, or ISO thereof, is mounted as /mnt/cdromimage
First, copy all needed grub/pxegrub related files. This is needed because
pxelinux is not able to boot opensolaris.
mkdir /tftpboot/boot
cp -av /mnt/cdromimage/boot/grub/pxegrub /tftpboot/boot/grub
Next, get the microroot and the platform-related files from the CD.
I havent experimented too much with this, but using the safe route of
keeping things as close to the root of the tftp is safe..
Note: We will patch and replace the x86.microroot later...
mkdir /tftpboot/solaris
cp /mnt/cdromimage/boot/x86.microroot /tftpboot/solaris/
cp -av /mnt/cdromimage/platform/ /tftpboot/solaris/platform/
Now, set up pxelinux-pxegrub chaining. pxegrub works with the layout
that we set up previously, that is having the grub distribution at
tftp:server/boot/grub/, including the menu.lst file.
pxelinux on the other hand, needs the pxegrub file itself to
be located at the root of tftp, with a name ending with .0
cp /tftpboot/boot/grub/pxegrub /tftpboot/pxegrub.0
vim /tftpboot/boot/grub/menu.lst
default=0
timeout=60
timeout=3
title Open Solaris PXE Install
kernel$ /solaris/platform/i86pc/kernel/unix -m verbose -B install_server=[ip of your nfs server]:/srv/export/opensolaris/
module /solaris/x86.microroot
vim /tftpboot/pxelinux.cfg/default
label g
menu label ^A PXEGrub
kernel pxegrub.0
Note that the lines described in menu.lst is all that is needed, whereas
the lines for pxelinux.cfg will need to be added to your existing
pxelinux.cfg setup. You may, if you wish, put this in a separate menu
or something like that. I have these three lines as part of
my "pxelinux.cfg/live.menu", a syslinux-menu with multiple boot options
of varions Live-media.
Initially I had the following line in the pxegrub menu.lst, but as I was
unable to debug a failure with prtconf on amd64, I went with the easy
route: forcing the kernel to 32bits, and thereby removing the problem.
Hack, yes, but it worked. The previous line was:
kernel$ /solaris/platform/i86pc/kernel/$ISADIR/unix -m verbose -B install_server=[ip of your nfs server]:/srv/export/opensolaris/
NOW, we need an already installed copy of Solaris to modiy the microroot image..
Boot, become root, copt the x86.microroot image file from the install CD, and then:
Rename the x86.microroot to x86.microroot.gz (it is a gzipped UFS image), and
decompress it. Then set up a loop-file dev-node to mount, and mount it.
mv x86.microroot x86.microroot.gz;gunzip x86.microroot.gz
lofiadm -a /path/to/x86.microroot /dev/lofi/1
mkdir /mnt/microroot
mount /dev/lofi/1 /mnt/microroot
We need to add some essential tools to get our little magic to work...
cp /usr/sbin/prtconf /mnt/microroot/usr/sbin/
cp /usr/sbin/i86/prtconf /mnt/microroot/usr/sbin/i86/
cp /usr/bin/cut /mnt/microroot/usr/bin/
cp /usr/bin/sed /mnt/microroot/usr/bin
cp /usr/sbin/svcadm /mnt/microroot/usr/sbin
Now, patch the method that loads/mounts the root filesystem using our new tools..
vim /mnt/microroot/lib/svc/method/live-fs-root
Find the following line:
echo "\rPreparing live image for use" >/dev/msglog
After that line, add the following hack/patch:
# grab the install_server setting from boot
install_server=`/usr/sbin/prtconf -v /devices|/usr/bin/sed -n '/install_server/{;n;p;}'|/usr/bin/cut -f 2 -d\'`
echo Install server is set as $install_server >/dev/msglog
# Awful hack - configure dhcp for all the plumbed interfaces
/sbin/ifconfig -a dhcp
# now mount the install server onto /.cdrom
# This is an even uglier hack to get around
# Linux/Solaris NFSv4 incompatibillities
/sbin/mount -F nfs -o vers=3 $install_server /.cdrom
echo Mounted $install_server using NFSv3 >/dev/msglog
(note: The bit that was giving me trouble in amd64, and made me force
a 32bit kernel, was the prtconf-command in this snippet...
When running a 64bit kernel, prtconf -v /devices returns the error:
prtconf: devinfo facility not available
If anyone knows how to get around this in the microroot, so that 64bit
can be used, I would really like to know...)
After completing the edit, our patching is done. Unmount, pack and rename the microroot:
umount /mnt/microroot
lofiadm -d /dev/lofi/1
gzip /path/to/x86.microroot
mv /path/to/x86.microroot.gz /path/to/x86.microroot
And transfer the microroot image to your TFTP server, replacing
our previous copy at /tftpboot/solaris/x86.microroot.
On the NFS server, we need a copy of the Live-CD contents, at the path used in
the /tftboot/boot/grub/menu.lst..
cp -av /mnt/cdromimage/ /srv/export/opensolaris
That should do it. At leas it was what was needed in my case. A lot of steps
are left out here, seeing as I already had a fairly complex tftp/pxelinux/menu/nfs
setup. See my other, related, documents on how I have set up my PXE Live/Install tank.