Fix dmraid building with LVM/device-mapper

dmraid is entirely broken if you try to use the system static
LVM/device-mapper. Instead, always build our own LVM2 for the initramfs,
using DESTDIR for cleaner install. Dead code paths for old LVM2 build
not removed yet until more users have tested.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
cleanup-cruft
Robin H. Johnson 13 years ago
parent 8e800df298
commit 265363f79d

@ -5,6 +5,13 @@
# Distributed under the GPL v2 # Distributed under the GPL v2
# $Id$ # $Id$
14 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> gen_compile.sh,
gen_initramfs.sh:
dmraid is entirely broken if you try to use the system static
LVM/device-mapper. Instead start always building LVM2 for the initramfs,
using DESTDIR for cleaner install. Dead code paths for old LVM2 build not
removed yet until more users have tested.
12 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> gen_compile.sh: 12 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> gen_compile.sh:
More UTILS_CROSS_COMPILE prefix on strip calls. More UTILS_CROSS_COMPILE prefix on strip calls.

@ -406,7 +406,7 @@ compile_busybox() {
/bin/tar -jxpf ${BUSYBOX_SRCTAR} || /bin/tar -jxpf ${BUSYBOX_SRCTAR} ||
gen_die 'Could not extract busybox source tarball!' gen_die 'Could not extract busybox source tarball!'
[ -d "${BUSYBOX_DIR}" ] || [ -d "${BUSYBOX_DIR}" ] ||
gen_die 'Busybox directory ${BUSYBOX_DIR} is invalid!' gen_die "Busybox directory ${BUSYBOX_DIR} is invalid!"
cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config" cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config.gk_orig" cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config.gk_orig"
cd "${BUSYBOX_DIR}" cd "${BUSYBOX_DIR}"
@ -441,19 +441,20 @@ compile_lvm() {
/bin/tar -zxpf ${LVM_SRCTAR} || /bin/tar -zxpf ${LVM_SRCTAR} ||
gen_die 'Could not extract LVM source tarball!' gen_die 'Could not extract LVM source tarball!'
[ -d "${LVM_DIR}" ] || [ -d "${LVM_DIR}" ] ||
gen_die 'LVM directory ${LVM_DIR} is invalid!' gen_die "LVM directory ${LVM_DIR} is invalid!"
cd "${LVM_DIR}" cd "${LVM_DIR}"
apply_patches lvm ${LVM_VER} apply_patches lvm ${LVM_VER}
print_info 1 'lvm: >> Configuring...' print_info 1 'lvm: >> Configuring...'
CFLAGS="-fPIC" \ CFLAGS="-fPIC" \
./configure --enable-static_link --prefix=${TEMP}/lvm \ ./configure --enable-static_link --prefix=/ \
--with-lvm1=internal --with-clvmd=none --with-cluster=none \ --with-lvm1=internal --with-clvmd=none --with-cluster=none \
--disable-readline --disable-selinux --with-mirrors=internal \ --disable-readline --disable-selinux --with-mirrors=internal \
--with-snapshots=internal --with-pool=internal >> ${LOGFILE} 2>&1 || \ --with-snapshots=internal --with-pool=internal \
>> ${LOGFILE} 2>&1 || \
gen_die 'Configure of lvm failed!' gen_die 'Configure of lvm failed!'
print_info 1 'lvm: >> Compiling...' print_info 1 'lvm: >> Compiling...'
compile_generic '' utils compile_generic '' utils
compile_generic 'install' utils compile_generic "install DESTDIR=${TEMP}/lvm/" utils
cd "${TEMP}/lvm" cd "${TEMP}/lvm"
print_info 1 ' >> Copying to bincache...' print_info 1 ' >> Copying to bincache...'
@ -462,11 +463,11 @@ compile_lvm() {
# See bug 382555 # See bug 382555
${UTILS_CROSS_COMPILE}strip "sbin/dmsetup.static" || ${UTILS_CROSS_COMPILE}strip "sbin/dmsetup.static" ||
gen_die 'Could not strip dmsetup.static' gen_die 'Could not strip dmsetup.static'
/bin/tar -cjf "${LVM_BINCACHE}" sbin/lvm.static sbin/dmsetup.static || /bin/tar -cjf "${LVM_BINCACHE}" . ||
gen_die 'Could not create binary cache' gen_die 'Could not create binary cache'
cd "${TEMP}" cd "${TEMP}"
rm -rf "${TEMP}/device-mapper" > /dev/null rm -rf "${TEMP}/lvm" > /dev/null
rm -rf "${LVM_DIR}" lvm rm -rf "${LVM_DIR}" lvm
fi fi
} }
@ -483,7 +484,7 @@ compile_mdadm() {
/bin/tar -jxpf "${MDADM_SRCTAR}" || /bin/tar -jxpf "${MDADM_SRCTAR}" ||
gen_die 'Could not extract MDADM source tarball!' gen_die 'Could not extract MDADM source tarball!'
[ -d "${MDADM_DIR}" ] || [ -d "${MDADM_DIR}" ] ||
gen_die 'MDADM directory ${MDADM_DIR} is invalid!' gen_die "MDADM directory ${MDADM_DIR} is invalid!"
cd "${MDADM_DIR}" cd "${MDADM_DIR}"
apply_patches mdadm ${MDADM_VER} apply_patches mdadm ${MDADM_VER}
@ -521,24 +522,26 @@ compile_dmraid() {
/bin/tar -jxpf ${DMRAID_SRCTAR} || /bin/tar -jxpf ${DMRAID_SRCTAR} ||
gen_die 'Could not extract DMRAID source tarball!' gen_die 'Could not extract DMRAID source tarball!'
[ -d "${DMRAID_DIR}" ] || [ -d "${DMRAID_DIR}" ] ||
gen_die 'DMRAID directory ${DMRAID_DIR} is invalid!' gen_die "DMRAID directory ${DMRAID_DIR} is invalid!"
rm -rf "${TEMP}/device-mapper" > /dev/null rm -rf "${TEMP}/lvm" > /dev/null
/bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" || mkdir -p "${TEMP}/lvm"
gen_die "Could not extract device-mapper binary cache!"; /bin/tar -jxpf "${LVM_BINCACHE}" -C "${TEMP}/lvm" ||
gen_die "Could not extract LVM2 binary cache!";
cd "${DMRAID_DIR}" cd "${DMRAID_DIR}"
apply_patches dmraid ${DMRAID_VER} apply_patches dmraid ${DMRAID_VER}
print_info 1 'dmraid: >> Configuring...' print_info 1 'dmraid: >> Configuring...'
LDFLAGS="-L${TEMP}/device-mapper/lib" \ LDFLAGS="-L${TEMP}/lvm/lib" \
CFLAGS="-I${TEMP}/device-mapper/include" \ CFLAGS="-I${TEMP}/lvm/include" \
CPPFLAGS="-I${TEMP}/device-mapper/include" \ CPPFLAGS="-I${TEMP}/lvm/include" \
LIBS="-ldevmapper" \
./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${LOGFILE} 2>&1 || ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${LOGFILE} 2>&1 ||
gen_die 'Configure of dmraid failed!' gen_die 'Configure of dmraid failed!'
# We dont necessarily have selinux installed yet... look into # We dont necessarily have selinux installed yet... look into
# selinux global support in the future. # selinux global support in the future.
sed -i tools/Makefile -e "s|DMRAIDLIBS += -lselinux||g" sed -i tools/Makefile -e "/DMRAID_LIBS +=/s|-lselinux||g"
###echo "DMRAIDLIBS += -lselinux -lsepol" >> tools/Makefile ###echo "DMRAIDLIBS += -lselinux -lsepol" >> tools/Makefile
mkdir -p "${TEMP}/dmraid" mkdir -p "${TEMP}/dmraid"
print_info 1 'dmraid: >> Compiling...' print_info 1 'dmraid: >> Compiling...'
@ -553,7 +556,7 @@ compile_dmraid() {
gen_die 'Could not create binary cache' gen_die 'Could not create binary cache'
cd "${TEMP}" cd "${TEMP}"
rm -rf "${TEMP}/device-mapper" > /dev/null rm -rf "${TEMP}/lvm" > /dev/null
rm -rf "${DMRAID_DIR}" dmraid rm -rf "${DMRAID_DIR}" dmraid
fi fi
} }

@ -235,7 +235,7 @@ append_lvm(){
cd ${TEMP} cd ${TEMP}
mkdir -p "${TEMP}/initramfs-lvm-temp/bin/" mkdir -p "${TEMP}/initramfs-lvm-temp/bin/"
mkdir -p "${TEMP}/initramfs-lvm-temp/etc/lvm/" mkdir -p "${TEMP}/initramfs-lvm-temp/etc/lvm/"
if [ -e '/sbin/lvm.static' ] if false && [ -e '/sbin/lvm.static' ]
then then
print_info 1 ' LVM: Adding support (using local static binary /sbin/lvm.static)...' print_info 1 ' LVM: Adding support (using local static binary /sbin/lvm.static)...'
cp /sbin/lvm.static "${TEMP}/initramfs-lvm-temp/bin/lvm" || cp /sbin/lvm.static "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
@ -245,7 +245,7 @@ append_lvm(){
then then
cp /sbin/dmsetup.static "${TEMP}/initramfs-lvm-temp/bin/dmsetup" cp /sbin/dmsetup.static "${TEMP}/initramfs-lvm-temp/bin/dmsetup"
fi fi
elif [ -e '/sbin/lvm' ] && LC_ALL="C" ldd /sbin/lvm|grep -q 'not a dynamic executable' elif false && [ -e '/sbin/lvm' ] && LC_ALL="C" ldd /sbin/lvm|grep -q 'not a dynamic executable'
then then
print_info 1 ' LVM: Adding support (using local static binary /sbin/lvm)...' print_info 1 ' LVM: Adding support (using local static binary /sbin/lvm)...'
cp /sbin/lvm "${TEMP}/initramfs-lvm-temp/bin/lvm" || cp /sbin/lvm "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
@ -265,6 +265,7 @@ append_lvm(){
# See bug 382555 # See bug 382555
mv ${TEMP}/initramfs-lvm-temp/sbin/dmsetup.static ${TEMP}/initramfs-lvm-temp/bin/dmsetup || mv ${TEMP}/initramfs-lvm-temp/sbin/dmsetup.static ${TEMP}/initramfs-lvm-temp/bin/dmsetup ||
gen_die 'LVM error: Could not move dmsetup.static to dmsetup!' gen_die 'LVM error: Could not move dmsetup.static to dmsetup!'
rm -rf ${TEMP}/initramfs-lvm-temp/{lib,share,man,include,sbin/{lvm,dmsetup}}
fi fi
if [ -x /sbin/lvm ] if [ -x /sbin/lvm ]
then then

Loading…
Cancel
Save