This code is not very elegant, so if there are suggestions to improve it,
please shoot!

Thanks,
Ward.

-- 
Ward Vandewege <[EMAIL PROTECTED]>
Free Software Foundation - Senior System Administrator
Make lab.conf parsing a bit smarter, allowing for 2 modules to be passed to
kexec. This allows Xen booting, for instance with this lab.conf file:

CMDLINE="com1=115200,8n1 cdb=com1"
INITRD=""
KERNEL="/xen-3.1.0.gz"
MODULE1="/vmlinuz-2.6.18-xen root=/dev/md1 ro console=tty0 console=ttyS0,115200"
MODULE2="/initrd.img-2.6.18-xen"
VT="1"

Of course a simple lab.conf file with kernel and initrd still works:

CMDLINE="root=/dev/md1 ro console=tty0 console=ttyS0,115200"
KERNEL="/vmlinuz-2.6.22-14-generic"
INITRD="/initrd.img-2.6.22-14-generic"
VT="1"

Signed-off-by: Ward Vandewege <[EMAIL PROTECTED]>

Index: skeleton/bin/boot.functions
===================================================================
--- skeleton/bin/boot.functions	(revision 54)
+++ skeleton/bin/boot.functions	(working copy)
@@ -26,13 +26,25 @@
 		. $DIR/lab.conf
 	fi
 
-	if [ "$INITRD" = "" ]; then
-		$DIR/kexec -l $DIR/$KERNEL --command-line="$CMDLINE"
-	else
-		$DIR/kexec -l $DIR/$KERNEL --initrd=$DIR/$INITRD --command-line="$CMDLINE"
-	fi
+  if [ "$INITRD" = "" ] && [ "$MODULE1" = "" ]; then
+    $DIR/kexec -l $DIR/$KERNEL --command-line="$CMDLINE"
+  elif [ "$INITRD" != "" ] && [ "$MODULE1" = "" ]; then
+    $DIR/kexec -l $DIR/$KERNEL --initrd=$DIR/$INITRD --command-line="$CMDLINE"
+  elif [ "$INITRD" = "" ] && [ "$MODULE1" != "" ]; then
+    if [ "$MODULE2" != "" ]; then
+      $DIR/kexec -l $DIR/$KERNEL --module="$DIR/$MODULE1" --module="$DIR/$MODULE2" --command-line="$CMDLINE"
+    else
+      $DIR/kexec -l $DIR/$KERNEL --module="$DIR/$MODULE1" --command-line="$CMDLINE"
+    fi
+  elif [ "$INITRD" != "" ] && [ "$MODULE1" != "" ]; then
+    if [ "$MODULE2" != "" ]; then
+      $DIR/kexec -l $DIR/$KERNEL --initrd=$DIR/$INITRD --module="$DIR/$MODULE1" --module="$DIR/$MODULE2" --command-line="$CMDLINE"
+    else
+      $DIR/kexec -l $DIR/$KERNEL --initrd=$DIR/$INITRD --module="$DIR/$MODULE1" --command-line="$CMDLINE"
+    fi
+  fi
 
 	$DIR/kexec -e
 
-	message "ERROR: can't run kexec $DIR/$KERNEL $CMDLINE $INITRD"
+	message "ERROR: can't run kexec $DIR/$KERNEL $CMDLINE $INITRD $MODULE1 $MODULE2"
 }
-- 
linuxbios mailing list
linuxbios@linuxbios.org
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to