early_printk.c 812 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (C) 2011 Richard Weinberger <richrd@nod.at>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/console.h>
  10. #include <linux/init.h>
  11. #include <os.h>
  12. static void early_console_write(struct console *con, const char *s, unsigned int n)
  13. {
  14. um_early_printk(s, n);
  15. }
  16. static struct console early_console_dev = {
  17. .name = "earlycon",
  18. .write = early_console_write,
  19. .flags = CON_BOOT,
  20. .index = -1,
  21. };
  22. static int __init setup_early_printk(char *buf)
  23. {
  24. if (!early_console) {
  25. early_console = &early_console_dev;
  26. register_console(&early_console_dev);
  27. }
  28. return 0;
  29. }
  30. early_param("earlyprintk", setup_early_printk);