panic.c 753 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. It will happen eventually, so you might as well learn do deal with it.
  3. TODO: how to scroll up to see full trace? Shift + Page Up does not work as it normally does:
  4. https://superuser.com/questions/848412/scrolling-up-the-failed-screen-with-kernel-panic
  5. The alternative is to get the serial data out streamed to console or to a file:
  6. - https://superuser.com/questions/269228/write-qemu-booting-virtual-machine-output-to-a-file
  7. - http://www.reactos.org/wiki/QEMU#Redirect_to_a_file
  8. */
  9. #include <linux/module.h>
  10. #include <linux/kernel.h>
  11. static int myinit(void)
  12. {
  13. pr_info("panic init\n");
  14. panic("hello panic");
  15. return 0;
  16. }
  17. static void myexit(void)
  18. {
  19. pr_info("panic cleanup\n");
  20. }
  21. module_init(myinit)
  22. module_exit(myexit)
  23. MODULE_LICENSE("GPL");