Committed, thanks Travis
On Tue, Feb 24, 2009 at 2:58 PM, Stefan Monnier <monn...@iro.umontreal.ca>wrote: > > Here is LVM support for OpenWRT. It introduces 3 new packages: > > - kmod-dm for the device mapper kernel module. > > - kmod-libdevmapper for the device-mapper library. > > - kmod-lvm2 for the `lvm' tool. > > Note that it currently does not create the symlinks for all the lvm > > tools, so you have to use "lvm pvs" rather than just "pvs". > > Actually, the patch was incomplete (missing a hunk in > package/base-files/files/etc/hotplug2-common.rules): > > Index: hotplug2-common.rules > =================================================================== > --- hotplug2-common.rules (révision 14605) > +++ hotplug2-common.rules (copie de travail) > @@ -1,9 +1,14 @@ > next > } > > +DEVICENAME == device-mapper { > + nothrottle > + makedev /dev/mapper/control 0600 > +} > + > DEVPATH is set { > nothrottle > makedev /dev/%DEVICENAME% 0644 > > Also, the order of the modules was incorrect in the autoload call. > The patch below may work better, > > > Stefan > > > Index: package/base-files/files/etc/hotplug2-common.rules > =================================================================== > --- package/base-files/files/etc/hotplug2-common.rules (révision 14605) > +++ package/base-files/files/etc/hotplug2-common.rules (copie de travail) > @@ -1,9 +1,14 @@ > next > } > > +DEVICENAME == device-mapper { > + nothrottle > + makedev /dev/mapper/control 0600 > +} > + > DEVPATH is set { > nothrottle > makedev /dev/%DEVICENAME% 0644 > > Index: package/kernel/modules/block.mk > =================================================================== > --- package/kernel/modules/block.mk (révision 14586) > +++ package/kernel/modules/block.mk (copie de travail) > @@ -287,6 +289,35 @@ > $(eval $(call KernelPackage,nbd)) > > > +define KernelPackage/dm > + SUBMENU:=$(BLOCK_MENU) > + TITLE:=Device Mapper > + # All the "=n" are unnecessary, they're only there > + # to stop the config from asking the question. > + # MIRROR is M because I've needed it for pvmove. > + KCONFIG:= \ > + CONFIG_BLK_DEV_MD=n \ > + CONFIG_DM_DEBUG=n \ > + CONFIG_DM_CRYPT=n \ > + CONFIG_DM_UEVENT=n \ > + CONFIG_DM_DELAY=n \ > + CONFIG_DM_MULTIPATH=n \ > + CONFIG_DM_ZERO=n \ > + CONFIG_DM_SNAPSHOT=n \ > + CONFIG_MD=y \ > + CONFIG_BLK_DEV_DM \ > + CONFIG_DM_MIRROR > + FILES:=$(LINUX_DIR)/drivers/md/dm-*.$(LINUX_KMOD_SUFFIX) > + AUTOLOAD:=$(call AutoLoad,30,dm-mod dm-log dm-region-hash dm-mirror) > +endef > + > +define KernelPackage/dm/description > + Kernel module necessary for LVM2 support > +endef > + > +$(eval $(call KernelPackage,dm)) > + > + > define KernelPackage/pata-rb153-cf > SUBMENU:=$(BLOCK_MENU) > DEPENDS:=kmod-ata-core @TARGET_adm5120_router_le > Index: feeds/packages/utils/lvm2/files/lvm2.init > =================================================================== > --- feeds/packages/utils/lvm2/files/lvm2.init (révision 0) > +++ feeds/packages/utils/lvm2/files/lvm2.init (révision 0) > @@ -0,0 +1,12 @@ > +#!/bin/sh /etc/rc.common > +# Copyright (C) 2009 Stefan Monnier > +START=15 > + > +start () { > + /sbin/lvm vgscan --ignorelockingfailure --mknodes || : > + /sbin/lvm vgchange -aly --ignorelockingfailure || return 2 > +} > + > +stop () { > + /sbin/lvm vgchange -aln --ignorelockingfailure || return 2 > +} > Index: feeds/packages/utils/lvm2/patches/100-readline-link.patch > =================================================================== > --- feeds/packages/utils/lvm2/patches/100-readline-link.patch (révision > 0) > +++ feeds/packages/utils/lvm2/patches/100-readline-link.patch (révision > 0) > @@ -0,0 +1,38 @@ > +=== modified file 'LVM2.2.02.43/make.tmpl.in' > +--- LVM2.2.02.43/make.tmpl.in 2009-01-16 15:02:27 +0000 > ++++ LVM2.2.02.43/make.tmpl.in 2009-01-16 15:02:45 +0000 > +@@ -84,11 +84,9 @@ > + endif > + > + LDFLAGS += -L$(top_srcdir)/libdm -L$(top_srcdir)/lib > +-CLDFLAGS += -L$(top_srcdir)/libdm -L$(top_srcdir)/lib > + > + ifeq ("@DMEVENTD@", "yes") > + LDFLAGS += -L$(top_srcdir)/daemons/dmeventd > +- CLDFLAGS += -L$(top_srcdir)/daemons/dmeventd > + endif > + > + ifeq ("@DM_COMPAT@", "yes") > +@@ -202,18 +200,18 @@ > + ifeq ("@LIB_SUFFIX@","so") > + $(LIB_SHARED): $(OBJECTS) $(LDDEPS) > + $(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \ > +- $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@ > ++ $(CFLAGS) $(CLDFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@ > + endif > + > + ifeq ("@LIB_SUFFIX@","dylib") > + $(LIB_SHARED): $(OBJECTS) $(LDDEPS) > + $(CC) -dynamiclib -dylib_current_version,$(LIB_VERSION) \ > +- $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@ > ++ $(CFLAGS) $(CLDFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@ > + endif > + > + %.so: %.a > + $(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \ > +- $(CFLAGS) $(CLDFLAGS) $(LIBS) -o $@ \ > ++ $(CFLAGS) $(CLDFLAGS) $(LDFLAGS) $(LIBS) -o $@ \ > + @CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@ > + > + $(LIB_STATIC): $(OBJECTS) > + > Index: feeds/packages/utils/lvm2/Makefile > =================================================================== > --- feeds/packages/utils/lvm2/Makefile (révision 0) > +++ feeds/packages/utils/lvm2/Makefile (révision 0) > @@ -0,0 +1,113 @@ > +# > +# Copyright (C) 2009 Stefan Monnier > +# > +# This is free software, licensed under the GNU General Public License > v3+. > +# See /LICENSE for more information. > + > +include $(TOPDIR)/rules.mk > + > +PKG_NAME:=LVM2 > +PKG_VERSION:=2.02.44 > +PKG_RELEASE:=1 > + > +PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz > +PKG_SOURCE_URL:=ftp://sources.redhat.com/pub/lvm2/ > +PKG_MD5SUM:=4ed7b99903a6fc5165b7b0b8def42486<ftp://sources.redhat.com/pub/lvm2/%0A+PKG_MD5SUM:=4ed7b99903a6fc5165b7b0b8def42486> > +# 2.02.43 = fc34655706a2aa116b92328b24fad619 > +# 2.02.44 = 4ed7b99903a6fc5165b7b0b8def42486 > + > +# OpenWRT normally expects the tarball to expand into > +# $(PKG_NAME)-$(PKG_VERSION), and this magic incantation seems to make it > +# understand that LVM2's tarball expands into $(PKG_NAME).$(PKG_VERSION). > +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME).$(PKG_VERSION) > + > +include $(INCLUDE_DIR)/package.mk > + > +define Package/libdevmapper > + SECTION:=libs > + CATEGORY:=Libraries > + SUBMENU:=disc > + DEPENDS:=+kmod-dm > + TITLE:=The Linux Kernel Device Mapper userspace library > + URL:=http://sourceware.org/dm/ > +endef > + > +define Package/libdevmapper/description > + The Linux Kernel Device Mapper is the LVM (Linux Logical Volume > Management) > + Team\'s implementation of a minimalistic kernel-space driver that > handles > + volume management, while keeping knowledge of the underlying device > layout > + in user-space. This makes it useful for not only LVM, but EVMS, > software > + raid, and other drivers that create "virtual" block devices. > + . > + This package contains the (user-space) shared library for accessing the > + device-mapper; it allows usage of the device-mapper through a clean, > + consistent interface (as opposed to through kernel ioctls). > +endef > + > +define Package/lvm2 > + SECTION:=utils > + CATEGORY:=Utilities > + SUBMENU:=disc > + TITLE:=The Linux Logical Volume Manager > + DEPENDS:=+libdevmapper +libreadline > + URL:=http://sourceware.org/lvm2/ > +endef > + > +define Package/lvm2/description > + This is LVM2, the rewrite of The Linux Logical Volume Manager. LVM > + supports enterprise level volume management of disk and disk subsystems > + by grouping arbitrary disks into volume groups. The total capacity of > + volume groups can be allocated to logical volumes, which are accessed as > + regular block devices. > +endef > + > +# I got problems building with readline, so I originally just disabled it. > +# I've since added patch 100-readline-link which fixes the problem > instead. > +# CONFIGURE_ARGS += --disable-readline > + > +# Apparently we have problems when "read"ing using O_DIRECT, maybe because > +# of uClibc. More specifically, with O_DIRECT lvm becomes erratic, > showing > +# non-deterministic behavior: `lvs', `pvs' and friends can return anything > +# from empty lists, to completely correct result, as well as checksum > errors, > +# complaints about missing volume groups, ... each run of the command can > +# return something different. The "root" of the problem is (maybe among > +# other places) in the "_io" function in dev-io.c, where calls to the > "read" > +# function often return garbage, although not always. There's nothing > +# obviously wrong with the dev-io.c code, so the bug may just as well be > in > +# uClibc or in the kernel (it appeared on the MIPS platform and could be > +# related to cache coherency issues). > +# Debian Lenny's lvm2 also disables O_DIRECT on "arm armeb hppa mips > mipsel". > +CONFIGURE_ARGS += --disable-o_direct > + > +define Build/InstallDev > + mkdir -p $(1)/usr/include > + $(INSTALL_DATA) $(PKG_BUILD_DIR)/include/libdevmapper.h > $(1)/usr/include/ > + mkdir -p $(1)/usr/lib > + $(CP) $(PKG_BUILD_DIR)/libdm/ioctl/libdevmapper.{a,so} > $(1)/usr/lib/ > + mkdir -p $(1)/usr/lib/pkgconfig > + $(CP) $(PKG_BUILD_DIR)/libdm/libdevmapper.pc > $(1)/usr/lib/pkgconfig/ > +endef > + > +define Package/libdevmapper/install > + $(INSTALL_DIR) $(1)/usr/lib > + $(INSTALL_DATA) $(PKG_BUILD_DIR)/libdm/libdevmapper.so.* > $(1)/usr/lib/ > +endef > + > +# This rule only installs the `lvm' executable. Debian also installs > +# a whole bunch of symlinks so that instead of `lvm <foo>' you can > directly > +# run `<foo>'. > +define Package/lvm2/install > + $(INSTALL_DIR) $(1)/sbin > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/lvm $(1)/sbin/ > + $(INSTALL_DIR) $(1)/etc/lvm > + $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/example.conf > $(1)/etc/lvm/lvm.conf > + $(INSTALL_DIR) $(1)/etc/init.d > + $(INSTALL_BIN) ./files/lvm2.init $(1)/etc/init.d/lvm2 > +endef > + > +define Package/lvm2/conffiles > +/etc/lvm/lvm.conf > +endef > + > +$(eval $(call BuildPackage,libdevmapper)) > +$(eval $(call BuildPackage,lvm2)) > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel >
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel