summaryrefslogtreecommitdiff
path: root/vmdebootstrap
diff options
context:
space:
mode:
authorNeil Williams <codehelp@debian.org>2015-01-02 18:22:02 +0000
committerNeil Williams <codehelp@debian.org>2015-01-02 18:28:48 +0000
commit152b9b40a9dac7b50e79843a1240a3a6188fe9a2 (patch)
tree59c0795a5c2bba28fbd63d494ec56afcc23aa5e6 /vmdebootstrap
parente0cee06cae390afd614e13ada5e12becfb6927ed (diff)
downloadvmdebootstrap-152b9b40a9dac7b50e79843a1240a3a6188fe9a2.tar.gz
Set serial and graphical grub output terminal
Allows qemu to boot a GRUB image with the -nographic option.
Diffstat (limited to 'vmdebootstrap')
-rwxr-xr-xvmdebootstrap11
1 files changed, 11 insertions, 0 deletions
diff --git a/vmdebootstrap b/vmdebootstrap
index ed49040..7ac8807 100755
--- a/vmdebootstrap
+++ b/vmdebootstrap
@@ -606,6 +606,17 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth
'%s' % os.path.join(rootdir, 'proc')])
self.runcmd(['mount', '/sys', '-t', 'sysfs', '-obind',
'%s' % os.path.join(rootdir, 'sys')])
+
+ cmdline = 'GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=tty1 console=ttyS0,38400n8"'
+ terminal = 'GRUB_TERMINAL="serial gfxterm"'
+ command = 'GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --parity=no --stop=1"'
+ grub_cfg = os.path.join(rootdir, 'etc', 'default', 'grub')
+ logging.debug("Allowing serial output in grub config %s", grub_cfg)
+ with open(grub_cfg, 'a+') as cfg:
+ cfg.write("# %s serial support\n" % os.path.basename(__file__))
+ cfg.write("%s\n" % cmdline)
+ cfg.write("%s\n" % terminal)
+ cfg.write("%s\n" % command)
try:
self.runcmd(['chroot', rootdir, 'update-grub'])
self.runcmd(['chroot', rootdir, 'grub-install', install_dev])