From 2e8236836297567aa26d011c7d83c34ecc245b28 Mon Sep 17 00:00:00 2001
From: Benoit Rat <benoit@sevensols.com>
Date: Mon, 2 Jul 2012 12:59:15 +0200
Subject: [PATCH 6/7] startup: load default environment when loading env
 failed

---
 common/startup.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/common/startup.c b/common/startup.c
index abd1b77..2992c43 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -147,6 +147,13 @@ void start_barebox (void)
 		run_command("source /env/bin/init", 0);
 	} else {
 		printf("not found\n");
+		if (stat("/env/", &s)) {
+			printf("Error loading  %s. "
+			"Using default environment\n",
+			default_environment_path);
+			envfs_load("/dev/defaultenv", "/env");
+			run_command("source /env/bin/init", 0);
+		}
 	}
 #endif
 	/* main_loop() can return to retry autoboot, if so just run it again. */
-- 
1.7.7.2

