Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 30647 - genkernel & initrd for root partitions under evms
Summary: genkernel & initrd for root partitions under evms
Status: RESOLVED LATER
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: x86 Linux
: High enhancement (vote)
Assignee: Brad House
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-08 02:58 UTC by Gour
Modified: 2004-01-18 08:08 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gour 2003-10-08 02:58:58 UTC
Those of us who use evms2 partitions (including root partition) have to manually build 
initrd so that evms2 partitions can be recognized. 
 
It would be nice if genkernel utility can build initrd ramdisk needed for root partition under 
evms. 
 
 

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Steven Wagner 2003-12-16 00:58:04 UTC
you betcha! I could really really use this right about now. 
Comment 2 Steven Wagner 2003-12-16 01:16:53 UTC
This URL is the only one I have found of someone who has claimed to have done it.
http://forums.gentoo.org/viewtopic.php?t=93085&highlight=evms

"loop mount the initrd and add the files as described in the sourceforge docs.
edit the linuxrd to start up devfsd and evms_activate as well as to set /proc/sys/kernel/real-root-dev
I got bit by all the utils being in the genkernel initrd except expr... make sure you grab it. Also watch the sym-links in /lib. "

also
"I've now got a script that takes the genkernel initrd and converts it to one that works with EVMS2."

I'll post it if I am able to get it from him.  Till then, I can't get my initrd to work for EVMS at all.
Comment 3 Cahya 2003-12-25 09:44:58 UTC
I need also initrd with LVM support  please.
Comment 4 Steven Wagner 2003-12-30 16:03:09 UTC
I got a script from someone who said this makes a working initrd for EVMS under gentoo.

Also...btw...in my testing I found that the initrd supplied on the evms website currently works with gentoo...though it would be nicer to have genkernel build a working initrd automatically.

Here is the script:

From:  	Linuxboy
To: 	shwag
Posted: 	Mon Dec 22, 2003 7:29 am
Subject: 	Re: evms initrd 	
Sorry for the delay, here is my script. note that it assumes SDA in one spot, so you may need to change it for your drives. 

#!/bin/sh

RD=/tmp/initrd
KD=`readlink -f /usr/src/linux`
KV="${KD##*/}"
KV="${KV##linux-}"

echo "Mounting initrd..."

# mount boot device if needed or fail
[ -e /boot/initrd-${KV} ] || mount /boot
[ -e /boot/initrd-${KV} ] || echo "Can't find initrd on /boot." || exit

cp -f /boot/initrd-${KV} /boot/initrd-${KV}.EVMS2.gz
gunzip -f /boot/initrd-${KV}.EVMS2.gz
mkdir -p ${RD}
mount -o loop /boot/initrd-${KV}.EVMS2 ${RD}

echo "Setting up linuxrc..."

# add EVMS2 activation to linuxrc
sed "s/^\s*exit$//" < ${RD}/linuxrc > /tmp/linuxrc
echo '
devfsd /dev

echo -e "\${HILITE} ---- Beginning evms root detection\${NORMAL}"
evms_activate

for name in `cat /proc/cmdline`; do
        echo $name | grep "^root=" > /dev/null
        if [ $? -eq 0 ]; then
                vol=`expr "\$name" : ".*=\(.*\)"`
                break
        fi
done

get_dev_num $vol>/proc/sys/kernel/real-root-dev

exit
'>> /tmp/linuxrc
cp -f /tmp/linuxrc ${RD}/linuxrc
rm /tmp/linuxrc

echo "Copying files..."

# set up additional directories
mkdir -p ${RD}/lib ${RD}/lib/evms ${RD}/lib/dev-state/
mkdir -p ${RD}/var ${RD}/var/log  ${RD}/var/lock
mkdir -p ${RD}/etc/devfs.d

# copy additional files
cp -f /bin/expr ${RD}/bin/

# setup devfsd
cp -f /sbin/devfsd ${RD}/sbin/
cp -fR /lib/dev-state ${RD}/lib/dev-state
cp -fR /etc/devfs.d ${RD}/etc/devfs.d
sed 's/^LOOKUP.*\s*\.\*\s*/#LOOKUP\t\t.*/g' </etc/devfsd.conf > ${RD}/etc/devfsd.conf

# copy evms specific files
cp -f /sbin/evms_activate ${RD}/sbin/
cp -f /sbin/get_dev_num ${RD}/sbin/
cp -f /etc/evms.conf ${RD}/etc/

# copy evms specific libs
cp -a /lib/libuuid.so.1 ${RD}/lib/
for file in `ls /lib/evms/ | grep -v "^csm-\|^ext2-\|^ha-\|^jfs-\|^reiser-\|^replace-\|^rsct-\|^swap-\|^xfs-"`
  do cp /lib/evms/$file ${RD}/lib/evms/
done
for file in `(ldd /sbin/evms_activate&&ldd /sbin/get_dev_num)|cut -d'=' -f 1 | sort -u`
  do [ -f $file ]&&cp $file ${RD}/lib/||cp -a /lib/$file ${RD}/lib/
done
# follow symlinks (two layers should be enough)
for file in `ls -l ${RD}/lib/|grep "\->" | cut -d'>' -f 2`
  do cp -a /lib/$file ${RD}/lib/
done
for file in `ls -l ${RD}/lib/|grep "\->" | cut -d'>' -f 2`
  do cp -a /lib/$file ${RD}/lib/
done

# fixup leftover /mnt/gentoo chroot issues if present in fstab
sed "s:^\s*mnt/gentoo/::g"</etc/fstab|sed "s:^\s*/dev/sda:# /dev/sda:g" >${RD}/etc/fstab

echo "Unmounting and compressing..."

umount ${RD}
rmdir ${RD}
gzip -f -9 /boot/initrd-${KV}.EVMS2
umount /boot

echo "Done."

echo -n "Press Enter to reboot or <Ctrl>-C to skip reboot" && read
init 6 
Comment 5 linuxboy 2004-01-07 09:55:44 UTC
The script is working for me under:
gentoo-sources kernel 2.4.20-r7 with EVMS 2.0.1
gentoo-sources kernel 2.4.20-r8 with EVMS 2.0.1
gentoo-sources kernel 2.4.22-r2 with EVMS 2.2.1

I have no reason to beleive that it won't keep working for the next few revs of 2.4 and EVMS.  EVMS on 2.6 seems to still have limitations, so I've not tried that yet.

In all cases, I use GRUB on a normal primary partition with ext3 and I have the kernel configured with devfs automount.

The ramdisk is larger than the default in the kernel so your kernel line in grub config needs to be something like this:
  kernel (hd0,0)/boot/kernel-2.4.22-gentoo-r2 root=/dev/evms/Root ramdisk=8192

To get genkernel to actually create the larger ramdisk, set the INITRD_SIZE setting in etc/kernels/settings and see Bug 29081 for how to use it.

The EVMS object layout that I personally use is here: 
  http://www.eby-brown.com/evms.gif

My sincere apologies for releasing such lousy quality code, this was intended to be a personal stopgap until genkernel got fixed.

Linuxboy
Comment 6 linuxboy 2004-01-08 17:14:16 UTC
Gentoo-sources 2.4.22-r[23] is not as "working" as I thought it was.
There is a warning in the ebuild saying "Presently gentoo-sources-2.4.22 
has basic support for evms2, but doesn't support some of the more 
advanced features."

This means that basic features like BBR are not supported and if you 
used them with 2.4.20, you won't be able to mount your existing volumes
anymore.

Simple volumes without any reason to be on EVMS2 work just fine, so if you're building an EVMS2 system just for fun, go right ahead.

Don't expect Gentoo-sources 2.6 to be any better for a while, the EVMS folks are still getting many of the features written.

See the notes at  Bug 37652

Linuxboy
Comment 7 Brad House 2004-01-18 08:08:30 UTC
yes, look at
/usr/share/genkernel/TODO
it's in there