From 8b3e22e84cce22b2ca06f470f4e916ea96b31587 Mon Sep 17 00:00:00 2001 From: Edison Su Date: Thu, 31 Mar 2011 18:48:53 -0400 Subject: [PATCH] enable serial console for system vm, to make debug easier --- .../config/etc/init.d/cloud-early-config | 3 ++- .../config/opt/cloud/bin/patchsystemvm.sh | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config index 3ce0f4e82f2..d3f82e5e857 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -114,7 +114,8 @@ patch() { echo ${newmd5} > ${md5file} fi log_it "Patching cloud service" - /opt/cloud/bin/patchsystemvm.sh $PATCH_MOUNT + hyperVisor=$(hypervisor) + /opt/cloud/bin/patchsystemvm.sh $PATCH_MOUNT $hyperVisor umount $PATCH_MOUNT if [ "$shouldpatch" == "true" ] then diff --git a/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh b/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh index 70e7dce752e..9d9f3ed2768 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh +++ b/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh @@ -76,9 +76,21 @@ enable_pcihotplug() { echo pci_hotplug >> /etc/modules } +enable_serial_console() { + sed -i -e "/^serial.*/d" /boot/grub/grub.conf + sed -i -e "/^terminal.*/d" /boot/grub/grub.conf + sed -i -e "/^default.*/a\serial --unit=0 --speed=115200 --parity=no --stop=1" /boot/grub/grub.conf + sed -i -e "/^serial.*/a\terminal --timeout=0 serial console" /boot/grub/grub.conf + sed -i -e "s/\(^kernel.* ro\) \(console.*\)/\1 console=tty0 console=ttyS0,115200n8/" /boot/grub/grub.conf + sed -i -e "/^s0:2345:respawn.*/d" /etc/inittab + sed -i -e "/6:23:respawn/a\s0:2345:respawn:/sbin/getty -L 115200 ttyS0 vt102" /etc/inittab +} + + CMDLINE=$(cat /var/cache/cloud/cmdline) TYPE="router" PATCH_MOUNT=$1 +Hypervisor=$2 for i in $CMDLINE do @@ -108,7 +120,11 @@ fi #empty known hosts echo "" > /root/.ssh/known_hosts -enable_pcihotplug +if [ "$Hypervisor" == "kvm" ] +then + enable_pcihotplug + enable_serial_console +fi if [ "$TYPE" == "router" ] then