The DRBD build system contains a facility to build RPM packages directly out of the DRBD source tree. For building RPMs, the section called “Checking build prerequisites” applies essentially in the same way as for building and installing with make, except that you also need the RPM build tools, of course.
Also, see the section called “Preparing the kernel source tree” if you are not building against a running kernel with precompiled headers available.
The build system offers two approaches for building RPMs.
The simpler approach is to simply invoke the rpm
target in the top-level Makefile:
cd /usr/src/drbd-x.y.z make rpm
This approach will auto-generate a spec file from a pre-defined template, and then use that spec file to build binary RPM packages.
The other, more flexible approach is to copy the
drbd.spec.in file to
drbd.spec, make any modifications you deem
necessary, and manually invoke the RPM build process:
cd /usr/src/drbd-x.y.z cp drbd.spec.in drbd.spec vi drbd.spec rpmbuild -bb drbd.spec
The RPM build process will create two binary RPM packages:
A package containing the DRBD userspace tools, named
drbd-x.y.z-BUILD.ARCH.rpm;
A separate package containing the DRBD kernel module,
named
drbd-km-.version-x.y.z-BUILD.ARCH.rpm
If you chose the make rpm approach, you will
find these packages in the dist/RPMS
subdirectory of your DRBD source tree. If you hacked your own
spec file and then invoked rpmbuild, the RPMs
will be created wherever your system RPM configuration (or your
personal ~/.rpmmacros configuration)
dictates.
After you have created these packages, you can install, upgrade, and uninstall them as you would any other RPM package in your system.
Note that any kernel upgrade will require you to generate a
new drbd-km package to match the new
kernel. The drbd package, in contrast, need
only be recreated when upgrading to a new DRBD version. If at
any time you upgrade to a new kernel and
new DRBD version, you will need to upgrade both packages.