My Favorites

Close

Please to see your favorites.


How to build a custom block-based Linux kernel driver

This document (7005873) is provided subject to the disclaimer at the end of this document.

Environment

PlateSpin Protect 10.x
PlateSpin Forge 3.x
PlateSpin Migrate 9.x

Situation

The PlateSpin blkwatch module must be built for the specific kernel running on the Linux system. PlateSpin products come with pre-compiled versions of the blkwatch module for all non-debug kernels (both 32 and 64 bit ) of the following Linux distributions:

- RedHat Enterprise Linux 4 (including updates 1-8)
- RedHat Enterprise Linux 5 (including updates 1-5)
- SUSE Linux Enterprise Server 10 (including service packs 1-3)
- SUSE Linux Enterprise Server 11 (including service pack 1. service pack 2 is included if using Forge 3.3 HotFix 2 or Protect 10.3 HotFix 2) 

Machines that run a Linux kernel not shipped by the vendor for distributions listed above are not supported by the supplied versions of the blkwatch module. However, it is possible to recompile the blkwatch module for systems that are running any of the supported distributions with a non-standard kernel (user-built or debug). To use the blkwatch module with such kernels, it must be recompiled for the specific (source workload) kernel and incorporated back into the PlateSpin product.

Resolution

On the PlateSpin server, navigate to the Platespin application's installation directory, as applicable to the environment:
   
 C:\Program Files\PlateSpin Migrate Server
 C:\Program Files\PlateSpin Protect Server
 D:\Program Files\PlateSpin Forge Server
 
1. Open the '.\Packages\9D470BFF-E30F-4015-83D8-4D308A8C8B1B' folder and copy the file named '1.package' (or '2.package', if using Forge 3.3 HotFix 2 or Protect 10.3 HotFix 2) out of the folder.

2. Rename 1.package file with .zip extension (1.zip). Create a temporary folder at any location (e.g. 'C:\Temp\blkwatch') and extract the contents of  1.zip file to this temporary folder.

3. Use ssh or a usb key to copy the 'src' subfolder to the Linux machine that is capable of building modules for the specific kernel. To build modules for a specific kernel, it is required that both a kernel development package (kernel-devel for RHEL or kernel-source for SLES) for the corresponding target kernel and a gcc compiler be installed on the linux machine.

4. Navigate to the 'src' directory on the Linux machine and run the following command:

make

This will produce a blkwatch.ko file in the 'src' directory.

5. Run the following command to get the release string of the kernel:

uname -r

6. Go back to the PlateSpin server and create a subfolder in the temporary folder where the package file was unpacked (as in step 2). For the subfolder name, use the following naming convention:

CustomKernel-<release string>-<architecture>
***It is important that the naming of the subfolder is done exactly as stated above (with hyphen sign)***
 
Replace <release string> with the actual string you obtained in step 5 and <architecture> with 'x86' for 32-bit platforms or with 'x86_64' for 64-bit platforms.
Note: The release string may contain an architecture, like this:
2.6.32.54-0.3.el6.x86_64

In that case the folder name will look like this:

CustomKernel-2.6.32.54-0.3.el6.x86_64-x86_64

7. Copy the blkwatch.ko produced in step 4 to the subfolder created in step 6.

8. Compress the contents of temporary folder (see note below in bold) using the .ZIP target format. Make sure that the compressed file contains all the folders that were unpacked in step 2, in addition to the new one created in step 6. Rename the new archive to '1.package' (replace .zip extension with .package).

***Make sure to archive the contents within the temporary folder, NOT the temporary folder itself.  If the folder is archived it will create an additional layer in the package, causing no block-based components to be found***

9. Copy the '1.package' file produced above to the original folder ('C:\Program Files\PlateSpin Migrate Server\Packages\9D470BFF-E30F-4015-83D8-4D308A8C8B1B') as in step 1. The custom kernel module is now installed and ready for use.
 
10. Remove the /usr/lib/ofx/packages/0/9d470bff-e30f-4015-83d8-4d308a8c8b1b directory from the source workload.

Additional Information

When building the blkwatch.ko file output similar to the following should be seen:
 
make -C /lib/modules/2.6.18-308.el5/build M=/root/BBT/src modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-308.el5-x86_64'
 
The second line indicates the directory used, which should match the kernel for which the blkwatch.ko file is being built.  If the output differs, especially if it points to a kernel other than the intended one, that can lead to the build failing or the blkwatch.ko file being invalid.  Using the above example as a correct output, the following would be an incorrect output on the same system:
 
make -C /lib/modules/2.6.18-308.el5/build M=/root/BBT/src modules
make[1]: Entering directory `/usr/src/redhat/SOURCES/linux-2.6.18.4'
 
In order to correct this, follow the solutions below.
 
Solution 1:

If kernel-devel (RedHat) or kernel-source (SLES) is not installed, install it.  Both this package and gcc are required to properly build blkwatch.ko files.  If this package is not installed, or not installed for the correct kernel version, the build will fail or the blkwatch.ko file will not be correct.
 
Solution 2:
 
The symbolic link may be incorrect.  Using the examples given above, these commands will restore the symbolic link:
 
rm -f /lib/modules/2.6.18-308.el5/build
ln -s /usr/src/kernel/2.6.18-308.el5-x86_64 /lib/modules/2.6.18-308.el5/build

Disclaimer

This Support Knowledgebase provides a valuable tool for NetIQ/Novell/SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7005873
  • Creation Date:29-APR-10
  • Modified Date:17-JUL-13
    • NetIQPlateSpin Forge
      PlateSpin Migrate
      PlateSpin Protect

Did this document solve your problem? Provide Feedback