#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/debugfs.h>
+#include <linux/utsname.h>
 
 #define DEFAULT_COUNT 10
 
 MODULE_PARM_DESC(cpoint_count, " Crash Point Count, number of times the "\
                                "crash point is to be hit to trigger action");
 
+/* For test debug reporting. */
+char *lkdtm_kernel_info;
 
 /* Return the crashtype number or NULL if the name is invalid */
 static const struct crashtype *find_crashtype(const char *name)
        crash_count = cpoint_count;
 #endif
 
+       /* Common initialization. */
+       lkdtm_kernel_info = kasprintf(GFP_KERNEL, "kernel (%s %s)",
+                                     init_uts_ns.name.release,
+                                     init_uts_ns.name.machine);
+
        /* Handle test-specific initialization. */
        lkdtm_bugs_init(&recur_count);
        lkdtm_perms_init();
        if (lkdtm_kprobe != NULL)
                unregister_kprobe(lkdtm_kprobe);
 
+       kfree(lkdtm_kernel_info);
+
        pr_info("Crash point unregistered\n");
 }
 
 
 #define pr_fmt(fmt) "lkdtm: " fmt
 
 #include <linux/kernel.h>
-#include <generated/compile.h>
-#include <generated/utsrelease.h>
 
-#define LKDTM_KERNEL "kernel (" UTS_RELEASE " " UTS_MACHINE ")"
+extern char *lkdtm_kernel_info;
 
 #define pr_expected_config(kconfig)                            \
 {                                                              \
        if (IS_ENABLED(kconfig))                                \
-               pr_err("Unexpected! This " LKDTM_KERNEL " was built with " #kconfig "=y\n"); \
+               pr_err("Unexpected! This %s was built with " #kconfig "=y\n", \
+                       lkdtm_kernel_info);                     \
        else                                                    \
-               pr_warn("This is probably expected, since this " LKDTM_KERNEL " was built *without* " #kconfig "=y\n"); \
+               pr_warn("This is probably expected, since this %s was built *without* " #kconfig "=y\n", \
+                       lkdtm_kernel_info);                     \
 }
 
 #ifndef MODULE
        if (IS_ENABLED(kconfig)) {                              \
                switch (lkdtm_check_bool_cmdline(param)) {      \
                case 0:                                         \
-                       pr_warn("This is probably expected, since this " LKDTM_KERNEL " was built with " #kconfig "=y but booted with '" param "=N'\n"); \
+                       pr_warn("This is probably expected, since this %s was built with " #kconfig "=y but booted with '" param "=N'\n", \
+                               lkdtm_kernel_info);             \
                        break;                                  \
                case 1:                                         \
-                       pr_err("Unexpected! This " LKDTM_KERNEL " was built with " #kconfig "=y and booted with '" param "=Y'\n"); \
+                       pr_err("Unexpected! This %s was built with " #kconfig "=y and booted with '" param "=Y'\n", \
+                               lkdtm_kernel_info);             \
                        break;                                  \
                default:                                        \
-                       pr_err("Unexpected! This " LKDTM_KERNEL " was built with " #kconfig "=y (and booted without '" param "' specified)\n"); \
+                       pr_err("Unexpected! This %s was built with " #kconfig "=y (and booted without '" param "' specified)\n", \
+                               lkdtm_kernel_info);             \
                }                                               \
        } else {                                                \
                switch (lkdtm_check_bool_cmdline(param)) {      \
                case 0:                                         \
-                       pr_warn("This is probably expected, as this " LKDTM_KERNEL " was built *without* " #kconfig "=y and booted with '" param "=N'\n"); \
+                       pr_warn("This is probably expected, as this %s was built *without* " #kconfig "=y and booted with '" param "=N'\n", \
+                               lkdtm_kernel_info);             \
                        break;                                  \
                case 1:                                         \
-                       pr_err("Unexpected! This " LKDTM_KERNEL " was built *without* " #kconfig "=y but booted with '" param "=Y'\n"); \
+                       pr_err("Unexpected! This %s was built *without* " #kconfig "=y but booted with '" param "=Y'\n", \
+                               lkdtm_kernel_info);             \
                        break;                                  \
                default:                                        \
-                       pr_err("This is probably expected, since this " LKDTM_KERNEL " was built *without* " #kconfig "=y (and booted without '" param "' specified)\n"); \
+                       pr_err("This is probably expected, since this %s was built *without* " #kconfig "=y (and booted without '" param "' specified)\n", \
+                               lkdtm_kernel_info);             \
                        break;                                  \
                }                                               \
        }                                                       \