Creating self contained jumpstart / flash install DVD

From: Mark Sturtevant (google_at_thesturt.com)
Date: 05/14/03


Date: 13 May 2003 22:15:04 -0700

I am posting this to help out anyone attempting to create a standalone
install DVD, this worked for me very well and with DVD media it
could be a very useful tool for anyone looking to do a hands off
install when a jumpstart server cannot be used.

Creating a self contained Solaris DVD install for Solaris 8 or 9

1) First you will need to setup a Solaris flash (flar) image. See the
Sun Blueprints document "WebStart Flash" by John Howard & Alex
Noordergraaf, November 2001 online issue for more information.

2) Next you will need a Solaris DVD, for this document I will be using
a Solaris 9 DVD. Note: You can use Solaris 9 to install a flash image
of Solaris 8 as well. We will be coping the DVD, it's vtoc and all
slices. Keep in mind that we will not want to change the vtoc of the
DVD just to be safe. We will be using dd, cpio, mkisofs, cat,
prtvtoc, DVD burning software and a DVD burner to create your image. I
used DVD-R media as I was unsure of support for DVD+R on Sun drives.

  Also for more good information on this subject, see the Sun
Blueprints document "Customizing JumpStart Framework for Installation
and Recovery", by John Howard & Alex Noordergraaf, August 2002 online
issue. Most of what is below comes from that document, same concept
just different media. You can find all the Blueprints archives at
http://www.sun.com/blueprints

3) First you will want to copy the contents of slice 0 before turning
off volume management (or mount the DVD manually if it's not being
used):

        # mkdir /local-filesystem/s0
        # cd /cdrom/cdrom0/s0
        # find . -print |cpio -pudm /local-filesystem/s0

Remove anything not needed from slice 0 to make room for your new
flash image, you should be able to remove the following as needed:

        # rm -rf s0/1of2_Doc_CD
        # rm -rf s0/2of2_Doc_CD
        # rm -rf s0/SW_Supp_CD
        # rm -rf s0/Solaris_9/ExtraValue
        # rm -rf s0/Solaris_9/EarlyAccess
        
        Note: You only need to remove enough to allow for the flash image, if
you need more space you can also remove the Solaris 9 packages from
s0/Solaris_9/Product, there is no need to remove more than you need as
the DVD needs to stay the same size, the more that is removed just
needs more padding later in the process.

Turn off volume management so you can use dd to copy the slices we do
not need to modify:

        # /etc/init.d/volmgt stop

   Copy the DVD vtoc:
        
        # dd if=/dev/dsk/c0t6d0s1 of=sol9.dvd.vtoc bs=512 count=1

Since you will need to know the size of slice 0 later save a printout
of the DVD vtoc:

        # prtvtoc /dev/dsk/c0t6d0s0 > /local-filesystem/sol9.vtoc.txt
        
*Partition Tag Flags Sector Count Sector Mount Directory
       0 4 10 0 5532800 5532799
                                   ^^^^^^^
        Make note of the sector count for slice 0 as the rest of the
        DVD will remain the same.

Now take a copy of slice 1 - 5 using dd, here is what they contain:

        Slice 1: the generic kernel and is the (root) directory
        Slice 2: boot for sun4c
        Slice 3: boot for sun4m
        Slice 4: boot for sun4d
        Slice 5: boot for sun4u & sun4us

        # for SLICE in 1 2 3 4 5
> do
> dd if=/dev/dsk/c0t6d0s${SLICE} of=sol9.s${SLICE} bs=512
> done
        1036800+0 records in
        1036800+0 records out
        2560+0 records in
        2560+0 records out
        2560+0 records in
        2560+0 records out
        2560+0 records in
        2560+0 records out
        2560+0 records in
        2560+0 records out

4) Next you need to modify slice 0 and put your flash image(s) on it:

  a) Copy over the new flash image that you would like to use for
installs:

        # cp /path/to/sol8.flar /local-filesystem/s0

  b) Add a new profile that uses the new flash image and create a new
rules.ok file so that it can be used:

        # cd /local-filesystem/s0/.install_config
        # cp ../Solaris_9/Misc/jumpstart_sample/check .
        # vi new-server.profile

        install_type flash_install
        archive_location local_file /cdrom/sol8.flar
        partitioning explicit
        filesys rootdisk.s0 free /
        filesys rootdisk.s1 16384 swap
        filesys rootdisk.s6 6144 /var
        
        # mv rules.ok rules.ok.orig
        # vi rules

        any - - new-server.profile -

        # ./check
        Validating rules...
        Validating profile new-server.profile...
        The custom JumpStart configuration is ok.

  c) Now edit the s0/Solaris_9/Tools/Boot/usr/sbin/install.d/profind
file so that your new DVD will install using the new flash image:
        
        # cd /local-filesystem/s0/Solaris_9/Tools/Boot/usr/sbin/install.d/
        # cp profind profind.orig
        # vi profind

cdrom()
{

    if [ -f /tmp/.preinstall ]; then
        mount -o ro -F lofs ${CD_CONFIG_DIR} ${SI_CONFIG_DIR}
>/dev/null 2>&1

        if [ $? -eq 0 ]; then
            verify_config "defaults" "CDROM"
        fi
    fi
# Start of edit
        gettext "<<< using CD default >>>";echo
        rmdir ${SI_CONFIG_DIR}
        ln -s /cdrom/.install_config ${SI_CONFIG_DIR}
        exit 0
# End of edit
}

   For what I needed to do I wanted the install to prompt for things
like timezone, IP address, netmask, root password, etc. If you wish
to have a completely hands off install you can mount up slice 1
read-write and modify the sysidcfg file using lofiadm. This is
possible as slice 1 is a UFS filesystem, none of the other slices can
be modified in this fashion.

   Note: I did not test this step but it should work, just keep in
mind it may not be 100% correct.

        # lofiadm -a /local-filesystem/sol9.s1
        /dev/lofi/1
        # mount /dev/lofi/1 /mnt
        # cd /mnt/etc
        # mv sysidcfg sysidcfg.orig
        # vi sysidcfg

        system_locale=en_US
        timezone=US/Central
        timeserver=192.168.1.60
        root_password=GZMmGcnI..J1g
        name_service=NIS {domain_name=my.domain.com}
        network_interface=primary {netmask=255.255.255.0
                                    protocol_ipv6=no}
        security_policy=none
        terminal=vt100

        # cd /
        # umount /mnt
        # lofiadm -d /dev/lofi/1

   If you would like to have it grab it's own IP address you can also
add a /etc/ethers (or NIS,NIS+ ethers map) and an entery into a hosts
file just as you would do for Jumpstarting a system, it will pick it
up when booting from the DVD.
   
5) Take the modified slice 0 directory and convert it to a HSFS
filesystem:

        mkisofs -R -d -L -l -o sol9.s0.pre `pwd`/s0

6) Use dd to get rid of the first block so you can put the vtoc back:

        # dd if=sol9.s0.pre of=sol9.s0 bs=512 skip=1
        4681215+0 records in (this number is needed for the next step)
        4681215+0 records out

  Go ahead and remove the sol9.s0.pre file as we no longer need it:
        
        rm sol9.s0.pre

7) Since we do not want to modify the vtoc we will need to create a
pad to put between slice 0 and slice 1.

        Take the original sector count for slice 0 from the prtvtoc you took
before and subtract the vtoc record and the size of the new slice 0
that was just created:

        # bc
        5532800 - (4681215+1)
        851584

        Now create a pad file using this record count, this will preserve
the validity of the DVD's vtoc, remember that you are only changing
slice 0 of the DVD, the vtoc and other slices must stay intact for
this procedure to work correctly.

        # dd if=/dev/zero of=sol9.pad bs=512 count=851584
        851584+0 records in
        851584+0 records out

8) Now you are ready to put the DVD image (ISO) back together:

        # cat sol9.dvd.vtoc sol9.s0 sol9.pad sol9.s1 sol9.s2 sol9.s3 sol9.s4
\
        sol.s5 > custom_sol9.iso

That's it, you are now ready to burn your new install DVD, this can be
done with any DVD burning software that understands this type of
image.

9) When installing the system with this DVD, all you will need to do
is boot the system with the following options:

        # boot cdrom - install