From time to time you might want to modify an imaging distribution by adding your own files. These can be additional programs, scripts, data files, or updated Linux drivers.
You can use the following methods to update imaging resource files:
The easiest method is to edit the settings.txt file, which is located on the root of the imaging CD or in /srv/tftp/boot on the ZENworks Imaging server for PXE booting.
Where you are using a ZENworks partition, you can boot to the manual or maintenance mode, mount the ZENworks partition, then copy the modified settings.txt and the files in initrd or root to the mounted ZENworks partition.
Another easy method is to edit the .cfg files located in /srv/tftp on the ZENworks Imaging server for PXE booting. This method is only available for Linux imaging servers, because the configuration files are provided by Novell’s version of PXE.
You can modify files in the initrd or root file systems, but you need a Linux environment for performing the modification process. Files required during the initial setup (during linuxrc processing time), such as LAN drivers, must be placed in the initrd file system. Other files that are not needed until the zenworks.s script file takes control can be placed in the root file system (for example, an imaging script).
This method is discussed in this section.
The following sections provide various methods for modifying imaging resource files:
If you have files to add to an imaging boot CD so they can be available for use when you get to the actual imaging process (such as scripts, but normally not driver modules), you can copy the files to the /addfiles directory on the imaging CD. This is an easy way to insert your script or other files into the distribution without modifying the initrd or root file systems. However, these files are not available during the boot and module loading phases.
The imaging boot CD has a directory named /addfiles where you can add files. They should be placed below this directory in their proper directory names. They are then available in this directory structure during the imaging process.
An example of how you can add files:
If you want to execute your own script instead of the normal imaging process, create a script file named myscript.s and place it on the boot CD. For example, /addfiles/bin/myscript.s.
IMPORTANT:The script file must have proper LF line terminators that Linux requires, not the DOS CR and LF end-of-line characters. In other words, you cannot use Notepad.exe to create the script; you must use a text editor compatible with Linux, such as TextPad.
To place the following line in the settings.txt file, enter:
export IMGCMD=/bin/myscript.s
When imaging is run, it runs /bin/myscript.s instead of using the normal img auto command.
This is the preferred method for updating imaging resource files, and must be performed in a Linux environment.
Before performing the procedure given below, make sure you have created backup copies of any files you plan to change, specifically the /srv/tftp/boot/initrd file. If you want to change the files on an imaging CD, you need an ISO editor or some other process for extracting and replacing the file in the bootcd.iso image file.
IMPORTANT:When updating or adding files and Linux drivers in the initrd or root file systems, document the changes you make. When you receive updated resource files from Novell, they do not contain your customized changes. If the kernel version has changed with the newer resource files from Novell, previously added drivers must be updated either by obtaining a new version from the manufacturer or recompiling the driver using the correct Linux kernel version source.
To modify the initrd file system:
Using a Linux device, create a working directory and change to that directory.
To copy initrd from the PXE server or the boot CD to the new working directory:
For PXE, copy /tftp/boot/initrd to the Linux workstation’s working directory.
For the CD, extract initrd from the /boot/i386/loader directory on the boot CD, then copy the extracted initrd to the Linux workstation’s working directory.
To rename initrd to initrd.gz, enter:
mv initrd initrd.gz
To unzip the initrd.gz file, enter:
gunzip initrd.gz
To create another working directory for use as a mount point in the subsequent steps, enter:
mkdir work
cd work
To extract initrd into the /work directory, enter:
cpio -idmuv < ../initrd >/dev/null 2>&1
To copy your files or updated driver to the extracted initrd file system, enter:
cp /your_path/module.ko work/lib/modules/2.6.5-override-default/initrd
where your_path is the path to the module.ko file and module is the name of the module.
Other files to be included in the initrd file system should be copied to the appropriate directory.
To re-package the initrd file system, enter:
cd work
find . | cpio --quiet -o -H newc > ../initrd
cd ..
To zip the new initrd file, enter:
gzip -v9c initrd > initrd.gz
To rename initrd.gz back to initrd, enter:
mv initrd.gz initrd
To copy the file back:
For PXE, copy the updated initrd file to the /tftp/boot directory on the PXE server.
For the CD, copy the updated initrd file to the /boot/i386/loader directory on the boot CD.
To modify the root file system:
Using a Linux device, create a working directory and change to that directory.
To copy root from the PXE server or the boot CD to the new working directory:
For PXE, copy /tftp/boot/root to the Linux workstation’s working directory.
For the CD, extract root from the /boot/i386/ directory on the boot CD, then copy the extracted root to the Linux workstation’s working directory.
To rename root to root.gz, enter:
mv root root.gz
To unzip the root.gz file, enter:
gunzip root.gz
To create another working directory for use as a mount point in the subsequent steps, enter:
mkdir work
To mount the root file system to the /work directory, enter:
mount -o loop root work
To copy your files or updated driver to the mounted root file system, enter:
cp /your_path/module.ko work/lib/modules/2.6.5-override-default/root
where your_path is the path to the module.ko file and module is the name of the module.
Other files to be included in the root file system should be copied to the appropriate directory.
To unmount the root file system, enter:
umount work
To zip the new root file, enter:
gzip -v9c root > root.gz
To rename root.gz back to root, enter:
mv root.gz root
To copy the file back:
For PXE, copy the updated root file to the /tftp/boot directory on the PXE server.
For the CD, copy the updated root file to the /boot/i386/ directory on the boot CD.