LVM2 compilation support; thanks to Eric Edgar for the patch. Bug #72129.
authorTim Yamin <plasmaroo@gentoo.org>
Sat, 27 Nov 2004 13:52:43 +0000 (13:52 +0000)
committerTim Yamin <plasmaroo@gentoo.org>
Sat, 27 Nov 2004 13:52:43 +0000 (13:52 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@151 67a159dc-881f-0410-a524-ba9dfbe2cb84

gen_cmdline.sh
gen_compile.sh
gen_determineargs.sh
gen_initrd.sh
genkernel
genkernel.conf

index 276f898d783269279550010535ccbfc892591a3f..b02e105a07d90b8428ceb53b4bf4a258bf9e28f2 100755 (executable)
@@ -63,7 +63,7 @@ longusage() {
   echo "       --bootsplash=<theme>    Force bootsplash using <theme>"
   echo "       --gensplash=<theme>     Force gensplash using <theme>"
   echo "       --do-keymap-auto        Forces keymap selection at boot"
-  echo "       --no-lvm2               Don't include LVM2 support"
+  echo "       --lvm2                  Include LVM2 support"
   echo "       --bootloader=grub       Add new kernel to GRUB configuration"
   echo "       --linuxrc=<file>        Specifies a user created linuxrc"
   echo "  Internals"
@@ -153,9 +153,9 @@ parse_cmdline() {
                      CMD_NOEVMS2=1
                      print_info 2 'CMD_NOEVMS2: 1'
              ;;
-             --no-lvm2)
-                     CMD_NOLVM2=1
-                     print_info 2 'CMD_NOLVM2: 1'
+             --lvm2)
+                     CMD_LVM2=1
+                     print_info 2 'CMD_LVM2: 1'
              ;;
              --bootloader=*)
                      CMD_BOOTLOADER=`parse_opt "$*"`
index 94f068c5fe00c3bd2b7443494242c738c3795b93..d8754bbd2a6a22674e82d7cd3927c01d01d90f5c 100644 (file)
@@ -277,6 +277,46 @@ compile_busybox() {
        fi
 }
 
+compile_lvm2() {
+       compile_device_mapper
+       if [ ! -f "${LVM2_BINCACHE}" ]
+       then
+               [ -f "${LVM2_SRCTAR}" ] ||
+                       gen_die "Could not find LVM2 source tarball: ${LVM2_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+               cd "${TEMP}"
+               rm -rf ${LVM2_DIR} > /dev/null
+               tar -zxpf ${LVM2_SRCTAR} ||
+                       gen_die 'Could not extract LVM2 source tarball!'
+               [ -d "${LVM2_DIR}" ] ||
+                       gen_die 'LVM2 directory ${LVM2_DIR} is invalid!'
+               rm -rf "${TEMP}/device-mapper" > /dev/null
+               tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
+                       gen_die "Could not extract device-mapper binary cache!";
+               
+               cd "${LVM2_DIR}"
+               print_info 1 'lvm2: >> Configuring...'
+                       LDFLAGS="-L${TEMP}/device-mapper/lib" \
+                       CFLAGS="-I${TEMP}/device-mapper/include" \
+                       CPPFLAGS="-I${TEMP}/device-mapper/include" \
+                       ./configure --enable-static_link --prefix=${TEMP}/lvm2 >> ${DEBUGFILE} 2>&1 ||
+                               gen_die 'Configure of lvm2 failed!'
+               print_info 1 'lvm2: >> Compiling...'
+                       compile_generic '' utils
+                       compile_generic 'install' utils
+
+               cd "${TEMP}/lvm2"
+               print_info 1 '      >> Copying to bincache...'
+               strip "sbin/lvm.static" ||
+                       gen_die 'Could not strip lvm.static!'
+               tar -cjf "${LVM2_BINCACHE}" sbin/lvm.static ||
+                       gen_die 'Could not create binary cache'
+
+               cd "${TEMP}"
+               rm -rf "${TEMP}/device-mapper" > /dev/null
+               rm -rf "${LVM2_DIR}" lvm2
+       fi
+}
+
 compile_modutils() {
        # I've disabled dietlibc support for the time being since the
        # version we use misses a few needed system calls.
@@ -438,6 +478,38 @@ compile_devfsd() {
        fi
 }
 
+compile_device_mapper() {
+       if [ ! -f "${DEVICE_MAPPER_BINCACHE}" ]
+       then
+               [ ! -f "${DEVICE_MAPPER_SRCTAR}" ] &&
+                       gen_die "Could not find device-mapper source tarball: ${DEVICE_MAPPER_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+               cd "${TEMP}"
+               rm -rf "${DEVICE_MAPPER_DIR}"
+               tar -zxpf "${DEVICE_MAPPER_SRCTAR}"
+               [ ! -d "${DEVICE_MAPPER_DIR}" ] &&
+                       gen_die "device-mapper directory ${DEVICE_MAPPER_DIR} invalid"
+               cd "${DEVICE_MAPPER_DIR}"
+               ./configure  --prefix=${TEMP}/device-mapper --enable-static_link >> ${DEBUGFILE} 2>&1 ||
+                       gen_die 'Configuring device-mapper failed!'
+               print_info 1 'device-mapper: >> Compiling...'
+               compile_generic '' utils
+               compile_generic 'install' utils
+               print_info 1 '        >> Copying to cache...'
+               cd "${TEMP}"
+               rm -r "${TEMP}/device-mapper/man" ||
+                       gen_die 'Could not remove manual pages!'
+               strip "${TEMP}/device-mapper/sbin/dmsetup" ||
+                       gen_die 'Could not strip dmsetup binary!'
+               tar -jcpf "${DEVICE_MAPPER_BINCACHE}" device-mapper ||
+                       gen_die 'Could not tar up the device-mapper binary!'
+               [ -f "${DEVICE_MAPPER_BINCACHE}" ] ||
+                       gen_die 'device-mapper cache not created!'
+               cd "${TEMP}"
+               rm -rf "${DEVICE_MAPPER_DIR}" > /dev/null
+               rm -rf "${TEMP}/device-mapper" > /dev/null
+       fi
+}
+
 compile_dietlibc() {
        local BUILD_DIETLIBC
        local ORIGTEMP
index c5feeadfc562e48191dc83745dec6b23325f1b97..b407cf730659d2b853e73e1dd704928ca87b10e2 100644 (file)
@@ -92,6 +92,8 @@ determine_real_args() {
        DEVFSD_BINCACHE=`cache_replace "${DEVFSD_BINCACHE}"`
        DEVFSD_CONF_BINCACHE=`cache_replace "${DEVFSD_CONF_BINCACHE}"`
        UDEV_BINCACHE=`cache_replace "${UDEV_BINCACHE}"`
+       DEVICE_MAPPER_BINCACHE=`cache_replace "${DEVICE_MAPPER_BINCACHE}"`
+       LVM2_BINCACHE=`cache_replace "${LVM2_BINCACHE}"`
   
        DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"`
        BUSYBOX_CONFIG=`arch_replace "${BUSYBOX_CONFIG}"`
@@ -103,6 +105,8 @@ determine_real_args() {
        DEVFSD_BINCACHE=`arch_replace "${DEVFSD_BINCACHE}"`
        DEVFSD_CONF_BINCACHE=`arch_replace "${DEVFSD_CONF_BINCACHE}"`
        UDEV_BINCACHE=`arch_replace "${UDEV_BINCACHE}"`
+       DEVICE_MAPPER_BINCACHE=`arch_replace "${DEVICE_MAPPER_BINCACHE}"`
+       LVM2_BINCACHE=`arch_replace "${LVM2_BINCACHE}"`
        
        if [ "${CMD_BOOTSPLASH}" != '' ]
        then
index 79232760948e6272f48781c1296b3bd97651101a..7a44702bb526048fa86ef87f96875148c4cc5353 100644 (file)
@@ -93,26 +93,46 @@ create_base_initrd_sys() {
 #              gen_die "could not uncompress devfsd.conf"
 
        # LVM2
-       if [ -e '/sbin/lvm' ] && ldd /sbin/lvm|grep -q 'not a dynamic executable';
+       if [ "${CMD_LVM2}" -eq '1' ]
        then
-               if [ "${CMD_NOLVM2}" != '1' ]
+               if [ -e '/sbin/lvm' ] && ldd /sbin/lvm|grep -q 'not a dynamic executable';
                then
-                       print_info 1 'lvm2: Adding support...'
+                       print_info 1 'LVM2: Adding support (using local static binaries)...'
                        cp /sbin/lvm "${TEMP}/initrd-temp/bin/lvm" ||
                                gen_die 'Could not copy over lvm!'
-                       ln -sf "./lvm" "${TEMP}/initrd-temp/bin/vgscan" ||
+                       ln -sf "${TEMP}/initrd-temp/bin/lvm" "${TEMP}/initrd-temp/bin/vgscan" ||
                                gen_die 'Could not symlink lvm -> vgscan!'
-                       ln -sf "./lvm" "${TEMP}/initrd-temp/bin/vgchange" ||
+                       ln -sf "${TEMP}/initrd-temp/bin/lvm" "${TEMP}/initrd-temp/bin/vgchange" ||
                                gen_die 'Could not symlink lvm -> vgchange!'
+               else
+                       print_info 1 'LVM2: Adding support (compiling binaries)...'
+                       compile_lvm2
+
+                       tar -jxpf "${LVM2_BINCACHE}" -C "${TEMP}/initrd-temp" ||
+                               gen_die "Could not extract lvm2 binary cache!";
+                       mv ${TEMP}/initrd-temp/bin/lvm.static ${TEMP}/initrd-temp/bin/lvm ||
+                               gen_die 'LVM2 error: Could not move lvm.static to lvm!'
+                       for i in vgchange vgscan; do
+                               ln  ${TEMP}/initrd-temp/bin/lvm ${TEMP}/initrd-temp/bin/$i ||
+                                       gen_die "LVM2 error: Could not link ${i}!"
+                       done
+               fi      
+       else # Deprecation warning; remove in a few versions.
+               if [ -e '/sbin/lvm' ]
+               then
+                       if ldd /sbin/lvm|grep -q 'not a dynamic executable';
+                       then
+                               print_warning 1 'LVM2: For support, use --lvm2!'
+                       fi
                fi
        fi
        
-       #EVMS2
+       # EVMS2
        if [ -e '/sbin/evms_activate' ]
        then
                if [ "${CMD_NOEVMS2}" -ne '1' ]
                then
-                       print_info 1 'evms2: Adding support...' 
+                       print_info 1 'EVMS2: Adding support...' 
                        mkdir -p ${TEMP}/initrd-temp/lib
                        cp -a /lib/ld-* "${TEMP}/initrd-temp/lib" || gen_die 'Could not copy files for EVMS2!'
                        cp -a /lib/libc-* /lib/libc.* "${TEMP}/initrd-temp/lib" || gen_die 'Could not copy files for EVMS2!'
index 29cda30bd2d24c48ee09df782c2040d63ed363f6..35477a7d1beeadad1d1097ccf7bd8cca719a6967 100755 (executable)
--- a/genkernel
+++ b/genkernel
@@ -265,8 +265,6 @@ then
        fi
 
        compile_devfsd
-       #UDEV=0
-       #[ "${VER}" -gt '2' ] || [ "${VER}" -eq '2' -a "${PAT}" -ge '6' -a "${NOUDEV}" -eq '0' ] && UDEV=1 && print_info 1 'udev: Target is a 2.6 kernel, support enabled.'
        [ "${UDEV}" -eq '1' ] && compile_udev
 
        # Create initrd
index e925fd28285bdf07f9908510c9c17746b7940c9e..74b67173cf18614155be6810b79212d6e8edfc31 100755 (executable)
@@ -94,3 +94,13 @@ UDEV_VER="039"
 UDEV_DIR="udev-${UDEV_VER}"
 UDEV_SRCTAR="${GK_SHARE}/pkg/udev-${UDEV_VER}.tar.bz2"
 UDEV_BINCACHE="%%CACHE%%/udev-${UDEV_VER}-%%ARCH%%.tar.bz2"
+
+DEVICE_MAPPER_VER="1.00.17"
+DEVICE_MAPPER_DIR="device-mapper.${DEVICE_MAPPER_VER}"
+DEVICE_MAPPER_SRCTAR="${GK_SHARE}/pkg/device-mapper.${DEVICE_MAPPER_VER}.tgz"
+DEVICE_MAPPER_BINCACHE="%%CACHE%%/device-mapper-${DEVICE_MAPPER_VER}-%%ARCH%%.tar.bz2"
+
+LVM2_VER="2.00.25"
+LVM2_DIR="LVM2.${LVM2_VER}"
+LVM2_SRCTAR="${GK_SHARE}/pkg/LVM2.${LVM2_VER}.tgz"
+LVM2_BINCACHE="%%CACHE%%/LVM2.${LVM2_VER}-%%ARCH%%.tar.bz2"