Author: alexander
Date: 2007-09-26 04:57:27 -0600 (Wed, 26 Sep 2007)
New Revision: 2073

Added:
   trunk/packages/multipath-tools/
   trunk/packages/multipath-tools/Makefile
   trunk/packages/multipath-tools/multipath-tools-0.4.8-fix_extpart-1.patch
Modified:
   trunk/Makefile
   trunk/doc/README
Log:
Added kpartx, because it is needed in order to access partitions behind OnTrack 
disk manager with libata-based IDE drivers.


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile      2007-09-23 15:58:58 UTC (rev 2072)
+++ trunk/Makefile      2007-09-26 10:57:27 UTC (rev 2073)
@@ -279,7 +279,7 @@
        ch-xchat ch-wireless_tools ch-wpa_supplicant \
        ch-tcpwrappers ch-portmap ch-nfs-utils \
        ch-traceroute ch-rsync ch-jhalfs ch-sudo ch-bc ch-dialog ch-ncftp  \
-       ch-device-mapper ch-LVM2 ch-dmraid \
+       ch-device-mapper ch-LVM2 ch-dmraid ch-multipath-tools \
        ch-dhcpcd ch-distcc ch-ppp ch-rp-pppoe ch-pptp \
        ch-cpio ch-mutt ch-msmtp ch-tin ch-mdadm ch-which ch-brltty  \
        ch-strace ch-iptables ch-eject ch-xlockmore ch-hdparm \

Modified: trunk/doc/README
===================================================================
--- trunk/doc/README    2007-09-23 15:58:58 UTC (rev 2072)
+++ trunk/doc/README    2007-09-26 10:57:27 UTC (rev 2073)
@@ -64,6 +64,7 @@
 * mdadm
 * LVM2
 * dmraid
+* kpartx
 * hdparm
 * parted
 * xlockmore

Added: trunk/packages/multipath-tools/Makefile
===================================================================
--- trunk/packages/multipath-tools/Makefile                             (rev 0)
+++ trunk/packages/multipath-tools/Makefile     2007-09-26 10:57:27 UTC (rev 
2073)
@@ -0,0 +1,40 @@
+# multipath-tools Makefile
+#
+# This Makefile installs only kpartx, because other parts require AIO
+# and can't be tested without the hardware
+#
+# Udev rules are not installed, because they rely on a patched dmsetup
+
+NM= multipath-tools
+VRS= 0.4.8
+DIR= $(NM)-$(VRS)
+
+FILE= $(DIR).tar.bz2
+URL-$(FILE)= http://christophe.varoqui.free.fr/$(NM)/$(FILE)
+SHA-$(FILE)= aadc7c7ed072c3df2e32c64a2ab1ba7fac850d7a
+
+# Fixes support for extended partitions
+# Incomplete, deactivation doesn't work for the first try
+PATCH1= $(DIR)-fix_extpart-1.patch
+
+# Targets
+
+include $(ROOT)/scripts/functions
+
+chroot:
+       chroot "$(MP)" $(chenv-blfs) \
+       'cd $(ROOT) && make ch-$(NM) $(chbash-post-bash)'
+
+stage2: Makefile $(FILE)
+       $(std_build)
+
+compile-stage2:
+       patch -Np1 -i ../$(PATCH1)
+       make -C kpartx
+       install -m755 kpartx/kpartx /sbin
+       install -m644 kpartx/kpartx.8 /usr/share/man/man8
+
+clean:
+       -rm -rf $(DIR)
+
+.PHONY: clean chroot compile-stage2

Added: trunk/packages/multipath-tools/multipath-tools-0.4.8-fix_extpart-1.patch
===================================================================
--- trunk/packages/multipath-tools/multipath-tools-0.4.8-fix_extpart-1.patch    
                        (rev 0)
+++ trunk/packages/multipath-tools/multipath-tools-0.4.8-fix_extpart-1.patch    
2007-09-26 10:57:27 UTC (rev 2073)
@@ -0,0 +1,90 @@
+kpartx: Handle extended partitions correctly
+
+When creating the device-mapper table for an extended partition we
+should calculate the size relative to the containing partition, not
+to the entire device.
+
+Signed-off-by: Hannes Reinecke <[EMAIL PROTECTED]>
+
+Edited by Alexander E. Patrakov to fix incorrect output of "kpartx -l"
+diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
+index dbe2ee2..f60e5f4 100644
+--- a/kpartx/kpartx.c
++++ b/kpartx/kpartx.c
+@@ -265,7 +265,7 @@ main(int argc, char **argv){
+       }
+ 
+       if (dm_prereq(DM_TARGET, 0, 0, 0) && (what == ADD || what == DELETE)) {
+-              fprintf(stderr, "device mapper prerequisites not met\n"); 
++              fprintf(stderr, "device mapper prerequisites not met\n");
+               exit(1);
+       }
+ 
+@@ -387,10 +387,10 @@ main(int argc, char **argv){
+                                       slices[j].minor = m++;
+ 
+                                       start = slices[j].start - 
slices[k].start;
+-                                      printf("%s%s%d : 0 %lu /dev/dm-%d 
%lu\n",
++                                      printf("%s%s%d : 0 %lu %s%s%d %lu\n",
+                                              mapname, delim, j+1,
+                                              (unsigned long) slices[j].size,
+-                                             slices[k].minor, start);
++                                             mapname, delim, k+1, start);
+                                       c--;
+                               }
+                               /* Terminate loop if nothing more to resolve */
+@@ -431,7 +431,7 @@ main(int argc, char **argv){
+                       break;
+ 
+               case ADD:
+-                      for (j=0, c = 0; j<n; j++) {
++                      for (j = 0, c = 0; j < n; j++) {
+                               if (slices[j].size == 0)
+                                       continue;
+ 
+@@ -477,6 +477,7 @@ main(int argc, char **argv){
+                       d = c;
+                       while (c) {
+                               for (j = 0; j < n; j++) {
++                                      unsigned long start;
+                                       int k = slices[j].container - 1;
+ 
+                                       if (slices[j].size == 0)
+@@ -487,7 +488,7 @@ main(int argc, char **argv){
+                                               continue;
+ 
+                                       /* Skip all simple slices */
+-                                      if (k < 0)
++                                      if (slices[j].container == 0)
+                                               continue;
+ 
+                                       /* Check container slice */
+@@ -502,10 +503,11 @@ main(int argc, char **argv){
+                                       }
+                                       strip_slash(partname);
+ 
++                                      start = slices[j].start - 
slices[k].start;
+                                       if (safe_sprintf(params, "%d:%d %lu",
+                                                        slices[k].major,
+                                                        slices[k].minor,
+-                                                       (unsigned 
long)slices[j].start)) {
++                                                       start)) {
+                                               fprintf(stderr, "params too 
small\n");
+                                               exit(1);
+                                       }
+@@ -524,9 +526,12 @@ main(int argc, char **argv){
+                                               &slices[j].minor);
+ 
+                                       if (verbose)
+-                                              printf("add map %s : 0 %lu %s 
%s\n",
+-                                                     partname, slices[j].size,
+-                                                     DM_TARGET, params);
++                                              printf("add map %s (%d:%d): 0 
%lu %s\n",
++                                                     partname, 
++                                                     slices[j].major,
++                                                     slices[j].minor,
++                                                     slices[j].size,
++                                                     params);
+                                       c--;
+                               }
+                               /* Terminate loop */

-- 
http://linuxfromscratch.org/mailman/listinfo/livecd
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to