65.4 Modifying ZENworks Imaging Resource Files

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 following sections provide various methods for modifying imaging resource files:

65.4.1 Adding Files to an Imaging Boot CD

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:

  1. 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.

  2. 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.

65.4.2 Adding Files to the Initrd or Root File Systems

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.

Adding to Initrd

To modify the initrd file system:

  1. Using a Linux device, create a working directory and change to that directory.

  2. 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.

  3. To rename initrd to initrd.gz, enter:

    mv initrd initrd.gz
    
  4. To unzip the initrd.gz file, enter:

    gunzip initrd.gz
    
  5. To create another working directory for use as a mount point in the subsequent steps, enter:

    mkdir work
    
    cd work
    
  6. To extract initrd into the /work directory, enter:

    cpio -idmuv < ../initrd >/dev/null 2>&1
    
  7. 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.

  8. To re-package the initrd file system, enter:

    cd work
    
    find . | cpio --quiet -o -H newc > ../initrd
    
    cd ..
    
  9. To zip the new initrd file, enter:

    gzip -v9c initrd > initrd.gz
    
  10. To rename initrd.gz back to initrd, enter:

    mv initrd.gz initrd
    
  11. 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.

Adding to Root

To modify the root file system:

  1. Using a Linux device, create a working directory and change to that directory.

  2. 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.

  3. To rename root to root.gz, enter:

    mv root root.gz
    
  4. To unzip the root.gz file, enter:

    gunzip root.gz
    
  5. To create another working directory for use as a mount point in the subsequent steps, enter:

    mkdir work
    
  6. To mount the root file system to the /work directory, enter:

    mount -o loop root work
    
  7. 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.

  8. To unmount the root file system, enter:

    umount work
    
  9. To zip the new root file, enter:

    gzip -v9c root > root.gz
    
  10. To rename root.gz back to root, enter:

    mv root.gz root
    
  11. 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.