From 6ae74289015820ae2d2825790988fb882c7e3b8c Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 20 Dec 2011 16:22:43 +0000 Subject: [PATCH] add --serial-console option --- vmdebootstrap | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/vmdebootstrap b/vmdebootstrap index 05178ea..b6d6a48 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -61,6 +61,8 @@ class VmDebootstrap(cliapp.Application): self.settings.string_list(['user'], 'create USER with PASSWORD', metavar='USER/PASSWORD') + self.settings.boolean(['serial-console'], + 'configure image to use a serial console') def process_args(self, args): if not self.settings['image']: @@ -272,13 +274,23 @@ timeout 1 label linux kernel %(kernel)s -append initrd=%(initrd)s root=UUID=%(uuid)s ro quiet +append initrd=%(initrd)s root=UUID=%(uuid)s ro quiet %(kserial)s +%(extserial)s ''' % { 'kernel': kernel_image, 'initrd': initrd_image, 'uuid': uuid, + 'kserial': + 'console=ttyS0,115200' if self.settings['serial-console'] else '', + 'extserial': 'serial 0 115200' if self.settings['serial-console'] else '', }) f.close() + + if self.settings['serial-console']: + logging.debug('adding getty to serial console') + inittab = os.path.join(rootdir, 'etc/inittab') + with open(inittab, 'a') as f: + f.write('\nS0:23:respawn:/sbin/getty -L ttyS0 115200 vt100\n') self.runcmd(['extlinux', '--install', rootdir]) self.runcmd(['sync']) -- 2.39.5