diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index 900cdad84..b6595b017 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -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 diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 539f27c8c..5b2fcc637 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -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 {