forked from opencomputeproject/onie
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for lvm2 and device-mapper
Reviewed By: puneet, dustin This patch adds support for logical volume management, specifically lvm2. This cuts across a number of components: GRUB -- adds support for loading the kernel and initrd from logical volumes. Linux Kernel -- adds device mapper support, which lvm2 is built on top of. user space -- adds lvm2 utilities for creating / managing logical volumes. Testing Done: 1. Boot into ONIE. 2. Create a volume group on /dev/sda4 3. Create a logical volume 4. Create a ext4 file system on logical volume, with a label 5. Mount logical volume 6. copy ONIE kernel and initramfs to logical volume 7. umount logical volume 8. Reboot, stopping in grub 9. From grub 'insmod lvm' 10. grub> ls -- shows the logical volume 11. grub> search command finds partition by file system label 12. grub> load kernel and initramfs from volume 13. grub> boot -- boots in ONIE from logical volume
- Loading branch information
Curt Brune
committed
Mar 18, 2014
1 parent
9595e73
commit 6ccd82c
Showing
9 changed files
with
247 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
#------------------------------------------------------------------------------- | ||
# | ||
# | ||
#------------------------------------------------------------------------------- | ||
# | ||
# This is a makefile fragment that defines the build of lvm2 | ||
# | ||
|
||
LVM2_VERSION = 2_02_105 | ||
LVM2_TARBALL = lvm2-$(LVM2_VERSION).tar.xz | ||
LVM2_TARBALL_URLS += $(ONIE_MIRROR) https://git.fedorahosted.org/cgit/lvm2.git/snapshot/ | ||
LVM2_BUILD_DIR = $(MBUILDDIR)/lvm2 | ||
LVM2_DIR = $(LVM2_BUILD_DIR)/lvm2-$(LVM2_VERSION) | ||
|
||
LVM2_SRCPATCHDIR = $(PATCHDIR)/lvm2 | ||
LVM2_DOWNLOAD_STAMP = $(DOWNLOADDIR)/lvm2-download | ||
LVM2_SOURCE_STAMP = $(STAMPDIR)/lvm2-source | ||
LVM2_PATCH_STAMP = $(STAMPDIR)/lvm2-patch | ||
LVM2_CONFIGURE_STAMP = $(STAMPDIR)/lvm2-configure | ||
LVM2_BUILD_STAMP = $(STAMPDIR)/lvm2-build | ||
LVM2_INSTALL_STAMP = $(STAMPDIR)/lvm2-install | ||
LVM2_STAMP = $(LVM2_SOURCE_STAMP) \ | ||
$(LVM2_CONFIGURE_STAMP) \ | ||
$(LVM2_BUILD_STAMP) \ | ||
$(LVM2_INSTALL_STAMP) | ||
|
||
PHONY += lvm2 lvm2-download lvm2-source lvm2-patch lvm2-configure \ | ||
lvm2-build lvm2-install lvm2-clean lvm2-download-clean | ||
|
||
# List of libraries and programs to install in the final sysroot for | ||
# lvm2. All the paths are relative to $(DEV_SYSROOT)/usr. | ||
|
||
LVM2_PROGS = \ | ||
lib/libdevmapper.so lib/libdevmapper.so.1.02 \ | ||
sbin/lvm \ | ||
sbin/lvchange \ | ||
sbin/lvconvert \ | ||
sbin/lvcreate \ | ||
sbin/lvdisplay \ | ||
sbin/lvextend \ | ||
sbin/lvmchange \ | ||
sbin/lvmdiskscan \ | ||
sbin/lvmsadc \ | ||
sbin/lvmsar \ | ||
sbin/lvreduce \ | ||
sbin/lvremove \ | ||
sbin/lvrename \ | ||
sbin/lvresize \ | ||
sbin/lvs \ | ||
sbin/lvscan \ | ||
sbin/pvchange \ | ||
sbin/pvresize \ | ||
sbin/pvck \ | ||
sbin/pvcreate \ | ||
sbin/pvdisplay \ | ||
sbin/pvmove \ | ||
sbin/pvremove \ | ||
sbin/pvs \ | ||
sbin/pvscan \ | ||
sbin/vgcfgbackup \ | ||
sbin/vgcfgrestore \ | ||
sbin/vgchange \ | ||
sbin/vgck \ | ||
sbin/vgconvert \ | ||
sbin/vgcreate \ | ||
sbin/vgdisplay \ | ||
sbin/vgexport \ | ||
sbin/vgextend \ | ||
sbin/vgimport \ | ||
sbin/vgmerge \ | ||
sbin/vgmknodes \ | ||
sbin/vgreduce \ | ||
sbin/vgremove \ | ||
sbin/vgrename \ | ||
sbin/vgs \ | ||
sbin/vgscan \ | ||
sbin/vgsplit \ | ||
sbin/dmsetup | ||
|
||
lvm2: $(LVM2_STAMP) | ||
|
||
DOWNLOAD += $(LVM2_DOWNLOAD_STAMP) | ||
lvm2-download: $(LVM2_DOWNLOAD_STAMP) | ||
$(LVM2_DOWNLOAD_STAMP): $(PROJECT_STAMP) | ||
$(Q) rm -f $@ && eval $(PROFILE_STAMP) | ||
$(Q) echo "==== Getting upstream lvm2 ====" | ||
$(Q) $(SCRIPTDIR)/fetch-package $(DOWNLOADDIR) $(UPSTREAMDIR) \ | ||
$(LVM2_TARBALL) $(LVM2_TARBALL_URLS) | ||
$(Q) touch $@ | ||
|
||
SOURCE += $(LVM2_SOURCE_STAMP) | ||
lvm2-source: $(LVM2_SOURCE_STAMP) | ||
$(LVM2_SOURCE_STAMP): $(TREE_STAMP) | $(LVM2_DOWNLOAD_STAMP) | ||
$(Q) rm -f $@ && eval $(PROFILE_STAMP) | ||
$(Q) echo "==== Extracting upstream lvm2 ====" | ||
$(Q) $(SCRIPTDIR)/extract-package $(LVM2_BUILD_DIR) $(DOWNLOADDIR)/$(LVM2_TARBALL) | ||
$(Q) touch $@ | ||
|
||
lvm2-patch: $(LVM2_PATCH_STAMP) | ||
$(LVM2_PATCH_STAMP): $(LVM2_SRCPATCHDIR)/* $(LVM2_SOURCE_STAMP) | ||
$(Q) rm -f $@ && eval $(PROFILE_STAMP) | ||
$(Q) echo "==== Patching lvm2 ====" | ||
$(Q) $(SCRIPTDIR)/apply-patch-series $(LVM2_SRCPATCHDIR)/series $(LVM2_DIR) | ||
$(Q) touch $@ | ||
|
||
ifndef MAKE_CLEAN | ||
LVM2_NEW_FILES = $(shell test -d $(LVM2_DIR) && test -f $(LVM2_BUILD_STAMP) && \ | ||
find -L $(LVM2_DIR) -newer $(LVM2_BUILD_STAMP) -type f -print -quit) | ||
endif | ||
|
||
# The lvm2 configure script is a bit pessimistic about a few things | ||
# while cross compiling. Let it know things are fine... | ||
LVM2_CONFIGURE_OVERRIDES = \ | ||
ac_cv_func_malloc_0_nonnull=yes \ | ||
ac_cv_func_memcmp_working=yes \ | ||
ac_cv_func_mmap_fixed_mapped=yes \ | ||
ac_cv_func_realloc_0_nonnull=yes \ | ||
ac_cv_func_strtod=yes \ | ||
ac_cv_func_chown_works=yes \ | ||
|
||
|
||
lvm2-configure: $(LVM2_CONFIGURE_STAMP) | ||
$(LVM2_CONFIGURE_STAMP): $(LVM2_PATCH_STAMP) | $(DEV_SYSROOT_INIT_STAMP) | ||
$(Q) rm -f $@ && eval $(PROFILE_STAMP) | ||
$(Q) echo "==== Configure lvm2-$(LVM2_VERSION) ====" | ||
$(Q) cd $(LVM2_DIR) && PATH='$(CROSSBIN):$(PATH)' \ | ||
$(LVM2_CONFIGURE_OVERRIDES) \ | ||
$(LVM2_DIR)/configure \ | ||
--prefix=$(DEV_SYSROOT)/usr \ | ||
--host=$(TARGET) \ | ||
--with-clvmd=none \ | ||
--disable-nls \ | ||
--disable-selinux \ | ||
CC=$(CROSSPREFIX)gcc \ | ||
CFLAGS="$(ONIE_CFLAGS)" \ | ||
LDFLAGS="$(ONIE_LDFLAGS)" | ||
$(Q) touch $@ | ||
|
||
lvm2-build: $(LVM2_BUILD_STAMP) | ||
$(LVM2_BUILD_STAMP): $(LVM2_CONFIGURE_STAMP) | ||
$(Q) rm -f $@ && eval $(PROFILE_STAMP) | ||
$(Q) echo "==== Building lvm2-$(LVM2_VERSION) ====" | ||
$(Q) PATH='$(CROSSBIN):$(PATH)' $(MAKE) -C $(LVM2_DIR) \ | ||
CROSS_COMPILE=$(CROSSPREFIX) all | ||
$(Q) touch $@ | ||
|
||
lvm2-install: $(LVM2_INSTALL_STAMP) | ||
$(LVM2_INSTALL_STAMP): $(SYSROOT_INIT_STAMP) $(LVM2_BUILD_STAMP) | ||
$(Q) rm -f $@ && eval $(PROFILE_STAMP) | ||
$(Q) echo "==== Installing lvm2 programs in $(SYSROOTDIR) ====" | ||
$(Q) PATH='$(CROSSBIN):$(PATH)' $(MAKE) -C $(LVM2_DIR) \ | ||
CROSS_COMPILE=$(CROSSPREFIX) install | ||
$(Q) for file in $(LVM2_PROGS) ; do \ | ||
cp -afv $(DEV_SYSROOT)/usr/$$file $(SYSROOTDIR)/usr/$$file ; \ | ||
chmod +w $(SYSROOTDIR)/usr/$$file ; \ | ||
done | ||
$(Q) touch $@ | ||
|
||
USERSPACE_CLEAN += lvm2-clean | ||
lvm2-clean: | ||
$(Q) rm -rf $(LVM2_BUILD_DIR) | ||
$(Q) rm -f $(LVM2_STAMP) | ||
$(Q) echo "=== Finished making $@ for $(PLATFORM)" | ||
|
||
DOWNLOAD_CLEAN += lvm2-download-clean | ||
lvm2-download-clean: | ||
$(Q) rm -f $(LVM2_DOWNLOAD_STAMP) $(DOWNLOADDIR)/$(LVM2_TARBALL) | ||
|
||
#------------------------------------------------------------------------------- | ||
# | ||
# Local Variables: | ||
# mode: makefile-gmake | ||
# End: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
lvm2 conf install directory fixup | ||
|
||
The lvm2 install target for the conf/ subdirectory is not quite right | ||
for cross compiling. It tries to install files in /etc instead of the | ||
target sysroot directory. | ||
|
||
diff --git a/conf/Makefile.in b/conf/Makefile.in | ||
index 3f66621..4193111 100644 | ||
--- a/conf/Makefile.in | ||
+++ b/conf/Makefile.in | ||
@@ -24,14 +24,14 @@ PROFILES=$(DEFAULT_PROFILE) $(srcdir)/thin-performance.profile | ||
include $(top_builddir)/make.tmpl | ||
|
||
install_conf: $(CONFSRC) | ||
- @if [ ! -e $(confdir)/$(CONFDEST) ]; then \ | ||
- echo "$(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST)"; \ | ||
- $(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST); \ | ||
+ @if [ ! -e $(sysconfdir)/$(CONFDEST) ]; then \ | ||
+ echo "$(INSTALL_WDATA) -D $< $(sysconfdir)/$(CONFDEST)"; \ | ||
+ $(INSTALL_WDATA) -D $< $(sysconfdir)/$(CONFDEST); \ | ||
fi | ||
|
||
install_profiles: $(PROFILES) | ||
- $(INSTALL_DIR) $(DESTDIR)$(DEFAULT_PROFILE_DIR) | ||
- $(INSTALL_DATA) $(PROFILES) $(DESTDIR)$(DEFAULT_PROFILE_DIR)/ | ||
+ $(INSTALL_DIR) $(sysconfdir)/profile | ||
+ $(INSTALL_DATA) $(PROFILES) $(sysconfdir)/profile/ | ||
|
||
install_lvm2: install_conf install_profiles | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# This series applies on GIT commit ad50b40707ea89ec1f8b9d3071df331dc3b289fd | ||
lvm2-conf-install-directory-fixup.patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
89b48344606ab35ecc5d89d6434598a8b1407345 lvm2-2_02_105.tar.xz |