kernel: main: Add panic if thread creation fails

Add check for thread creation and panic if it fails.

Change-Id: I1960dc2ba9496b602dad30402150e7035522077d
diff --git a/kernel/main.c b/kernel/main.c
index 95a4339..a40aa7d 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -65,6 +65,8 @@
 void kmain(void) __NO_RETURN __EXTERNALLY_VISIBLE;
 void kmain(void)
 {
+	thread_t *thr;
+
 	// get us into some sort of thread context
 	thread_init_early();
 
@@ -105,7 +107,13 @@
 #if (!ENABLE_NANDWRITE)
 	// create a thread to complete system initialization
 	dprintf(SPEW, "creating bootstrap completion thread\n");
-	thread_resume(thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE));
+	thr = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
+	if (!thr)
+	{
+		panic("failed to create thread bootstrap2\n");
+	}
+	thread_resume(thr);
+
 
 	// enable interrupts
 	exit_critical_section();