Quantcast
Channel: FedoraForum.org
Viewing all articles
Browse latest Browse all 36444

Build DRBD 8.4.2 on Fedora 17

$
0
0
1. fetch sources

http://www.drbd.org/users-guide/ch-b...g-drbd-sources

says to use

wget http://oss.linbit.com/drbd/8.4/drbd-latest.tar.gz

but you get a 404 and you really need

wget http://oss.linbit.com/drbd/8.4/drbd-8.4.2.tar.gz

2. setup system build environment
Code:

yum install rpm-build redhat-rpm-config flex git autoheader autoconf kernel-devel

mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

3. generate spec files
Code:

tar xfz drbd-8.4.2.tar.gz
cd drbd-8.4.2
/autogen.sh
./configure --with-km
./configure --enable-spec --with-km
cp ../drbd-8.4.2.tar.gz ~/rpmbuild/SOURCES/
cp drbd*.spec ~/rpmbuild/SPECS/
cd ~/rpmbuild/SPECS/

4. Hack /usr/lib/rpm/redhat/macros

Sad but true

https://bugzilla.redhat.com/show_bug.cgi?id=819747

Code:

--- /root/macros.orig        2012-12-01 12:38:05.101671058 -0500
+++ /usr/lib/rpm/redhat/macros        2012-12-01 12:44:55.011215451 -0500
@@ -238,7 +238,7 @@
                done \
        fi \
        echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
-        echo "%%global kernel_source() /usr/src/kernels/%kverrel-\\\$([ %%%%{1} = default ] || echo "%%%%{1}-")%_target_cpu" \
+        echo "%%global kernel_source() /usr/src/kernels/%kverrel.\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
        if [ ! -z "%{-f*}" ] \
        then \
                filelist="%{-f*}" \

Two "-" should be "."

5. Hack the drbd-kernel.spec file too.

Admittedly I'm not proud about this hack job. If you have improvements please post them.

Code:

$ diff -u drbd-kernel.spec.orig drbd-kernel.spec
--- drbd-kernel.spec.orig        2012-12-01 11:58:40.668370638 -0500
+++ drbd-kernel.spec        2012-12-01 18:55:39.117136636 -0500
@@ -89,10 +89,27 @@
 rm -f drbd.conf
 %else
 mkdir -p $RPM_BUILD_ROOT/etc/depmod.d
-echo "override drbd * weak-updates" \
+echo "override drbd * extra" \
    > $RPM_BUILD_ROOT/etc/depmod.d/drbd.conf
 %endif
 
+# Somehow depmod gets run and the files it produces are not in any
+# packages so rpmbuild fails to produce the desired rpm.
+# Remove the output of depmod
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.alias
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.alias.bin
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.dep
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.dep.bin
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.devname
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.softdep
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.symbols
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.symbols.bin
+
+%files
+%defattr(-,root,root)
+/etc/depmod.d/drbd.conf
+/lib/modules/%{kernel_version}.%{_target_cpu}/extra/drbd/drbd.ko
+
 %clean
 rm -rf %{buildroot}

6. Build and install the RPMs

Code:

cd ~/rpmbuild/SPECS
rpmbuild -ba drbd.spec
rpmbuild -ba drbd-kernel.spec
cd ../RPMS/x86_64
yum install heartbeat pacemaker xen
rpm -i drdb*

7. Cry about the fact that depmod doesn't find the 8.4.2 version of drbd.ko but it's easy to work around by using insmod instead of modprobe.
Code:

insmod /lib/modules/3.6.7-4.fc17.x86_64/extra/drbd/drbd.ko

Viewing all articles
Browse latest Browse all 36444

Trending Articles