Building outside source tree
The following patch allows building the lvm utilities in a seperate directory from the source. It is a patch agains 1.0.1rc1 and has been tested with linux 2.2.18.
INSTALL renamed from ../orig/LVM/1.0.1-rc1/INSTALL +34 -28
@@ -8,29 +8,36 @@ If you don't have a stock kernel including LVM or you want to use a more recent LVM version than the one in the stock kernel you have to patch your -kernel with the corresponding patch. See bellow for details. +kernel with the corresponding patch. See below for details. +1. Unpack the source code. This will create a directory called + LVM/1.0.1-rc1 containing the sourcecode, documentation and + the configure script. -1. Change to LVM/1.0.1-rc1/ +2. Change directories to the directory where you want to build + the lvm utilities and run the configure script from the + source directory. You will need to tell configure where + the kernel source is located using --with-kernel_dir=. -2. run the configure script +3. Build and apply the appropriate kernel patches following the + instructions in PATCHES/README. -3. Follow the instructions in PATCHES/README to create - a patch for your kernel and apply it +4. Configure and build a new kernel following the instructions + in the README file at the top of the kernel source tree. + Make sure that you enable lvm when configuring the kernel + (you should find it under block devices). -4. cd to /usr/src/linux and configure LVM and loadable module support - if you want to load it as a module (see /usr/src/linux/README for - instructions) by "make config/menuconfig/xconfig" (whichever you prefer) +5. Install the new kernel and modules making sure you have + some means of booting the old kernel if something goes + wrong. -5. Build a new kernel +6. Type "make" in the lvm build directory to create the library + and utilities. -6. Change back to LVM/1.0.1-rc1/ +7. Type "make install" in the lvm build directory to install the + lvm library, utilities and man pages. -7. Do a "make" - -8. Do a "make install" - -9. Omit this step if you chose yes for LVM instead of module in "make config". +8. If you built the lvm kernel code as a module then: Put an "insmod lvm-mod" into your startup script OR check/extend /etc/modules.conf (formerly /etc/conf.modules) for/by
@@ -40,19 +47,18 @@ to enable modprobe to load the LVM module (don't forget to enable kmod). -10. Add a "vgscan" and a "vgchange -a y" to your startup files - (/sbin/init.d/boot with SuSE for eg.) so that the actual volume - group configuration is online after each reboot. - - Put a "vgchange -a n" into your shutdown script (/sbin/init.d/halt for eg.) - after dismounting all filesystems. - -11. Please remember to keep a lilo.conf entry which is configured to boot - the previous kernel in case of an emergency! - - Reboot your machine. +9. Add a "vgscan" and a "vgchange -a y" to your startup files + (/sbin/init.d/boot with SuSE for eg.) so that the actual volume + group configuration is online after each reboot. + + Put a "vgchange -a n" into your shutdown script (/sbin/init.d/halt for eg.) + after dismounting all filesystems. + +10. Reboot your machine with the new kernel (remember what we said + about having some means to boot the old kernel in case something + goes wrong). -12. read the ascii file LVM-HOWTO to go ahead using the LVM +11. Read the ascii file LVM-HOWTO to go ahead using the LVM and read the manuals starting with lvm(8).
@@ -60,7 +66,7 @@ If you want to remove the LVM software. -1. change directory to LVM/1.0.1-rc1 +1. change to the lvm build directory 2. do a "make remove"
PATCHES/Makefile.in renamed from ../orig/LVM/1.0.1-rc1/PATCHES/Makefile.in +5 -5
@@ -26,11 +26,11 @@ LVM_VERSION=@lvm_ver@ KERNEL_VERSION=@kernel_ver@ -DRIVER_DIR=../kernel +DRIVER_DIR=@top_srcdir@/kernel CLEANED_DIR=cleaned -CLEANER=../scripts/select_version -PATCHER=../scripts/patch_fragment -FRAGGER=../scripts/select_fragments +CLEANER=@top_srcdir@/scripts/select_version +PATCHER=@top_srcdir@/scripts/patch_fragment +FRAGGER=@top_srcdir@/scripts/select_fragments LVM_PATCH=./lvm-$(LVM_VERSION)-$(KERNEL_VERSION).patch ifneq (,$(findstring 2.2,$(KERNEL_VERSION)))
@@ -51,7 +51,7 @@ $(PATCHER) $(KERNEL_DIR) $(K_DRIVER_DIR)/lvm-internal.h $(CLEANED_DIR)/lvm-internal.h >> $@ $(PATCHER) $(KERNEL_DIR) $(K_DRIVER_DIR)/lvm-snap.c $(CLEANED_DIR)/lvm-snap.c >> $@ $(PATCHER) $(KERNEL_DIR) $(K_DRIVER_DIR)/lvm-fs.c $(CLEANED_DIR)/lvm-fs.c >> $@ - $(FRAGGER) $(KERNEL_VERSION) >> $@ + (cd @top_srcdir@/PATCHES/ ; $(FRAGGER) $(KERNEL_VERSION)) >> $@ $(CLEANED_DIR)/lvm.h: $(DRIVER_DIR)/lvm.h cleaned $(CLEANER) $(KERNEL_VERSION) < $< > $@
PATCHES/README renamed from ../orig/LVM/1.0.1-rc1/PATCHES/README +4 -20
@@ -11,34 +11,18 @@ If you are not familiar with patching or building the kernel then consider looking for pre-built binaries of LVM. -Configuring LVM for your kernel -------------------------------- - -You can skip this step if you are sure you ran configure with the correct -options. - -o untar your clean Linux kernel - -o run 'make distclean' in the directory above this one to clean up any - previous configure information. If you get an error that says - "make: *** No rule to make target `distclean'. Stop." it generally - means your source tree is clean and you can ignore it. - -o run configure in the directory above this one to produce 'Makefile', making - sure to specify the '--with-kernel_dir=' flag if your kernel source is not - in '/usr/src/linux'. - Creating the patch ------------------ -o check the following variables at the top of 'Makefile' in the PATCHES - directory +o Check the following variables at the top of 'Makefile' in the PATCHES + subdirectory of your lvm build directory. If these are not correct + then you probably didn't pass the correct values to configure. KERNEL_DIR should point to the kernel source that you wish to patch eg, KERNEL_DIR=/usr/src/linux LVM_VERSION the LVM version - eg, LVM_VERSION=0.9.1_beta5 + eg, LVM_VERSION=1.0.1 KERNEL_VERSION the version of your kernel that is to be patched eg, KERNEL_VERSION=2.2.18
configure renamed from ../orig/LVM/1.0.1-rc1/configure +9 -7
@@ -1585,12 +1585,12 @@ kernel_dir=/usr/src/linux fi -kernel_ver=`scripts/linuxver -d $kernel_dir` -lvm_ver=`scripts/lvmver -d .` -lvm_majver=`scripts/lvmver -d . | sed -e 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\(.*\)*/\1/'` -lvm_minver=`scripts/lvmver -d . | sed -e 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\(.*\)*/\2/'` -iop_ver=`scripts/iopver -d .` - +kernel_ver=`cd $srcdir;./scripts/linuxver -d $kernel_dir` +lvm_ver=`cd $srcdir; ./scripts/lvmver -d .` +lvm_majver=`cd $srcdir; ./scripts/lvmver -d . | sed -e 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\(.*\)*/\1/'` +lvm_minver=`cd $srcdir; ./scripts/lvmver -d . | sed -e 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\(.*\)*/\2/'` +iop_ver=`cd $srcdir; ./scripts/iopver -d .` +topobjdir=`pwd` if [ -z $iop_ver ]; then echo "Unable to determine IOP version...configure failed.";
@@ -1878,6 +1878,7 @@ + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure
@@ -2049,6 +2050,7 @@ s%@lvm_majver@%$lvm_majver%g s%@lvm_minver@%$lvm_minver%g s%@iop_ver@%$iop_ver%g +s%@topobjdir@%$topobjdir%g CEOF EOF
@@ -2170,5 +2172,5 @@ test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 -ln -f kernel/lvm.h tools/lib/lvm.h +ln -sf $srcdir/kernel/lvm.h tools/lib/lvm.h
configure.in renamed from ../orig/LVM/1.0.1-rc1/configure.in +8 -7
@@ -66,13 +66,13 @@ [ kernel_dir="$withval" ], [ kernel_dir=/usr/src/linux ]) dnl -- get the version of the specified kernel -kernel_ver=`scripts/linuxver -d $kernel_dir` +kernel_ver=`cd $srcdir;./scripts/linuxver -d $kernel_dir` dnl -- get the version of LVM we are configuring -lvm_ver=`scripts/lvmver -d .` -lvm_majver=`scripts/lvmver -d . | sed -e 's/\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)\(.*\)*/\1/'` -lvm_minver=`scripts/lvmver -d . | sed -e 's/\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)\(.*\)*/\2/'` -iop_ver=`scripts/iopver -d .` - +lvm_ver=`cd $srcdir; ./scripts/lvmver -d .` +lvm_majver=`cd $srcdir; ./scripts/lvmver -d . | sed -e 's/\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)\(.*\)*/\1/'` +lvm_minver=`cd $srcdir; ./scripts/lvmver -d . | sed -e 's/\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)\(.*\)*/\2/'` +iop_ver=`cd $srcdir; ./scripts/iopver -d .` +topobjdir=`pwd` if [[ -z $iop_ver ]]; then echo "Unable to determine IOP version...configure failed.";
@@ -106,6 +106,7 @@ AC_SUBST(lvm_majver) AC_SUBST(lvm_minver) AC_SUBST(iop_ver) +AC_SUBST(topobjdir) dnl First and last lines should not contain files to generate in order to dnl keep utility scripts running properly AC_OUTPUT( \
@@ -117,4 +118,4 @@ tools/lib/Makefile \ tools/man8/Makefile \ ) -AC_OUTPUT_COMMANDS([ln -f kernel/lvm.h tools/lib/lvm.h]) +AC_OUTPUT_COMMANDS([ln -sf $srcdir/kernel/lvm.h tools/lib/lvm.h])
make.tmpl.in renamed from ../orig/LVM/1.0.1-rc1/make.tmpl.in +10 -10
@@ -41,7 +41,7 @@ sbindir = @sbindir@ infodir = @infodir@ mandir = @mandir@ - +topobjdir = @topobjdir@ # setup misc variables # define the ownership variables for the binaries and man pages OWNER=@OWNER@
@@ -59,26 +59,26 @@ .SUFFIXES = .o.po.c %.a: %.o - $(AR) -r $@ $*.o + $(AR) -r $@ $< %.o: %.c - $(CC) -c -pipe $(CFLAGS) -o $@ $*.c + $(CC) -c -pipe $(CFLAGS) -o $@ $< %.po: %.c - $(CC) -c -pipe $(CFLAGS) -fPIC -o $@ $*.c + $(CC) -c -pipe $(CFLAGS) -fPIC -o $@ $< %: %.o $(LIBS) - $(CC) $(LDFLAGS) $*.o $(LOADLIBES) $(LDLIBS) -o $@ + $(CC) $(LDFLAGS) $< $(LOADLIBES) $(LDLIBS) -o $@ CFLAGS+= @CFLAGS@ -Wall -ALL_SOURCES = $(wildcard *.c) -ALL_TARGETS = $(ALL_SOURCES:.c=) +ALL_SOURCES := $(foreach dir,. $(subst :, ,$(VPATH)),$(wildcard $(dir)/*.c)) +ALL_TARGETS := $(notdir $(ALL_SOURCES:.c=)) ALL_EXECS = $(ALL_TARGETS) -ALL_HEADERS = $(wildcard *.h) +ALL_HEADERS := $(notdir $(foreach dir,. $(subst :, ,$(VPATH)),$(wildcard $(dir)/*.h))) ALL_FILES = $(ALL_SOURCES) $(ALL_HEADERS) -ALL_OBJECTS = $(ALL_SOURCES:.c=.o) -ALL_POBJECTS = $(ALL_SOURCES:.c=.po) +ALL_OBJECTS := $(notdir $(ALL_SOURCES:.c=.o)) +ALL_POBJECTS := $(notdir $(ALL_SOURCES:.c=.po)) OTHER_DEP = Makefile all:
scripts/select_fragments renamed from ../orig/LVM/1.0.1-rc1/scripts/select_fragments +0 -1
@@ -1,7 +1,6 @@ #! /usr/bin/perl -w $kver = shift() || _help(); - for $f (<fragments-*>) { if($f =~ m/fragments-([0-9]+\.[0-9]+\.[0-9]+)/) { if($1 le $kver) {
tools/Makefile.in renamed from ../orig/LVM/1.0.1-rc1/tools/Makefile.in +3 -3
@@ -41,11 +41,11 @@ include ../make.tmpl include tools_and_lib.make.tmpl -LOADLIBES = -L$(TOP)/tools/lib +LOADLIBES = -L$(topobjdir)/tools/lib LDLIBS = -llvm-@iop_ver@ LDFLAGS += @LDFLAGS@ -ALL = $(ALL_SOURCES:.c=) +ALL := $(notdir $(ALL_SOURCES:.c=)) ALL_RM = $(ALL) $(ALL_OBJECTS) ALL_SCRIPTS = lvmcreate_initrd
@@ -82,7 +82,7 @@ do \ rm -f $(DESTDIR)$(sbindir)/$$f; \ @INSTALL@ -d $(DESTDIR)$(sbindir); \ - @INSTALL@ -o $(OWNER) -g $(GROUP) -m 555 $$f $(DESTDIR)$(sbindir)/$$f; \ + @INSTALL@ -o $(OWNER) -g $(GROUP) -m 555 $(srcdir)/$$f $(DESTDIR)$(sbindir)/$$f; \ done remove-bin: $(ALL_TARGETS) $(ALL_SCRIPTS)
tools/man8/Makefile.in renamed from ../orig/LVM/1.0.1-rc1/tools/man8/Makefile.in +8 -10
@@ -29,23 +29,21 @@ include ../../make.tmpl -ALL_MANUALS=$(wildcard *.8) +ALL_MANUALS= $(foreach dir,. $(subst :, ,$(VPATH)),$(wildcard $(dir)/*.8)) +MAN_PAGES= $(notdir $(ALL_MANUALS)) + MAN8DIR=${mandir}/man8 all_this: @true -install-man8: - @echo "*** Installing $(ALL_MANUALS) in $(DESTDIR)$(MAN8DIR) ***" - @for f in $(ALL_MANUALS); \ - do \ - rm -f $(DESTDIR)$(MAN8DIR)/$$f; \ - @INSTALL@ -D -o $(OWNER) -g $(GROUP) -m 444 $$f $(DESTDIR)$(MAN8DIR)/$$f; \ - done +install-man8: remove-man8 + @echo "*** Installing $(MAN_PAGES) in $(DESTDIR)$(MAN8DIR) ***" + @INSTALL@ -o $(OWNER) -g $(GROUP) -m 444 $(ALL_MANUALS) $(DESTDIR)$(MAN8DIR)/ remove-man8: - @echo "*** Removing $(ALL_MANUALS) from $(DESTDIR)$(MAN8DIR) ***" - for f in $(ALL_MANUALS); \ + @echo "*** Removing $(MAN_PAGES) from $(DESTDIR)$(MAN8DIR) ***" + for f in $(MAN_PAGES); \ do \ rm -f $(DESTDIR)$(MAN8DIR)/$$f; \ done
tools/tools_and_lib.make.tmpl.in renamed from ../orig/LVM/1.0.1-rc1/tools/tools_and_lib.make.tmpl.in +1 -1
@@ -25,4 +25,4 @@ # # CFLAGS += -DLVM_DONT_INTERRUPT -CFLAGS += -DDEBUG -I${TOP}/tools/lib -I${TOP}/tools +CFLAGS += -DDEBUG -I${TOP}/tools/lib -I${TOP}/tools -I${topobjdir}/tools/lib
Quoted 3 lines · Bill Hay
The following patch allows building the lvm utilities in a seperate directory from the source. It is a patch agains 1.0.1rc1 and has been tested with linux 2.2.18.
Cool ! This will go in. Thanks.
- Joe
Quoted 3 lines · Bill Hay
The following patch allows building the lvm utilities in a seperate directory from the source. It is a patch agains 1.0.1rc1 and has been tested with linux 2.2.18.
Committed, with the following changes to make everything work:
PATCHES/Makefile.in +1 -1
@@ -30,7 +30,7 @@ CLEANED_DIR=cleaned CLEANER=@top_srcdir@/scripts/select_version PATCHER=@top_srcdir@/scripts/patch_fragment -FRAGGER=@top_srcdir@/scripts/select_fragments +FRAGGER=../scripts/select_fragments LVM_PATCH=./lvm-$(LVM_VERSION)-$(KERNEL_VERSION).patch ifneq (,$(findstring 2.2,$(KERNEL_VERSION)))
configure +1 -1
@@ -2172,5 +2172,5 @@ test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 -ln -sf $srcdir/kernel/lvm.h tools/lib/lvm.h +ln -sf $topobjdir/$srcdir/kernel/lvm.h tools/lib/lvm.h
configure.in +1 -1
@@ -118,4 +118,4 @@ tools/lib/Makefile \ tools/man8/Makefile \ ) -AC_OUTPUT_COMMANDS([ln -sf $srcdir/kernel/lvm.h tools/lib/lvm.h]) +AC_OUTPUT_COMMANDS([ln -sf $topobjdir/$srcdir/kernel/lvm.h tools/lib/lvm.h])
tools/man8/Makefile.in +1 -0
@@ -39,6 +39,7 @@ install-man8: remove-man8 @echo "*** Installing $(MAN_PAGES) in $(DESTDIR)$(MAN8DIR) ***" + @INSTALL@ -d $(DESTDIR)$(MAN8DIR)/ @INSTALL@ -o $(OWNER) -g $(GROUP) -m 444 $(ALL_MANUALS) $(DESTDIR)$(MAN8DIR)/ remove-man8:
Signature · 14 lines
AJ Lewis Sistina Software Inc. Voice: 612-638-0500 1313 5th St SE, Suite 111 Fax: 612-638-0500 Minneapolis, MN 55414 E-Mail: [email protected] http://www.sistina.com Current GPG fingerprint = 3B5F 6011 5216 76A5 2F6B 52A0 941E 1261 0029 2648 Get my key at: http://www.sistina.com/~lewis/gpgkey (Unfortunately, the PKS-type keyservers do not work with multiple sub-keys) -----Begin Obligatory Humorous Quote---------------------------------------- Quitters never win, and winners never quit, but those who never quit AND never win are idiots. -----End Obligatory Humorous Quote------------------------------------------
Quoted 6 lines
Quoted 3 lines
The following patch allows building the lvm utilities in a=20 seperate directory from the source. It is a patch agains 1.0.1rc1 and has been tested with linux 2.2.18.
Committed, with the following changes to make everything work:
Probably better to back both patches out.
My original patch works only if given an absolute path to the source. Your patch works only if the path to source is precisely .. Incidentally it would appear that relative paths to the kernel source don't work either.
I'll fix the patch and resubmit it.
Quoted 5 lines · On Tue, Aug 21, 2001 at 08:23:07PM +0100, [email protected] wrote:
My original patch works only if given an absolute path to the source. Your patch works only if the path to source is precisely .. Incidentally it would appear that relative paths to the kernel source don't work either.
I'll fix the patch and resubmit it.
Fixed in the CVS now. Looking into relative kernel source paths...
Signature · 13 lines
AJ Lewis Sistina Software Inc. Voice: 612-638-0500 1313 5th St SE, Suite 111 Fax: 612-638-0500 Minneapolis, MN 55414 E-Mail: [email protected] http://www.sistina.com Current GPG fingerprint = 3B5F 6011 5216 76A5 2F6B 52A0 941E 1261 0029 2648 Get my key at: http://www.sistina.com/~lewis/gpgkey (Unfortunately, the PKS-type keyservers do not work with multiple sub-keys) -----Begin Obligatory Humorous Quote---------------------------------------- A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1... -----End Obligatory Humorous Quote------------------------------------------
Quoted 6 lines
Quoted 3 lines
The following patch allows building the lvm utilities in a=20 seperate directory from the source. It is a patch agains 1.0.1rc1 and has been tested with linux 2.2.18.
Committed, with the following changes to make everything work:
Applying the following patch on top of your patch & my original patch allows lvm to be built when the path to the source is specified as either an absolute path or a relative path. It
has been tested in the following situations:
1.Absolute path specified from unrelated directory. 2.Relative path specified from unrelated directory. 3.Relative path specified from child directory (../configure). 4.Relative path specified from source directory (./configure).
All versions appear to work.
NB kernel source must be specified with an absolute path.
configure +0 -3
@@ -2171,6 +2171,3 @@ rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - -ln -sf $topobjdir/$srcdir/kernel/lvm.h tools/lib/lvm.h -
configure.in +0 -1
@@ -118,4 +118,3 @@ tools/lib/Makefile \ tools/man8/Makefile \ ) -AC_OUTPUT_COMMANDS([ln -sf $topobjdir/$srcdir/kernel/lvm.h tools/lib/lvm.h])
tools/lib/Makefile.in +6 -4
@@ -38,7 +38,7 @@ ALL_RM = $(ALL_OBJECTS) $(ALL_POBJECTS) $(ARCHIVE) $(SO) $(SOM) $(SOV) -all_this: $(ARCHIVE) $(SO) Makefile +all_this: $(ARCHIVE) $(SO) Makefile lvm.h @echo "" @echo "Done Library parts" @echo ""
@@ -60,11 +60,11 @@ @rm -f $(DESTDIR)$(libdir)/${SO} $(DESTDIR)$(libdir)/${SOV} \ $(DESTDIR)$(libdir)/${SOM} $(DESTDIR)$(staticlibdir)/$(ARCHIVE); -$(ALL_SOURCES): liblvm.h $(OTHER_DEP) +$(ALL_SOURCES): liblvm.h $(OTHER_DEP) lvm.h -$(ALL_OBJECTS): liblvm.h $(OTHER_DEP) +$(ALL_OBJECTS): liblvm.h $(OTHER_DEP) lvm.h -$(ALL_POBJECTS): liblvm.h $(OTHER_DEP) +$(ALL_POBJECTS): liblvm.h $(OTHER_DEP) lvm.h $(ARCHIVE): $(ALL_OBJECTS) @echo "Making User parts"
@@ -77,6 +77,8 @@ ln -sf $(SOV) $(SOM) ln -sf $(SOV) $(SO) +lvm.h: + ln -sf $(TOP)/kernel/lvm.h lvm.h clean_this: rm -f $(ALL_RM)