[systemd-devel] [PATCH 1/2] getty-generator: run console shell for uml

Ramkumar Ramachandra artagnon at gmail.com
Fri Jul 19 12:36:19 PDT 2013


In its default configuration, um Linux connects its /dev/console to the
host's fd:0,fd:1.  Other tty devices (/dev/tty*) are accessible on
various host devices that the user must connect to explicitly.  By
running getty on /dev/console by default,

  $ ./linux ubd0=arch-rootfs

will display a prompt immediately on the same terminal, along with the
boot messages.  This is much more user-friendly, than making the user
explicitly connect to the right device using

  $ screen /dev/pts/8

to get a login prompt.

Cc: Thomas Bächler <thomas at archlinux.org>
Cc: Lennart Poettering <lennart at poettering.net>
Signed-off-by: Ramkumar Ramachandra <artagnon at gmail.com>
---
 src/getty-generator/getty-generator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c
index 4b7a60a..9c7ed1a 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -96,6 +96,7 @@ int main(int argc, char *argv[]) {
         int r = EXIT_SUCCESS;
         char *active;
         const char *j;
+        const char *id = NULL;
 
         if (argc > 1 && argc != 4) {
                 log_error("This program takes three or no arguments.");
@@ -111,7 +112,7 @@ int main(int argc, char *argv[]) {
 
         umask(0022);
 
-        if (detect_container(NULL) > 0) {
+        if (detect_container(NULL) > 0 || (detect_vm(&id) > 0 && !strcmp(id, "uml"))) {
                 log_debug("Automatically adding console shell.");
 
                 if (add_symlink("console-getty.service", "console-getty.service") < 0)
-- 
1.8.3.3.797.gb72c616.dirty



More information about the systemd-devel mailing list