=head1 NAME

B<genimage> - Generates a stateless image to be used for a diskless install.

=head1 SYNOPSIS

B<genimage>

B<genimage>  B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<--onlyinitrd>]  [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>]

B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] I<imagename>


B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]


=head1 DESCRIPTION

Generates a stateless and a statelite image that can be used to boot xCAT nodes in a diskless mode.  
If I<imagename> is not specified, the default packages included
(and excluded) in the image are specified by 

/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].pkglist and

/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].exlist. 

Additional packages that are not from the os distro can be specified in a 

/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].otherpkgs.pkglist file.

Customized package list files can be specified under /install/custom/netboot/<os> directory. The generated image will be put in /install/netboot/<osver>/<arch>/<profile> directory.

The newly generated image names will have the following format:

 for stateless: <osver>-<arch>-netboot-<profile>

 for statelite: <osver>-<arch>-statelite-<profile>

B<genimage> command will create them into I<linuximage> and I<osimage> tables.

If I<imagename> is specified, the package list file names are read from the I<osimage> table and I<linuximage> tables. 

If B<genimage> runs on the management node, both the I<osimage> table and I<linuximage> table will be updated with the given values from the options.

The B<genimage> command will generate two initial ramdisks for B<stateless> and B<statelite>, one is B<initrd-stateless.gz>, the other one is B<initrd-statelite.gz>.

After your image is created, you can chroot to the
image, install any additional software you would like, or make modifications to files, and then run the following command to prepare the image for deployment.

for stateless: B<packimage>

for statelite: B<liteimg>

Becides prompting for the input for some paramters, the B<genimage> command takes default quesses for the parameters not specified or not defined in the I<osimage> and I<linuximage> tables. It also makes default answers for questions from yum/zypper command when installing rpms into the image. Please use --interactive flag if you want yum/zypper command to prompt you for the answers.  

If B<--onlyinitrd> is specified, only regenerates the initrd for a stateless image to be used for a diskless install.

The B<genimage> command must be run on a system that is the same architecture and same distro with same major release version as the nodes it will be
used on.  If the management node is not the same architecture or same distro level, copy the contents of
/opt/xcat/share/xcat/netboot/<os> to a system that is the proper architecture, and mount /install from
the management node to that system. Then change directory to /opt/xcat/share/xcat/netboot/<os> and run ./genimage.


 
=head1 Parameters

I<imagename> specifies the name of a os image definition to be used. The specification for the image is storted in the I<osimage> table and I<linuximage> table.


=head1 OPTIONS

=over 12

=item B<-a> I<arch>

The hardware architecture of this node: x86_64, ppc64, x86, ia64, etc. If omitted, the current hardware architecture will be used.

=item B<-o> I<osver>

The operating system for the image:  fedora8, rhel5, sles10, etc.  The OS packages must be in
/install/<osver>/<arch> (use L<copycds(8)|copycds.8>).

=item B<-p> I<profile>

The profile (e.g. compute, service) to use to create the image.  This determines what package lists are
used from /opt/xcat/share/xcat/netboot/<os> to create the image with.  When deploying nodes with this image,
the nodes' nodetype.profile attribute must be set to this same value.

=item B<-i> I<nodebootif>

The network interface the diskless node will boot over (e.g. eth0).

=item B<-n> I<nodenetdrivers>

This argument is now optional, and allows you to specify the driver
modules needed for the network interface(s) on your stateless nodes.  If
you do not specify this option, the default is to include all recent IBM
xSeries network drivers.  

If specified, I<nodenetdrivers> should be a comma separated list of
network drivers to be used by the stateless nodes (Ie.: -n tg3,e1000).
Note that the drivers will be loaded in the order that you list them,
which may prove important in some cases.

=item B<-l> I<rootlimit>

The maximum size allowed for the root file system in the image.  Specify in bytes, or can append k, m, or g.

=item B<--onlyinitrd>

Regenerates the initrd for a stateless image to be used for a diskless install.


Regenerates the initrd that is part of a stateless/statelite image that is used to boot xCAT nodes in a stateless/stateli
te mode.
The generated initrd will be put in /install/netboot/<OS>/<arch>/<profile>.

The B<genimage --onlyinitrd> command will generate two initial ramdisks, one is B<initrd-statelite.gz> for B<statelite> mode, the other one is B<initrd-stateless.gz> for B<stateless> mode.

=item B<--permission> I<permission>

The mount permission of B</.statelite> directory for B<statelite> mode, which is only used for B<statelite> mode, and the default permission is 755.

=item B<-r> I<otherifaces>

Other network interfaces (e.g. eth1) in the image that should be configured via DHCP.

=item B<-k> I<kernelver>

Use this flag if you want to use a specific version of the kernel in the image.  Defaults to the first kernel found
in the install image.

=item B<-g> I<krpmver>

This flag is for SLES only. Use this flag to specify the rpm version for kernel packages in the image. It must be present if -k flag is specified in the command for SLES.

=item B<-m> statelite

This flag is for Ubuntu, Debian and Fedora12 only. Use this flag to specify if you want to generate statelite image. The default is to generate stateless image for these three operating systems. For others, this flag is invalid because both stateless and statelite images will be generated with this command.

=item B<--interactive> 

This flag allows the user to answer questions from yum/zypper command when installing rpms into the image. If it is not specified, '-y' will be passed to the yum command and '--non-interactive --no-gpg-checks' will be passed to the zypper command as default answers. 

=item B<--dryrun>

This flag shows the underlying call to the os specific genimage function. The user can copy and the paste the output to run the command on another machine that does not have xCAT installed.


=item B<-t> I<tmplimit>

(Deprecated) This flag allows the user to setup the /tmp and the /var/tmp file system sizes. This flag is no longer supported. You can overwrite any file system size using the .postinstall script where you can create a new /etc/fstab file. 


=item B<-v|--version>

Display version.

=item B<-h|--help>

Display usage message.

=back


=head1 RETURN VALUE

0 The command completed successfully.

1 An error has occurred.


=head1 EXAMPLES

=over 3

=item 1
To prompt the user for inputs:

  genimage

=item 2

To generate a fedora8 image for a compute node architecture
x86_64 and place it in the
/install/netboot/fedora8/x86_64/compute/rootimg directory:

  genimage -i eth0 -o fedora8 -p compute

=item 3

  genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute

=item 4

  genimage -i eth0 -n tg3,bnx2 -o sles11 -p compute --interactive

=item 5

  genimage -i eth0 -n igb,e1000e,e1000,bnx2,tg3 -o centos5.4 -p nfsroot --permission 777

=item 6

  genimage -i eth0 -n tg3 myimagename

=item 7

  genimage myimagename

=item 8

  genimage myimagename --interactive

=item 9

To regenerate the initrd for a fedora8 image for a compute node architecture x86_64 and place it in the /install/netboot/fedora8/x86_64/compute/rootimg directory:  change directory to /opt/xcat/share/xcat/netboot/fedora and run:

  genimage --onlyinitrd -i eth0 -n tg3,bnx2 -o fedora8 -p compute

=item 10

  genimage --dryrun  myimagename


=back


=head1 FILES

/opt/xcat/bin/genimage

/opt/xcat/share/xcat/netboot/<OS>/genimage


=head1 SEE ALSO

L<packimage(1)|packimage.1>, L<liteimg(1)|liteimg.1>
