diff options
5 files changed, 304 insertions, 9 deletions
diff --git a/meta-oe/recipes-support/multipath-tools/files/always-use-libdevmapper-kpartx.patch b/meta-oe/recipes-support/multipath-tools/files/always-use-libdevmapper-kpartx.patch new file mode 100644 index 0000000000..a16a854052 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/always-use-libdevmapper-kpartx.patch | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | Always use devmapper for kpartx | ||
| 2 | |||
| 3 | Do not try to compute the LIBDM_API_COOKIE make variable | ||
| 4 | from host information when cross-compiling. | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [embedded specific] | ||
| 7 | |||
| 8 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
| 9 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 10 | |||
| 11 | diff --git a/kpartx/Makefile b/kpartx/Makefile | ||
| 12 | index 2a07334..24bdabc 100644 | ||
| 13 | --- a/kpartx/Makefile | ||
| 14 | +++ b/kpartx/Makefile | ||
| 15 | @@ -4,13 +4,7 @@ | ||
| 16 | # | ||
| 17 | include ../Makefile.inc | ||
| 18 | |||
| 19 | -CFLAGS += -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 | ||
| 20 | - | ||
| 21 | -LIBDM_API_COOKIE = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_set_cookie' /usr/include/libdevmapper.h) | ||
| 22 | - | ||
| 23 | -ifneq ($(strip $(LIBDM_API_COOKIE)),0) | ||
| 24 | - CFLAGS += -DLIBDM_API_COOKIE | ||
| 25 | -endif | ||
| 26 | +CFLAGS += -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DLIBDM_API_COOKIE | ||
| 27 | |||
| 28 | LDFLAGS = -ldevmapper | ||
| 29 | OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \ | ||
diff --git a/meta-oe/recipes-support/multipath-tools/files/always-use-libdevmapper.patch b/meta-oe/recipes-support/multipath-tools/files/always-use-libdevmapper.patch new file mode 100644 index 0000000000..89d2352dab --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/always-use-libdevmapper.patch | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | Always use devmapper | ||
| 2 | |||
| 3 | Do not try to compute several _API_ make variables | ||
| 4 | from host information when cross-compiling. | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [embedded specific] | ||
| 7 | |||
| 8 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
| 9 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 10 | |||
| 11 | diff --git a/libmultipath/Makefile b/libmultipath/Makefile | ||
| 12 | index e5b06b3..efd6cf6 100644 | ||
| 13 | --- a/libmultipath/Makefile | ||
| 14 | +++ b/libmultipath/Makefile | ||
| 15 | @@ -17,23 +17,18 @@ OBJS = memory.o parser.o vector.o devmapper.o \ | ||
| 16 | log.o configure.o structs_vec.o sysfs.o prio.o checkers.o \ | ||
| 17 | lock.o waiter.o file.o wwids.o | ||
| 18 | |||
| 19 | -LIBDM_API_FLUSH = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_no_flush' /usr/include/libdevmapper.h) | ||
| 20 | |||
| 21 | -ifneq ($(strip $(LIBDM_API_FLUSH)),0) | ||
| 22 | +#ifneq ($(strip $(LIBDM_API_FLUSH)),0) | ||
| 23 | CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE | ||
| 24 | -endif | ||
| 25 | +#endif | ||
| 26 | |||
| 27 | -LIBDM_API_COOKIE = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_set_cookie' /usr/include/libdevmapper.h) | ||
| 28 | - | ||
| 29 | -ifneq ($(strip $(LIBDM_API_COOKIE)),0) | ||
| 30 | +#ifneq ($(strip $(LIBDM_API_COOKIE)),0) | ||
| 31 | CFLAGS += -DLIBDM_API_COOKIE | ||
| 32 | -endif | ||
| 33 | - | ||
| 34 | -LIBUDEV_API_RECVBUF = $(shell grep -Ecs '^[a-z]*[[:space:]]+udev_monitor_set_resolve_buffer_size' /usr/include/libudev.h) | ||
| 35 | +#endif | ||
| 36 | |||
| 37 | -ifneq ($(strip $(LIBUDEV_API_RECVBUF)),0) | ||
| 38 | +#ifneq ($(strip $(LIBUDEV_API_RECVBUF)),0) | ||
| 39 | CFLAGS += -DLIBUDEV_API_RECVBUF | ||
| 40 | -endif | ||
| 41 | +#endif | ||
| 42 | |||
| 43 | |||
| 44 | all: $(LIBS) | ||
diff --git a/meta-oe/recipes-support/multipath-tools/files/makefile_inc.patch b/meta-oe/recipes-support/multipath-tools/files/makefile_inc.patch new file mode 100644 index 0000000000..ff71f39675 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/makefile_inc.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | multipath-tools: modify Makefile.inc for cross-compilation | ||
| 2 | |||
| 3 | Do not look for systemd info on the host, and allow us to pass in CFLAGS | ||
| 4 | using the OPTFLAGS variable. | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [embedded specific] | ||
| 7 | |||
| 8 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 9 | |||
| 10 | |||
| 11 | --- a/Makefile.inc | ||
| 12 | +++ b/Makefile.inc | ||
| 13 | @@ -21,12 +21,6 @@ ifndef LIB | ||
| 14 | endif | ||
| 15 | endif | ||
| 16 | |||
| 17 | -ifndef SYSTEMD | ||
| 18 | - ifeq ($(shell systemctl --version > /dev/null 2>&1 && echo 1), 1) | ||
| 19 | - SYSTEMD = $(shell systemctl --version 2> /dev/null | sed -n 's/systemd \([0-9]*\)/\1/p') | ||
| 20 | - endif | ||
| 21 | -endif | ||
| 22 | - | ||
| 23 | prefix = | ||
| 24 | exec_prefix = $(prefix) | ||
| 25 | bindir = $(exec_prefix)/sbin | ||
| 26 | @@ -49,7 +43,10 @@ ifndef RPM_OPT_FLAGS | ||
| 27 | RPM_OPT_FLAGS = -O2 -g -pipe -Wformat-security -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 | ||
| 28 | endif | ||
| 29 | |||
| 30 | +ifndef OPTFLAGS | ||
| 31 | OPTFLAGS = $(RPM_OPT_FLAGS) -Wunused -Wstrict-prototypes | ||
| 32 | +endif | ||
| 33 | + | ||
| 34 | CFLAGS = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\" | ||
| 35 | SHARED_FLAGS = -shared | ||
| 36 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/multipathd.oe b/meta-oe/recipes-support/multipath-tools/files/multipathd.oe new file mode 100755 index 0000000000..3bdf875e3c --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/multipathd.oe | |||
| @@ -0,0 +1,146 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # multipathd Starts the multipath daemon | ||
| 4 | # | ||
| 5 | # chkconfig: - 06 87 | ||
| 6 | # description: Manages device-mapper multipath devices | ||
| 7 | |||
| 8 | ### BEGIN INIT INFO | ||
| 9 | # Provides: multipathd | ||
| 10 | # Required-Start: | ||
| 11 | # Required-Stop: | ||
| 12 | # Default-Start: | ||
| 13 | # Default-Stop: | ||
| 14 | # Short-Description: Control multipathd | ||
| 15 | # Description: This service monitors and manages | ||
| 16 | # device-mapper multipath devices | ||
| 17 | ### END INIT INFO | ||
| 18 | |||
| 19 | DAEMON=/sbin/multipathd | ||
| 20 | prog=`basename $DAEMON` | ||
| 21 | initdir=/etc/init.d | ||
| 22 | lockdir=/var/lock/subsys | ||
| 23 | sysconfig=/etc/sysconfig | ||
| 24 | syspath=/sys/block | ||
| 25 | |||
| 26 | RETVAL=0 | ||
| 27 | |||
| 28 | teardown_slaves() | ||
| 29 | { | ||
| 30 | pushd $1 > /dev/null | ||
| 31 | if [ -d "slaves" ]; then | ||
| 32 | for slave in slaves/*; | ||
| 33 | do | ||
| 34 | if [ "$slave" = "slaves/*" ]; then | ||
| 35 | read dev < $1/dev | ||
| 36 | tablename=`dmsetup table --target multipath | sed -n "s/\(.*\): .* $dev .*/\1/p"` | ||
| 37 | if ! [ -z $tablename ]; then | ||
| 38 | echo "Root is on a multipathed device, multipathd can not be stopped" | ||
| 39 | exit 1 | ||
| 40 | fi | ||
| 41 | else | ||
| 42 | local_slave=`readlink -f $slave`; | ||
| 43 | teardown_slaves $local_slave; | ||
| 44 | fi | ||
| 45 | done | ||
| 46 | |||
| 47 | else | ||
| 48 | read dev < $1/dev | ||
| 49 | tablename=`dmsetup table --target multipath | sed -n "s/\(.*\): .* $dev .*/\1/p"` | ||
| 50 | if ! [ -z $tablename ]; then | ||
| 51 | echo "Root is on a multipathed device, multipathd can not be stopped" | ||
| 52 | exit 1 | ||
| 53 | fi | ||
| 54 | fi | ||
| 55 | popd > /dev/null | ||
| 56 | } | ||
| 57 | |||
| 58 | # | ||
| 59 | # See how we were called. | ||
| 60 | # | ||
| 61 | |||
| 62 | start() { | ||
| 63 | test -x $DAEMON || exit 5 | ||
| 64 | echo -n $"Starting $prog daemon: " | ||
| 65 | start-stop-daemon --start --quiet --exec $DAEMON | ||
| 66 | RETVAL=$? | ||
| 67 | [ $RETVAL -eq 0 ] && touch $lockdir/$prog | ||
| 68 | echo | ||
| 69 | } | ||
| 70 | |||
| 71 | force_stop() { | ||
| 72 | echo -n $"Stopping $prog daemon: " | ||
| 73 | killall $DAEMON | ||
| 74 | RETVAL=$? | ||
| 75 | [ $RETVAL -eq 0 ] && rm -f $lockdir/$prog | ||
| 76 | echo | ||
| 77 | } | ||
| 78 | |||
| 79 | stop() { | ||
| 80 | root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab) | ||
| 81 | dm_num=`dmsetup info -c --noheadings -o minor $root_dev 2> /dev/null` | ||
| 82 | if [ $? -eq 0 ]; then | ||
| 83 | root_dm_device="dm-$dm_num" | ||
| 84 | [ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device | ||
| 85 | fi | ||
| 86 | |||
| 87 | force_stop | ||
| 88 | } | ||
| 89 | |||
| 90 | restart() { | ||
| 91 | stop | ||
| 92 | start | ||
| 93 | } | ||
| 94 | |||
| 95 | force_restart() { | ||
| 96 | force_stop | ||
| 97 | start | ||
| 98 | } | ||
| 99 | |||
| 100 | reload() { | ||
| 101 | echo -n "Reloading $prog: " | ||
| 102 | trap "" SIGHUP | ||
| 103 | killall $DAEMON -s SIGHUP -v | ||
| 104 | RETVAL=$? | ||
| 105 | echo | ||
| 106 | } | ||
| 107 | |||
| 108 | case "$1" in | ||
| 109 | start) | ||
| 110 | start | ||
| 111 | ;; | ||
| 112 | stop) | ||
| 113 | stop | ||
| 114 | ;; | ||
| 115 | force-stop) | ||
| 116 | force_stop | ||
| 117 | ;; | ||
| 118 | force-reload|reload) | ||
| 119 | reload | ||
| 120 | ;; | ||
| 121 | restart) | ||
| 122 | restart | ||
| 123 | ;; | ||
| 124 | force-restart) | ||
| 125 | force_restart | ||
| 126 | ;; | ||
| 127 | condrestart|try-restart) | ||
| 128 | if [ -f $lockdir/$prog ]; then | ||
| 129 | restart | ||
| 130 | fi | ||
| 131 | ;; | ||
| 132 | status) | ||
| 133 | if pidof -o %PPID $DAEMON > /dev/null; then | ||
| 134 | echo "Running" | ||
| 135 | RETVAL=0 | ||
| 136 | else | ||
| 137 | echo "Not running" | ||
| 138 | RETVAL=1 | ||
| 139 | fi | ||
| 140 | ;; | ||
| 141 | *) | ||
| 142 | echo $"Usage: $0 {start|stop|force-stop|status|restart|force-restart|condrestart|reload}" | ||
| 143 | RETVAL=2 | ||
| 144 | esac | ||
| 145 | |||
| 146 | exit $RETVAL | ||
diff --git a/meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb b/meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb index 038f4e26df..055cfe64c9 100644 --- a/meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb +++ b/meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb | |||
| @@ -1,30 +1,70 @@ | |||
| 1 | SUMMARY = "The upstream project used to drive the Device Mapper multipathing driver" | 1 | SUMMARY = "The upstream project used to drive the Device Mapper multipathing driver" |
| 2 | 2 | ||
| 3 | DEPENDS = "lvm2 libaio readline" | 3 | DEPENDS = "lvm2 libaio readline udev" |
| 4 | 4 | ||
| 5 | LICENSE = "GPLv2" | 5 | LICENSE = "LGPLv2" |
| 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=7be2873b6270e45abacc503abbe2aa3d" | ||
| 7 | 6 | ||
| 7 | SRC_URI = "git://git.opensvc.com/multipath-tools/.git;protocol=http \ | ||
| 8 | file://multipathd.oe \ | ||
| 9 | file://makefile_inc.patch \ | ||
| 10 | file://always-use-libdevmapper.patch \ | ||
| 11 | file://always-use-libdevmapper-kpartx.patch \ | ||
| 12 | " | ||
| 13 | # 0.5.0 | ||
| 14 | # | ||
| 15 | #SRCREV = "82f391e787dc02e9d9294aa391137ab424bb83c4" | ||
| 16 | #LIC_FILES_CHKSUM = "file://COPYING;md5=7be2873b6270e45abacc503abbe2aa3d" | ||
| 17 | |||
| 18 | # 0.5.0 + commits thru 7/18/2014 | ||
| 19 | # | ||
| 20 | #SRCREV = "0d72f46c12207a6b7b89f5ef4f5ab5f87ed8bc90" | ||
| 21 | #LIC_FILES_CHKSUM = "file://COPYING;md5=b06690e7a95c166eefe0199b39118eb1" | ||
| 22 | |||
| 23 | # 0.5.0 + commits thru 9/12/2014 | ||
| 24 | # | ||
| 25 | # includes important systemd related structure size fix | ||
| 26 | # | ||
| 27 | SRCREV = "aec68ab217fd2956443b27ceeb97dd6475267789" | ||
| 28 | LIC_FILES_CHKSUM = "file://COPYING;md5=b06690e7a95c166eefe0199b39118eb1" | ||
| 29 | |||
| 30 | inherit systemd | ||
| 8 | 31 | ||
| 9 | SRC_URI = "git://git.opensvc.com/multipath-tools/.git;protocol=http" | ||
| 10 | SRCREV = "15fc23ffb2bd1bac6990eda3e23c3e8980e6cfa5" | ||
| 11 | 32 | ||
| 12 | S = "${WORKDIR}/git" | 33 | S = "${WORKDIR}/git" |
| 13 | 34 | ||
| 14 | PV = "0.4.9+git" | 35 | PV = "0.5.0+git${@'${SRCPV}'.split('+')[-1]}" |
| 15 | 36 | ||
| 16 | EXTRA_OEMAKE = "MULTIPATH_VERSION=${PV} DESTDIR=${D} syslibdir=${base_libdir} libdir=${base_libdir}/multipath" | 37 | # The exact version of SYSTEMD does not matter but should be greater than 209. |
| 38 | # | ||
| 39 | EXTRA_OEMAKE = 'MULTIPATH_VERSION=${PV} DESTDIR=${D} syslibdir=${base_libdir} \ | ||
| 40 | OPTFLAGS="${CFLAGS}" \ | ||
| 41 | LIB=${base_libdir} libdir=${base_libdir}/multipath \ | ||
| 42 | unitdir=/lib/systemd/system \ | ||
| 43 | ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "SYSTEMD=216", "", d)} \ | ||
| 44 | ' | ||
| 17 | 45 | ||
| 18 | do_install() { | 46 | do_install() { |
| 19 | oe_runmake install | 47 | oe_runmake install |
| 48 | |||
| 49 | # Copy a sample conf file, but do not rename it multipath.conf. | ||
| 50 | # | ||
| 51 | cp multipath.conf.defaults ${D}${sysconfdir} | ||
| 52 | |||
| 53 | # We copy an initscript, but do not start multipathd at init time. | ||
| 54 | # | ||
| 55 | cp ${WORKDIR}/multipathd.oe ${D}${sysconfdir}/init.d/multipathd | ||
| 56 | |||
| 20 | } | 57 | } |
| 21 | 58 | ||
| 22 | FILES_${PN}-dbg += "${base_libdir}/multipath/.debug" | 59 | FILES_${PN}-dbg += "${base_libdir}/multipath/.debug" |
| 60 | |||
| 61 | # systemd and udev stuff always goes under /lib! | ||
| 62 | # | ||
| 23 | FILES_${PN} += "${base_libdir}/multipath \ | 63 | FILES_${PN} += "${base_libdir}/multipath \ |
| 24 | ${base_libdir}/systemd" | 64 | /lib/systemd" |
| 25 | 65 | ||
| 26 | PACKAGES =+ "kpartx" | 66 | PACKAGES =+ "kpartx" |
| 27 | FILES_kpartx = "${base_sbindir}/kpartx \ | 67 | FILES_kpartx = "${base_sbindir}/kpartx \ |
| 28 | ${base_libdir}/udev/kpartx_id" | 68 | /lib/udev/kpartx_id" |
| 29 | 69 | ||
| 30 | RDEPENDS_${PN} += "kpartx" | 70 | RDEPENDS_${PN} += "kpartx" |
