add "-l" option support of genimage in dracut mode

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15238 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
immarvin 2013-02-22 08:35:36 +00:00
parent 2142411c43
commit 38b5874b32
2 changed files with 26 additions and 4 deletions

View File

@ -3,6 +3,8 @@ NEWROOT=$3
RWDIR=.statelite
XCATMASTER=$XCAT
. /lib/dracut-lib.sh
rootlimit="$(getarg rootlimit=)"
if [ ! -z "$imgurl" ]; then
if [ xhttp = x${imgurl%%:*} ]; then
NFS=0
@ -41,7 +43,12 @@ if [ -r /rootimg.sfs ]; then
mount --move /rw $NEWROOT/rw
elif [ -r /rootimg.gz ]; then
echo Setting up RAM-root tmpfs.
mount -t tmpfs -o mode=755 rootfs $NEWROOT
if [ -z $rootlimit ];then
mount -t tmpfs -o mode=755 rootfs $NEWROOT
else
mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT
fi
cd $NEWROOT
echo -n "Extracting root filesystem:"
if [ -x /bin/cpio ]; then
@ -52,7 +59,13 @@ elif [ -r /rootimg.gz ]; then
echo Done
elif [ -r /rootimg-statelite.gz ]; then
echo Setting up RAM-root tmpfs for statelite mode.
mount -t tmpfs -o mode=755 rootfs $NEWROOT
if [ -z $rootlimit];then
mount -t tmpfs -o mode=755 rootfs $NEWROOT
else
mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT
fi
cd $NEWROOT
echo -n "Extracting root filesystem:"
if [ -x /bin/cpio ]; then

View File

@ -813,9 +813,18 @@ sub mkinitrd_dracut {
xdie "the mode: $mode is not supported by genimage";
}
system("chroot $rootimg_dir dracut -f /tmp/initrd.$$.gz $kernelver");
my $additional_options=undef;
if($rootlimit)
{
open(my $ETC_CMDLINE,">","$rootimg_dir/tmp/cmdline");
print $ETC_CMDLINE qq{rootlimit=$rootlimit\n};
close $ETC_CMDLINE;
$additional_options= qq{--include /tmp/cmdline /etc/cmdline};
}
system("chroot $rootimg_dir dracut $additional_options -f /tmp/initrd.$$.gz $kernelver");
print "the initial ramdisk for $mode is generated successfully.\n";
move("$rootimg_dir/tmp/initrd.$$.gz", "$destdir/initrd-$mode.gz");
move("$rootimg_dir/tmp/initrd.$$.gz", "$destdir/initrd-$mode.gz");
}
sub mkinitrd {